From b5dad6674d464199eefc5d64fcf80a99b8317c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sat, 16 Apr 2016 01:45:27 +0100 Subject: [PATCH 001/552] Swagger definitions now have `type` set to `object`. While the spec does not seem to require this, the Swagger editor at http://editor.swagger.io/ gets confused and does not display the 'Try this operation' UI correctly. Many of the examples found around also specify `"type": "object"`, so this *should* be the right thing to do. --- protoc-gen-swagger/genswagger/template.go | 1 + 1 file changed, 1 insertion(+) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 26a272cd34e..3793d0e5578 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -51,6 +51,7 @@ func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descrip func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { for _, msg := range messages { object := swaggerSchemaObject{ + Type: "object", Properties: map[string]swaggerSchemaObject{}, } for _, field := range msg.Fields { From 717d2ff2b60f50d5b45fc10e41612777ccfa5197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sat, 16 Apr 2016 02:13:28 +0100 Subject: [PATCH 002/552] Updating golden Swagger JSONs to reflect changes in a8a4151. --- examples/examplepb/echo_service.swagger.json | 1 + examples/examplepb/streamless_everything.swagger.json | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/examplepb/echo_service.swagger.json b/examples/examplepb/echo_service.swagger.json index 76a905721d6..edf7015793b 100644 --- a/examples/examplepb/echo_service.swagger.json +++ b/examples/examplepb/echo_service.swagger.json @@ -71,6 +71,7 @@ }, "definitions": { "examplepbSimpleMessage": { + "type": "object", "properties": { "id": { "type": "string", diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index 50806ce071a..508508eb36e 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -339,6 +339,7 @@ }, "definitions": { "ABitOfEverythingNested": { + "type": "object", "properties": { "amount": { "type": "integer", @@ -362,6 +363,7 @@ "default": "FALSE" }, "examplepbABitOfEverything": { + "type": "object", "properties": { "bool_value": { "type": "boolean", @@ -441,8 +443,11 @@ } } }, - "examplepbEmptyMessage": {}, + "examplepbEmptyMessage": { + "type": "object" + }, "examplepbIdMessage": { + "type": "object", "properties": { "uuid": { "type": "string", @@ -459,6 +464,7 @@ "default": "ZERO" }, "subStringMessage": { + "type": "object", "properties": { "value": { "type": "string", From 5090416ea9419e1d5e2eebe161044b448d49f22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sat, 16 Apr 2016 02:24:20 +0100 Subject: [PATCH 003/552] Remove Swagger plugin, too, during realclean. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index ce3d7199d6a..8de1bd8f444 100644 --- a/Makefile +++ b/Makefile @@ -91,5 +91,6 @@ realclean: distclean rm -f $(EXAMPLE_GWSRCS) rm -f $(EXAMPLE_SWAGGERSRCS) rm -f $(GO_PLUGIN) + rm -f $(SWAGGER_PLUGIN) .PHONY: generate examples test clean distclean realclean From b6ae24c6d5a3d9c6f629ad841575073219f706de Mon Sep 17 00:00:00 2001 From: Yukinari Toyota Date: Fri, 29 Apr 2016 00:03:11 +0900 Subject: [PATCH 004/552] Fix swagger generator to treat map as a swagger map object --- examples/examplepb/a_bit_of_everything.proto | 2 + .../examplepb/streamless_everything.proto | 2 + .../streamless_everything.swagger.json | 13 ++++++ protoc-gen-swagger/genswagger/template.go | 43 ++++++++++++++++--- protoc-gen-swagger/genswagger/types.go | 5 ++- 5 files changed, 56 insertions(+), 9 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 406023ad010..162d8f3aec0 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -36,6 +36,8 @@ message ABitOfEverything { sint32 sint32_value = 17; sint64 sint64_value = 18; repeated string repeated_string_value = 19; + map mapped_string_value = 20; + map mapped_nested_value = 21; } message EmptyMessage { diff --git a/examples/examplepb/streamless_everything.proto b/examples/examplepb/streamless_everything.proto index a6d2145d8ab..6780a38f2ad 100644 --- a/examples/examplepb/streamless_everything.proto +++ b/examples/examplepb/streamless_everything.proto @@ -35,6 +35,8 @@ message ABitOfEverything { sint32 sint32_value = 17; sint64 sint64_value = 18; repeated string repeated_string_value = 19; + map mapped_string_value = 20; + map mapped_nested_value = 21; } message EmptyMessage { diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index 508508eb36e..4f24d9fd5a9 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -396,6 +396,19 @@ "type": "integer", "format": "int64" }, + "mapped_nested_value": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ABitOfEverythingNested" + } + }, + "mapped_string_value": { + "type": "object", + "additionalProperties": { + "type": "string", + "format": "string" + } + }, "nested": { "type": "array", "items": { diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 3793d0e5578..d163cabeee1 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -50,16 +50,28 @@ func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descrip func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { for _, msg := range messages { + if opt := msg.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { + continue + } object := swaggerSchemaObject{ - Type: "object", + Type: "object", Properties: map[string]swaggerSchemaObject{}, } for _, field := range msg.Fields { + fieldDescriptor := field.FieldDescriptorProto + mapEntry := false + if fieldMessage, err := reg.LookupMsg("", field.GetTypeName()); err == nil { + if opt := fieldMessage.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { + fieldDescriptor = fieldMessage.GetField()[1] + mapEntry = true + } + } + var fieldType, fieldFormat string primitive := true // Field type and format from http://swagger.io/specification/ in the // "Data Types" table - switch field.FieldDescriptorProto.Type.String() { + switch fieldDescriptor.Type.String() { case "TYPE_DOUBLE": fieldType = "number" fieldFormat = "double" @@ -142,8 +154,17 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, } if primitive { - // If repeated render as an array of items. - if field.FieldDescriptorProto.GetLabel() == pbdescriptor.FieldDescriptorProto_LABEL_REPEATED { + switch { + case mapEntry: + object.Properties[field.GetName()] = swaggerSchemaObject{ + Type: "object", + AdditionalProperties: &swaggerSchemaObject{ + Type: fieldType, + Format: fieldFormat, + }, + } + case field.FieldDescriptorProto.GetLabel() == pbdescriptor.FieldDescriptorProto_LABEL_REPEATED: + // If repeated render as an array of items. object.Properties[field.GetName()] = swaggerSchemaObject{ Type: "array", Items: &swaggerItemsObject{ @@ -151,21 +172,29 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, Format: fieldFormat, }, } - } else { + default: object.Properties[field.GetName()] = swaggerSchemaObject{ Type: fieldType, Format: fieldFormat, } } } else { - if field.FieldDescriptorProto.GetLabel() == pbdescriptor.FieldDescriptorProto_LABEL_REPEATED { + switch { + case mapEntry: + object.Properties[field.GetName()] = swaggerSchemaObject{ + Type: "object", + AdditionalProperties: &swaggerSchemaObject{ + Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(fieldDescriptor.GetTypeName(), reg), + }, + } + case field.FieldDescriptorProto.GetLabel() == pbdescriptor.FieldDescriptorProto_LABEL_REPEATED: object.Properties[field.GetName()] = swaggerSchemaObject{ Type: "array", Items: &swaggerItemsObject{ Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(field.GetTypeName(), reg), }, } - } else { + default: object.Properties[field.GetName()] = swaggerSchemaObject{ Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(field.GetTypeName(), reg), } diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index fd441683b1b..4cc8b538d7a 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -91,8 +91,9 @@ type swaggerSchemaObject struct { Type string `json:"type,omitempty"` Format string `json:"format,omitempty"` // Properties can be recursively defined - Properties map[string]swaggerSchemaObject `json:"properties,omitempty"` - Items *swaggerItemsObject `json:"items,omitempty"` + Properties map[string]swaggerSchemaObject `json:"properties,omitempty"` + AdditionalProperties *swaggerSchemaObject `json:"additionalProperties,omitempty"` + Items *swaggerItemsObject `json:"items,omitempty"` // If the item is an enumeration include a list of all the *NAMES* of the // enum values. I'm not sure how well this will work but assuming all enums From a2e787e03399a921e73fac9f7ca974865fdfa507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 1 May 2016 12:44:58 +0100 Subject: [PATCH 005/552] Documented protoPathIndex. Improved error handling. Also, fixed a few typos and renamed protoPath into protoPathIndex (as we are not returning the entire path in that method). --- examples/examplepb/a_bit_of_everything.pb.go | 98 +++++++++++++------ examples/examplepb/echo_service.pb.go | 40 +++++--- examples/examplepb/echo_service.swagger.json | 1 + examples/examplepb/flow_combination.pb.go | 66 +++++++++---- .../streamless_everything.swagger.json | 8 +- protoc-gen-swagger/genswagger/template.go | 67 ++++++++----- 6 files changed, 194 insertions(+), 86 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 18b174ac92f..21b8e96c92c 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -132,7 +132,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for ABitOfEverythingService service @@ -325,28 +325,40 @@ func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingS s.RegisterService(&_ABitOfEverythingService_serviceDesc, srv) } -func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Create(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Create(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Create(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_BulkCreate_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -375,16 +387,22 @@ func (x *aBitOfEverythingServiceBulkCreateServer) Recv() (*ABitOfEverything, err return m, nil } -func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Lookup(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Lookup(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Lookup(ctx, req.(*sub2.IdMessage)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_List_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -408,40 +426,58 @@ 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) (interface{}, error) { +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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Update(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Update(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Update(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Delete_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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Delete(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Delete(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Delete(ctx, req.(*sub2.IdMessage)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(gengo_grpc_gateway_examples_sub.StringMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Echo(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Echo(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Echo(ctx, req.(*gengo_grpc_gateway_examples_sub.StringMessage)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_BulkEcho_Handler(srv interface{}, stream grpc.ServerStream) error { diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 76cd1d1250c..20274707d60 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -41,7 +41,9 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. const _ = proto.ProtoPackageIsVersion1 +// SimpleMessage represents a simple message sent to the Echo service. type SimpleMessage struct { + // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` } @@ -60,12 +62,14 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for EchoService service type EchoServiceClient interface { + // Echo method receives a simple message and returns it. Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) + // EchoBody method receives a simple message and returns it. EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) } @@ -98,7 +102,9 @@ func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opt // Server API for EchoService service type EchoServiceServer interface { + // Echo method receives a simple message and returns it. Echo(context.Context, *SimpleMessage) (*SimpleMessage, error) + // EchoBody method receives a simple message and returns it. EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error) } @@ -106,28 +112,40 @@ func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer) { s.RegisterService(&_EchoService_serviceDesc, srv) } -func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(EchoServiceServer).Echo(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(EchoServiceServer).Echo(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.EchoService/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EchoServiceServer).Echo(ctx, req.(*SimpleMessage)) + } + return interceptor(ctx, in, info, handler) } -func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(EchoServiceServer).EchoBody(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(EchoServiceServer).EchoBody(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.EchoService/EchoBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EchoServiceServer).EchoBody(ctx, req.(*SimpleMessage)) + } + return interceptor(ctx, in, info, handler) } var _EchoService_serviceDesc = grpc.ServiceDesc{ diff --git a/examples/examplepb/echo_service.swagger.json b/examples/examplepb/echo_service.swagger.json index 84c0d128f4c..988ff327271 100644 --- a/examples/examplepb/echo_service.swagger.json +++ b/examples/examplepb/echo_service.swagger.json @@ -73,6 +73,7 @@ }, "definitions": { "examplepbSimpleMessage": { + "type": "object", "properties": { "id": { "type": "string", diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 40606b6eb0d..345f7ed5a8a 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -95,7 +95,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for FlowCombination service @@ -368,16 +368,22 @@ func RegisterFlowCombinationServer(s *grpc.Server, srv FlowCombinationServer) { s.RegisterService(&_FlowCombination_serviceDesc, srv) } -func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(EmptyProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, req.(*EmptyProto)) + } + return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcEmptyStream_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -453,40 +459,58 @@ func (x *flowCombinationStreamEmptyStreamServer) Recv() (*EmptyProto, error) { return m, nil } -func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NonEmptyProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcBodyRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcBodyRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcBodyRpc(ctx, req.(*NonEmptyProto)) + } + return interceptor(ctx, in, info, handler) } -func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SingleNestedProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, req.(*SingleNestedProto)) + } + return interceptor(ctx, in, info, handler) } -func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NestedProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, req.(*NestedProto)) + } + return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error { diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index b9130c8f11c..928a890c537 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -339,6 +339,7 @@ }, "definitions": { "ABitOfEverythingNested": { + "type": "object", "properties": { "amount": { "type": "integer", @@ -365,6 +366,7 @@ "description": "DeepEnum is one or zero. FALSE: FALSE is false. TRUE: TRUE is true." }, "examplepbABitOfEverything": { + "type": "object", "properties": { "bool_value": { "type": "boolean", @@ -445,8 +447,11 @@ } } }, - "examplepbEmptyMessage": {}, + "examplepbEmptyMessage": { + "type": "object" + }, "examplepbIdMessage": { + "type": "object", "properties": { "uuid": { "type": "string", @@ -464,6 +469,7 @@ "description": "NumericEnum is one or zero. ZERO: ZERO means 0 ONE: ONE means 1" }, "subStringMessage": { + "type": "object", "properties": { "value": { "type": "string", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index f0b37850f1a..b18e44d109b 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -143,7 +143,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, fieldFormat = "UNKNOWN" } - fieldProtoPath := protoPath(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "Field") + fieldProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "Field") fieldDescription := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index), fieldProtoPath, int32(fieldIdx)) if primitive { @@ -187,7 +187,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, // renderEnumerationsAsDefinition inserts enums into the definitions object. func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { - valueProtoPath := protoPath(reflect.TypeOf((*pbdescriptor.EnumDescriptorProto)(nil)), "Value") + valueProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.EnumDescriptorProto)(nil)), "Value") for _, enum := range enums { enumDescription := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index)) @@ -436,7 +436,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re pathItemObject = swaggerPathItemObject{} } - methProtoPath := protoPath(reflect.TypeOf((*pbdescriptor.ServiceDescriptorProto)(nil)), "Method") + methProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.ServiceDescriptorProto)(nil)), "Method") methDescription := protoComments(reg, svc.File, nil, "Service", int32(svcIdx), methProtoPath, int32(methIdx)) operationObject := &swaggerOperationObject{ Summary: fmt.Sprintf("%s.%s", svc.GetName(), meth.GetName()), @@ -512,8 +512,8 @@ func applyTemplate(p param) (string, error) { return w.String(), nil } -func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []string, typeName string, typeIndex int32, fieldPathes ...int32) string { - outerPathes := make([]int32, len(outers)) +func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []string, typeName string, typeIndex int32, fieldPaths ...int32) string { + outerPaths := make([]int32, len(outers)) for i := range outers { location := "" if file.Package != nil { @@ -524,18 +524,18 @@ func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []str if err != nil { panic(err) } - outerPathes[i] = int32(msg.Index) + outerPaths[i] = int32(msg.Index) } - messageProtoPath := protoPath(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "MessageType") - nestedProtoPath := protoPath(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "NestedType") + messageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "MessageType") + nestedProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "NestedType") L1: for _, loc := range file.SourceCodeInfo.Location { - if len(loc.Path) < len(outerPathes)*2+2+len(fieldPathes) { + if len(loc.Path) < len(outerPaths)*2+2+len(fieldPaths) { continue } - for i, v := range outerPathes { + for i, v := range outerPaths { if i == 0 && loc.Path[i*2+0] != messageProtoPath { continue L1 } @@ -547,15 +547,15 @@ L1: } } - outerOffset := len(outerPathes) * 2 - if outerOffset == 0 && loc.Path[outerOffset] != protoPath(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), typeName) { + outerOffset := len(outerPaths) * 2 + if outerOffset == 0 && loc.Path[outerOffset] != protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), typeName) { continue } if outerOffset != 0 { if typeName == "MessageType" { typeName = "NestedType" } - if loc.Path[outerOffset] != protoPath(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), typeName) { + if loc.Path[outerOffset] != protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), typeName) { continue } } @@ -563,7 +563,7 @@ L1: continue } - for i, v := range fieldPathes { + for i, v := range fieldPaths { if loc.Path[outerOffset+2+i] != v { continue L1 } @@ -579,20 +579,43 @@ L1: return "" } -func protoPath(descriptorType reflect.Type, what string) int32 { - // TODO(ivucica): handle errors obtaining any of the following. +// protoPathIndex returns a path component for google.protobuf.descriptor.SourceCode_Location. +// +// Specifically, it returns an id as generated from descriptor proto which +// can be used to determine what type the id following it in the path is. +// For example, if we are trying to locate comments related to a field named +// `Address` in a message named `Person`, the path will be: +// +// [4, a, 2, b] +// +// While `a` gets determined by the order in which the messages appear in +// the proto file, and `b` is the field index specified in the proto +// file itself, the path actually needs to specify that `a` refers to a +// message and not, say, a service; and that `b` refers to a field and not +// an option. +// +// protoPathIndex figures out the values 4 and 2 in the above example. Because +// messages are top level objects, the value of 4 comes from field id for +// `MessageType` inside `google.protobuf.descriptor.FileDescriptor` message. +// This field has a message type `google.protobuf.descriptor.DescriptorProto`. +// And inside message `DescriptorProto`, there is a field named `Field` with id +// 2. +// +// Some code generators seem to be hardcoding these values; this method instead +// interprets them from `descriptor.proto`-derived Go source as necessary. +func protoPathIndex(descriptorType reflect.Type, what string) int32 { field, ok := descriptorType.Elem().FieldByName(what) if !ok { - // TODO(ivucica): consider being more graceful. - panic(fmt.Errorf("Could not find type id for %s.", what)) + panic(fmt.Errorf("Could not find protobuf descriptor type id for %s.", what)) } pbtag := field.Tag.Get("protobuf") if pbtag == "" { - // TODO(ivucica): consider being more graceful. - panic(fmt.Errorf("No protobuf tag on %s.", what)) + panic(fmt.Errorf("No Go tag 'protobuf' on protobuf descriptor for %s.", what)) + } + path, err := strconv.Atoi(strings.Split(pbtag, ",")[1]) + if err != nil { + panic(fmt.Errorf("Protobuf descriptor id for %s cannot be converted to a number: %s", what, err.Error())) } - // TODO(ivucica): handle error - path, _ := strconv.Atoi(strings.Split(pbtag, ",")[1]) return int32(path) } From 1ac3f80c6c0ad6a9ba8f4e063b549ef112044ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 1 May 2016 22:15:19 +0100 Subject: [PATCH 006/552] Fix test which was not setting the SourceCodeInfo field. This field should generally be non-nil while running the generator. This commit also adds a trivial check to make panic more informative in case a future test breaks in a similar fashion. --- protoc-gen-swagger/genswagger/template.go | 10 +++++++ .../genswagger/template_test.go | 29 ++++++++++--------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 525fcc01a97..f6290f48402 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -514,6 +514,16 @@ func applyTemplate(p param) (string, error) { } func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []string, typeName string, typeIndex int32, fieldPaths ...int32) string { + if file.SourceCodeInfo == nil { + // Curious! A file without any source code info. + // This could be a test that's providing incomplete + // descriptor.File information. + // + // We could simply return no comments, but panic + // could make debugging easier. + panic("descriptor.File should not contain nil SourceCodeInfo") + } + outerPaths := make([]int32, len(outers)) for i := range outers { location := "" diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index c27812acd85..270b38d3560 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -48,11 +48,12 @@ func TestApplyTemplateSimple(t *testing.T) { } file := descriptor.File{ FileDescriptorProto: &protodescriptor.FileDescriptorProto{ - Name: proto.String("example.proto"), - Package: proto.String("example"), - Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, - MessageType: []*protodescriptor.DescriptorProto{msgdesc}, - Service: []*protodescriptor.ServiceDescriptorProto{svc}, + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, + MessageType: []*protodescriptor.DescriptorProto{msgdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", @@ -182,10 +183,11 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { } file := descriptor.File{ FileDescriptorProto: &protodescriptor.FileDescriptorProto{ - Name: proto.String("example.proto"), - Package: proto.String("example"), - MessageType: []*protodescriptor.DescriptorProto{msgdesc, nesteddesc}, - Service: []*protodescriptor.ServiceDescriptorProto{svc}, + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + MessageType: []*protodescriptor.DescriptorProto{msgdesc, nesteddesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", @@ -343,10 +345,11 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { } file := descriptor.File{ FileDescriptorProto: &protodescriptor.FileDescriptorProto{ - Name: proto.String("example.proto"), - Package: proto.String("example"), - MessageType: []*protodescriptor.DescriptorProto{msgdesc, nesteddesc}, - Service: []*protodescriptor.ServiceDescriptorProto{svc}, + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + MessageType: []*protodescriptor.DescriptorProto{msgdesc, nesteddesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", From e7ef62648b3368f42521e7d636cd10611a6a556e Mon Sep 17 00:00:00 2001 From: Yukinari Toyota Date: Tue, 3 May 2016 00:15:11 +0900 Subject: [PATCH 007/552] update grpc-go and examples --- examples/examplepb/a_bit_of_everything.pb.go | 254 ++++++++++++------- examples/examplepb/echo_service.pb.go | 34 ++- examples/examplepb/flow_combination.pb.go | 66 +++-- 3 files changed, 224 insertions(+), 130 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 18b174ac92f..452f6a8cdc0 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -78,13 +78,15 @@ type ABitOfEverything struct { BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` // TODO(yugui) add bytes_value - Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` - EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=gengo.grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` - Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` - Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` - Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` - Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` - RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` + EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=gengo.grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` + Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` + Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` + Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` + Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` + RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` + MappedStringValue map[string]string `protobuf:"bytes,20,rep,name=mapped_string_value,json=mappedStringValue" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,21,rep,name=mapped_nested_value,json=mappedNestedValue" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` } func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } @@ -99,6 +101,20 @@ func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { return nil } +func (m *ABitOfEverything) GetMappedStringValue() map[string]string { + if m != nil { + return m.MappedStringValue + } + return nil +} + +func (m *ABitOfEverything) GetMappedNestedValue() map[string]*ABitOfEverything_Nested { + if m != nil { + return m.MappedNestedValue + } + return nil +} + type ABitOfEverything_Nested struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Amount uint32 `protobuf:"varint,2,opt,name=amount" json:"amount,omitempty"` @@ -132,7 +148,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for ABitOfEverythingService service @@ -325,28 +341,40 @@ func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingS s.RegisterService(&_ABitOfEverythingService_serviceDesc, srv) } -func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Create(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Create(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Create(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_BulkCreate_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -375,16 +403,22 @@ func (x *aBitOfEverythingServiceBulkCreateServer) Recv() (*ABitOfEverything, err return m, nil } -func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Lookup(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Lookup(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Lookup(ctx, req.(*sub2.IdMessage)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_List_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -408,40 +442,58 @@ 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) (interface{}, error) { +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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Update(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Update(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Update(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Delete_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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Delete(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Delete(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Delete(ctx, req.(*sub2.IdMessage)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(gengo_grpc_gateway_examples_sub.StringMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Echo(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Echo(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Echo(ctx, req.(*gengo_grpc_gateway_examples_sub.StringMessage)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_BulkEcho_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -520,64 +572,70 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ } var fileDescriptor1 = []byte{ - // 932 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0xdd, 0x8e, 0xdb, 0x44, - 0x14, 0xc6, 0x49, 0xd6, 0x49, 0xc6, 0x9b, 0x6c, 0x3a, 0x15, 0xb0, 0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94, 0xf8, 0x0b, 0xa8, 0x7c, 0x6e, 0xa6, 0x74, 0xbb, 0x37, 0x4c, - 0x61, 0x3a, 0x3a, 0xf8, 0xed, 0x8d, 0x1e, 0x8e, 0x3f, 0x9e, 0x2b, 0xfc, 0x8b, 0x80, 0x2a, 0x27, - 0x76, 0x10, 0xe2, 0x5d, 0xaa, 0xde, 0x5d, 0xe6, 0x3b, 0x4c, 0xe6, 0x35, 0xbc, 0x69, 0xae, 0xb7, - 0x04, 0xfc, 0x1b, 0xb4, 0xe9, 0xbe, 0x67, 0x5e, 0xfe, 0x48, 0x6f, 0x33, 0x8d, 0xef, 0xb5, 0xb7, - 0x6c, 0x65, 0x6c, 0xc1, 0xef, 0x90, 0x78, 0x8f, 0x38, 0x04, 0xa4, 0x3e, 0x33, 0xd1, 0x9d, 0x24, - 0xa4, 0xd3, 0xec, 0x6e, 0x3b, 0xcd, 0x27, 0x30, 0xcd, 0xc1, 0xe4, 0x21, 0xc5, 0xca, 0x7f, 0x66, - 0x03, 0x69, 0x4a, 0xf2, 0xdd, 0xc9, 0xd4, 0xfd, 0x4f, 0xbc, 0x3c, 0x61, 0xc2, 0xbe, 0xc1, 0x37, - 0x37, 0x09, 0x23, 0xa0, 0x46, 0x5d, 0x26, 0xcf, 0xc9, 0xf0, 0x35, 0xb9, 0xa5, 0xce, 0xb5, 0x1c, - 0x1f, 0xc7, 0xee, 0xec, 0xb1, 0xd8, 0x10, 0xe3, 0x67, 0x42, 0xb1, 0x37, 0x6b, 0xf1, 0x85, 0xbe, - 0x94, 0x8a, 0xb6, 0xbe, 0xc0, 0x4c, 0x75, 0x7c, 0x81, 0x6f, 0x09, 0x7d, 0x69, 0x58, 0xcf, 0x27, - 0x37, 0x16, 0xd9, 0x1f, 0xd7, 0xde, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x17, 0x44, 0xcc, 0x34, - 0x66, 0x0b, 0x00, 0x00, + // 1026 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b,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x83, 0xc0, 0xea, 0xd3, 0x64, 0xef, 0x75, 0x79, + 0xcf, 0x98, 0xdc, 0x54, 0xff, 0x02, 0xa8, 0xdf, 0xdb, 0xb5, 0xc3, 0xc3, 0x93, 0x56, 0x26, 0x8c, + 0x10, 0x28, 0x44, 0x91, 0xdd, 0x5b, 0x57, 0x36, 0x95, 0xad, 0xb2, 0xc9, 0xbf, 0xc9, 0x23, 0x28, + 0xba, 0x34, 0x08, 0x69, 0x6f, 0x3d, 0xb7, 0x99, 0xdf, 0xaa, 0x18, 0x9f, 0x68, 0x73, 0xe9, 0xd6, + 0xa6, 0xc9, 0xb5, 0x03, 0xce, 0x62, 0x26, 0x6c, 0x64, 0x03, 0x2a, 0x27, 0x03, 0x66, 0x85, 0xed, + 0xa1, 0x35, 0x88, 0xe8, 0x7a, 0x1e, 0x5d, 0xe6, 0x4c, 0xe0, 0xa6, 0x47, 0xb1, 0x85, 0xdc, 0x80, + 0xe5, 0x1e, 0x8b, 0x3a, 0x03, 0x9a, 0x20, 0x0a, 0x88, 0x50, 0xcc, 0x8a, 0xb0, 0x09, 0x08, 0x72, + 0xd8, 0x6e, 0xf8, 0xc1, 0xfb, 0x09, 0x62, 0x09, 0x11, 0x79, 0x13, 0xb8, 0x29, 0xe3, 0x88, 0x64, + 0x44, 0x11, 0x11, 0x05, 0xb3, 0x12, 0x49, 0x10, 0xc1, 0xb1, 0x6d, 0x24, 0x88, 0x2b, 0x88, 0x58, + 0xe2, 0x1c, 0xdb, 0x86, 0x00, 0xbc, 0x05, 0xd5, 0x13, 0xfb, 0x09, 0xed, 0x65, 0x24, 0x25, 0x84, + 0x14, 0xcd, 0xe5, 0xc4, 0x38, 0x09, 0xca, 0x78, 0xca, 0x08, 0xba, 0x92, 0x80, 0x52, 0xa6, 0x37, + 0x01, 0x3a, 0x8c, 0x0d, 0x12, 0x04, 0x20, 0xa2, 0x64, 0x96, 0x63, 0x4b, 0x26, 0x36, 0x08, 0x7d, + 0x4c, 0x55, 0x02,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f7, 0xe8, 0x80, 0xa2, 0xd4, 0x73, 0x15, 0x5d, 0x48, 0x42, 0x52, 0xcd, + 0xe6, 0xbc, 0xd5, 0x7c, 0x8e, 0xd5, 0x6c, 0x75, 0x1f, 0x33, 0xa2, 0xfd, 0xa3, 0x37, 0x94, 0xa6, + 0x89, 0xe7, 0x27, 0x55, 0xf7, 0x2f, 0xf1, 0x6a, 0x97, 0x0b, 0xfb, 0x9a, 0xdc, 0x9e, 0x25, 0x8c, + 0xa2, 0x1a, 0x7d, 0x2c, 0xae, 0x93, 0xe3, 0xd7, 0xd4, 0xba, 0x3e, 0x34, 0x32, 0x7c, 0xbc, 0xb7, + 0x23, 0x5e, 0x93, 0x63, 0x42, 0xce, 0x6d, 0xc5, 0xbd, 0x59, 0x8a, 0x07, 0xfa, 0xa5, 0x44, 0x34, + 0xf7, 0x00, 0x73, 0xd5, 0xf1, 0x00, 0xdf, 0x51, 0x76, 0x2b, 0xc7, 0xe5, 0xac, 0x72, 0x9d, 0x22, + 0xff, 0x17, 0xb2, 0xfd, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x83, 0x65, 0x26, 0x33, 0x0d, + 0x00, 0x00, } diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 76cd1d1250c..4c78cacd2b6 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -60,7 +60,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for EchoService service @@ -106,28 +106,40 @@ func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer) { s.RegisterService(&_EchoService_serviceDesc, srv) } -func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(EchoServiceServer).Echo(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(EchoServiceServer).Echo(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.EchoService/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EchoServiceServer).Echo(ctx, req.(*SimpleMessage)) + } + return interceptor(ctx, in, info, handler) } -func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(EchoServiceServer).EchoBody(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(EchoServiceServer).EchoBody(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.EchoService/EchoBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EchoServiceServer).EchoBody(ctx, req.(*SimpleMessage)) + } + return interceptor(ctx, in, info, handler) } var _EchoService_serviceDesc = grpc.ServiceDesc{ diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 40606b6eb0d..345f7ed5a8a 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -95,7 +95,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for FlowCombination service @@ -368,16 +368,22 @@ func RegisterFlowCombinationServer(s *grpc.Server, srv FlowCombinationServer) { s.RegisterService(&_FlowCombination_serviceDesc, srv) } -func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(EmptyProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, req.(*EmptyProto)) + } + return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcEmptyStream_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -453,40 +459,58 @@ func (x *flowCombinationStreamEmptyStreamServer) Recv() (*EmptyProto, error) { return m, nil } -func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NonEmptyProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcBodyRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcBodyRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcBodyRpc(ctx, req.(*NonEmptyProto)) + } + return interceptor(ctx, in, info, handler) } -func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SingleNestedProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, req.(*SingleNestedProto)) + } + return interceptor(ctx, in, info, handler) } -func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NestedProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, req.(*NestedProto)) + } + return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error { From 3e80ca37a0ba0d386c694a9b61d2132c332bab32 Mon Sep 17 00:00:00 2001 From: "Md.Abdulla-Al-Sun" Date: Thu, 5 May 2016 17:42:41 +0600 Subject: [PATCH 008/552] Link to LICENSE.txt Link to LICENSE.txt added. I think this decrease the searching time of developers. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 419ab026b59..b01b3706397 100644 --- a/README.md +++ b/README.md @@ -213,4 +213,4 @@ But patch is welcome. # License grpc-gateway is licensed under the BSD 3-Clause License. -See `LICENSE.txt` for more details. +See [LICENSE.txt](https://github.com/gengo/grpc-gateway/blob/master/LICENSE.txt) for more details. From 246704b074784407232c38fb9d7da8992045fe9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sat, 7 May 2016 20:01:42 +0100 Subject: [PATCH 009/552] Swagger: summary, description, custom JSON, package docs. This patch will extract summary separately from description in Swagger objects that happen to support both summary and description. It will do so by splitting the relevant proto comment based on paragraphs, and using the first paragraph as the summary. This patch will also allow updating the Swagger schema's otherwise hard-to-map fields by allowing custom JSON to be placed within the proto comment. The syntax leaves something to be desired, but it works. Use of JSON is, on the other hand, rather universal. This patch will also allow describing the whole API by attaching the comments to the 'package' stanza inside the proto. In this case, summary will be applied to info.title, and description will be applied to info.description. Other properties have to be set through JSON. Schema has been slightly updated to allow for fields such as termsOfService, contact, license, externalDocs, etc. If a method is not documented, stub summary for Swagger Operation is no longer generated. Documentation for enum values is now multiline with dashes before values. --- examples/examplepb/echo_service.pb.go | 57 +++++ examples/examplepb/echo_service.proto | 47 +++- examples/examplepb/echo_service.swagger.json | 24 +- .../streamless_everything.swagger.json | 17 +- protoc-gen-swagger/genswagger/template.go | 241 ++++++++++++++---- protoc-gen-swagger/genswagger/types.go | 33 ++- 6 files changed, 340 insertions(+), 79 deletions(-) diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 20274707d60..d191846eaec 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -5,6 +5,30 @@ /* Package examplepb is a generated protocol buffer package. +Echo Service + +Echo Service API consists of a single service which returns +a message. + + + It is generated from these files: examples/examplepb/echo_service.proto examples/examplepb/a_bit_of_everything.proto @@ -42,6 +66,15 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion1 // SimpleMessage represents a simple message sent to the Echo service. +// +// type SimpleMessage struct { // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` @@ -68,6 +101,18 @@ const _ = grpc.SupportPackageIsVersion2 type EchoServiceClient interface { // Echo method receives a simple message and returns it. + // + // The message posted as the id parameter will also be + // returned. + // + // Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) // EchoBody method receives a simple message and returns it. EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) @@ -103,6 +148,18 @@ func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opt type EchoServiceServer interface { // Echo method receives a simple message and returns it. + // + // The message posted as the id parameter will also be + // returned. + // + // Echo(context.Context, *SimpleMessage) (*SimpleMessage, error) // EchoBody method receives a simple message and returns it. EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error) diff --git a/examples/examplepb/echo_service.proto b/examples/examplepb/echo_service.proto index 83ebe704ed3..4baeddad06c 100644 --- a/examples/examplepb/echo_service.proto +++ b/examples/examplepb/echo_service.proto @@ -1,10 +1,43 @@ syntax = "proto3"; option go_package = "examplepb"; + +// Echo Service +// +// Echo Service API consists of a single service which returns +// a message. +// +// package gengo.grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; -// SimpleMessage represents a simple message sent to the Echo service. +// SimpleMessage represents a simple message sent to the Echo service. +// +// message SimpleMessage { // Id represents the message identifier. string id = 1; @@ -13,6 +46,18 @@ message SimpleMessage { // Echo service responds to incoming echo requests. service EchoService { // Echo method receives a simple message and returns it. + // + // The message posted as the id parameter will also be + // returned. + // + // rpc Echo(SimpleMessage) returns (SimpleMessage) { option (google.api.http) = { post: "/v1/example/echo/{id}" diff --git a/examples/examplepb/echo_service.swagger.json b/examples/examplepb/echo_service.swagger.json index 988ff327271..39f226e1b09 100644 --- a/examples/examplepb/echo_service.swagger.json +++ b/examples/examplepb/echo_service.swagger.json @@ -1,9 +1,16 @@ { "swagger": "2.0", "info": { - "version": "", - "title": "" + "title": "Echo Service", + "description": "Echo Service API consists of a single service which returns\na message.", + "version": "1.0", + "contact": { + "name": "gRPC-Gateway project", + "url": "https://github.com/gengo/grpc-gateway", + "email": "none@example.com" + } }, + "host": "localhost", "schemes": [ "http", "https" @@ -17,8 +24,8 @@ "paths": { "/v1/example/echo/{id}": { "post": { - "summary": "EchoService.Echo", - "description": "Echo method receives a simple message and returns it.", + "summary": "Echo method receives a simple message and returns it.", + "description": "The message posted as the id parameter will also be\nreturned.", "operationId": "Echo", "responses": { "default": { @@ -39,13 +46,16 @@ ], "tags": [ "EchoService" - ] + ], + "externalDocs": { + "description": "Find out more about EchoService", + "url": "http://github.com/gengo/grpc-gateway" + } } }, "/v1/example/echo_body": { "post": { - "summary": "EchoService.EchoBody", - "description": "EchoBody method receives a simple message and returns it.", + "summary": "EchoBody method receives a simple message and returns it.", "operationId": "EchoBody", "responses": { "default": { diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index 928a890c537..bd314024891 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -1,8 +1,8 @@ { "swagger": "2.0", "info": { - "version": "", - "title": "" + "title": "examples/examplepb/streamless_everything.proto", + "version": "version not set" }, "schemes": [ "http", @@ -17,7 +17,6 @@ "paths": { "/v1/example/a_bit_of_everything": { "get": { - "summary": "ABitOfEverythingService.List", "operationId": "List", "responses": { "default": { @@ -32,7 +31,6 @@ ] }, "post": { - "summary": "ABitOfEverythingService.CreateBody", "operationId": "CreateBody", "responses": { "default": { @@ -59,7 +57,6 @@ }, "/v1/example/a_bit_of_everything/bulk": { "post": { - "summary": "ABitOfEverythingService.BulkCreate", "operationId": "BulkCreate", "responses": { "default": { @@ -86,7 +83,6 @@ }, "/v1/example/a_bit_of_everything/echo": { "post": { - "summary": "ABitOfEverythingService.BulkEcho", "operationId": "BulkEcho", "responses": { "default": { @@ -113,7 +109,6 @@ }, "/v1/example/a_bit_of_everything/echo/{value}": { "get": { - "summary": "ABitOfEverythingService.Echo", "operationId": "Echo", "responses": { "default": { @@ -139,7 +134,6 @@ }, "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}": { "post": { - "summary": "ABitOfEverythingService.Create", "operationId": "Create", "responses": { "default": { @@ -256,7 +250,6 @@ }, "/v1/example/a_bit_of_everything/{uuid}": { "get": { - "summary": "ABitOfEverythingService.Lookup", "operationId": "Lookup", "responses": { "default": { @@ -280,7 +273,6 @@ ] }, "delete": { - "summary": "ABitOfEverythingService.Delete", "operationId": "Delete", "responses": { "default": { @@ -304,7 +296,6 @@ ] }, "put": { - "summary": "ABitOfEverythingService.Update", "operationId": "Update", "responses": { "default": { @@ -363,7 +354,7 @@ "TRUE" ], "default": "FALSE", - "description": "DeepEnum is one or zero. FALSE: FALSE is false. TRUE: TRUE is true." + "description": "DeepEnum is one or zero.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true." }, "examplepbABitOfEverything": { "type": "object", @@ -466,7 +457,7 @@ "ONE" ], "default": "ZERO", - "description": "NumericEnum is one or zero. ZERO: ZERO means 0 ONE: ONE means 1" + "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" }, "subStringMessage": { "type": "object", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index f6290f48402..96239a9b550 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -13,6 +13,8 @@ import ( pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" ) +var swaggerExtrasRegexp = regexp.MustCompile(`(?s)^(.*[^\s])[\s]*[\s]*(.*)$`) + // findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service. func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, e enumMap) { for _, svc := range s { @@ -51,11 +53,13 @@ func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descrip func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { for _, msg := range messages { - msgDescription := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index)) object := swaggerSchemaObject{ - Type: "object", - Properties: map[string]swaggerSchemaObject{}, - Description: msgDescription, + Type: "object", + Properties: map[string]swaggerSchemaObject{}, + } + msgComments := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index)) + if err := updateSwaggerDataFromComments(&object, msgComments); err != nil { + panic(err) } for fieldIdx, field := range msg.Fields { var fieldType, fieldFormat string @@ -145,42 +149,43 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, } fieldProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "Field") - fieldDescription := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index), fieldProtoPath, int32(fieldIdx)) + fieldProtoComments := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index), fieldProtoPath, int32(fieldIdx)) + var fieldValue swaggerSchemaObject if primitive { // If repeated render as an array of items. if field.FieldDescriptorProto.GetLabel() == pbdescriptor.FieldDescriptorProto_LABEL_REPEATED { - object.Properties[field.GetName()] = swaggerSchemaObject{ + fieldValue = swaggerSchemaObject{ Type: "array", Items: &swaggerItemsObject{ Type: fieldType, Format: fieldFormat, }, - Description: fieldDescription, } } else { - object.Properties[field.GetName()] = swaggerSchemaObject{ - Type: fieldType, - Format: fieldFormat, - Description: fieldDescription, + fieldValue = swaggerSchemaObject{ + Type: fieldType, + Format: fieldFormat, } } } else { if field.FieldDescriptorProto.GetLabel() == pbdescriptor.FieldDescriptorProto_LABEL_REPEATED { - object.Properties[field.GetName()] = swaggerSchemaObject{ + fieldValue = swaggerSchemaObject{ Type: "array", Items: &swaggerItemsObject{ Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(field.GetTypeName(), reg), }, - Description: fieldDescription, } } else { - object.Properties[field.GetName()] = swaggerSchemaObject{ - Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(field.GetTypeName(), reg), - Description: fieldDescription, + fieldValue = swaggerSchemaObject{ + Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(field.GetTypeName(), reg), } } } + if err := updateSwaggerDataFromComments(&fieldValue, fieldProtoComments); err != nil { + panic(err) + } + object.Properties[field.GetName()] = fieldValue } d[fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)] = object } @@ -190,11 +195,12 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { valueProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.EnumDescriptorProto)(nil)), "Value") for _, enum := range enums { - enumDescription := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index)) + enumComments := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index)) var enumNames []string // it may be necessary to sort the result of the GetValue function. var defaultValue string + var valueDescriptions []string for valueIdx, value := range enum.GetValue() { enumNames = append(enumNames, value.GetName()) if defaultValue == "" && value.GetNumber() == 0 { @@ -203,16 +209,23 @@ func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, r valueDescription := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index), valueProtoPath, int32(valueIdx)) if valueDescription != "" { - enumDescription += " " + value.GetName() + ": " + valueDescription + valueDescriptions = append(valueDescriptions, value.GetName()+": "+valueDescription) } } - d[fullyQualifiedNameToSwaggerName(enum.FQEN(), reg)] = swaggerSchemaObject{ - Type: "string", - Enum: enumNames, - Default: defaultValue, - Description: enumDescription, + if len(valueDescriptions) > 0 { + enumComments += "\n\n - " + strings.Join(valueDescriptions, "\n - ") } + enumSchemaObject := swaggerSchemaObject{ + Type: "string", + Enum: enumNames, + Default: defaultValue, + } + if err := updateSwaggerDataFromComments(&enumSchemaObject, enumComments); err != nil { + panic(err) + } + + d[fullyQualifiedNameToSwaggerName(enum.FQEN(), reg)] = enumSchemaObject } } @@ -438,10 +451,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } methProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.ServiceDescriptorProto)(nil)), "Method") - methDescription := protoComments(reg, svc.File, nil, "Service", int32(svcIdx), methProtoPath, int32(methIdx)) operationObject := &swaggerOperationObject{ - Summary: fmt.Sprintf("%s.%s", svc.GetName(), meth.GetName()), - Description: methDescription, Tags: []string{svc.GetName()}, OperationId: fmt.Sprintf("%s", meth.GetName()), Parameters: parameters, @@ -454,6 +464,10 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re }, }, } + methComments := protoComments(reg, svc.File, nil, "Service", int32(svcIdx), methProtoPath, int32(methIdx)) + if err := updateSwaggerDataFromComments(operationObject, methComments); err != nil { + panic(err) + } switch b.HTTPMethod { case "DELETE": @@ -490,6 +504,10 @@ func applyTemplate(p param) (string, error) { Produces: []string{"application/json"}, Paths: make(swaggerPathsObject), Definitions: make(swaggerDefinitionsObject), + Info: swaggerInfoObject{ + Title: *p.File.Name, + Version: "version not set", + }, } // Loops through all the services and their exposed GET/POST/PUT/DELETE definitions @@ -504,6 +522,13 @@ func applyTemplate(p param) (string, error) { renderMessagesAsDefinition(m, s.Definitions, p.reg) renderEnumerationsAsDefinition(e, s.Definitions, p.reg) + // File itself might have some comments and metadata. + packageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") + packageComments := protoComments(p.reg, p.File, nil, "Package", packageProtoPath) + if err := updateSwaggerDataFromComments(&s, packageComments); err != nil { + panic(err) + } + // We now have rendered the entire swagger object. Write the bytes out to a // string so it can be written to disk. var w bytes.Buffer @@ -513,6 +538,98 @@ func applyTemplate(p param) (string, error) { return w.String(), nil } +// updateSwaggerDataFromComments updates a Swagger object based on a comment +// from the proto file. +// +// As a first step, a section matching: +// +// +// +// where .* contains valid JSON will be stored for later processing, and then +// removed from the passed string. +// (Implementation note: Currently, the JSON gets immediately applied and +// thus cannot override summary and description.) +// +// First paragraph of a comment is used for summary. Remaining paragraphs of a +// comment are used for description. If 'Summary' field is not present on the +// passed swaggerObject, the summary and description are joined by \n\n. +// +// If there is a field named 'Info', its 'Summary' and 'Description' fields +// will be updated instead. (JSON always gets applied directly to the passed +// object.) +// +// If there is no 'Summary', the same behavior will be attempted on 'Title'. +// +// To apply additional Swagger properties, one can pass valid JSON as described +// before. This JSON gets parsed and applied to the passed swaggerObject +// directly. This lets users easily apply custom properties such as contact +// details, API base path, et al. +func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) error { + // Find a section containing additional Swagger metadata. + matches := swaggerExtrasRegexp.FindStringSubmatch(comment) + + if len(matches) > 0 { + // If found, before further processing, replace the + // comment with a version that does not contain the + // extras. + comment = matches[1] + if len(matches[3]) > 0 { + comment += "\n\n" + matches[3] + } + + // Parse the JSON and apply it. + // TODO(ivucica): apply extras /after/ applying summary + // and description. + if err := json.Unmarshal([]byte(matches[2]), swaggerObject); err != nil { + return fmt.Errorf("error: %s, parsing: %s", err.Error(), matches[2]) + } + } + + // Figure out what to apply changes to. + swaggerObjectValue := reflect.ValueOf(swaggerObject) + infoObjectValue := swaggerObjectValue.Elem().FieldByName("Info") + if !infoObjectValue.CanSet() { + // No such field? Apply summary and description directly to + // passed object. + infoObjectValue = swaggerObjectValue.Elem() + } + + // Figure out which properties to update. + summaryValue := infoObjectValue.FieldByName("Summary") + descriptionValue := infoObjectValue.FieldByName("Description") + if !summaryValue.CanSet() { + summaryValue = infoObjectValue.FieldByName("Title") + } + + // If there is a summary (or summary-equivalent), use the first + // paragraph as summary, and the rest as description. + if summaryValue.CanSet() { + paragraphs := strings.Split(comment, "\n\n") + + summary := strings.TrimSpace(paragraphs[0]) + description := strings.TrimSpace(strings.Join(paragraphs[1:], "\n\n")) + if len(summary) > 0 { + summaryValue.Set(reflect.ValueOf(summary)) + } + if len(description) > 0 { + if !descriptionValue.CanSet() { + return fmt.Errorf("Object that has Summary but no Description?") + } + descriptionValue.Set(reflect.ValueOf(description)) + } + return nil + } + + // There was no summary field on the swaggerObject. Try to apply the + // whole comment into description. + if descriptionValue.CanSet() { + descriptionValue.Set(reflect.ValueOf(comment)) + return nil + } + + return fmt.Errorf("No description nor summary property.") +} + func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []string, typeName string, typeIndex int32, fieldPaths ...int32) string { if file.SourceCodeInfo == nil { // Curious! A file without any source code info. @@ -540,50 +657,64 @@ func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []str messageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "MessageType") nestedProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "NestedType") + packageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") L1: for _, loc := range file.SourceCodeInfo.Location { - if len(loc.Path) < len(outerPaths)*2+2+len(fieldPaths) { - continue - } - - for i, v := range outerPaths { - if i == 0 && loc.Path[i*2+0] != messageProtoPath { - continue L1 - } - if i != 0 && loc.Path[i*2+0] != nestedProtoPath { - continue L1 + if typeIndex != packageProtoPath { + if len(loc.Path) < len(outerPaths)*2+2+len(fieldPaths) { + continue } - if loc.Path[i*2+1] != v { - continue L1 + for i, v := range outerPaths { + if i == 0 && loc.Path[i*2+0] != messageProtoPath { + continue L1 + } + if i != 0 && loc.Path[i*2+0] != nestedProtoPath { + continue L1 + } + if loc.Path[i*2+1] != v { + continue L1 + } } - } - outerOffset := len(outerPaths) * 2 - if outerOffset == 0 && loc.Path[outerOffset] != protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), typeName) { - continue - } - if outerOffset != 0 { - if typeName == "MessageType" { - typeName = "NestedType" + outerOffset := len(outerPaths) * 2 + if outerOffset == 0 && loc.Path[outerOffset] != protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), typeName) { + continue + } + if outerOffset != 0 { + if typeName == "MessageType" { + typeName = "NestedType" + } + if loc.Path[outerOffset] != protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), typeName) { + continue + } } - if loc.Path[outerOffset] != protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), typeName) { + if loc.Path[outerOffset+1] != typeIndex { continue } - } - if loc.Path[outerOffset+1] != typeIndex { - continue - } - for i, v := range fieldPaths { - if loc.Path[outerOffset+2+i] != v { - continue L1 + for i, v := range fieldPaths { + if loc.Path[outerOffset+2+i] != v { + continue L1 + } + } + } else { + // path for package comments is just [2], and all the other processing + // is too complex for it. + if len(loc.Path) == 0 || typeIndex != loc.Path[0] { + continue } } - comments := "" if loc.LeadingComments != nil { comments = strings.TrimRight(*loc.LeadingComments, "\n") comments = strings.TrimSpace(comments) + // TODO(ivucica): this is a hack to fix "// " being interpreted as "//". + // perhaps we should: + // - split by \n + // - determine if every (but first and last) line begins with " " + // - trim every line only if that is the case + // - join by \n + comments = strings.Replace(comments, "\n ", "\n", -1) } return comments } diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 822470d2c4d..e2ed057f7a7 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -15,8 +15,33 @@ type binding struct { // http://swagger.io/specification/#infoObject type swaggerInfoObject struct { - Version string `json:"version"` - Title string `json:"title"` + Title string `json:"title"` + Description string `json:"description,omitempty"` + TermsOfService string `json:"termsOfService,omitempty"` + Version string `json:"version"` + + Contact *swaggerContactObject `json:"contact,omitempty"` + License *swaggerLicenseObject `json:"license,omitempty"` + ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` +} + +// http://swagger.io/specification/#contactObject +type swaggerContactObject struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` + Email string `json:"email,omitempty"` +} + +// http://swagger.io/specification/#licenseObject +type swaggerLicenseObject struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` +} + +// http://swagger.io/specification/#externalDocumentationObject +type swaggerExternalDocumentationObject struct { + Description string `json:"description,omitempty"` + URL string `json:"url,omitempty"` } // http://swagger.io/specification/#swaggerObject @@ -45,12 +70,14 @@ type swaggerPathItemObject struct { // http://swagger.io/specification/#operationObject type swaggerOperationObject struct { - Summary string `json:"summary"` + Summary string `json:"summary,omitempty"` Description string `json:"description,omitempty"` OperationId string `json:"operationId"` Responses swaggerResponsesObject `json:"responses"` Parameters swaggerParametersObject `json:"parameters,omitempty"` Tags []string `json:"tags,omitempty"` + + ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` } type swaggerParametersObject []swaggerParameterObject From 497b8982e605b9b9fc690afdb40dbf3531d56fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sat, 7 May 2016 20:19:36 +0100 Subject: [PATCH 010/552] Swagger: Default response's key is now 200. While the spec does not seem to dictate this, most of the examples seem to have HTTP status codes as the keys. This patch replaces the text 'default' with value of '200'. --- examples/examplepb/echo_service.swagger.json | 4 ++-- .../streamless_everything.swagger.json | 18 +++++++++--------- protoc-gen-swagger/genswagger/template.go | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/examplepb/echo_service.swagger.json b/examples/examplepb/echo_service.swagger.json index 39f226e1b09..dbc9ece0833 100644 --- a/examples/examplepb/echo_service.swagger.json +++ b/examples/examplepb/echo_service.swagger.json @@ -28,7 +28,7 @@ "description": "The message posted as the id parameter will also be\nreturned.", "operationId": "Echo", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" @@ -58,7 +58,7 @@ "summary": "EchoBody method receives a simple message and returns it.", "operationId": "EchoBody", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index bd314024891..664d99557e9 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -19,7 +19,7 @@ "get": { "operationId": "List", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" @@ -33,7 +33,7 @@ "post": { "operationId": "CreateBody", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" @@ -59,7 +59,7 @@ "post": { "operationId": "BulkCreate", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/examplepbEmptyMessage" @@ -85,7 +85,7 @@ "post": { "operationId": "BulkEcho", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/subStringMessage" @@ -111,7 +111,7 @@ "get": { "operationId": "Echo", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/subStringMessage" @@ -136,7 +136,7 @@ "post": { "operationId": "Create", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" @@ -252,7 +252,7 @@ "get": { "operationId": "Lookup", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" @@ -275,7 +275,7 @@ "delete": { "operationId": "Delete", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/examplepbEmptyMessage" @@ -298,7 +298,7 @@ "put": { "operationId": "Update", "responses": { - "default": { + "200": { "description": "Description", "schema": { "$ref": "#/definitions/examplepbEmptyMessage" diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 96239a9b550..0470199d256 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -456,7 +456,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re OperationId: fmt.Sprintf("%s", meth.GetName()), Parameters: parameters, Responses: swaggerResponsesObject{ - "default": swaggerResponseObject{ + "200": swaggerResponseObject{ Description: "Description", Schema: swaggerSchemaObject{ Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)), From 81b965bcb97adc502617148505248c8b5fb6b457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 17 Apr 2016 03:01:53 +0100 Subject: [PATCH 011/552] Allow period in path URL templates when generating Swagger templates. This allows for the templates to contain references to request proto messages' fields. --- examples/examplepb/a_bit_of_everything.pb.go | 276 +++++++++++------- .../examplepb/a_bit_of_everything.pb.gw.go | 58 ++++ examples/examplepb/a_bit_of_everything.proto | 7 + examples/examplepb/echo_service.pb.go | 34 ++- examples/examplepb/flow_combination.pb.go | 66 +++-- .../examplepb/streamless_everything.proto | 7 + .../streamless_everything.swagger.json | 37 +++ examples/server/a_bit_of_everything.go | 8 + protoc-gen-swagger/genswagger/template.go | 2 +- 9 files changed, 364 insertions(+), 131 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 18b174ac92f..10eca5f4e95 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -78,13 +78,14 @@ type ABitOfEverything struct { BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` // TODO(yugui) add bytes_value - Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` - EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=gengo.grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` - Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` - Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` - Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` - Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` - RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` + EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=gengo.grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` + Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` + Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` + Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` + Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` + RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` + SingleNested *ABitOfEverything_Nested `protobuf:"bytes,20,opt,name=single_nested,json=singleNested" json:"single_nested,omitempty"` } func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } @@ -99,6 +100,13 @@ func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { return nil } +func (m *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested { + if m != nil { + return m.SingleNested + } + return nil +} + type ABitOfEverything_Nested struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Amount uint32 `protobuf:"varint,2,opt,name=amount" json:"amount,omitempty"` @@ -132,7 +140,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for ABitOfEverythingService service @@ -146,6 +154,7 @@ type ABitOfEverythingServiceClient interface { 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) } type aBitOfEverythingServiceClient struct { @@ -307,6 +316,15 @@ func (x *aBitOfEverythingServiceBulkEchoClient) Recv() (*gengo_grpc_gateway_exam 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...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for ABitOfEverythingService service type ABitOfEverythingServiceServer interface { @@ -319,34 +337,47 @@ type ABitOfEverythingServiceServer interface { 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) } func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingServiceServer) { s.RegisterService(&_ABitOfEverythingService_serviceDesc, srv) } -func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Create(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Create(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Create(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_BulkCreate_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -375,16 +406,22 @@ func (x *aBitOfEverythingServiceBulkCreateServer) Recv() (*ABitOfEverything, err return m, nil } -func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Lookup(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Lookup(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Lookup(ctx, req.(*sub2.IdMessage)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_List_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -408,40 +445,58 @@ 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) (interface{}, error) { +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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Update(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Update(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Update(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Delete_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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Delete(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Delete(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Delete(ctx, req.(*sub2.IdMessage)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(gengo_grpc_gateway_examples_sub.StringMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Echo(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Echo(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Echo(ctx, req.(*gengo_grpc_gateway_examples_sub.StringMessage)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_BulkEcho_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -470,6 +525,24 @@ func (x *aBitOfEverythingServiceBulkEchoServer) Recv() (*gengo_grpc_gateway_exam 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 { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).DeepPathEcho(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).DeepPathEcho(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) +} + var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ ServiceName: "gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService", HandlerType: (*ABitOfEverythingServiceServer)(nil), @@ -498,6 +571,10 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "Echo", Handler: _ABitOfEverythingService_Echo_Handler, }, + { + MethodName: "DeepPathEcho", + Handler: _ABitOfEverythingService_DeepPathEcho_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -520,64 +597,67 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ } var fileDescriptor1 = []byte{ - // 932 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0xdd, 0x8e, 0xdb, 0x44, - 0x14, 0xc6, 0x49, 0xd6, 0x49, 0xc6, 0x9b, 0x6c, 0x3a, 0x15, 0xb0, 0x04, 0xd0, 0x6e, 0x4d, 0x0b, - 0x21, 0x54, 0x76, 0xeb, 0x20, 0x90, 0x2a, 0x81, 0xd4, 0xd0, 0x80, 0x90, 0x96, 0x5d, 0xe1, 0xa5, - 0x45, 0x8a, 0x84, 0x22, 0x27, 0x9e, 0xb8, 0xd6, 0x3a, 0x1e, 0xcb, 0x3f, 0xa1, 0x51, 0x14, 0x2e, - 0x7a, 0x85, 0xc4, 0x05, 0x12, 0x3c, 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b7, - 0x04, 0xfc, 0x1b, 0xb4, 0xe9, 0xbe, 0x67, 0x5e, 0xfe, 0x48, 0x6f, 0x33, 0x8d, 0xef, 0xb5, 0xb7, - 0x6c, 0x65, 0x6c, 0xc1, 0xef, 0x90, 0x78, 0x8f, 0x38, 0x04, 0xa4, 0x3e, 0x33, 0xd1, 0x9d, 0x24, - 0xa4, 0xd3, 0xec, 0x6e, 0x3b, 0xcd, 0x27, 0x30, 0xcd, 0xc1, 0xe4, 0x21, 0xc5, 0xca, 0x7f, 0x66, - 0x03, 0x69, 0x4a, 0xf2, 0xdd, 0xc9, 0xd4, 0xfd, 0x4f, 0xbc, 0x3c, 0x61, 0xc2, 0xbe, 0xc1, 0x37, - 0x37, 0x09, 0x23, 0xa0, 0x46, 0x5d, 0x26, 0xcf, 0xc9, 0xf0, 0x35, 0xb9, 0xa5, 0xce, 0xb5, 0x1c, - 0x1f, 0xc7, 0xee, 0xec, 0xb1, 0xd8, 0x10, 0xe3, 0x67, 0x42, 0xb1, 0x37, 0x6b, 0xf1, 0x85, 0xbe, - 0x94, 0x8a, 0xb6, 0xbe, 0xc0, 0x4c, 0x75, 0x7c, 0x81, 0x6f, 0x09, 0x7d, 0x69, 0x58, 0xcf, 0x27, - 0x37, 0x16, 0xd9, 0x1f, 0xd7, 0xde, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x17, 0x44, 0xcc, 0x34, - 0x66, 0x0b, 0x00, 0x00, + // 984 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0xdd, 0x6e, 0x1b, 0x45, + 0x14, 0x66, 0x1d, 0xc7, 0xb1, 0x8f, 0x7f, 0xe2, 0x4e, 0xf9, 0x09, 0x06, 0x94, 0x74, 0x69, 0x21, + 0x98, 0x6a, 0x97, 0x6e, 0x2a, 0x10, 0x95, 0x00, 0x35, 0xd4, 0x20, 0xa4, 0x90, 0xc0, 0x86, 0x16, + 0x29, 0x12, 0xb2, 0xd6, 0xf6, 0xc4, 0x59, 0xc5, 0xde, 0x59, 0xed, 0x8f, 0x69, 0x64, 0x85, 0x8b, + 0xde, 0x80, 0xc4, 0x45, 0x25, 0x78, 0x00, 0xae, 0x41, 0x82, 0x77, 0xe0, 0x9a, 0x4b, 0x5e, 0x81, + 0x07, 0xe1, 0xcc, 0xcc, 0xee, 0x32, 0xeb, 0x22, 0x6c, 0x1c, 0x29, 0xbd, 0xdb, 0x99, 0xf3, 0xcd, + 0x37, 0xdf, 0x99, 0xf3, 0x9d, 0x99, 0x85, 0x9b, 0xf4, 0xa1, 0x33, 0xf6, 0x47, 0x34, 0x34, 0x93, + 0x0f, 0xbf, 0x67, 0x3a, 0xdd, 0x9e, 0x1b, 0x75, 0xd9, 0x71, 0x97, 0x4e, 0x68, 0x70, 0x16, 0x9d, + 0xb8, 0xde, 0xd0, 0xf0, 0x03, 0x16, 0x31, 0x72, 0x63, 0x48, 0xbd, 0x21, 0x33, 0x86, 0x81, 0xdf, + 0x37, 0x86, 0x4e, 0x44, 0xbf, 0x76, 0xce, 0x8c, 0x94, 0xc0, 0xc8, 0x08, 0x5a, 0x2f, 0x0f, 0x19, + 0x1b, 0x8e, 0xa8, 0xe9, 0xf8, 0xae, 0xe9, 0x78, 0x1e, 0x8b, 0x9c, 0xc8, 0x65, 0x5e, 0x28, 0x49, + 0x5a, 0xad, 0x6c, 0xcb, 0x30, 0xee, 0x99, 0x63, 0x1a, 0x86, 0xce, 0x90, 0x26, 0xb1, 0x97, 0xd4, + 0x98, 0x95, 0x0f, 0xea, 0xdf, 0x96, 0xa1, 0x79, 0x77, 0xd7, 0x8d, 0x0e, 0x8e, 0x3b, 0x99, 0x30, + 0x42, 0xa0, 0x18, 0xc7, 0xee, 0x60, 0x43, 0xdb, 0xd2, 0xb6, 0x2b, 0xb6, 0xf8, 0x26, 0x0f, 0xa0, + 0xe4, 0xd1, 0x30, 0xa2, 0x83, 0x8d, 0xc2, 0xd6, 0xca, 0x76, 0xd5, 0x7a, 0xdf, 0x58, 0x48, 0xb7, + 0x31, 0x4b, 0x6e, 0xec, 0x0b, 0x16, 0x3b, 0x61, 0x23, 0x9b, 0x50, 0x3d, 0x1e, 0x31, 0x27, 0xea, + 0x4e, 0x9c, 0x51, 0x4c, 0x37, 0x56, 0x70, 0xcb, 0x82, 0x0d, 0x62, 0xea, 0x01, 0x9f, 0x21, 0xd7, + 0xa0, 0x36, 0x60, 0x71, 0x6f, 0x44, 0x13, 0x44, 0x11, 0x11, 0x9a, 0x5d, 0x95, 0x73, 0x12, 0x82, + 0x1c, 0xae, 0x17, 0xbd, 0x7d, 0x3b, 0x41, 0xac, 0x22, 0x62, 0xc5, 0x06, 0x31, 0x95, 0x71, 0xc4, + 0x2a, 0xa2, 0x84, 0x88, 0xa2, 0x5d, 0x8d, 0x15, 0x88, 0xe4, 0xd8, 0xb1, 0x12, 0xc4, 0x1a, 0x22, + 0x56, 0x05, 0xc7, 0x8e, 0x25, 0x01, 0xaf, 0x42, 0xfd, 0xd8, 0x7d, 0x48, 0x07, 0x19, 0x49, 0x19, + 0x21, 0x25, 0xbb, 0x96, 0x4c, 0xe6, 0x41, 0x19, 0x4f, 0x05, 0x41, 0x6b, 0x09, 0x28, 0x65, 0x7a, + 0x05, 0xa0, 0xc7, 0xd8, 0x28, 0x41, 0x00, 0x22, 0xca, 0x76, 0x85, 0xcf, 0x64, 0x62, 0xc3, 0x28, + 0xc0, 0xa3, 0x4a, 0x00, 0x55, 0x51, 0x85, 0xaa, 0x9c, 0xcb, 0xe5, 0x93, 0xed, 0x52, 0x47, 0x48, + 0x5d, 0xe6, 0x93, 0x6e, 0xf2, 0x39, 0x00, 0xf5, 0xe2, 0x71, 0x02, 0x68, 0x20, 0xa0, 0x61, 0x59, + 0x0b, 0xd6, 0x6c, 0x3f, 0x1e, 0xd3, 0xc0, 0xed, 0x77, 0x70, 0xbd, 0x5d, 0xe1, 0x2c, 0x92, 0xf2, + 0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x54, 0xc9, 0xe8, 0x7b, 0x25, 0xf1, 0x87, 0xbf, 0xf3, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xdb, 0x03, 0xf3, 0x17, 0x8f, 0x0c, 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 f6f214bfb5d..ac9ff9c1c4f 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -461,6 +461,37 @@ func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, client ABit } +func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + if err := json.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["single_nested.name"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) + + if err != nil { + return nil, metadata, err + } + + msg, err := client.DeepPathEcho(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + // RegisterABitOfEverythingServiceHandlerFromEndpoint is same as RegisterABitOfEverythingServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { @@ -744,6 +775,29 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }) + 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() + 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()) + } + resp, md, err := request_ABitOfEverythingService_DeepPathEcho_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, w, req, err) + return + } + + forward_ABitOfEverythingService_DeepPathEcho_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -769,6 +823,8 @@ 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"}, "")) ) var ( @@ -793,4 +849,6 @@ var ( forward_ABitOfEverythingService_Echo_2 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_BulkEcho_0 = runtime.ForwardResponseStream + + forward_ABitOfEverythingService_DeepPathEcho_0 = runtime.ForwardResponseMessage ) diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 406023ad010..bce017617a2 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -36,6 +36,7 @@ message ABitOfEverything { sint32 sint32_value = 17; sint64 sint64_value = 18; repeated string repeated_string_value = 19; + Nested single_nested = 20; } message EmptyMessage { @@ -104,4 +105,10 @@ service ABitOfEverythingService { 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/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 76cd1d1250c..4c78cacd2b6 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -60,7 +60,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for EchoService service @@ -106,28 +106,40 @@ func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer) { s.RegisterService(&_EchoService_serviceDesc, srv) } -func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(EchoServiceServer).Echo(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(EchoServiceServer).Echo(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.EchoService/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EchoServiceServer).Echo(ctx, req.(*SimpleMessage)) + } + return interceptor(ctx, in, info, handler) } -func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(EchoServiceServer).EchoBody(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(EchoServiceServer).EchoBody(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.EchoService/EchoBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EchoServiceServer).EchoBody(ctx, req.(*SimpleMessage)) + } + return interceptor(ctx, in, info, handler) } var _EchoService_serviceDesc = grpc.ServiceDesc{ diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 40606b6eb0d..345f7ed5a8a 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -95,7 +95,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for FlowCombination service @@ -368,16 +368,22 @@ func RegisterFlowCombinationServer(s *grpc.Server, srv FlowCombinationServer) { s.RegisterService(&_FlowCombination_serviceDesc, srv) } -func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(EmptyProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, req.(*EmptyProto)) + } + return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcEmptyStream_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -453,40 +459,58 @@ func (x *flowCombinationStreamEmptyStreamServer) Recv() (*EmptyProto, error) { return m, nil } -func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NonEmptyProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcBodyRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcBodyRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcBodyRpc(ctx, req.(*NonEmptyProto)) + } + return interceptor(ctx, in, info, handler) } -func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SingleNestedProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, req.(*SingleNestedProto)) + } + return interceptor(ctx, in, info, handler) } -func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NestedProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, req.(*NestedProto)) + } + return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error { diff --git a/examples/examplepb/streamless_everything.proto b/examples/examplepb/streamless_everything.proto index a6d2145d8ab..4c92ada16e1 100644 --- a/examples/examplepb/streamless_everything.proto +++ b/examples/examplepb/streamless_everything.proto @@ -35,6 +35,7 @@ message ABitOfEverything { sint32 sint32_value = 17; sint64 sint64_value = 18; repeated string repeated_string_value = 19; + Nested single_nested = 20; } message EmptyMessage { @@ -107,4 +108,10 @@ service ABitOfEverythingService { 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/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index 508508eb36e..1136ee27f80 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -254,6 +254,40 @@ ] } }, + "/v1/example/a_bit_of_everything/{single_nested.name}": { + "post": { + "summary": "ABitOfEverythingService.DeepPathEcho", + "operationId": "DeepPathEcho", + "responses": { + "default": { + "description": "Description", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + }, + "parameters": [ + { + "name": "single_nested.name", + "in": "path", + "required": true, + "type": "string", + "format": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, "/v1/example/a_bit_of_everything/{uuid}": { "get": { "summary": "ABitOfEverythingService.Lookup", @@ -417,6 +451,9 @@ "type": "integer", "format": "int32" }, + "single_nested": { + "$ref": "#/definitions/ABitOfEverythingNested" + }, "sint32_value": { "type": "integer", "format": "int32" diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 20f24214bd9..0506557251d 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -206,3 +206,11 @@ func (s *_ABitOfEverythingServer) BulkEcho(stream examples.ABitOfEverythingServi })) return nil } + +func (s *_ABitOfEverythingServer) DeepPathEcho(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { + s.m.Lock() + defer s.m.Unlock() + + glog.Info(msg) + return msg, nil +} diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 3793d0e5578..5a38ab12f7e 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -296,7 +296,7 @@ func templateToSwaggerPath(path string) string { // Parts is now an array of segments of the path. Interestingly, since the // syntax for this subsection CAN be handled by a regexp since it has no // memory. - re := regexp.MustCompile("{([a-z][a-z0-9_]*).*}") + re := regexp.MustCompile("{([a-z][a-z0-9_.]*).*}") for index, part := range parts { parts[index] = re.ReplaceAllString(part, "{$1}") } From 0f189fd7d60775cd4bedb3182c636c55681707fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sat, 7 May 2016 22:51:40 +0100 Subject: [PATCH 012/552] Swagger: schema objects can have titles, too. --- protoc-gen-swagger/genswagger/types.go | 1 + 1 file changed, 1 insertion(+) diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index e2ed057f7a7..18ed850e669 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -129,6 +129,7 @@ type swaggerSchemaObject struct { Default string `json:"default,omitempty"` Description string `json:"description,omitempty"` + Title string `json:"title,omitempty"` } // http://swagger.io/specification/#referenceObject From 8a126adb6f14939775ae8991783708d503fa5b81 Mon Sep 17 00:00:00 2001 From: William King Date: Fri, 8 Apr 2016 17:31:34 -0700 Subject: [PATCH 013/552] JSON Adapter --- .../descriptor/types_test.go | 8 + .../generator/generator.go | 2 +- .../gengateway/generator.go | 9 +- .../gengateway/template.go | 16 +- protoc-gen-grpc-gateway/main.go | 4 +- runtime/handler.go | 22 ++- runtime/json.go | 140 ++++++++++++++++++ runtime/mux.go | 4 + 8 files changed, 181 insertions(+), 24 deletions(-) create mode 100644 runtime/json.go diff --git a/protoc-gen-grpc-gateway/descriptor/types_test.go b/protoc-gen-grpc-gateway/descriptor/types_test.go index 8642ff23b19..bf57cfe0ceb 100644 --- a/protoc-gen-grpc-gateway/descriptor/types_test.go +++ b/protoc-gen-grpc-gateway/descriptor/types_test.go @@ -20,6 +20,10 @@ func TestGoPackageStandard(t *testing.T) { pkg: GoPackage{Path: "encoding/json", Name: "json"}, want: true, }, + { + pkg: GoPackage{Path: "github.com/golang/protobuf/jsonpb", Name: "jsonpb"}, + want: true, + }, { pkg: GoPackage{Path: "golang.org/x/net/context", Name: "context"}, want: false, @@ -52,6 +56,10 @@ func TestGoPackageString(t *testing.T) { pkg: GoPackage{Path: "encoding/json", Name: "json"}, want: `"encoding/json"`, }, + { + pkg: GoPackage{Path: "github.com/golang/protobuf/jsonpb", Name: "jsonpb"}, + want: `"github.com/golang/protobuf/jsonpb"`, + }, { pkg: GoPackage{Path: "golang.org/x/net/context", Name: "context"}, want: `"golang.org/x/net/context"`, diff --git a/protoc-gen-grpc-gateway/generator/generator.go b/protoc-gen-grpc-gateway/generator/generator.go index b4de256c912..1c7afab89b5 100644 --- a/protoc-gen-grpc-gateway/generator/generator.go +++ b/protoc-gen-grpc-gateway/generator/generator.go @@ -2,7 +2,7 @@ package generator import ( - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" ) diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index 24245545f4c..e49c4be589e 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -8,8 +8,8 @@ import ( "path/filepath" "strings" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - gen "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/generator" + "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/generator" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" @@ -28,11 +28,10 @@ type generator struct { func New(reg *descriptor.Registry) gen.Generator { var imports []descriptor.GoPackage for _, pkgpath := range []string{ - "encoding/json", "io", "net/http", - "github.com/gengo/grpc-gateway/runtime", - "github.com/gengo/grpc-gateway/utilities", + "github.com/willtrking/grpc-gateway/runtime", + "github.com/willtrking/grpc-gateway/utilities", "github.com/golang/protobuf/proto", "golang.org/x/net/context", "google.golang.org/grpc", diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 37bbc64544b..cc634a10945 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -6,8 +6,8 @@ import ( "strings" "text/template" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/gengo/grpc-gateway/utilities" + "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/willtrking/grpc-gateway/utilities" "github.com/golang/glog" ) @@ -113,7 +113,7 @@ import ( var _ codes.Code var _ io.Reader var _ = runtime.String -var _ = json.Marshal +var _ = runtime.JSONAdapter var _ = utilities.NewDoubleArray `)) @@ -127,9 +127,9 @@ var _ = utilities.NewDoubleArray _ = template.Must(handlerTemplate.New("request-func-signature").Parse(strings.Replace(` {{if .Method.GetServerStreaming}} -func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) ({{.Method.Service.GetName}}_{{.Method.GetName}}Client, runtime.ServerMetadata, error) +func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(json runtime.JSONAdapter, ctx context.Context, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) ({{.Method.Service.GetName}}_{{.Method.GetName}}Client, runtime.ServerMetadata, error) {{else}} -func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) +func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(json runtime.JSONAdapter, ctx context.Context, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {{end}}`, "\n", "", -1))) _ = template.Must(handlerTemplate.New("client-streaming-request-func").Parse(` @@ -280,16 +280,16 @@ func Register{{$svc.GetName}}Handler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(runtime.AnnotateContext(ctx, req), client, req, pathParams) + resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(mux.JSONHandler, runtime.AnnotateContext(ctx, req), client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, w, req, err) return } {{if $m.GetServerStreaming}} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(mux.JSONHandler, ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) {{else}} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(mux.JSONHandler, ctx, w, req, resp, mux.GetForwardResponseOptions()...) {{end}} }) {{end}} diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 32a719c2b23..8b166adef3c 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -7,8 +7,8 @@ import ( "os" "strings" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/gengateway" + "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/gengateway" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" diff --git a/runtime/handler.go b/runtime/handler.go index 22aab23704b..48605e797eb 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -1,12 +1,12 @@ package runtime import ( - "encoding/json" "fmt" "io" "net/http" "net/textproto" + builtinjson "encoding/json" "github.com/golang/protobuf/proto" "golang.org/x/net/context" "google.golang.org/grpc" @@ -18,6 +18,11 @@ type responseStreamChunk struct { Error *responseStreamError `json:"error,omitempty"` } +//Make this also conform to proto.Message for builtin JSONPb JSONAdapter +func (m *responseStreamChunk) Reset() { *m = responseStreamChunk{} } +func (m *responseStreamChunk) String() string { return proto.CompactTextString(m) } +func (*responseStreamChunk) ProtoMessage() {} + type responseStreamError struct { GrpcCode int `json:"grpc_code, omitempty"` HTTPCode int `json:"http_code, omitempty"` @@ -26,7 +31,7 @@ type responseStreamError struct { } // ForwardResponseStream forwards the stream from gRPC server to REST client. -func ForwardResponseStream(ctx context.Context, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { +func ForwardResponseStream(json JSONAdapter, ctx context.Context, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { f, ok := w.(http.Flusher) if !ok { grpclog.Printf("Flush not supported in %T", w) @@ -56,14 +61,15 @@ func ForwardResponseStream(ctx context.Context, w http.ResponseWriter, req *http return } if err != nil { - handleForwardResponseStreamError(w, err) + handleForwardResponseStreamError(json,w, err) return } if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { - handleForwardResponseStreamError(w, err) + handleForwardResponseStreamError(json,w, err) return } - buf, err := json.Marshal(responseStreamChunk{Result: resp}) + + buf, err := json.Marshal(&responseStreamChunk{Result: resp}) if err != nil { grpclog.Printf("Failed to marshal response chunk: %v", err) return @@ -102,7 +108,7 @@ func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) { } // ForwardResponseMessage forwards the message "resp" from gRPC server to REST client. -func ForwardResponseMessage(ctx context.Context, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { +func ForwardResponseMessage(json JSONAdapter, ctx context.Context, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { md, ok := ServerMetadataFromContext(ctx) if !ok { grpclog.Printf("Failed to extract ServerMetadata from context") @@ -143,7 +149,7 @@ func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, re return nil } -func handleForwardResponseStreamError(w http.ResponseWriter, err error) { +func handleForwardResponseStreamError(json JSONAdapter,w http.ResponseWriter, err error) { grpcCode := grpc.Code(err) httpCode := HTTPStatusFromCode(grpcCode) resp := responseStreamChunk{ @@ -153,7 +159,7 @@ func handleForwardResponseStreamError(w http.ResponseWriter, err error) { Message: err.Error(), HTTPStatus: http.StatusText(httpCode), }} - buf, merr := json.Marshal(resp) + buf, merr := builtinjson.Marshal(resp) if merr != nil { grpclog.Printf("Failed to marshal an error: %v", merr) return diff --git a/runtime/json.go b/runtime/json.go new file mode 100644 index 00000000000..bb9e9b8578f --- /dev/null +++ b/runtime/json.go @@ -0,0 +1,140 @@ +package runtime + +import ( + "errors" + "io" + "bytes" + "encoding/json" + + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" +) + +type JSONAdapter interface { + Marshal(v interface{}) ([]byte, error) + Unmarshal(data []byte, v interface{}) error + NewDecoder(r io.Reader) JSONDecoderAdapter + NewEncoder(w io.Writer) JSONEncoderAdapter +} + +type JSONDecoderAdapter interface { + Decode(v interface{}) error +} + +type JSONEncoderAdapter interface { + Encode(v interface{}) error +} + +type JSONBuiltin struct { } + +func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) { + return json.Marshal(v) +} + +func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { + return json.Unmarshal(data,v) +} + +func (j *JSONBuiltin) NewDecoder(r io.Reader) JSONDecoderAdapter { + return json.NewDecoder(r) +} + +func (j *JSONBuiltin) NewEncoder(w io.Writer) JSONEncoderAdapter { + return json.NewEncoder(w) +} + + +type JSONPb struct { + // Whether to render enum values as integers, as opposed to string values. + EnumsAsInts bool + + // Whether to render fields with zero values. + EmitDefaults bool + + // A string to indent each level by. The presence of this field will + // also cause a space to appear between the field separator and + // value, and for newlines to be appear between fields and array + // elements. + Indent string + + // Whether to use the original (.proto) name for fields. + OrigName bool +} + +func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { + m := &jsonpb.Marshaler{ + EnumsAsInts:j.EnumsAsInts, + EmitDefaults:j.EmitDefaults, + Indent:j.Indent, + OrigName:j.OrigName, + } + if p, ok := v.(proto.Message); ok { + var buf bytes.Buffer + if err := m.Marshal(&buf, p); err != nil { + return nil, err + } + return buf.Bytes(), nil + } else { + _ = v.(proto.Message) + return nil,errors.New("Interface is not proto.Message") + } + +} + +func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { + r := bytes.NewReader(data) + if p, ok := v.(proto.Message); ok { + return jsonpb.Unmarshal(r,p) + } else { + _ = v.(proto.Message) + return errors.New("Interface is not proto.Message") + } +} + +func (j *JSONPb) NewDecoder(r io.Reader) JSONDecoderAdapter { + return &JSONPbDecoder{decoder:json.NewDecoder(r)} +} + +func (j *JSONPb) NewEncoder(w io.Writer) JSONEncoderAdapter { + m := &jsonpb.Marshaler{ + EnumsAsInts:j.EnumsAsInts, + EmitDefaults:j.EmitDefaults, + Indent:j.Indent, + OrigName:j.OrigName, + } + + + return &JSONPbEncoder{ + marshal:m, + writer:w, + } +} + + + +type JSONPbDecoder struct { + decoder *json.Decoder +} + +func (j *JSONPbDecoder) Decode(v interface{}) error { + if p, ok := v.(proto.Message); ok { + return jsonpb.UnmarshalNext(j.decoder,p) + } else { + _ = v.(proto.Message) + return errors.New("Interface is not proto.Message") + } +} + +type JSONPbEncoder struct { + marshal *jsonpb.Marshaler + writer io.Writer +} + +func (j *JSONPbEncoder) Encode(v interface{}) error { + if p, ok := v.(proto.Message); ok { + return j.marshal.Marshal(j.writer,p) + } else { + _ = v.(proto.Message) + return errors.New("Interface is not proto.Message") + } +} \ No newline at end of file diff --git a/runtime/mux.go b/runtime/mux.go index e9c1c5a7ba7..ab1ad7071fe 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -18,6 +18,7 @@ type ServeMux struct { // handlers maps HTTP method to a list of handlers. handlers map[string][]handler forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error + JSONHandler JSONAdapter } // ServeMuxOption is an option that can be given to a ServeMux on construction. @@ -41,6 +42,9 @@ func NewServeMux(opts ...ServeMuxOption) *ServeMux { handlers: make(map[string][]handler), forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), } + + serveMux.JSONHandler = &JSONBuiltin{} + for _, opt := range opts { opt(serveMux) } From 161470ffdf5cf3521949c694995ac041060565d6 Mon Sep 17 00:00:00 2001 From: William King Date: Fri, 8 Apr 2016 17:32:37 -0700 Subject: [PATCH 014/552] For PR --- protoc-gen-grpc-gateway/generator/generator.go | 2 +- protoc-gen-grpc-gateway/gengateway/generator.go | 8 ++++---- protoc-gen-grpc-gateway/gengateway/template.go | 4 ++-- protoc-gen-grpc-gateway/main.go | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/protoc-gen-grpc-gateway/generator/generator.go b/protoc-gen-grpc-gateway/generator/generator.go index 1c7afab89b5..b4de256c912 100644 --- a/protoc-gen-grpc-gateway/generator/generator.go +++ b/protoc-gen-grpc-gateway/generator/generator.go @@ -2,7 +2,7 @@ package generator import ( - "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" ) diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index e49c4be589e..33cf6cc65f1 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -8,8 +8,8 @@ import ( "path/filepath" "strings" - "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - gen "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/generator" + "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/generator" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" @@ -30,8 +30,8 @@ func New(reg *descriptor.Registry) gen.Generator { for _, pkgpath := range []string{ "io", "net/http", - "github.com/willtrking/grpc-gateway/runtime", - "github.com/willtrking/grpc-gateway/utilities", + "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", diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index cc634a10945..2c0b6911ef5 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -6,8 +6,8 @@ import ( "strings" "text/template" - "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/willtrking/grpc-gateway/utilities" + "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/gengo/grpc-gateway/utilities" "github.com/golang/glog" ) diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 8b166adef3c..32a719c2b23 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -7,8 +7,8 @@ import ( "os" "strings" - "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/willtrking/grpc-gateway/protoc-gen-grpc-gateway/gengateway" + "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/gengateway" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" From 5f2cd32a8f5a92f55ad64fe97b636cf2dec871f9 Mon Sep 17 00:00:00 2001 From: William King Date: Fri, 8 Apr 2016 17:34:23 -0700 Subject: [PATCH 015/552] Oops --- protoc-gen-grpc-gateway/gengateway/template.go | 1 - 1 file changed, 1 deletion(-) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 2c0b6911ef5..29243895833 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -113,7 +113,6 @@ import ( var _ codes.Code var _ io.Reader var _ = runtime.String -var _ = runtime.JSONAdapter var _ = utilities.NewDoubleArray `)) From da92a6c0e0d857bddd1988bbb6aaae177fa18348 Mon Sep 17 00:00:00 2001 From: William King Date: Fri, 8 Apr 2016 18:10:43 -0700 Subject: [PATCH 016/552] Scratch builtin --- runtime/handler.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/handler.go b/runtime/handler.go index 48605e797eb..ed65184115b 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -6,7 +6,6 @@ import ( "net/http" "net/textproto" - builtinjson "encoding/json" "github.com/golang/protobuf/proto" "golang.org/x/net/context" "google.golang.org/grpc" @@ -30,6 +29,11 @@ type responseStreamError struct { HTTPStatus string `json:"http_status, omitempty"` } +//Make this also conform to proto.Message for builtin JSONPb JSONAdapter +func (m *responseStreamError) Reset() { *m = responseStreamError{} } +func (m *responseStreamError) String() string { return proto.CompactTextString(m) } +func (*responseStreamError) ProtoMessage() {} + // ForwardResponseStream forwards the stream from gRPC server to REST client. func ForwardResponseStream(json JSONAdapter, ctx context.Context, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { f, ok := w.(http.Flusher) @@ -152,14 +156,14 @@ func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, re func handleForwardResponseStreamError(json JSONAdapter,w http.ResponseWriter, err error) { grpcCode := grpc.Code(err) httpCode := HTTPStatusFromCode(grpcCode) - resp := responseStreamChunk{ + resp := &responseStreamChunk{ Error: &responseStreamError{ GrpcCode: int(grpcCode), HTTPCode: httpCode, Message: err.Error(), HTTPStatus: http.StatusText(httpCode), }} - buf, merr := builtinjson.Marshal(resp) + buf, merr := json.Marshal(resp) if merr != nil { grpclog.Printf("Failed to marshal an error: %v", merr) return From dce3cd8f4a377f76a027e1efc4d21157112cce00 Mon Sep 17 00:00:00 2001 From: William King Date: Mon, 18 Apr 2016 17:00:31 -0700 Subject: [PATCH 017/552] Name changes, inbound/outbound, marshal on error, mime registry --- .../gengateway/template.go | 17 +- runtime/errors.go | 15 +- runtime/handler.go | 48 +-- runtime/json.go | 140 -------- runtime/marshaler.go | 307 ++++++++++++++++++ runtime/mux.go | 17 +- 6 files changed, 363 insertions(+), 181 deletions(-) delete mode 100644 runtime/json.go create mode 100644 runtime/marshaler.go diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 29243895833..b7e70d75d5b 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -126,9 +126,9 @@ var _ = utilities.NewDoubleArray _ = template.Must(handlerTemplate.New("request-func-signature").Parse(strings.Replace(` {{if .Method.GetServerStreaming}} -func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(json runtime.JSONAdapter, ctx context.Context, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) ({{.Method.Service.GetName}}_{{.Method.GetName}}Client, runtime.ServerMetadata, error) +func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(marshaler runtime.Marshaler, ctx context.Context, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) ({{.Method.Service.GetName}}_{{.Method.GetName}}Client, runtime.ServerMetadata, error) {{else}} -func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(json runtime.JSONAdapter, ctx context.Context, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) +func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(marshaler runtime.Marshaler, ctx context.Context, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {{end}}`, "\n", "", -1))) _ = template.Must(handlerTemplate.New("client-streaming-request-func").Parse(` @@ -139,7 +139,7 @@ func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(json run grpclog.Printf("Failed to start streaming: %v", err) return nil, metadata, err } - dec := json.NewDecoder(req.Body) + dec := marshaler.NewDecoder(req.Body) for { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} err = dec.Decode(&protoReq) @@ -186,7 +186,7 @@ var ( var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} var metadata runtime.ServerMetadata {{if .Body}} - if err := json.NewDecoder(req.Body).Decode(&{{.Body.RHS "protoReq"}}); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&{{.Body.RHS "protoReq"}}); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } {{end}} @@ -279,16 +279,17 @@ func Register{{$svc.GetName}}Handler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(mux.JSONHandler, runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(inboundMarshaler, runtime.AnnotateContext(ctx, req), client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(outboundMarshaler, ctx, w, req, err) return } {{if $m.GetServerStreaming}} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(mux.JSONHandler, ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(outboundMarshaler, ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) {{else}} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(mux.JSONHandler, ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(outboundMarshaler, ctx, w, req, resp, mux.GetForwardResponseOptions()...) {{end}} }) {{end}} diff --git a/runtime/errors.go b/runtime/errors.go index 163fb8b8d62..e6b2e5698f4 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -1,10 +1,11 @@ package runtime import ( - "encoding/json" "io" "net/http" + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -67,22 +68,28 @@ type errorBody struct { Code int `json:"code"` } +//Make this also conform to proto.Message for builtin JSONPb Marshaler +func (e *errorBody) Reset() { *e = errorBody{} } +func (e *errorBody) String() string { return proto.CompactTextString(e) } +func (*errorBody) ProtoMessage() {} + // DefaultHTTPError is the default implementation of HTTPError. // If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode. // If otherwise, it replies with http.StatusInternalServerError. // // The response body returned by this function is a JSON object, // which contains a member whose key is "error" and whose value is err.Error(). -func DefaultHTTPError(ctx context.Context, w http.ResponseWriter, _ *http.Request, err error) { +func DefaultHTTPError(marshaler Marshaler, ctx context.Context, w http.ResponseWriter, _ *http.Request, err error) { const fallback = `{"error": "failed to marshal error message"}` w.Header().Del("Trailer") - w.Header().Set("Content-Type", "application/json") + w.Header().Set("Content-Type", marshaler.ContentType()) body := errorBody{ Error: grpc.ErrorDesc(err), Code: int(grpc.Code(err)), } - buf, merr := json.Marshal(body) + + buf, merr := marshaler.Marshal(body) if merr != nil { grpclog.Printf("Failed to marshal error message %q: %v", body, merr) w.WriteHeader(http.StatusInternalServerError) diff --git a/runtime/handler.go b/runtime/handler.go index ed65184115b..a85e3c651ec 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -17,25 +17,25 @@ type responseStreamChunk struct { Error *responseStreamError `json:"error,omitempty"` } -//Make this also conform to proto.Message for builtin JSONPb JSONAdapter -func (m *responseStreamChunk) Reset() { *m = responseStreamChunk{} } -func (m *responseStreamChunk) String() string { return proto.CompactTextString(m) } -func (*responseStreamChunk) ProtoMessage() {} +//Make this also conform to proto.Message for builtin JSONPb Marshaler +func (m *responseStreamChunk) Reset() { *m = responseStreamChunk{} } +func (m *responseStreamChunk) String() string { return proto.CompactTextString(m) } +func (*responseStreamChunk) ProtoMessage() {} type responseStreamError struct { - GrpcCode int `json:"grpc_code, omitempty"` - HTTPCode int `json:"http_code, omitempty"` - Message string `json:"message, omitempty"` - HTTPStatus string `json:"http_status, omitempty"` + GrpcCode int `json:"grpc_code,omitempty"` + HTTPCode int `json:"http_code,omitempty"` + Message string `json:"message,omitempty"` + HTTPStatus string `json:"http_status,omitempty"` } -//Make this also conform to proto.Message for builtin JSONPb JSONAdapter -func (m *responseStreamError) Reset() { *m = responseStreamError{} } -func (m *responseStreamError) String() string { return proto.CompactTextString(m) } -func (*responseStreamError) ProtoMessage() {} +//Make this also conform to proto.Message for builtin JSONPb Marshaler +func (m *responseStreamError) Reset() { *m = responseStreamError{} } +func (m *responseStreamError) String() string { return proto.CompactTextString(m) } +func (*responseStreamError) ProtoMessage() {} // ForwardResponseStream forwards the stream from gRPC server to REST client. -func ForwardResponseStream(json JSONAdapter, ctx context.Context, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { +func ForwardResponseStream(marshaler Marshaler, ctx context.Context, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { f, ok := w.(http.Flusher) if !ok { grpclog.Printf("Flush not supported in %T", w) @@ -52,7 +52,7 @@ func ForwardResponseStream(json JSONAdapter, ctx context.Context, w http.Respons handleForwardResponseServerMetadata(w, md) w.Header().Set("Transfer-Encoding", "chunked") - w.Header().Set("Content-Type", "application/json") + w.Header().Set("Content-Type", marshaler.ContentType()) if err := handleForwardResponseOptions(ctx, w, nil, opts); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return @@ -65,15 +65,15 @@ func ForwardResponseStream(json JSONAdapter, ctx context.Context, w http.Respons return } if err != nil { - handleForwardResponseStreamError(json,w, err) + handleForwardResponseStreamError(marshaler, w, err) return } if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { - handleForwardResponseStreamError(json,w, err) + handleForwardResponseStreamError(marshaler, w, err) return } - buf, err := json.Marshal(&responseStreamChunk{Result: resp}) + buf, err := marshaler.Marshal(&responseStreamChunk{Result: resp}) if err != nil { grpclog.Printf("Failed to marshal response chunk: %v", err) return @@ -112,7 +112,7 @@ func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) { } // ForwardResponseMessage forwards the message "resp" from gRPC server to REST client. -func ForwardResponseMessage(json JSONAdapter, ctx context.Context, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { +func ForwardResponseMessage(marshaler Marshaler, ctx context.Context, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { md, ok := ServerMetadataFromContext(ctx) if !ok { grpclog.Printf("Failed to extract ServerMetadata from context") @@ -120,16 +120,16 @@ func ForwardResponseMessage(json JSONAdapter, ctx context.Context, w http.Respon handleForwardResponseServerMetadata(w, md) handleForwardResponseTrailerHeader(w, md) - w.Header().Set("Content-Type", "application/json") + w.Header().Set("Content-Type", marshaler.ContentType()) if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { - HTTPError(ctx, w, req, err) + HTTPError(marshaler, ctx, w, req, err) return } - buf, err := json.Marshal(resp) + buf, err := marshaler.Marshal(resp) if err != nil { grpclog.Printf("Marshal error: %v", err) - HTTPError(ctx, w, req, err) + HTTPError(marshaler, ctx, w, req, err) return } @@ -153,7 +153,7 @@ func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, re return nil } -func handleForwardResponseStreamError(json JSONAdapter,w http.ResponseWriter, err error) { +func handleForwardResponseStreamError(marshaler Marshaler, w http.ResponseWriter, err error) { grpcCode := grpc.Code(err) httpCode := HTTPStatusFromCode(grpcCode) resp := &responseStreamChunk{ @@ -163,7 +163,7 @@ func handleForwardResponseStreamError(json JSONAdapter,w http.ResponseWriter, er Message: err.Error(), HTTPStatus: http.StatusText(httpCode), }} - buf, merr := json.Marshal(resp) + buf, merr := marshaler.Marshal(resp) if merr != nil { grpclog.Printf("Failed to marshal an error: %v", merr) return diff --git a/runtime/json.go b/runtime/json.go deleted file mode 100644 index bb9e9b8578f..00000000000 --- a/runtime/json.go +++ /dev/null @@ -1,140 +0,0 @@ -package runtime - -import ( - "errors" - "io" - "bytes" - "encoding/json" - - "github.com/golang/protobuf/jsonpb" - "github.com/golang/protobuf/proto" -) - -type JSONAdapter interface { - Marshal(v interface{}) ([]byte, error) - Unmarshal(data []byte, v interface{}) error - NewDecoder(r io.Reader) JSONDecoderAdapter - NewEncoder(w io.Writer) JSONEncoderAdapter -} - -type JSONDecoderAdapter interface { - Decode(v interface{}) error -} - -type JSONEncoderAdapter interface { - Encode(v interface{}) error -} - -type JSONBuiltin struct { } - -func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) { - return json.Marshal(v) -} - -func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { - return json.Unmarshal(data,v) -} - -func (j *JSONBuiltin) NewDecoder(r io.Reader) JSONDecoderAdapter { - return json.NewDecoder(r) -} - -func (j *JSONBuiltin) NewEncoder(w io.Writer) JSONEncoderAdapter { - return json.NewEncoder(w) -} - - -type JSONPb struct { - // Whether to render enum values as integers, as opposed to string values. - EnumsAsInts bool - - // Whether to render fields with zero values. - EmitDefaults bool - - // A string to indent each level by. The presence of this field will - // also cause a space to appear between the field separator and - // value, and for newlines to be appear between fields and array - // elements. - Indent string - - // Whether to use the original (.proto) name for fields. - OrigName bool -} - -func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { - m := &jsonpb.Marshaler{ - EnumsAsInts:j.EnumsAsInts, - EmitDefaults:j.EmitDefaults, - Indent:j.Indent, - OrigName:j.OrigName, - } - if p, ok := v.(proto.Message); ok { - var buf bytes.Buffer - if err := m.Marshal(&buf, p); err != nil { - return nil, err - } - return buf.Bytes(), nil - } else { - _ = v.(proto.Message) - return nil,errors.New("Interface is not proto.Message") - } - -} - -func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { - r := bytes.NewReader(data) - if p, ok := v.(proto.Message); ok { - return jsonpb.Unmarshal(r,p) - } else { - _ = v.(proto.Message) - return errors.New("Interface is not proto.Message") - } -} - -func (j *JSONPb) NewDecoder(r io.Reader) JSONDecoderAdapter { - return &JSONPbDecoder{decoder:json.NewDecoder(r)} -} - -func (j *JSONPb) NewEncoder(w io.Writer) JSONEncoderAdapter { - m := &jsonpb.Marshaler{ - EnumsAsInts:j.EnumsAsInts, - EmitDefaults:j.EmitDefaults, - Indent:j.Indent, - OrigName:j.OrigName, - } - - - return &JSONPbEncoder{ - marshal:m, - writer:w, - } -} - - - -type JSONPbDecoder struct { - decoder *json.Decoder -} - -func (j *JSONPbDecoder) Decode(v interface{}) error { - if p, ok := v.(proto.Message); ok { - return jsonpb.UnmarshalNext(j.decoder,p) - } else { - _ = v.(proto.Message) - return errors.New("Interface is not proto.Message") - } -} - -type JSONPbEncoder struct { - marshal *jsonpb.Marshaler - writer io.Writer -} - -func (j *JSONPbEncoder) Encode(v interface{}) error { - if p, ok := v.(proto.Message); ok { - return j.marshal.Marshal(j.writer,p) - } else { - _ = v.(proto.Message) - return errors.New("Interface is not proto.Message") - } -} \ No newline at end of file diff --git a/runtime/marshaler.go b/runtime/marshaler.go new file mode 100644 index 00000000000..a2112776526 --- /dev/null +++ b/runtime/marshaler.go @@ -0,0 +1,307 @@ +package runtime + +import ( + "bytes" + "encoding/json" + "errors" + "io" + "net/http" + + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" +) + +const MIMEWILDCARD = "*" + +var inboundDefaultMarshaler = &JSONBuiltin{} +var outboundDefaultMarshaler = &JSONBuiltin{} +var contentTypeHeader = http.CanonicalHeaderKey("Content-Type") + +// Get the inbound/outbound marshalers for this request. Checks the registry on the ServeMux for +// the MIME type set by the Content-Type header. +// If it isn't set (or the request Content-Type is empty), checks for "*". +// If that isn't set, uses the ServerMux's InboundMarshaler/OutboundMarshaler. +// If there are multiple Content-Type headers set, choose the first one that it can +// exactly match in the registry. Otherwise, follows the above logic for "*"/InboundMarshaler/OutboundMarshaler. +func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) { + + inbound = nil + outbound = nil + + headerVals := r.Header[contentTypeHeader] + + for _, val := range headerVals { + if mux.MIMERegistry != nil && mux.MIMERegistry.mimeMap != nil { + if m, ok := mux.MIMERegistry.mimeMap[val]; ok { + if inbound == nil && m.inbound != nil { + inbound = m.inbound + } + if outbound == nil && m.outbound != nil { + outbound = m.outbound + } + } + } else { + //Nil mimeMap, no need to bother checking for MIMEWILDCARD + if mux.InboundMarshaler == nil { + //Its nil, use our default + inbound = inboundDefaultMarshaler + } else { + inbound = mux.InboundMarshaler + } + + if mux.OutboundMarshaler == nil { + //Its nil, use our default + outbound = outboundDefaultMarshaler + } else { + outbound = mux.OutboundMarshaler + } + } + + if inbound != nil && outbound != nil { + //Got them both, return + return inbound, outbound + } + } + + if mux.MIMERegistry != nil && mux.MIMERegistry.mimeMap != nil { + if m, ok := mux.MIMERegistry.mimeMap[MIMEWILDCARD]; ok { + if inbound == nil && m.inbound != nil { + inbound = m.inbound + } + if outbound == nil && m.outbound != nil { + outbound = m.outbound + } + } + } + + //Haven't gotten anywhere with any of the headers or MIMEWILDCARD + //Try to use the mux, otherwise use our default + if inbound == nil { + if mux.InboundMarshaler == nil { + //Its nil, use our default + inbound = inboundDefaultMarshaler + } else { + inbound = mux.InboundMarshaler + } + } + + if outbound == nil { + if mux.OutboundMarshaler == nil { + //Its nil, use our default + outbound = outboundDefaultMarshaler + } else { + outbound = mux.OutboundMarshaler + } + } + + return inbound, outbound + +} + +type MarshalerMIMERegistry struct { + mimeMap map[string]*mimeMarshaler +} + +type mimeMarshaler struct { + inbound Marshaler + outbound Marshaler +} + +// Add an inbound and outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). +// Inbound is the marshaler that is used when marshaling inbound requests from the client. +// Outbound is the marshaler that is used when marshaling outbound responses to the client. +func (m *MarshalerMIMERegistry) AddMarshaler(mime string, inbound Marshaler, outbound Marshaler) { + + if len(mime) == 0 { + panic("Mime can't be an empty string") + } + + m.mimeMap[mime] = &mimeMarshaler{ + inbound: inbound, + outbound: outbound, + } + +} + +// Add an inbound marshaler for a case-sensitive MIME type string ("*" to match any MIME type). +// Inbound is the marshaler that is used when marshaling inbound requests from the client. +func (m *MarshalerMIMERegistry) AddInboundMarshaler(mime string, inbound Marshaler) { + + if len(mime) == 0 { + panic("Mime can't be an empty string") + } + + if _, ok := m.mimeMap[mime]; ok { + //Already have this mime, just change inbound + m.mimeMap[mime].inbound = inbound + } else { + m.mimeMap[mime] = &mimeMarshaler{ + inbound: inbound, + outbound: nil, + } + } + +} + +// Add an outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). +// Outbound is the marshaler that is used when marshaling outbound responses to the client. +func (m *MarshalerMIMERegistry) AddOutboundMarshaler(mime string, outbound Marshaler) { + mime = http.CanonicalHeaderKey(mime) + if len(mime) == 0 { + panic("Mime can't be an empty string") + } + + if _, ok := m.mimeMap[mime]; ok { + //Already have this mime, just change outbound + m.mimeMap[mime].outbound = outbound + } else { + m.mimeMap[mime] = &mimeMarshaler{ + inbound: nil, + outbound: outbound, + } + } + +} + +// Create a new MIME marshaler registry. Allows for a mapping of case-sensitive +// Content-Type MIME type string to runtime.Marshaler interfaces. +// For example, you could allow the client to specify the use of the runtime.JSONPb marshaler +// with a "applicaton/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler +// with a "application/json" Content-Type. +// "*" can be used to match any Content-Type. +// This can be attached to a ServerMux with the MIMERegistry option. +func NewMarshalerMIMERegistry() *MarshalerMIMERegistry { + return &MarshalerMIMERegistry{ + mimeMap: make(map[string]*mimeMarshaler), + } +} + +type Marshaler interface { + Marshal(v interface{}) ([]byte, error) + Unmarshal(data []byte, v interface{}) error + NewDecoder(r io.Reader) Decoder + NewEncoder(w io.Writer) Encoder + ContentType() string +} + +type Decoder interface { + Decode(v interface{}) error +} + +type Encoder interface { + Encode(v interface{}) error +} + +type JSONBuiltin struct{} + +func (*JSONBuiltin) ContentType() string { + return "application/json" +} + +func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) { + return json.Marshal(v) +} + +func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { + return json.Unmarshal(data, v) +} + +func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder { + return json.NewDecoder(r) +} + +func (j *JSONBuiltin) NewEncoder(w io.Writer) Encoder { + return json.NewEncoder(w) +} + +type JSONPb struct { + // Whether to render enum values as integers, as opposed to string values. + EnumsAsInts bool + + // Whether to render fields with zero values. + EmitDefaults bool + + // A string to indent each level by. The presence of this field will + // also cause a space to appear between the field separator and + // value, and for newlines to be appear between fields and array + // elements. + Indent string + + // Whether to use the original (.proto) name for fields. + OrigName bool +} + +func (*JSONPb) ContentType() string { + return "application/json" +} + +func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { + m := &jsonpb.Marshaler{ + EnumsAsInts: j.EnumsAsInts, + EmitDefaults: j.EmitDefaults, + Indent: j.Indent, + OrigName: j.OrigName, + } + if p, ok := v.(proto.Message); ok { + var buf bytes.Buffer + if err := m.Marshal(&buf, p); err != nil { + return nil, err + } + return buf.Bytes(), nil + } else { + return nil, errors.New("Interface is not proto.Message") + } + +} + +func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { + r := bytes.NewReader(data) + if p, ok := v.(proto.Message); ok { + return jsonpb.Unmarshal(r, p) + } else { + return errors.New("Interface is not proto.Message") + } +} + +func (j *JSONPb) NewDecoder(r io.Reader) Decoder { + return &JSONPbDecoder{decoder: json.NewDecoder(r)} +} + +func (j *JSONPb) NewEncoder(w io.Writer) Encoder { + m := &jsonpb.Marshaler{ + EnumsAsInts: j.EnumsAsInts, + EmitDefaults: j.EmitDefaults, + Indent: j.Indent, + OrigName: j.OrigName, + } + + return &JSONPbEncoder{ + marshal: m, + writer: w, + } +} + +type JSONPbDecoder struct { + decoder *json.Decoder +} + +func (j *JSONPbDecoder) Decode(v interface{}) error { + if p, ok := v.(proto.Message); ok { + return jsonpb.UnmarshalNext(j.decoder, p) + } else { + return errors.New("Interface is not proto.Message") + } +} + +type JSONPbEncoder struct { + marshal *jsonpb.Marshaler + writer io.Writer +} + +func (j *JSONPbEncoder) Encode(v interface{}) error { + if p, ok := v.(proto.Message); ok { + return j.marshal.Marshal(j.writer, p) + } else { + return errors.New("Interface is not proto.Message") + } +} diff --git a/runtime/mux.go b/runtime/mux.go index ab1ad7071fe..943c8916122 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -18,7 +18,13 @@ type ServeMux struct { // handlers maps HTTP method to a list of handlers. handlers map[string][]handler forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error - JSONHandler JSONAdapter + // InboundMarshaler is the marshaler that is used when marshaling inbound requests from + // a client. Defaults to runtime.JSONBuiltin + InboundMarshaler Marshaler + // OutbutMarshaler is the marshaler that is used when marshaling outbound responses to + // a client. Defaults to runtime.JSONBuiltin + OutboundMarshaler Marshaler + MIMERegistry *MarshalerMIMERegistry } // ServeMuxOption is an option that can be given to a ServeMux on construction. @@ -36,15 +42,16 @@ func WithForwardResponseOption(forwardResponseOption func(context.Context, http. } } -// NewServeMux returns a new MuxHandler whose internal mapping is empty. +// NewServeMux returns a new ServeMux whose internal mapping is empty. func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ handlers: make(map[string][]handler), forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), + InboundMarshaler: &JSONBuiltin{}, + OutboundMarshaler: &JSONBuiltin{}, + MIMERegistry: nil, } - - serveMux.JSONHandler = &JSONBuiltin{} - + for _, opt := range opts { opt(serveMux) } From 0d9a288cbc4eaf0f3f745032a64df145f78b6b9f Mon Sep 17 00:00:00 2001 From: William King Date: Mon, 18 Apr 2016 21:51:24 -0700 Subject: [PATCH 018/552] Fix error handling --- runtime/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/errors.go b/runtime/errors.go index e6b2e5698f4..1b88396d3a7 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -84,7 +84,7 @@ func DefaultHTTPError(marshaler Marshaler, ctx context.Context, w http.ResponseW w.Header().Del("Trailer") w.Header().Set("Content-Type", marshaler.ContentType()) - body := errorBody{ + body := &errorBody{ Error: grpc.ErrorDesc(err), Code: int(grpc.Code(err)), } From 9a9e13516e02ad59e0af0132b7b02ba5d491934d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sat, 7 May 2016 23:05:12 +0100 Subject: [PATCH 019/552] Title used a bit less often, which is important for swaggerSchemaObject. --- .../streamless_everything.swagger.json | 2 +- protoc-gen-swagger/genswagger/template.go | 27 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index 664d99557e9..46c92c4bd73 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -426,7 +426,7 @@ "uint32_value": { "type": "integer", "format": "int64", - "description": "TODO(yugui) add bytes_value" + "title": "TODO(yugui) add bytes_value" }, "uint64_value": { "type": "integer", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 0470199d256..538376cd6de 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -558,13 +558,18 @@ func applyTemplate(p param) (string, error) { // will be updated instead. (JSON always gets applied directly to the passed // object.) // -// If there is no 'Summary', the same behavior will be attempted on 'Title'. +// If there is no 'Summary', the same behavior will be attempted on 'Title', +// but only if the last character is not a period. // // To apply additional Swagger properties, one can pass valid JSON as described // before. This JSON gets parsed and applied to the passed swaggerObject // directly. This lets users easily apply custom properties such as contact // details, API base path, et al. func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) error { + if len(comment) == 0 { + return nil + } + // Find a section containing additional Swagger metadata. matches := swaggerExtrasRegexp.FindStringSubmatch(comment) @@ -597,8 +602,10 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er // Figure out which properties to update. summaryValue := infoObjectValue.FieldByName("Summary") descriptionValue := infoObjectValue.FieldByName("Description") + usingTitle := false if !summaryValue.CanSet() { summaryValue = infoObjectValue.FieldByName("Title") + usingTitle = true } // If there is a summary (or summary-equivalent), use the first @@ -608,16 +615,18 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er summary := strings.TrimSpace(paragraphs[0]) description := strings.TrimSpace(strings.Join(paragraphs[1:], "\n\n")) - if len(summary) > 0 { - summaryValue.Set(reflect.ValueOf(summary)) - } - if len(description) > 0 { - if !descriptionValue.CanSet() { - return fmt.Errorf("Object that has Summary but no Description?") + if !usingTitle || summary[len(summary)-1] != '.' { + if len(summary) > 0 { + summaryValue.Set(reflect.ValueOf(summary)) } - descriptionValue.Set(reflect.ValueOf(description)) + if len(description) > 0 { + if !descriptionValue.CanSet() { + return fmt.Errorf("Encountered object type with a summary, but no description") + } + descriptionValue.Set(reflect.ValueOf(description)) + } + return nil } - return nil } // There was no summary field on the swaggerObject. Try to apply the From 5f52c5dbec7ec170ec573cc1f98ec5ce446ab0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sat, 7 May 2016 23:09:54 +0100 Subject: [PATCH 020/552] Backing out 'swagger extras' JSON code, per [request][1]. [1]: https://github.com/gengo/grpc-gateway/pull/134#issuecomment-217670498 --- examples/examplepb/echo_service.pb.go | 46 -------------------- examples/examplepb/echo_service.proto | 37 ---------------- examples/examplepb/echo_service.swagger.json | 14 +----- protoc-gen-swagger/genswagger/template.go | 39 +---------------- 4 files changed, 3 insertions(+), 133 deletions(-) diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index d191846eaec..fb676c649f4 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -10,25 +10,6 @@ Echo Service Echo Service API consists of a single service which returns a message. - - It is generated from these files: examples/examplepb/echo_service.proto examples/examplepb/a_bit_of_everything.proto @@ -66,15 +47,6 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion1 // SimpleMessage represents a simple message sent to the Echo service. -// -// type SimpleMessage struct { // Id represents the message identifier. Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` @@ -104,15 +76,6 @@ type EchoServiceClient interface { // // The message posted as the id parameter will also be // returned. - // - // Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) // EchoBody method receives a simple message and returns it. EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) @@ -151,15 +114,6 @@ type EchoServiceServer interface { // // The message posted as the id parameter will also be // returned. - // - // Echo(context.Context, *SimpleMessage) (*SimpleMessage, error) // EchoBody method receives a simple message and returns it. EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error) diff --git a/examples/examplepb/echo_service.proto b/examples/examplepb/echo_service.proto index 4baeddad06c..0573f29f052 100644 --- a/examples/examplepb/echo_service.proto +++ b/examples/examplepb/echo_service.proto @@ -5,39 +5,11 @@ option go_package = "examplepb"; // // Echo Service API consists of a single service which returns // a message. -// -// package gengo.grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; // SimpleMessage represents a simple message sent to the Echo service. -// -// message SimpleMessage { // Id represents the message identifier. string id = 1; @@ -49,15 +21,6 @@ service EchoService { // // The message posted as the id parameter will also be // returned. - // - // rpc Echo(SimpleMessage) returns (SimpleMessage) { option (google.api.http) = { post: "/v1/example/echo/{id}" diff --git a/examples/examplepb/echo_service.swagger.json b/examples/examplepb/echo_service.swagger.json index dbc9ece0833..94e1abde9ac 100644 --- a/examples/examplepb/echo_service.swagger.json +++ b/examples/examplepb/echo_service.swagger.json @@ -3,14 +3,8 @@ "info": { "title": "Echo Service", "description": "Echo Service API consists of a single service which returns\na message.", - "version": "1.0", - "contact": { - "name": "gRPC-Gateway project", - "url": "https://github.com/gengo/grpc-gateway", - "email": "none@example.com" - } + "version": "version not set" }, - "host": "localhost", "schemes": [ "http", "https" @@ -46,11 +40,7 @@ ], "tags": [ "EchoService" - ], - "externalDocs": { - "description": "Find out more about EchoService", - "url": "http://github.com/gengo/grpc-gateway" - } + ] } }, "/v1/example/echo_body": { diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 538376cd6de..88cb584715a 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -13,8 +13,6 @@ import ( pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" ) -var swaggerExtrasRegexp = regexp.MustCompile(`(?s)^(.*[^\s])[\s]*[\s]*(.*)$`) - // findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service. func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, e enumMap) { for _, svc := range s { @@ -541,55 +539,20 @@ func applyTemplate(p param) (string, error) { // updateSwaggerDataFromComments updates a Swagger object based on a comment // from the proto file. // -// As a first step, a section matching: -// -// -// -// where .* contains valid JSON will be stored for later processing, and then -// removed from the passed string. -// (Implementation note: Currently, the JSON gets immediately applied and -// thus cannot override summary and description.) -// // First paragraph of a comment is used for summary. Remaining paragraphs of a // comment are used for description. If 'Summary' field is not present on the // passed swaggerObject, the summary and description are joined by \n\n. // // If there is a field named 'Info', its 'Summary' and 'Description' fields -// will be updated instead. (JSON always gets applied directly to the passed -// object.) +// will be updated instead. // // If there is no 'Summary', the same behavior will be attempted on 'Title', // but only if the last character is not a period. -// -// To apply additional Swagger properties, one can pass valid JSON as described -// before. This JSON gets parsed and applied to the passed swaggerObject -// directly. This lets users easily apply custom properties such as contact -// details, API base path, et al. func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) error { if len(comment) == 0 { return nil } - // Find a section containing additional Swagger metadata. - matches := swaggerExtrasRegexp.FindStringSubmatch(comment) - - if len(matches) > 0 { - // If found, before further processing, replace the - // comment with a version that does not contain the - // extras. - comment = matches[1] - if len(matches[3]) > 0 { - comment += "\n\n" + matches[3] - } - - // Parse the JSON and apply it. - // TODO(ivucica): apply extras /after/ applying summary - // and description. - if err := json.Unmarshal([]byte(matches[2]), swaggerObject); err != nil { - return fmt.Errorf("error: %s, parsing: %s", err.Error(), matches[2]) - } - } - // Figure out what to apply changes to. swaggerObjectValue := reflect.ValueOf(swaggerObject) infoObjectValue := swaggerObjectValue.Elem().FieldByName("Info") From 8a35060fe80ef0ec6a210ddd3e272295d3d313e3 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sat, 7 May 2016 15:30:20 -0700 Subject: [PATCH 021/552] Move marshaler to second parameter, update tests. --- examples/examplepb/a_bit_of_everything.pb.go | 98 +++++-- .../examplepb/a_bit_of_everything.pb.gw.go | 111 ++++---- examples/examplepb/echo_service.pb.go | 34 ++- examples/examplepb/echo_service.pb.gw.go | 22 +- examples/examplepb/flow_combination.pb.go | 66 +++-- examples/examplepb/flow_combination.pb.gw.go | 264 ++++++++++-------- .../descriptor/types_test.go | 2 +- .../gengateway/template.go | 12 +- .../gengateway/template_test.go | 12 +- runtime/errors.go | 2 +- runtime/errors_test.go | 2 +- runtime/handler.go | 8 +- 12 files changed, 369 insertions(+), 264 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 18b174ac92f..21b8e96c92c 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -132,7 +132,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for ABitOfEverythingService service @@ -325,28 +325,40 @@ func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingS s.RegisterService(&_ABitOfEverythingService_serviceDesc, srv) } -func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Create(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Create(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Create(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_BulkCreate_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -375,16 +387,22 @@ func (x *aBitOfEverythingServiceBulkCreateServer) Recv() (*ABitOfEverything, err return m, nil } -func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Lookup(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Lookup(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Lookup(ctx, req.(*sub2.IdMessage)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_List_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -408,40 +426,58 @@ 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) (interface{}, error) { +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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Update(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Update(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Update(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Delete_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 { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Delete(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Delete(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Delete(ctx, req.(*sub2.IdMessage)) + } + return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(gengo_grpc_gateway_examples_sub.StringMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(ABitOfEverythingServiceServer).Echo(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Echo(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Echo(ctx, req.(*gengo_grpc_gateway_examples_sub.StringMessage)) + } + return interceptor(ctx, in, info, handler) } func _ABitOfEverythingService_BulkEcho_Handler(srv interface{}, stream grpc.ServerStream) error { diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index f6f214bfb5d..5c07e4c0782 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -10,7 +10,6 @@ It translates gRPC into RESTful JSON APIs. package examplepb import ( - "encoding/json" "io" "net/http" @@ -28,14 +27,13 @@ import ( var _ codes.Code var _ io.Reader var _ = runtime.String -var _ = json.Marshal var _ = utilities.NewDoubleArray var ( filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}} ) -func request_ABitOfEverythingService_Create_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_ABitOfEverythingService_Create_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 @@ -209,11 +207,11 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, client ABitOf } -func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_ABitOfEverythingService_CreateBody_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 - if err := json.NewDecoder(req.Body).Decode(&protoReq); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -222,14 +220,14 @@ func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, client AB } -func request_ABitOfEverythingService_BulkCreate_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +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 := json.NewDecoder(req.Body) + dec := marshaler.NewDecoder(req.Body) for { var protoReq ABitOfEverything err = dec.Decode(&protoReq) @@ -263,7 +261,7 @@ func request_ABitOfEverythingService_BulkCreate_0(ctx context.Context, client AB } -func request_ABitOfEverythingService_Lookup_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +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 @@ -290,7 +288,7 @@ func request_ABitOfEverythingService_Lookup_0(ctx context.Context, client ABitOf } -func request_ABitOfEverythingService_List_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (ABitOfEverythingService_ListClient, runtime.ServerMetadata, error) { +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 @@ -307,11 +305,11 @@ func request_ABitOfEverythingService_List_0(ctx context.Context, client ABitOfEv } -func request_ABitOfEverythingService_Update_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +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 - if err := json.NewDecoder(req.Body).Decode(&protoReq); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -338,7 +336,7 @@ func request_ABitOfEverythingService_Update_0(ctx context.Context, client ABitOf } -func request_ABitOfEverythingService_Delete_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_ABitOfEverythingService_Delete_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 @@ -365,7 +363,7 @@ func request_ABitOfEverythingService_Delete_0(ctx context.Context, client ABitOf } -func request_ABitOfEverythingService_Echo_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub.StringMessage var metadata runtime.ServerMetadata @@ -392,11 +390,11 @@ func request_ABitOfEverythingService_Echo_0(ctx context.Context, client ABitOfEv } -func request_ABitOfEverythingService_Echo_1(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub.StringMessage var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.Value); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Value); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -409,7 +407,7 @@ var ( filter_ABitOfEverythingService_Echo_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_ABitOfEverythingService_Echo_2(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub.StringMessage var metadata runtime.ServerMetadata @@ -422,14 +420,14 @@ func request_ABitOfEverythingService_Echo_2(ctx context.Context, client ABitOfEv } -func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (ABitOfEverythingService_BulkEchoClient, runtime.ServerMetadata, error) { +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 := json.NewDecoder(req.Body) + dec := marshaler.NewDecoder(req.Body) for { var protoReq sub.StringMessage err = dec.Decode(&protoReq) @@ -503,14 +501,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_Create_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_Create_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Create_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Create_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -526,14 +525,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_CreateBody_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_CreateBody_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_CreateBody_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_CreateBody_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -549,14 +549,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_BulkCreate_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_BulkCreate_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_BulkCreate_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_BulkCreate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -572,14 +573,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_Lookup_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_Lookup_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Lookup_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Lookup_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -595,14 +597,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_List_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_List_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_List_0(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_List_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -618,14 +621,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_Update_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_Update_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Update_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Update_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -641,14 +645,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_Delete_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_Delete_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Delete_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Delete_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -664,14 +669,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_Echo_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_Echo_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Echo_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Echo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -687,14 +693,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_Echo_1(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_Echo_1(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Echo_1(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Echo_1(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -710,14 +717,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_Echo_2(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_Echo_2(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Echo_2(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Echo_2(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -733,14 +741,15 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_ABitOfEverythingService_BulkEcho_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_BulkEcho_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_BulkEcho_0(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_BulkEcho_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 76cd1d1250c..4c78cacd2b6 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -60,7 +60,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for EchoService service @@ -106,28 +106,40 @@ func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer) { s.RegisterService(&_EchoService_serviceDesc, srv) } -func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(EchoServiceServer).Echo(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(EchoServiceServer).Echo(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.EchoService/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EchoServiceServer).Echo(ctx, req.(*SimpleMessage)) + } + return interceptor(ctx, in, info, handler) } -func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SimpleMessage) if err := dec(in); err != nil { return nil, err } - out, err := srv.(EchoServiceServer).EchoBody(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(EchoServiceServer).EchoBody(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.EchoService/EchoBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EchoServiceServer).EchoBody(ctx, req.(*SimpleMessage)) + } + return interceptor(ctx, in, info, handler) } var _EchoService_serviceDesc = grpc.ServiceDesc{ diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 6ab992ad9f8..6cb8c55cc3c 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -10,7 +10,6 @@ It translates gRPC into RESTful JSON APIs. package examplepb import ( - "encoding/json" "io" "net/http" @@ -26,10 +25,9 @@ import ( var _ codes.Code var _ io.Reader var _ = runtime.String -var _ = json.Marshal var _ = utilities.NewDoubleArray -func request_EchoService_Echo_0(ctx context.Context, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata @@ -56,11 +54,11 @@ func request_EchoService_Echo_0(ctx context.Context, client EchoServiceClient, r } -func request_EchoService_EchoBody_0(ctx context.Context, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -111,14 +109,15 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_EchoService_Echo_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_EchoService_Echo_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_EchoService_Echo_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_EchoService_Echo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -134,14 +133,15 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_EchoService_EchoBody_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_EchoService_EchoBody_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_EchoService_EchoBody_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_EchoService_EchoBody_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 40606b6eb0d..345f7ed5a8a 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -95,7 +95,7 @@ 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.SupportPackageIsVersion1 +const _ = grpc.SupportPackageIsVersion2 // Client API for FlowCombination service @@ -368,16 +368,22 @@ func RegisterFlowCombinationServer(s *grpc.Server, srv FlowCombinationServer) { s.RegisterService(&_FlowCombination_serviceDesc, srv) } -func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(EmptyProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, req.(*EmptyProto)) + } + return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcEmptyStream_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -453,40 +459,58 @@ func (x *flowCombinationStreamEmptyStreamServer) Recv() (*EmptyProto, error) { return m, nil } -func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NonEmptyProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcBodyRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcBodyRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcBodyRpc(ctx, req.(*NonEmptyProto)) + } + return interceptor(ctx, in, info, handler) } -func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SingleNestedProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, req.(*SingleNestedProto)) + } + return interceptor(ctx, in, info, handler) } -func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NestedProto) if err := dec(in); err != nil { return nil, err } - out, err := srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, req.(*NestedProto)) + } + return interceptor(ctx, in, info, handler) } func _FlowCombination_RpcBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error { diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 6230e23a50d..8b575104f05 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -10,7 +10,6 @@ It translates gRPC into RESTful JSON APIs. package examplepb import ( - "encoding/json" "io" "net/http" @@ -26,10 +25,9 @@ import ( var _ codes.Code var _ io.Reader var _ = runtime.String -var _ = json.Marshal var _ = utilities.NewDoubleArray -func request_FlowCombination_RpcEmptyRpc_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq EmptyProto var metadata runtime.ServerMetadata @@ -38,7 +36,7 @@ func request_FlowCombination_RpcEmptyRpc_0(ctx context.Context, client FlowCombi } -func request_FlowCombination_RpcEmptyStream_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcEmptyStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcEmptyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcEmptyStreamClient, runtime.ServerMetadata, error) { var protoReq EmptyProto var metadata runtime.ServerMetadata @@ -55,14 +53,14 @@ func request_FlowCombination_RpcEmptyStream_0(ctx context.Context, client FlowCo } -func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var metadata runtime.ServerMetadata stream, err := client.StreamEmptyRpc(ctx) if err != nil { grpclog.Printf("Failed to start streaming: %v", err) return nil, metadata, err } - dec := json.NewDecoder(req.Body) + dec := marshaler.NewDecoder(req.Body) for { var protoReq EmptyProto err = dec.Decode(&protoReq) @@ -96,14 +94,14 @@ func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, client FlowCo } -func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_StreamEmptyStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_StreamEmptyStreamClient, runtime.ServerMetadata, error) { var metadata runtime.ServerMetadata stream, err := client.StreamEmptyStream(ctx) if err != nil { grpclog.Printf("Failed to start streaming: %v", err) return nil, metadata, err } - dec := json.NewDecoder(req.Body) + dec := marshaler.NewDecoder(req.Body) for { var protoReq EmptyProto err = dec.Decode(&protoReq) @@ -135,11 +133,11 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, client Flo } -func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -148,7 +146,7 @@ func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, client FlowCombin } -func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -201,7 +199,7 @@ var ( filter_FlowCombination_RpcBodyRpc_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_FlowCombination_RpcBodyRpc_2(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyRpc_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -214,11 +212,11 @@ func request_FlowCombination_RpcBodyRpc_2(ctx context.Context, client FlowCombin } -func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -260,11 +258,11 @@ var ( filter_FlowCombination_RpcBodyRpc_4 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_FlowCombination_RpcBodyRpc_4(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyRpc_4(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -281,11 +279,11 @@ var ( filter_FlowCombination_RpcBodyRpc_5 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) -func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -320,7 +318,7 @@ var ( filter_FlowCombination_RpcBodyRpc_6 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_FlowCombination_RpcBodyRpc_6(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyRpc_6(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -355,7 +353,7 @@ var ( filter_FlowCombination_RpcPathSingleNestedRpc_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) -func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SingleNestedProto var metadata runtime.ServerMetadata @@ -390,11 +388,11 @@ var ( filter_FlowCombination_RpcPathNestedRpc_0 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2, "b": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 3, 1, 2, 4, 5}} ) -func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -440,7 +438,7 @@ var ( filter_FlowCombination_RpcPathNestedRpc_1 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) -func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata @@ -475,11 +473,11 @@ var ( filter_FlowCombination_RpcPathNestedRpc_2 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 3, 2, 4}} ) -func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -510,11 +508,11 @@ func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, client Flow } -func request_FlowCombination_RpcBodyStream_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -531,7 +529,7 @@ func request_FlowCombination_RpcBodyStream_0(ctx context.Context, client FlowCom } -func request_FlowCombination_RpcBodyStream_1(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -592,7 +590,7 @@ var ( filter_FlowCombination_RpcBodyStream_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_FlowCombination_RpcBodyStream_2(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyStream_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -613,11 +611,11 @@ func request_FlowCombination_RpcBodyStream_2(ctx context.Context, client FlowCom } -func request_FlowCombination_RpcBodyStream_3(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -667,11 +665,11 @@ var ( filter_FlowCombination_RpcBodyStream_4 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_FlowCombination_RpcBodyStream_4(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyStream_4(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -696,11 +694,11 @@ var ( filter_FlowCombination_RpcBodyStream_5 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) -func request_FlowCombination_RpcBodyStream_5(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -743,7 +741,7 @@ var ( filter_FlowCombination_RpcBodyStream_6 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_FlowCombination_RpcBodyStream_6(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcBodyStream_6(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -786,7 +784,7 @@ var ( filter_FlowCombination_RpcPathSingleNestedStream_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) -func request_FlowCombination_RpcPathSingleNestedStream_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathSingleNestedStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcPathSingleNestedStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathSingleNestedStreamClient, runtime.ServerMetadata, error) { var protoReq SingleNestedProto var metadata runtime.ServerMetadata @@ -829,11 +827,11 @@ var ( filter_FlowCombination_RpcPathNestedStream_0 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2, "b": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 3, 1, 2, 4, 5}} ) -func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -887,7 +885,7 @@ var ( filter_FlowCombination_RpcPathNestedStream_1 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) -func request_FlowCombination_RpcPathNestedStream_1(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcPathNestedStream_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata @@ -930,11 +928,11 @@ var ( filter_FlowCombination_RpcPathNestedStream_2 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 3, 2, 4}} ) -func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata - if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -1015,14 +1013,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcEmptyRpc_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcEmptyRpc_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcEmptyRpc_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcEmptyRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1038,14 +1037,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcEmptyStream_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcEmptyStream_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcEmptyStream_0(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcEmptyStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1061,14 +1061,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_StreamEmptyRpc_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_StreamEmptyRpc_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_StreamEmptyRpc_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_StreamEmptyRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1084,14 +1085,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_StreamEmptyStream_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_StreamEmptyStream_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_StreamEmptyStream_0(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_StreamEmptyStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1107,14 +1109,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyRpc_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyRpc_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1130,14 +1133,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyRpc_1(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyRpc_1(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_1(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_1(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1153,14 +1157,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyRpc_2(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyRpc_2(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_2(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_2(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1176,14 +1181,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyRpc_3(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyRpc_3(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_3(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_3(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1199,14 +1205,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyRpc_4(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyRpc_4(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_4(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_4(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1222,14 +1229,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyRpc_5(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyRpc_5(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_5(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_5(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1245,14 +1253,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyRpc_6(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyRpc_6(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_6(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_6(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1268,14 +1277,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcPathSingleNestedRpc_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcPathSingleNestedRpc_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathSingleNestedRpc_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathSingleNestedRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1291,14 +1301,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcPathNestedRpc_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcPathNestedRpc_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedRpc_0(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1314,14 +1325,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcPathNestedRpc_1(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcPathNestedRpc_1(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedRpc_1(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedRpc_1(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1337,14 +1349,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcPathNestedRpc_2(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcPathNestedRpc_2(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedRpc_2(ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedRpc_2(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1360,14 +1373,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyStream_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyStream_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_0(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1383,14 +1397,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyStream_1(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyStream_1(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_1(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_1(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1406,14 +1421,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyStream_2(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyStream_2(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_2(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_2(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1429,14 +1445,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyStream_3(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyStream_3(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_3(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_3(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1452,14 +1469,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyStream_4(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyStream_4(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_4(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_4(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1475,14 +1493,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyStream_5(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyStream_5(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_5(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_5(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1498,14 +1517,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcBodyStream_6(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcBodyStream_6(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_6(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_6(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1521,14 +1541,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcPathSingleNestedStream_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcPathSingleNestedStream_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathSingleNestedStream_0(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathSingleNestedStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1544,14 +1565,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcPathNestedStream_0(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcPathNestedStream_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedStream_0(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1567,14 +1589,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcPathNestedStream_1(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcPathNestedStream_1(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedStream_1(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedStream_1(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1590,14 +1613,15 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, } }(ctx.Done(), cn.CloseNotify()) } - resp, md, err := request_FlowCombination_RpcPathNestedStream_2(runtime.AnnotateContext(ctx, req), client, req, pathParams) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_FlowCombination_RpcPathNestedStream_2(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedStream_2(ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedStream_2(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) diff --git a/protoc-gen-grpc-gateway/descriptor/types_test.go b/protoc-gen-grpc-gateway/descriptor/types_test.go index bf57cfe0ceb..4b7caea6f3d 100644 --- a/protoc-gen-grpc-gateway/descriptor/types_test.go +++ b/protoc-gen-grpc-gateway/descriptor/types_test.go @@ -22,7 +22,7 @@ func TestGoPackageStandard(t *testing.T) { }, { pkg: GoPackage{Path: "github.com/golang/protobuf/jsonpb", Name: "jsonpb"}, - want: true, + want: false, }, { pkg: GoPackage{Path: "golang.org/x/net/context", Name: "context"}, diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index b7e70d75d5b..416c8c4e6cc 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -126,9 +126,9 @@ var _ = utilities.NewDoubleArray _ = template.Must(handlerTemplate.New("request-func-signature").Parse(strings.Replace(` {{if .Method.GetServerStreaming}} -func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(marshaler runtime.Marshaler, ctx context.Context, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) ({{.Method.Service.GetName}}_{{.Method.GetName}}Client, runtime.ServerMetadata, error) +func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, marshaler runtime.Marshaler, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) ({{.Method.Service.GetName}}_{{.Method.GetName}}Client, runtime.ServerMetadata, error) {{else}} -func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(marshaler runtime.Marshaler, ctx context.Context, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) +func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, marshaler runtime.Marshaler, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {{end}}`, "\n", "", -1))) _ = template.Must(handlerTemplate.New("client-streaming-request-func").Parse(` @@ -280,16 +280,16 @@ func Register{{$svc.GetName}}Handler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(inboundMarshaler, runtime.AnnotateContext(ctx, req), client, req, pathParams) + resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(outboundMarshaler, ctx, w, req, err) + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) return } {{if $m.GetServerStreaming}} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(outboundMarshaler, ctx, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) {{else}} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(outboundMarshaler, ctx, w, req, resp, mux.GetForwardResponseOptions()...) + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) {{end}} }) {{end}} diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index c53d51e0eeb..cfad4312fee 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -133,11 +133,11 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { }{ { serverStreaming: false, - sigWant: `func request_ExampleService_Echo_0(ctx context.Context, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {`, + sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {`, }, { serverStreaming: true, - sigWant: `func request_ExampleService_Echo_0(ctx context.Context, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (ExampleService_EchoClient, runtime.ServerMetadata, error) {`, + sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (ExampleService_EchoClient, runtime.ServerMetadata, error) {`, }, } { meth.ServerStreaming = proto.Bool(spec.serverStreaming) @@ -230,7 +230,7 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { if want := spec.sigWant; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `json.NewDecoder(req.Body).Decode(&protoReq.GetNested().Bool)`; !strings.Contains(got, want) { + if want := `marshaler.NewDecoder(req.Body).Decode(&protoReq.GetNested().Bool)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `val, ok = pathParams["nested.int32"]`; !strings.Contains(got, want) { @@ -294,11 +294,11 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { }{ { serverStreaming: false, - sigWant: `func request_ExampleService_Echo_0(ctx context.Context, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {`, + sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {`, }, { serverStreaming: true, - sigWant: `func request_ExampleService_Echo_0(ctx context.Context, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (ExampleService_EchoClient, runtime.ServerMetadata, error) {`, + sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (ExampleService_EchoClient, runtime.ServerMetadata, error) {`, }, } { meth.ServerStreaming = proto.Bool(spec.serverStreaming) @@ -391,7 +391,7 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { if want := spec.sigWant; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `json.NewDecoder(req.Body)`; !strings.Contains(got, want) { + if want := `marshaler.NewDecoder(req.Body)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { diff --git a/runtime/errors.go b/runtime/errors.go index 1b88396d3a7..4d19b645607 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -79,7 +79,7 @@ func (*errorBody) ProtoMessage() {} // // The response body returned by this function is a JSON object, // which contains a member whose key is "error" and whose value is err.Error(). -func DefaultHTTPError(marshaler Marshaler, ctx context.Context, w http.ResponseWriter, _ *http.Request, err error) { +func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) { const fallback = `{"error": "failed to marshal error message"}` w.Header().Del("Trailer") diff --git a/runtime/errors_test.go b/runtime/errors_test.go index 9f5022aa3c9..3cc9acfde35 100644 --- a/runtime/errors_test.go +++ b/runtime/errors_test.go @@ -35,7 +35,7 @@ func TestDefaultHTTPError(t *testing.T) { } { w := httptest.NewRecorder() req, _ := http.NewRequest("", "", nil) // Pass in an empty request to match the signature - runtime.DefaultHTTPError(ctx, w, req, spec.err) + runtime.DefaultHTTPError(ctx, &runtime.JSONBuiltin{}, w, req, spec.err) if got, want := w.Header().Get("Content-Type"), "application/json"; got != want { t.Errorf(`w.Header().Get("Content-Type") = %q; want %q; on spec.err=%v`, got, want, spec.err) diff --git a/runtime/handler.go b/runtime/handler.go index a85e3c651ec..ca113bc7c29 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -35,7 +35,7 @@ func (m *responseStreamError) String() string { return proto.CompactTextString(m func (*responseStreamError) ProtoMessage() {} // ForwardResponseStream forwards the stream from gRPC server to REST client. -func ForwardResponseStream(marshaler Marshaler, ctx context.Context, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { +func ForwardResponseStream(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { f, ok := w.(http.Flusher) if !ok { grpclog.Printf("Flush not supported in %T", w) @@ -112,7 +112,7 @@ func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) { } // ForwardResponseMessage forwards the message "resp" from gRPC server to REST client. -func ForwardResponseMessage(marshaler Marshaler, ctx context.Context, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { +func ForwardResponseMessage(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { md, ok := ServerMetadataFromContext(ctx) if !ok { grpclog.Printf("Failed to extract ServerMetadata from context") @@ -122,14 +122,14 @@ func ForwardResponseMessage(marshaler Marshaler, ctx context.Context, w http.Res handleForwardResponseTrailerHeader(w, md) w.Header().Set("Content-Type", marshaler.ContentType()) if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { - HTTPError(marshaler, ctx, w, req, err) + HTTPError(ctx, marshaler, w, req, err) return } buf, err := marshaler.Marshal(resp) if err != nil { grpclog.Printf("Marshal error: %v", err) - HTTPError(marshaler, ctx, w, req, err) + HTTPError(ctx, marshaler, w, req, err) return } From fca52a7c4cfbfa840ceb07d22c68010ef95e32c4 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 9 May 2016 11:29:48 +0900 Subject: [PATCH 022/552] Fix style and lint errors --- runtime/marshaler.go | 124 ++++++++++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 44 deletions(-) diff --git a/runtime/marshaler.go b/runtime/marshaler.go index a2112776526..b250d33ec03 100644 --- a/runtime/marshaler.go +++ b/runtime/marshaler.go @@ -11,23 +11,25 @@ import ( "github.com/golang/protobuf/proto" ) -const MIMEWILDCARD = "*" +const mimeWildcard = "*" -var inboundDefaultMarshaler = &JSONBuiltin{} -var outboundDefaultMarshaler = &JSONBuiltin{} -var contentTypeHeader = http.CanonicalHeaderKey("Content-Type") +var ( + inboundDefaultMarshaler = new(JSONBuiltin) + outboundDefaultMarshaler = new(JSONBuiltin) -// Get the inbound/outbound marshalers for this request. Checks the registry on the ServeMux for -// the MIME type set by the Content-Type header. + contentTypeHeader = http.CanonicalHeaderKey("Content-Type") +) + +// MarshalerForRequest returns the inbound/outbound marshalers for this request. +// It checks the registry on the ServeMux for the MIME type set by the Content-Type header. // If it isn't set (or the request Content-Type is empty), checks for "*". // If that isn't set, uses the ServerMux's InboundMarshaler/OutboundMarshaler. // If there are multiple Content-Type headers set, choose the first one that it can -// exactly match in the registry. Otherwise, follows the above logic for "*"/InboundMarshaler/OutboundMarshaler. +// exactly match in the registry. +// Otherwise, it follows the above logic for "*"/InboundMarshaler/OutboundMarshaler. func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) { - inbound = nil outbound = nil - headerVals := r.Header[contentTypeHeader] for _, val := range headerVals { @@ -41,7 +43,7 @@ func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, out } } } else { - //Nil mimeMap, no need to bother checking for MIMEWILDCARD + //Nil mimeMap, no need to bother checking for mimeWildcard if mux.InboundMarshaler == nil { //Its nil, use our default inbound = inboundDefaultMarshaler @@ -64,7 +66,7 @@ func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, out } if mux.MIMERegistry != nil && mux.MIMERegistry.mimeMap != nil { - if m, ok := mux.MIMERegistry.mimeMap[MIMEWILDCARD]; ok { + if m, ok := mux.MIMERegistry.mimeMap[mimeWildcard]; ok { if inbound == nil && m.inbound != nil { inbound = m.inbound } @@ -74,7 +76,7 @@ func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, out } } - //Haven't gotten anywhere with any of the headers or MIMEWILDCARD + //Haven't gotten anywhere with any of the headers or mimeWildcard //Try to use the mux, otherwise use our default if inbound == nil { if mux.InboundMarshaler == nil { @@ -98,6 +100,7 @@ func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, out } +// MarshalerMIMERegistry keeps a mapping from MIME types to mimeMarshalers. type MarshalerMIMERegistry struct { mimeMap map[string]*mimeMarshaler } @@ -107,10 +110,10 @@ type mimeMarshaler struct { outbound Marshaler } -// Add an inbound and outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). +// AddMarshaler adds an inbound and outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). // Inbound is the marshaler that is used when marshaling inbound requests from the client. // Outbound is the marshaler that is used when marshaling outbound responses to the client. -func (m *MarshalerMIMERegistry) AddMarshaler(mime string, inbound Marshaler, outbound Marshaler) { +func (m *MarshalerMIMERegistry) AddMarshaler(mime string, inbound, outbound Marshaler) { if len(mime) == 0 { panic("Mime can't be an empty string") @@ -123,7 +126,7 @@ func (m *MarshalerMIMERegistry) AddMarshaler(mime string, inbound Marshaler, out } -// Add an inbound marshaler for a case-sensitive MIME type string ("*" to match any MIME type). +// AddInboundMarshaler adds an inbound marshaler for a case-sensitive MIME type string ("*" to match any MIME type). // Inbound is the marshaler that is used when marshaling inbound requests from the client. func (m *MarshalerMIMERegistry) AddInboundMarshaler(mime string, inbound Marshaler) { @@ -143,7 +146,7 @@ func (m *MarshalerMIMERegistry) AddInboundMarshaler(mime string, inbound Marshal } -// Add an outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). +// AddOutboundMarshaler adds an outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). // Outbound is the marshaler that is used when marshaling outbound responses to the client. func (m *MarshalerMIMERegistry) AddOutboundMarshaler(mime string, outbound Marshaler) { mime = http.CanonicalHeaderKey(mime) @@ -163,8 +166,9 @@ func (m *MarshalerMIMERegistry) AddOutboundMarshaler(mime string, outbound Marsh } -// Create a new MIME marshaler registry. Allows for a mapping of case-sensitive -// Content-Type MIME type string to runtime.Marshaler interfaces. +// NewMarshalerMIMERegistry returns a new registry of marshalers. +// It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces. +// // For example, you could allow the client to specify the use of the runtime.JSONPb marshaler // with a "applicaton/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler // with a "application/json" Content-Type. @@ -176,44 +180,65 @@ func NewMarshalerMIMERegistry() *MarshalerMIMERegistry { } } +// Marshaler defines a conversion between byte sequence and gRPC payloads / fields. type Marshaler interface { + // Marshal marshals "v" into byte sequence. Marshal(v interface{}) ([]byte, error) + // Unmarshal unmarshals "data" into "v". + // "v" must be a pointer value. Unmarshal(data []byte, v interface{}) error + // NewDecoder returns a Decoder which reads byte sequence from "r". NewDecoder(r io.Reader) Decoder + // NewEncoder returns an Encoder which writes bytes sequence into "w". NewEncoder(w io.Writer) Encoder + // ContentType returns the Content-Type which this marshaler is responsible for. ContentType() string } +// Decoder decodes a byte sequence type Decoder interface { Decode(v interface{}) error } +// Encoder encodes gRPC payloads / fields into byte sequence. type Encoder interface { Encode(v interface{}) error } +// JSONBuiltin is a Marshaler which marshals/unmarshals into/from JSON +// with the standard "encoding/json" package of Golang. +// Although it is generally faster for simple proto messages than JSONPb, +// it does not support advanced features of protobuf, e.g. map, oneof, .... type JSONBuiltin struct{} +// ContentType always Returns "application/json". func (*JSONBuiltin) ContentType() string { return "application/json" } +// Marshal marshals "v" into JSON func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) { return json.Marshal(v) } +// Unmarshal unmarshals JSON data into "v". func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { return json.Unmarshal(data, v) } +// NewDecoder returns a Decoder which reads JSON stream from "r". func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder { return json.NewDecoder(r) } +// NewEncoder returns an Encoder which writes JSON stream into "w". func (j *JSONBuiltin) NewEncoder(w io.Writer) Encoder { return json.NewEncoder(w) } +// JSONPb is a Marshaler which marshals/unmarshals into/from JSON +// with the "github.com/golang/protobuf/jsonpb". +// It supports fully functionality of protobuf unlike JSONBuiltin. type JSONPb struct { // Whether to render enum values as integers, as opposed to string values. EnumsAsInts bool @@ -231,10 +256,14 @@ type JSONPb struct { OrigName bool } +// ContentType always returns "application/json". func (*JSONPb) ContentType() string { return "application/json" } +// Marshal marshals "v" into JSON +// Currently it can marshal only proto.Message. +// TODO(yugui) Support fields of primitive types in a message. func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { m := &jsonpb.Marshaler{ EnumsAsInts: j.EnumsAsInts, @@ -242,31 +271,37 @@ func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { Indent: j.Indent, OrigName: j.OrigName, } - if p, ok := v.(proto.Message); ok { - var buf bytes.Buffer - if err := m.Marshal(&buf, p); err != nil { - return nil, err - } - return buf.Bytes(), nil - } else { - return nil, errors.New("Interface is not proto.Message") + p, ok := v.(proto.Message) + if !ok { + return nil, errors.New("interface is not proto.Message") } + var buf bytes.Buffer + if err := m.Marshal(&buf, p); err != nil { + return nil, err + } + return buf.Bytes(), nil + } +// Unmarshal unmarshals JSON "data" into "v" +// Currently it can marshal only proto.Message. +// TODO(yugui) Support fields of primitive types in a message. func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { r := bytes.NewReader(data) - if p, ok := v.(proto.Message); ok { - return jsonpb.Unmarshal(r, p) - } else { - return errors.New("Interface is not proto.Message") + p, ok := v.(proto.Message) + if !ok { + return errors.New("interface is not proto.Message") } + return jsonpb.Unmarshal(r, p) } +// NewDecoder returns a Decoder which reads JSON stream from "r". func (j *JSONPb) NewDecoder(r io.Reader) Decoder { - return &JSONPbDecoder{decoder: json.NewDecoder(r)} + return &jsonPbDecoder{decoder: json.NewDecoder(r)} } +// NewEncoder returns an Encoder which writes JSON stream into "w". func (j *JSONPb) NewEncoder(w io.Writer) Encoder { m := &jsonpb.Marshaler{ EnumsAsInts: j.EnumsAsInts, @@ -275,33 +310,34 @@ func (j *JSONPb) NewEncoder(w io.Writer) Encoder { OrigName: j.OrigName, } - return &JSONPbEncoder{ + return &jsonPbEncoder{ marshal: m, writer: w, } } -type JSONPbDecoder struct { +type jsonPbDecoder struct { decoder *json.Decoder } -func (j *JSONPbDecoder) Decode(v interface{}) error { - if p, ok := v.(proto.Message); ok { - return jsonpb.UnmarshalNext(j.decoder, p) - } else { - return errors.New("Interface is not proto.Message") +func (j *jsonPbDecoder) Decode(v interface{}) error { + p, ok := v.(proto.Message) + if !ok { + return errors.New("interface is not proto.Message") } + + return jsonpb.UnmarshalNext(j.decoder, p) } -type JSONPbEncoder struct { +type jsonPbEncoder struct { marshal *jsonpb.Marshaler writer io.Writer } -func (j *JSONPbEncoder) Encode(v interface{}) error { - if p, ok := v.(proto.Message); ok { - return j.marshal.Marshal(j.writer, p) - } else { - return errors.New("Interface is not proto.Message") +func (j *jsonPbEncoder) Encode(v interface{}) error { + p, ok := v.(proto.Message) + if !ok { + return errors.New("interface is not proto.Message") } + return j.marshal.Marshal(j.writer, p) } From 186aeb09b79a027aaaa38ff7008cc66c7bbac3dd Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 9 May 2016 11:34:20 +0900 Subject: [PATCH 023/552] Split marshaler implementation into smaller files --- runtime/marshal_json.go | 37 ++++++++++ runtime/marshal_jsonpb.go | 117 +++++++++++++++++++++++++++++++ runtime/marshaler.go | 143 -------------------------------------- 3 files changed, 154 insertions(+), 143 deletions(-) create mode 100644 runtime/marshal_json.go create mode 100644 runtime/marshal_jsonpb.go diff --git a/runtime/marshal_json.go b/runtime/marshal_json.go new file mode 100644 index 00000000000..0acd2ca29ef --- /dev/null +++ b/runtime/marshal_json.go @@ -0,0 +1,37 @@ +package runtime + +import ( + "encoding/json" + "io" +) + +// JSONBuiltin is a Marshaler which marshals/unmarshals into/from JSON +// with the standard "encoding/json" package of Golang. +// Although it is generally faster for simple proto messages than JSONPb, +// it does not support advanced features of protobuf, e.g. map, oneof, .... +type JSONBuiltin struct{} + +// ContentType always Returns "application/json". +func (*JSONBuiltin) ContentType() string { + return "application/json" +} + +// Marshal marshals "v" into JSON +func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) { + return json.Marshal(v) +} + +// Unmarshal unmarshals JSON data into "v". +func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { + return json.Unmarshal(data, v) +} + +// NewDecoder returns a Decoder which reads JSON stream from "r". +func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder { + return json.NewDecoder(r) +} + +// NewEncoder returns an Encoder which writes JSON stream into "w". +func (j *JSONBuiltin) NewEncoder(w io.Writer) Encoder { + return json.NewEncoder(w) +} diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go new file mode 100644 index 00000000000..73a86a38f7c --- /dev/null +++ b/runtime/marshal_jsonpb.go @@ -0,0 +1,117 @@ +package runtime + +import ( + "bytes" + "encoding/json" + "errors" + "io" + + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" +) + +// JSONPb is a Marshaler which marshals/unmarshals into/from JSON +// with the "github.com/golang/protobuf/jsonpb". +// It supports fully functionality of protobuf unlike JSONBuiltin. +type JSONPb struct { + // Whether to render enum values as integers, as opposed to string values. + EnumsAsInts bool + + // Whether to render fields with zero values. + EmitDefaults bool + + // A string to indent each level by. The presence of this field will + // also cause a space to appear between the field separator and + // value, and for newlines to be appear between fields and array + // elements. + Indent string + + // Whether to use the original (.proto) name for fields. + OrigName bool +} + +// ContentType always returns "application/json". +func (*JSONPb) ContentType() string { + return "application/json" +} + +// Marshal marshals "v" into JSON +// Currently it can marshal only proto.Message. +// TODO(yugui) Support fields of primitive types in a message. +func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { + m := &jsonpb.Marshaler{ + EnumsAsInts: j.EnumsAsInts, + EmitDefaults: j.EmitDefaults, + Indent: j.Indent, + OrigName: j.OrigName, + } + p, ok := v.(proto.Message) + if !ok { + return nil, errors.New("interface is not proto.Message") + } + + var buf bytes.Buffer + if err := m.Marshal(&buf, p); err != nil { + return nil, err + } + return buf.Bytes(), nil + +} + +// Unmarshal unmarshals JSON "data" into "v" +// Currently it can marshal only proto.Message. +// TODO(yugui) Support fields of primitive types in a message. +func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { + r := bytes.NewReader(data) + p, ok := v.(proto.Message) + if !ok { + return errors.New("interface is not proto.Message") + } + return jsonpb.Unmarshal(r, p) +} + +// NewDecoder returns a Decoder which reads JSON stream from "r". +func (j *JSONPb) NewDecoder(r io.Reader) Decoder { + return &jsonPbDecoder{decoder: json.NewDecoder(r)} +} + +// NewEncoder returns an Encoder which writes JSON stream into "w". +func (j *JSONPb) NewEncoder(w io.Writer) Encoder { + m := &jsonpb.Marshaler{ + EnumsAsInts: j.EnumsAsInts, + EmitDefaults: j.EmitDefaults, + Indent: j.Indent, + OrigName: j.OrigName, + } + + return &jsonPbEncoder{ + marshal: m, + writer: w, + } +} + +type jsonPbDecoder struct { + decoder *json.Decoder +} + +func (j *jsonPbDecoder) Decode(v interface{}) error { + p, ok := v.(proto.Message) + if !ok { + return errors.New("interface is not proto.Message") + } + + return jsonpb.UnmarshalNext(j.decoder, p) +} + +type jsonPbEncoder struct { + marshal *jsonpb.Marshaler + writer io.Writer +} + +func (j *jsonPbEncoder) Encode(v interface{}) error { + p, ok := v.(proto.Message) + if !ok { + return errors.New("interface is not proto.Message") + } + return j.marshal.Marshal(j.writer, p) +} diff --git a/runtime/marshaler.go b/runtime/marshaler.go index b250d33ec03..aa202fb397a 100644 --- a/runtime/marshaler.go +++ b/runtime/marshaler.go @@ -1,14 +1,8 @@ package runtime import ( - "bytes" - "encoding/json" - "errors" "io" "net/http" - - "github.com/golang/protobuf/jsonpb" - "github.com/golang/protobuf/proto" ) const mimeWildcard = "*" @@ -204,140 +198,3 @@ type Decoder interface { type Encoder interface { Encode(v interface{}) error } - -// JSONBuiltin is a Marshaler which marshals/unmarshals into/from JSON -// with the standard "encoding/json" package of Golang. -// Although it is generally faster for simple proto messages than JSONPb, -// it does not support advanced features of protobuf, e.g. map, oneof, .... -type JSONBuiltin struct{} - -// ContentType always Returns "application/json". -func (*JSONBuiltin) ContentType() string { - return "application/json" -} - -// Marshal marshals "v" into JSON -func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) { - return json.Marshal(v) -} - -// Unmarshal unmarshals JSON data into "v". -func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { - return json.Unmarshal(data, v) -} - -// NewDecoder returns a Decoder which reads JSON stream from "r". -func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder { - return json.NewDecoder(r) -} - -// NewEncoder returns an Encoder which writes JSON stream into "w". -func (j *JSONBuiltin) NewEncoder(w io.Writer) Encoder { - return json.NewEncoder(w) -} - -// JSONPb is a Marshaler which marshals/unmarshals into/from JSON -// with the "github.com/golang/protobuf/jsonpb". -// It supports fully functionality of protobuf unlike JSONBuiltin. -type JSONPb struct { - // Whether to render enum values as integers, as opposed to string values. - EnumsAsInts bool - - // Whether to render fields with zero values. - EmitDefaults bool - - // A string to indent each level by. The presence of this field will - // also cause a space to appear between the field separator and - // value, and for newlines to be appear between fields and array - // elements. - Indent string - - // Whether to use the original (.proto) name for fields. - OrigName bool -} - -// ContentType always returns "application/json". -func (*JSONPb) ContentType() string { - return "application/json" -} - -// Marshal marshals "v" into JSON -// Currently it can marshal only proto.Message. -// TODO(yugui) Support fields of primitive types in a message. -func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { - m := &jsonpb.Marshaler{ - EnumsAsInts: j.EnumsAsInts, - EmitDefaults: j.EmitDefaults, - Indent: j.Indent, - OrigName: j.OrigName, - } - p, ok := v.(proto.Message) - if !ok { - return nil, errors.New("interface is not proto.Message") - } - - var buf bytes.Buffer - if err := m.Marshal(&buf, p); err != nil { - return nil, err - } - return buf.Bytes(), nil - -} - -// Unmarshal unmarshals JSON "data" into "v" -// Currently it can marshal only proto.Message. -// TODO(yugui) Support fields of primitive types in a message. -func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { - r := bytes.NewReader(data) - p, ok := v.(proto.Message) - if !ok { - return errors.New("interface is not proto.Message") - } - return jsonpb.Unmarshal(r, p) -} - -// NewDecoder returns a Decoder which reads JSON stream from "r". -func (j *JSONPb) NewDecoder(r io.Reader) Decoder { - return &jsonPbDecoder{decoder: json.NewDecoder(r)} -} - -// NewEncoder returns an Encoder which writes JSON stream into "w". -func (j *JSONPb) NewEncoder(w io.Writer) Encoder { - m := &jsonpb.Marshaler{ - EnumsAsInts: j.EnumsAsInts, - EmitDefaults: j.EmitDefaults, - Indent: j.Indent, - OrigName: j.OrigName, - } - - return &jsonPbEncoder{ - marshal: m, - writer: w, - } -} - -type jsonPbDecoder struct { - decoder *json.Decoder -} - -func (j *jsonPbDecoder) Decode(v interface{}) error { - p, ok := v.(proto.Message) - if !ok { - return errors.New("interface is not proto.Message") - } - - return jsonpb.UnmarshalNext(j.decoder, p) -} - -type jsonPbEncoder struct { - marshal *jsonpb.Marshaler - writer io.Writer -} - -func (j *jsonPbEncoder) Encode(v interface{}) error { - p, ok := v.(proto.Message) - if !ok { - return errors.New("interface is not proto.Message") - } - return j.marshal.Marshal(j.writer, p) -} From 166ea0069a40ecd90a56eaf1f844dc180343f1d7 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 9 May 2016 12:44:00 +0900 Subject: [PATCH 024/552] Add map and oneof into the example --- examples/examplepb/a_bit_of_everything.pb.go | 243 ++++++++++++++----- examples/examplepb/a_bit_of_everything.proto | 6 + 2 files changed, 189 insertions(+), 60 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 21b8e96c92c..4ba8752c92e 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -85,6 +85,11 @@ type ABitOfEverything struct { Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` + // Types that are valid to be assigned to OneofValue: + // *ABitOfEverything_OneofEmpty + // *ABitOfEverything_OneofString + OneofValue isABitOfEverything_OneofValue `protobuf_oneof:"oneof_value"` + MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=gengo.grpc.gateway.examples.examplepb.NumericEnum"` } func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } @@ -92,6 +97,27 @@ func (m *ABitOfEverything) String() string { return proto.CompactText func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } +type isABitOfEverything_OneofValue interface { + isABitOfEverything_OneofValue() +} + +type ABitOfEverything_OneofEmpty struct { + OneofEmpty *EmptyMessage `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"` +} + +func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} +func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} + +func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { + if m != nil { + return m.OneofValue + } + return nil +} + func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { if m != nil { return m.Nested @@ -99,6 +125,97 @@ func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { return nil } +func (m *ABitOfEverything) GetOneofEmpty() *EmptyMessage { + if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok { + return x.OneofEmpty + } + return nil +} + +func (m *ABitOfEverything) GetOneofString() string { + if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofString); ok { + return x.OneofString + } + return "" +} + +func (m *ABitOfEverything) GetMapValue() map[string]NumericEnum { + if m != nil { + return m.MapValue + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ABitOfEverything) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ABitOfEverything_OneofMarshaler, _ABitOfEverything_OneofUnmarshaler, _ABitOfEverything_OneofSizer, []interface{}{ + (*ABitOfEverything_OneofEmpty)(nil), + (*ABitOfEverything_OneofString)(nil), + } +} + +func _ABitOfEverything_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ABitOfEverything) + // oneof_value + switch x := m.OneofValue.(type) { + case *ABitOfEverything_OneofEmpty: + b.EncodeVarint(20<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.OneofEmpty); err != nil { + return err + } + case *ABitOfEverything_OneofString: + b.EncodeVarint(21<<3 | proto.WireBytes) + b.EncodeStringBytes(x.OneofString) + case nil: + default: + return fmt.Errorf("ABitOfEverything.OneofValue has unexpected type %T", x) + } + return nil +} + +func _ABitOfEverything_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ABitOfEverything) + switch tag { + case 20: // oneof_value.oneof_empty + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(EmptyMessage) + err := b.DecodeMessage(msg) + m.OneofValue = &ABitOfEverything_OneofEmpty{msg} + return true, err + case 21: // oneof_value.oneof_string + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.OneofValue = &ABitOfEverything_OneofString{x} + return true, err + default: + return false, nil + } +} + +func _ABitOfEverything_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ABitOfEverything) + // oneof_value + switch x := m.OneofValue.(type) { + case *ABitOfEverything_OneofEmpty: + s := proto.Size(x.OneofEmpty) + n += proto.SizeVarint(20<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ABitOfEverything_OneofString: + n += proto.SizeVarint(21<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.OneofString))) + n += len(x.OneofString) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + type ABitOfEverything_Nested struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Amount uint32 `protobuf:"varint,2,opt,name=amount" json:"amount,omitempty"` @@ -556,64 +673,70 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ } var fileDescriptor1 = []byte{ - // 932 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0xdd, 0x8e, 0xdb, 0x44, - 0x14, 0xc6, 0x49, 0xd6, 0x49, 0xc6, 0x9b, 0x6c, 0x3a, 0x15, 0xb0, 0x04, 0xd0, 0x6e, 0x4d, 0x0b, - 0x21, 0x54, 0x76, 0xeb, 0x20, 0x90, 0x2a, 0x81, 0xd4, 0xd0, 0x80, 0x90, 0x96, 0x5d, 0xe1, 0xa5, - 0x45, 0x8a, 0x84, 0x22, 0x27, 0x9e, 0xb8, 0xd6, 0x3a, 0x1e, 0xcb, 0x3f, 0xa1, 0x51, 0x14, 0x2e, - 0x7a, 0x85, 0xc4, 0x05, 0x12, 0x3c, 0x00, 0x12, 0x77, 0x20, 0xc1, 0x8b, 0xf4, 0x92, 0x57, 0xe0, - 0x41, 0x38, 0x1e, 0xff, 0x74, 0x9c, 0x22, 0x12, 0x52, 0x69, 0x7b, 0x97, 0x99, 0xf3, 0xcd, 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0x8f, 0x38, 0x04, 0xa4, 0x3e, 0x33, 0xd1, 0x9d, 0x24, - 0xa4, 0xd3, 0xec, 0x6e, 0x3b, 0xcd, 0x27, 0x30, 0xcd, 0xc1, 0xe4, 0x21, 0xc5, 0xca, 0x7f, 0x66, - 0x03, 0x69, 0x4a, 0xf2, 0xdd, 0xc9, 0xd4, 0xfd, 0x4f, 0xbc, 0x3c, 0x61, 0xc2, 0xbe, 0xc1, 0x37, - 0x37, 0x09, 0x23, 0xa0, 0x46, 0x5d, 0x26, 0xcf, 0xc9, 0xf0, 0x35, 0xb9, 0xa5, 0xce, 0xb5, 0x1c, - 0x1f, 0xc7, 0xee, 0xec, 0xb1, 0xd8, 0x10, 0xe3, 0x67, 0x42, 0xb1, 0x37, 0x6b, 0xf1, 0x85, 0xbe, - 0x94, 0x8a, 0xb6, 0xbe, 0xc0, 0x4c, 0x75, 0x7c, 0x81, 0x6f, 0x09, 0x7d, 0x69, 0x58, 0xcf, 0x27, - 0x37, 0x16, 0xd9, 0x1f, 0xd7, 0xde, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x17, 0x44, 0xcc, 0x34, - 0x66, 0x0b, 0x00, 0x00, + // 1033 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x57, 0xdd, 0x6e, 0x1b, 0x45, + 0x18, 0xed, 0xda, 0x89, 0x63, 0x7f, 0x1b, 0x3b, 0xee, 0x94, 0x16, 0x63, 0x40, 0x49, 0x97, 0x16, + 0x82, 0xa9, 0x76, 0xdb, 0x0d, 0x02, 0x14, 0x09, 0xa4, 0x9a, 0x1a, 0x8a, 0x94, 0x26, 0x62, 0x43, + 0x83, 0x14, 0x09, 0x59, 0x6b, 0x7b, 0xe2, 0xae, 0x62, 0xef, 0xac, 0xf6, 0xc7, 0xd4, 0xb2, 0xc2, + 0x45, 0xb9, 0x41, 0xe2, 0x02, 0x09, 0x1e, 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, 0x31, 0x3b, 0xec, 0x4e, 0xec, + 0x51, 0x44, 0x1b, 0x45, 0x3c, 0xb2, 0x60, 0x81, 0x98, 0x3a, 0xe1, 0x33, 0xe4, 0x3a, 0x6c, 0x0e, + 0x58, 0xd4, 0x1b, 0xd1, 0x18, 0xb1, 0x86, 0x08, 0xc5, 0x52, 0xe5, 0x9c, 0x84, 0x20, 0x87, 0xe3, + 0x86, 0xef, 0xbd, 0x1b, 0x23, 0xd6, 0x11, 0x51, 0xb4, 0x40, 0x4c, 0xa5, 0x1c, 0x51, 0x16, 0x51, + 0x42, 0xc4, 0x9a, 0xa5, 0x46, 0x19, 0x88, 0xe4, 0xd8, 0x33, 0x63, 0xc4, 0x06, 0x22, 0xd6, 0x05, + 0xc7, 0x9e, 0x29, 0x01, 0x6f, 0x40, 0xf5, 0xcc, 0x79, 0x4c, 0x07, 0x29, 0x49, 0x19, 0x21, 0x25, + 0x6b, 0x33, 0x9e, 0x9c, 0x07, 0xa5, 0x3c, 0x15, 0x04, 0x6d, 0xc4, 0xa0, 0x84, 0xe9, 0x75, 0x80, + 0x1e, 0x63, 0xa3, 0x18, 0x01, 0x88, 0x28, 0x5b, 0x15, 0x3e, 0x93, 0x8a, 0x0d, 0x42, 0x1f, 0x53, + 0x15, 0x03, 0x54, 0x51, 0x05, 0x55, 0xce, 0xcd, 0xc5, 0x93, 0x9e, 0x52, 0x45, 0x48, 0x55, 0xc6, + 0x93, 0x1c, 0xf2, 0x39, 0x00, 0x75, 0xa3, 0x71, 0x0c, 0xa8, 0x21, 0xa0, 0x66, 0x9a, 0x2b, 0xd6, + 0xec, 0x30, 0x1a, 0x53, 0xdf, 0xe9, 0x77, 0x70, 0xbf, 0x55, 0xe1, 0x2c, 0x92, 0xf2, 0x26, 0xd4, + 0x82, 0xf9, 0xe8, 0xb6, 0x90, 0x76, 0xcb, 0xaa, 0x06, 0x73, 0xe1, 0xa5, 0xb0, 0x34, 0x53, 0x75, + 0x84, 0xd5, 0x13, 0x58, 0xa6, 0x26, 0x41, 0x36, 0x86, 0xcb, 0x08, 0xba, 0x8c, 0x61, 0x66, 0x62, + 0x88, 0x21, 0x29, 0x0f, 0x41, 0x08, 0x91, 0x90, 0x84, 0xc5, 0x84, 0xab, 0x3e, 0xf5, 0x28, 0xc6, + 0x32, 0xe8, 0xce, 0x65, 0xed, 0x0a, 0x76, 0x69, 0xc5, 0xba, 0x92, 0x2c, 0x1e, 0x67, 0xb2, 0x77, + 0x02, 0x2a, 0x73, 0x29, 0xf7, 0xe2, 0xd8, 0x0b, 0xa7, 0x8d, 0x97, 0x90, 0x55, 0x35, 0xf7, 0x56, + 0xcc, 0x4d, 0x87, 0xef, 0x79, 0x20, 0x3d, 0x74, 0xff, 0x92, 0x05, 0x82, 0x49, 0x4c, 0x62, 0xf1, + 0x37, 0x25, 0xaf, 0x14, 0xd2, 0xb8, 0xca, 0x0b, 0x87, 0x18, 0x79, 0x9a, 0x54, 0x40, 0x7a, 0x50, + 0x19, 0xdb, 0x5e, 0x2c, 0xf2, 0x9a, 0xb0, 0x52, 0x27, 0xaf, 0x95, 0x1e, 0xd8, 0x9e, 0x88, 0xa8, + 0xe3, 0x86, 0xfe, 0xd4, 0x2a, 0x8f, 0xe3, 0x61, 0xf3, 0x77, 0x05, 0x4a, 0xd2, 0x66, 0xdc, 0xca, + 0xae, 0x3d, 0xa6, 0x89, 0x95, 0xf9, 0x37, 0xb9, 0x06, 0x25, 0x7b, 0xcc, 0x22, 0x37, 0x44, 0x2b, + 0xf3, 0xbe, 0x89, 0x47, 0xe4, 0x4b, 0x28, 0xb0, 0x73, 0xe1, 0xc0, 0x9a, 0xf9, 0xe9, 0xf3, 0xd9, + 0x5b, 0xbf, 0x47, 0xa9, 0x27, 0xfa, 0x07, 0x29, 0xb5, 0x6d, 0x28, 0x27, 0x63, 0x52, 0x81, 0xf5, + 0x4f, 0xee, 0x1e, 0x1c, 0x77, 0xea, 0x97, 0x48, 0x19, 0xd6, 0xbe, 0xb0, 0x1e, 0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7c, 0x5c, 0x4e, 0x09, 0x79, 0x66, 0x89, + 0xf7, 0x66, 0x99, 0x1b, 0xfa, 0x85, 0x44, 0xb4, 0xb2, 0x81, 0x85, 0x6a, 0x6e, 0xe0, 0xdb, 0x4a, + 0x5b, 0x3d, 0xad, 0xa4, 0x95, 0xeb, 0x95, 0xc4, 0x3f, 0x83, 0xbd, 0xbf, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x9e, 0x8d, 0xf0, 0x8e, 0xc7, 0x0c, 0x00, 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 406023ad010..c1a5a2ffa25 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -36,6 +36,12 @@ message ABitOfEverything { 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; } message EmptyMessage { From 5325871c5db7b0c44d0e1b8604e5562278a37a4b Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 9 May 2016 12:44:14 +0900 Subject: [PATCH 025/552] Add tests --- runtime/marshal_json_test.go | 198 ++++++++++++++++++ runtime/marshal_jsonpb_test.go | 356 +++++++++++++++++++++++++++++++++ runtime/marshaler.go | 73 ++----- runtime/marshaler_test.go | 119 +++++++++++ 4 files changed, 695 insertions(+), 51 deletions(-) create mode 100644 runtime/marshal_json_test.go create mode 100644 runtime/marshal_jsonpb_test.go create mode 100644 runtime/marshaler_test.go diff --git a/runtime/marshal_json_test.go b/runtime/marshal_json_test.go new file mode 100644 index 00000000000..44165e31b06 --- /dev/null +++ b/runtime/marshal_json_test.go @@ -0,0 +1,198 @@ +package runtime_test + +import ( + "bytes" + "encoding/json" + "reflect" + "strings" + "testing" + + "github.com/gengo/grpc-gateway/examples/examplepb" + "github.com/gengo/grpc-gateway/runtime" +) + +func TestJSONBuiltinMarshal(t *testing.T) { + var m runtime.JSONBuiltin + msg := examplepb.SimpleMessage{ + Id: "foo", + } + + buf, err := m.Marshal(&msg) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success", &msg, err) + } + + var got examplepb.SimpleMessage + if err := json.Unmarshal(buf, &got); err != nil { + t.Errorf("json.Unmarshal(%q, &got) failed with %v; want success", buf, err) + } + if want := msg; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v", &got, &want) + } +} + +func TestJSONBuiltinMarshalPrimitive(t *testing.T) { + var m runtime.JSONBuiltin + for _, v := range []interface{}{ + "", + "foo", + 1, + 0, + -1, + -0.0, + 1.5, + } { + buf, err := m.Marshal(v) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success", v, err) + } + + dest := reflect.New(reflect.TypeOf(v)) + if err := json.Unmarshal(buf, dest.Interface()); err != nil { + t.Errorf("json.Unmarshal(%q, unmarshaled) failed with %v; want success", buf, err) + } + if got, want := dest.Elem().Interface(), v; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v", &got, &want) + } + } +} + +func TestJSONBuiltinsnmarshal(t *testing.T) { + var ( + m runtime.JSONBuiltin + got examplepb.SimpleMessage + + data = []byte(`{"id": "foo"}`) + ) + if err := m.Unmarshal(data, &got); err != nil { + t.Errorf("m.Unmarshal(%q, &got) failed with %v; want success", data, err) + } + + want := examplepb.SimpleMessage{ + Id: "foo", + } + if !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v", &got, &want) + } +} + +func TestJSONBuiltinUnmarshalPrimitive(t *testing.T) { + var m runtime.JSONBuiltin + for _, spec := range []struct { + data string + want interface{} + }{ + {data: `""`, want: ""}, + {data: `"foo"`, want: "foo"}, + {data: `1`, want: 1}, + {data: `0`, want: 0}, + {data: `-1`, want: -1}, + {data: `-0.0`, want: -0.0}, + {data: `1.5`, want: 1.5}, + } { + dest := reflect.New(reflect.TypeOf(spec.want)) + if err := m.Unmarshal([]byte(spec.data), dest.Interface()); err != nil { + t.Errorf("m.Unmarshal(%q, dest) failed with %v; want success", spec.data, err) + } + + if got, want := dest.Elem().Interface(), spec.want; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v", got, want) + } + } +} + +func TestJSONBuiltinEncoder(t *testing.T) { + var m runtime.JSONBuiltin + msg := examplepb.SimpleMessage{ + Id: "foo", + } + + var buf bytes.Buffer + enc := m.NewEncoder(&buf) + if err := enc.Encode(&msg); err != nil { + t.Errorf("enc.Encode(%v) failed with %v; want success", &msg, err) + } + + var got examplepb.SimpleMessage + if err := json.Unmarshal(buf.Bytes(), &got); err != nil { + t.Errorf("json.Unmarshal(%q, &got) failed with %v; want success", buf.String(), err) + } + if want := msg; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v", &got, &want) + } +} + +func TestJSONBuiltinEncoderPrimitive(t *testing.T) { + var m runtime.JSONBuiltin + for _, v := range []interface{}{ + "", + "foo", + 1, + 0, + -1, + -0.0, + 1.5, + } { + var buf bytes.Buffer + enc := m.NewEncoder(&buf) + if err := enc.Encode(v); err != nil { + t.Errorf("enc.Encode(%v) failed with %v; want success", v, err) + } + + dest := reflect.New(reflect.TypeOf(v)) + if err := json.Unmarshal(buf.Bytes(), dest.Interface()); err != nil { + t.Errorf("json.Unmarshal(%q, unmarshaled) failed with %v; want success", buf.String(), err) + } + if got, want := dest.Elem().Interface(), v; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v", &got, &want) + } + } +} + +func TestJSONBuiltinDecoder(t *testing.T) { + var ( + m runtime.JSONBuiltin + got examplepb.SimpleMessage + + data = `{"id": "foo"}` + ) + r := strings.NewReader(data) + dec := m.NewDecoder(r) + if err := dec.Decode(&got); err != nil { + t.Errorf("m.Unmarshal(&got) failed with %v; want success", err) + } + + want := examplepb.SimpleMessage{ + Id: "foo", + } + if !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v", &got, &want) + } +} + +func TestJSONBuiltinDecoderPrimitive(t *testing.T) { + var m runtime.JSONBuiltin + for _, spec := range []struct { + data string + want interface{} + }{ + {data: `""`, want: ""}, + {data: `"foo"`, want: "foo"}, + {data: `1`, want: 1}, + {data: `0`, want: 0}, + {data: `-1`, want: -1}, + {data: `-0.0`, want: -0.0}, + {data: `1.5`, want: 1.5}, + } { + r := strings.NewReader(spec.data) + dec := m.NewDecoder(r) + dest := reflect.New(reflect.TypeOf(spec.want)) + if err := dec.Decode(dest.Interface()); err != nil { + t.Errorf("dec.Decode(dest) failed with %v; want success; data=%q", err, spec.data) + } + + if got, want := dest.Elem().Interface(), spec.want; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v", got, want) + } + } +} diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go new file mode 100644 index 00000000000..de401f1bc19 --- /dev/null +++ b/runtime/marshal_jsonpb_test.go @@ -0,0 +1,356 @@ +package runtime_test + +import ( + "bytes" + "reflect" + "strings" + "testing" + + "github.com/gengo/grpc-gateway/examples/examplepb" + "github.com/gengo/grpc-gateway/runtime" + "github.com/golang/protobuf/jsonpb" +) + +func TestJSONPbMarshal(t *testing.T) { + msg := examplepb.ABitOfEverything{ + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + Nested: []*examplepb.ABitOfEverything_Nested{ + { + Name: "foo", + Amount: 12345, + }, + }, + Uint64Value: 0xFFFFFFFFFFFFFFFF, + EnumValue: examplepb.NumericEnum_ONE, + OneofValue: &examplepb.ABitOfEverything_OneofString{ + OneofString: "bar", + }, + MapValue: map[string]examplepb.NumericEnum{ + "a": examplepb.NumericEnum_ONE, + "b": examplepb.NumericEnum_ZERO, + }, + } + + for _, spec := range []struct { + enumsAsInts, emitDefaults bool + indent string + origName bool + verifier func(json string) + }{ + { + verifier: func(json string) { + if strings.ContainsAny(json, " \t\r\n") { + t.Errorf("strings.ContainsAny(%q, %q) = true; want false", json, " \t\r\n") + } + if !strings.Contains(json, "ONE") { + t.Errorf(`strings.Contains(%q, "ONE") = false; want true`, json) + } + if want := "uint64Value"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + enumsAsInts: true, + verifier: func(json string) { + if strings.Contains(json, "ONE") { + t.Errorf(`strings.Contains(%q, "ONE") = true; want false`, json) + } + }, + }, + { + emitDefaults: true, + verifier: func(json string) { + if want := `"sfixed32Value"`; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + indent: "\t\t", + verifier: func(json string) { + if want := "\t\t\"amount\":"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + origName: true, + verifier: func(json string) { + if want := "uint64_value"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + } { + m := runtime.JSONPb{ + EnumsAsInts: spec.enumsAsInts, + EmitDefaults: spec.emitDefaults, + Indent: spec.indent, + OrigName: spec.origName, + } + buf, err := m.Marshal(&msg) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success; spec=%v", &msg, err, spec) + } + + var got examplepb.ABitOfEverything + if err := jsonpb.UnmarshalString(string(buf), &got); err != nil { + t.Errorf("jsonpb.UnmarshalString(%q, &got) failed with %v; want success; spec=%v", string(buf), err, spec) + } + if want := msg; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v; spec=%v", &got, &want, spec) + } + if spec.verifier != nil { + spec.verifier(string(buf)) + } + } +} + +func TestJSONPbUnmarshal(t *testing.T) { + var ( + m runtime.JSONPb + got examplepb.ABitOfEverything + ) + for _, data := range []string{ + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": 18446744073709551615, + "enumValue": "ONE", + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": "18446744073709551615", + "enumValue": "ONE", + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": 18446744073709551615, + "enumValue": 1, + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + } { + if err := m.Unmarshal([]byte(data), &got); err != nil { + t.Errorf("m.Unmarshal(%q, &got) failed with %v; want success", data, err) + } + + want := examplepb.ABitOfEverything{ + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + Nested: []*examplepb.ABitOfEverything_Nested{ + { + Name: "foo", + Amount: 12345, + }, + }, + Uint64Value: 0xFFFFFFFFFFFFFFFF, + EnumValue: examplepb.NumericEnum_ONE, + OneofValue: &examplepb.ABitOfEverything_OneofString{ + OneofString: "bar", + }, + MapValue: map[string]examplepb.NumericEnum{ + "a": examplepb.NumericEnum_ONE, + "b": examplepb.NumericEnum_ZERO, + }, + } + + if !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v", &got, &want) + } + } +} + +func TestJSONPbEncoder(t *testing.T) { + msg := examplepb.ABitOfEverything{ + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + Nested: []*examplepb.ABitOfEverything_Nested{ + { + Name: "foo", + Amount: 12345, + }, + }, + Uint64Value: 0xFFFFFFFFFFFFFFFF, + OneofValue: &examplepb.ABitOfEverything_OneofString{ + OneofString: "bar", + }, + MapValue: map[string]examplepb.NumericEnum{ + "a": examplepb.NumericEnum_ONE, + "b": examplepb.NumericEnum_ZERO, + }, + } + + for _, spec := range []struct { + enumsAsInts, emitDefaults bool + indent string + origName bool + verifier func(json string) + }{ + { + verifier: func(json string) { + if strings.ContainsAny(json, " \t\r\n") { + t.Errorf("strings.ContainsAny(%q, %q) = true; want false", json, " \t\r\n") + } + if strings.Contains(json, "ONE") { + t.Errorf(`strings.Contains(%q, "ONE") = true; want false`, json) + } + if want := "uint64Value"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + enumsAsInts: true, + verifier: func(json string) { + if strings.Contains(json, "ONE") { + t.Errorf(`strings.Contains(%q, "ONE") = true; want false`, json) + } + }, + }, + { + emitDefaults: true, + verifier: func(json string) { + if want := `"sfixed32Value"`; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + indent: "\t\t", + verifier: func(json string) { + if want := "\t\t\"amount\":"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + origName: true, + verifier: func(json string) { + if want := "uint64_value"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + } { + m := runtime.JSONPb{ + EnumsAsInts: spec.enumsAsInts, + EmitDefaults: spec.emitDefaults, + Indent: spec.indent, + OrigName: spec.origName, + } + + var buf bytes.Buffer + enc := m.NewEncoder(&buf) + if err := enc.Encode(&msg); err != nil { + t.Errorf("enc.Encode(%v) failed with %v; want success; spec=%v", &msg, err, spec) + } + + var got examplepb.ABitOfEverything + if err := jsonpb.UnmarshalString(buf.String(), &got); err != nil { + t.Errorf("jsonpb.UnmarshalString(%q, &got) failed with %v; want success; spec=%v", buf.String(), err, spec) + } + if want := msg; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v; spec=%v", &got, &want, spec) + } + if spec.verifier != nil { + spec.verifier(buf.String()) + } + } +} + +func TestJSONPbDecoder(t *testing.T) { + var ( + m runtime.JSONPb + got examplepb.ABitOfEverything + ) + for _, data := range []string{ + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": 18446744073709551615, + "enumValue": "ONE", + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": "18446744073709551615", + "enumValue": "ONE", + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": 18446744073709551615, + "enumValue": 1, + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + } { + r := strings.NewReader(data) + dec := m.NewDecoder(r) + if err := dec.Decode(&got); err != nil { + t.Errorf("m.Unmarshal(&got) failed with %v; want success; data=%q", err, data) + } + + want := examplepb.ABitOfEverything{ + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + Nested: []*examplepb.ABitOfEverything_Nested{ + { + Name: "foo", + Amount: 12345, + }, + }, + Uint64Value: 0xFFFFFFFFFFFFFFFF, + EnumValue: examplepb.NumericEnum_ONE, + OneofValue: &examplepb.ABitOfEverything_OneofString{ + OneofString: "bar", + }, + MapValue: map[string]examplepb.NumericEnum{ + "a": examplepb.NumericEnum_ONE, + "b": examplepb.NumericEnum_ZERO, + }, + } + if !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v; data = %v", &got, &want, data) + } + } +} diff --git a/runtime/marshaler.go b/runtime/marshaler.go index aa202fb397a..58e327d9284 100644 --- a/runtime/marshaler.go +++ b/runtime/marshaler.go @@ -22,72 +22,36 @@ var ( // exactly match in the registry. // Otherwise, it follows the above logic for "*"/InboundMarshaler/OutboundMarshaler. func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) { - inbound = nil - outbound = nil - headerVals := r.Header[contentTypeHeader] + headerVals := append(append([]string(nil), r.Header[contentTypeHeader]...), "*") for _, val := range headerVals { - if mux.MIMERegistry != nil && mux.MIMERegistry.mimeMap != nil { - if m, ok := mux.MIMERegistry.mimeMap[val]; ok { - if inbound == nil && m.inbound != nil { - inbound = m.inbound - } - if outbound == nil && m.outbound != nil { - outbound = m.outbound - } - } - } else { - //Nil mimeMap, no need to bother checking for mimeWildcard - if mux.InboundMarshaler == nil { - //Its nil, use our default - inbound = inboundDefaultMarshaler - } else { - inbound = mux.InboundMarshaler + m := mux.MIMERegistry.lookup(val) + if m != nil { + if inbound == nil { + inbound = m.inbound } - - if mux.OutboundMarshaler == nil { - //Its nil, use our default - outbound = outboundDefaultMarshaler - } else { - outbound = mux.OutboundMarshaler + if outbound == nil { + outbound = m.outbound } } - if inbound != nil && outbound != nil { - //Got them both, return + // Got them both, return return inbound, outbound } } - if mux.MIMERegistry != nil && mux.MIMERegistry.mimeMap != nil { - if m, ok := mux.MIMERegistry.mimeMap[mimeWildcard]; ok { - if inbound == nil && m.inbound != nil { - inbound = m.inbound - } - if outbound == nil && m.outbound != nil { - outbound = m.outbound - } - } + if inbound == nil { + inbound = mux.InboundMarshaler } - - //Haven't gotten anywhere with any of the headers or mimeWildcard - //Try to use the mux, otherwise use our default if inbound == nil { - if mux.InboundMarshaler == nil { - //Its nil, use our default - inbound = inboundDefaultMarshaler - } else { - inbound = mux.InboundMarshaler - } + inbound = inboundDefaultMarshaler } if outbound == nil { - if mux.OutboundMarshaler == nil { - //Its nil, use our default - outbound = outboundDefaultMarshaler - } else { - outbound = mux.OutboundMarshaler - } + outbound = mux.OutboundMarshaler + } + if outbound == nil { + outbound = outboundDefaultMarshaler } return inbound, outbound @@ -160,6 +124,13 @@ func (m *MarshalerMIMERegistry) AddOutboundMarshaler(mime string, outbound Marsh } +func (m *MarshalerMIMERegistry) lookup(mime string) *mimeMarshaler { + if m == nil { + return nil + } + return m.mimeMap[mime] +} + // NewMarshalerMIMERegistry returns a new registry of marshalers. // It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces. // diff --git a/runtime/marshaler_test.go b/runtime/marshaler_test.go new file mode 100644 index 00000000000..c416471e7db --- /dev/null +++ b/runtime/marshaler_test.go @@ -0,0 +1,119 @@ +package runtime_test + +import ( + "errors" + "io" + "net/http" + "testing" + + "github.com/gengo/grpc-gateway/runtime" +) + +func TestMarshalerForRequest(t *testing.T) { + r, err := http.NewRequest("GET", "http://example.com", nil) + if err != nil { + t.Fatalf(`http.NewRequest("GET", "http://example.com", nil) failed with %v; want success`, err) + } + r.Header.Set("Content-Type", "application/x-example") + + reg := runtime.NewMarshalerMIMERegistry() + mux := runtime.NewServeMux() + mux.MIMERegistry = reg + + in, out := runtime.MarshalerForRequest(mux, r) + if _, ok := in.(*runtime.JSONBuiltin); !ok { + t.Errorf("in = %#v; want a runtime.JSONBuiltin", in) + } + if _, ok := out.(*runtime.JSONBuiltin); !ok { + t.Errorf("out = %#v; want a runtime.JSONBuiltin", in) + } + + m1 := new(dummyMarshaler) + reg.AddMarshaler("*", m1, m1) + in, out = runtime.MarshalerForRequest(mux, r) + if got, want := in, m1; got != want { + t.Errorf("in = %#v; want %#v", got, want) + } + if got, want := out, m1; got != want { + t.Errorf("out = %#v; want %#v", got, want) + } + + m2 := new(dummyMarshaler) + reg.AddInboundMarshaler("*", m2) + in, out = runtime.MarshalerForRequest(mux, r) + if got, want := in, m2; got != want { + t.Errorf("in = %#v; want %#v", got, want) + } + if got, want := out, m1; got != want { + t.Errorf("out = %#v; want %#v", got, want) + } + + m3 := new(dummyMarshaler) + reg.AddOutboundMarshaler("application/x-example", m3) + in, out = runtime.MarshalerForRequest(mux, r) + if got, want := in, m2; got != want { + t.Errorf("in = %#v; want %#v", got, want) + } + if got, want := out, m3; got != want { + t.Errorf("out = %#v; want %#v", got, want) + } + + m4 := new(dummyMarshaler) + reg.AddInboundMarshaler("application/x-example", m4) + in, out = runtime.MarshalerForRequest(mux, r) + if got, want := in, m4; got != want { + t.Errorf("in = %#v; want %#v", got, want) + } + if got, want := out, m3; got != want { + t.Errorf("out = %#v; want %#v", got, want) + } + + m5, m6 := new(dummyMarshaler), new(dummyMarshaler) + reg.AddMarshaler("application/x-example", m5, m6) + in, out = runtime.MarshalerForRequest(mux, r) + if got, want := in, m5; got != want { + t.Errorf("in = %#v; want %#v", got, want) + } + if got, want := out, m6; got != want { + t.Errorf("out = %#v; want %#v", got, want) + } + + r.Header.Set("Content-Type", "application/x-another") + in, out = runtime.MarshalerForRequest(mux, r) + if got, want := in, m2; got != want { + t.Errorf("in = %#v; want %#v", got, want) + } + if got, want := out, m1; got != want { + t.Errorf("out = %#v; want %#v", got, want) + } +} + +type dummyMarshaler struct{} + +func (dummyMarshaler) ContentType() string { return "" } +func (dummyMarshaler) Marshal(interface{}) ([]byte, error) { + return nil, errors.New("not implemented") +} + +func (dummyMarshaler) Unmarshal([]byte, interface{}) error { + return errors.New("not implemented") +} + +func (dummyMarshaler) NewDecoder(r io.Reader) runtime.Decoder { + return dummyDecoder{} +} +func (dummyMarshaler) NewEncoder(w io.Writer) runtime.Encoder { + return dummyEncoder{} +} + +type dummyDecoder struct{} + +func (dummyDecoder) Decode(interface{}) error { + return errors.New("not implemented") +} + +type dummyEncoder struct{} + +func (dummyEncoder) Encode(interface{}) error { + return errors.New("not implemented") +} From 43effe4f872aaeb069cac8578da911a9ab6dbbe2 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 9 May 2016 17:05:49 +0900 Subject: [PATCH 026/552] Simplify control flow --- protoc-gen-swagger/genswagger/template.go | 338 ++++++++-------------- protoc-gen-swagger/genswagger/types.go | 9 +- 2 files changed, 125 insertions(+), 222 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index d163cabeee1..412763e1e9f 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -53,155 +53,112 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, if opt := msg.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { continue } - object := swaggerSchemaObject{ - Type: "object", - Properties: map[string]swaggerSchemaObject{}, + schema := swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "object", + }, + Properties: make(map[string]swaggerSchemaObject), } - for _, field := range msg.Fields { - fieldDescriptor := field.FieldDescriptorProto - mapEntry := false - if fieldMessage, err := reg.LookupMsg("", field.GetTypeName()); err == nil { - if opt := fieldMessage.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { - fieldDescriptor = fieldMessage.GetField()[1] - mapEntry = true - } - } + for _, f := range msg.Fields { + schema.Properties[f.GetName()] = schemaOfField(f, reg) + } + d[fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)] = schema + } +} - var fieldType, fieldFormat string - primitive := true - // Field type and format from http://swagger.io/specification/ in the - // "Data Types" table - switch fieldDescriptor.Type.String() { - case "TYPE_DOUBLE": - fieldType = "number" - fieldFormat = "double" - break - case "TYPE_FLOAT": - fieldType = "number" - fieldFormat = "float" - break - case "TYPE_INT64": - fieldType = "integer" - fieldFormat = "int64" - break - case "TYPE_UINT64": - fieldType = "integer" - fieldFormat = "int64" - break - case "TYPE_INT32": - fieldType = "integer" - fieldFormat = "int32" - break - case "TYPE_FIXED64": - fieldType = "integer" - fieldFormat = "int64" - break - case "TYPE_FIXED32": - fieldType = "integer" - fieldFormat = "int32" - break - case "TYPE_BOOL": - fieldType = "boolean" - fieldFormat = "boolean" - break - case "TYPE_STRING": - fieldType = "string" - fieldFormat = "string" - break - case "TYPE_GROUP": - // WTF is a group? is this sufficient? - primitive = false - break - case "TYPE_MESSAGE": - // Check in here if it is the special date/datetime proto and - // serialize as a primitive date object - primitive = false - fieldType = "" - fieldFormat = "" - break - case "TYPE_BYTES": - fieldType = "string" - fieldFormat = "byte" - break - case "TYPE_UINT32": - fieldType = "integer" - fieldFormat = "int64" - break - case "TYPE_ENUM": - primitive = false - fieldType = "" - fieldFormat = "" - break - case "TYPE_SFIXED32": - fieldType = "integer" - fieldFormat = "int32" - break - case "TYPE_SFIXED64": - fieldType = "integer" - fieldFormat = "int32" - break - case "TYPE_SINT32": - fieldType = "integer" - fieldFormat = "int32" - break - case "TYPE_SINT64": - fieldType = "integer" - fieldFormat = "int64" - break - default: - fieldType = field.FieldDescriptorProto.Type.String() - fieldFormat = "UNKNOWN" - } +// schemaOfField returns a swagger Schema Object for a protobuf field. +func schemaOfField(f *descriptor.Field, reg *descriptor.Registry) swaggerSchemaObject { + const ( + singular = 0 + array = 1 + object = 2 + ) + var ( + core schemaCore + aggregate int + ) - if primitive { - switch { - case mapEntry: - object.Properties[field.GetName()] = swaggerSchemaObject{ - Type: "object", - AdditionalProperties: &swaggerSchemaObject{ - Type: fieldType, - Format: fieldFormat, - }, - } - case field.FieldDescriptorProto.GetLabel() == pbdescriptor.FieldDescriptorProto_LABEL_REPEATED: - // If repeated render as an array of items. - object.Properties[field.GetName()] = swaggerSchemaObject{ - Type: "array", - Items: &swaggerItemsObject{ - Type: fieldType, - Format: fieldFormat, - }, - } - default: - object.Properties[field.GetName()] = swaggerSchemaObject{ - Type: fieldType, - Format: fieldFormat, - } - } - } else { - switch { - case mapEntry: - object.Properties[field.GetName()] = swaggerSchemaObject{ - Type: "object", - AdditionalProperties: &swaggerSchemaObject{ - Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(fieldDescriptor.GetTypeName(), reg), - }, - } - case field.FieldDescriptorProto.GetLabel() == pbdescriptor.FieldDescriptorProto_LABEL_REPEATED: - object.Properties[field.GetName()] = swaggerSchemaObject{ - Type: "array", - Items: &swaggerItemsObject{ - Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(field.GetTypeName(), reg), - }, - } - default: - object.Properties[field.GetName()] = swaggerSchemaObject{ - Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(field.GetTypeName(), reg), - } - } - } + fd := f.FieldDescriptorProto + if m, err := reg.LookupMsg("", f.GetTypeName()); err == nil { + if opt := m.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { + fd = m.GetField()[1] + aggregate = object } - d[fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)] = object + } + if fd.GetLabel() == pbdescriptor.FieldDescriptorProto_LABEL_REPEATED { + aggregate = array + } + + switch ft := fd.GetType(); ft { + case pbdescriptor.FieldDescriptorProto_TYPE_ENUM, pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE, pbdescriptor.FieldDescriptorProto_TYPE_GROUP: + core = schemaCore{ + Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(fd.GetTypeName(), reg), + } + default: + ftype, format, ok := primitiveSchema(ft) + if ok { + core = schemaCore{Type: ftype, Format: format} + } else { + core = schemaCore{Type: ft.String(), Format: "UNKNOWN"} + } + } + switch aggregate { + case array: + return swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "array", + }, + Items: (*swaggerItemsObject)(&core), + } + case object: + return swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "object", + }, + AdditionalProperties: &swaggerSchemaObject{schemaCore: core}, + } + default: + return swaggerSchemaObject{schemaCore: core} + } +} + +// primitiveSchema returns a pair of "Type" and "Format" in JSON Schema for +// the given primitive field type. +// The last return parameter is true iff the field type is actually primitive. +func primitiveSchema(t pbdescriptor.FieldDescriptorProto_Type) (ftype, format string, ok bool) { + switch t { + case pbdescriptor.FieldDescriptorProto_TYPE_DOUBLE: + return "number", "double", true + case pbdescriptor.FieldDescriptorProto_TYPE_FLOAT: + return "number", "float", true + case pbdescriptor.FieldDescriptorProto_TYPE_INT64: + return "integer", "int64", true + case pbdescriptor.FieldDescriptorProto_TYPE_UINT64: + return "integer", "int64", true + case pbdescriptor.FieldDescriptorProto_TYPE_INT32: + return "integer", "int32", true + case pbdescriptor.FieldDescriptorProto_TYPE_FIXED64: + return "integer", "int64", true + case pbdescriptor.FieldDescriptorProto_TYPE_FIXED32: + return "integer", "int32", true + case pbdescriptor.FieldDescriptorProto_TYPE_BOOL: + return "boolean", "boolean", true + case pbdescriptor.FieldDescriptorProto_TYPE_STRING: + return "string", "string", true + case pbdescriptor.FieldDescriptorProto_TYPE_BYTES: + return "string", "byte", true + case pbdescriptor.FieldDescriptorProto_TYPE_UINT32: + return "integer", "int64", true + case pbdescriptor.FieldDescriptorProto_TYPE_SFIXED32: + return "integer", "int32", true + case pbdescriptor.FieldDescriptorProto_TYPE_SFIXED64: + return "integer", "int32", true + case pbdescriptor.FieldDescriptorProto_TYPE_SINT32: + return "integer", "int32", true + case pbdescriptor.FieldDescriptorProto_TYPE_SINT64: + return "integer", "int64", true + default: + return "", "", false } } @@ -219,7 +176,9 @@ func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, r } d[fullyQualifiedNameToSwaggerName(enum.FQEN(), reg)] = swaggerSchemaObject{ - Type: "string", + schemaCore: schemaCore{ + Type: "string", + }, Enum: enumNames, Default: defaultValue, } @@ -345,79 +304,18 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re for _, parameter := range b.PathParams { var paramType, paramFormat string - switch parameter.Target.FieldDescriptorProto.Type.String() { - case "TYPE_DOUBLE": - paramType = "number" - paramFormat = "double" - break - case "TYPE_FLOAT": - paramType = "number" - paramFormat = "float" - break - case "TYPE_INT64": - paramType = "integer" - paramFormat = "int64" - break - case "TYPE_UINT64": - paramType = "integer" - paramFormat = "int64" - break - case "TYPE_INT32": - paramType = "integer" - paramFormat = "int32" - break - case "TYPE_FIXED64": - paramType = "integer" - paramFormat = "int64" - break - case "TYPE_FIXED32": - paramType = "integer" - paramFormat = "int32" - break - case "TYPE_BOOL": - paramType = "boolean" - paramFormat = "boolean" - break - case "TYPE_STRING": - paramType = "string" - paramFormat = "string" - break - case "TYPE_GROUP": - return fmt.Errorf("Groups are not allowed in the path for a HTTP RPC. Please use a primitive type instead (string, int64, etc)") - case "TYPE_MESSAGE": - return fmt.Errorf("Groups are not allowed in the path for a HTTP RPC. Please use a primitive type instead (string, int64, etc)") - case "TYPE_BYTES": - paramType = "string" - paramFormat = "byte" - break - case "TYPE_UINT32": - paramType = "integer" - paramFormat = "int64" - break - case "TYPE_ENUM": + switch pt := parameter.Target.GetType(); pt { + case pbdescriptor.FieldDescriptorProto_TYPE_GROUP, pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE: + return fmt.Errorf("only primitive types are allowed in path parameters") + case pbdescriptor.FieldDescriptorProto_TYPE_ENUM: paramType = fullyQualifiedNameToSwaggerName(parameter.Target.GetTypeName(), reg) paramFormat = "" - break - case "TYPE_SFIXED32": - paramType = "integer" - paramFormat = "int32" - break - case "TYPE_SFIXED64": - paramType = "integer" - paramFormat = "int32" - break - case "TYPE_SINT32": - paramType = "integer" - paramFormat = "int32" - break - case "TYPE_SINT64": - paramType = "integer" - paramFormat = "int64" - break default: - paramType = parameter.Target.FieldDescriptorProto.Type.String() - return fmt.Errorf("Detected field type of '" + paramType + "' which is unknown. Please use a primitive type (Ex: string, int64)") - + var ok bool + paramType, paramFormat, ok = primitiveSchema(pt) + if !ok { + return fmt.Errorf("unknown field type %v", pt) + } } parameters = append(parameters, swaggerParameterObject{ @@ -436,7 +334,9 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re In: "body", Required: true, Schema: &swaggerSchemaObject{ - Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)), + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)), + }, }, }) } @@ -454,7 +354,9 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re "default": swaggerResponseObject{ Description: "Description", Schema: swaggerSchemaObject{ - Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)), + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)), + }, }, }, }, diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 4cc8b538d7a..ba7c0fde490 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -69,13 +69,16 @@ type swaggerParameterObject struct { Schema *swaggerSchemaObject `json:"schema,omitempty"` } +// core part of schema, which is common to itemsObject and schemaObject. // http://swagger.io/specification/#itemsObject -type swaggerItemsObject struct { +type schemaCore struct { Type string `json:"type,omitempty"` Format string `json:"format,omitempty"` Ref string `json:"$ref,omitempty"` } +type swaggerItemsObject schemaCore + // http://swagger.io/specification/#responsesObject type swaggerResponsesObject map[string]swaggerResponseObject @@ -87,9 +90,7 @@ type swaggerResponseObject struct { // http://swagger.io/specification/#schemaObject type swaggerSchemaObject struct { - Ref string `json:"$ref,omitempty"` - Type string `json:"type,omitempty"` - Format string `json:"format,omitempty"` + schemaCore // Properties can be recursively defined Properties map[string]swaggerSchemaObject `json:"properties,omitempty"` AdditionalProperties *swaggerSchemaObject `json:"additionalProperties,omitempty"` From 15eba49c461fae8c8954731c68e70e3241c5a920 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 9 May 2016 22:34:07 +0900 Subject: [PATCH 027/552] Unify APIs of custom marshaler into SeveMuxOptions --- runtime/marshaler.go | 141 ----------------------------- runtime/marshaler_registry.go | 138 ++++++++++++++++++++++++++++ runtime/marshaler_registry_test.go | 116 ++++++++++++++++++++++++ runtime/marshaler_test.go | 119 ------------------------ runtime/mux.go | 12 +-- 5 files changed, 256 insertions(+), 270 deletions(-) create mode 100644 runtime/marshaler_registry.go create mode 100644 runtime/marshaler_registry_test.go delete mode 100644 runtime/marshaler_test.go diff --git a/runtime/marshaler.go b/runtime/marshaler.go index 58e327d9284..a7dbc0b43bd 100644 --- a/runtime/marshaler.go +++ b/runtime/marshaler.go @@ -2,149 +2,8 @@ package runtime import ( "io" - "net/http" ) -const mimeWildcard = "*" - -var ( - inboundDefaultMarshaler = new(JSONBuiltin) - outboundDefaultMarshaler = new(JSONBuiltin) - - contentTypeHeader = http.CanonicalHeaderKey("Content-Type") -) - -// MarshalerForRequest returns the inbound/outbound marshalers for this request. -// It checks the registry on the ServeMux for the MIME type set by the Content-Type header. -// If it isn't set (or the request Content-Type is empty), checks for "*". -// If that isn't set, uses the ServerMux's InboundMarshaler/OutboundMarshaler. -// If there are multiple Content-Type headers set, choose the first one that it can -// exactly match in the registry. -// Otherwise, it follows the above logic for "*"/InboundMarshaler/OutboundMarshaler. -func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) { - headerVals := append(append([]string(nil), r.Header[contentTypeHeader]...), "*") - - for _, val := range headerVals { - m := mux.MIMERegistry.lookup(val) - if m != nil { - if inbound == nil { - inbound = m.inbound - } - if outbound == nil { - outbound = m.outbound - } - } - if inbound != nil && outbound != nil { - // Got them both, return - return inbound, outbound - } - } - - if inbound == nil { - inbound = mux.InboundMarshaler - } - if inbound == nil { - inbound = inboundDefaultMarshaler - } - - if outbound == nil { - outbound = mux.OutboundMarshaler - } - if outbound == nil { - outbound = outboundDefaultMarshaler - } - - return inbound, outbound - -} - -// MarshalerMIMERegistry keeps a mapping from MIME types to mimeMarshalers. -type MarshalerMIMERegistry struct { - mimeMap map[string]*mimeMarshaler -} - -type mimeMarshaler struct { - inbound Marshaler - outbound Marshaler -} - -// AddMarshaler adds an inbound and outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). -// Inbound is the marshaler that is used when marshaling inbound requests from the client. -// Outbound is the marshaler that is used when marshaling outbound responses to the client. -func (m *MarshalerMIMERegistry) AddMarshaler(mime string, inbound, outbound Marshaler) { - - if len(mime) == 0 { - panic("Mime can't be an empty string") - } - - m.mimeMap[mime] = &mimeMarshaler{ - inbound: inbound, - outbound: outbound, - } - -} - -// AddInboundMarshaler adds an inbound marshaler for a case-sensitive MIME type string ("*" to match any MIME type). -// Inbound is the marshaler that is used when marshaling inbound requests from the client. -func (m *MarshalerMIMERegistry) AddInboundMarshaler(mime string, inbound Marshaler) { - - if len(mime) == 0 { - panic("Mime can't be an empty string") - } - - if _, ok := m.mimeMap[mime]; ok { - //Already have this mime, just change inbound - m.mimeMap[mime].inbound = inbound - } else { - m.mimeMap[mime] = &mimeMarshaler{ - inbound: inbound, - outbound: nil, - } - } - -} - -// AddOutboundMarshaler adds an outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). -// Outbound is the marshaler that is used when marshaling outbound responses to the client. -func (m *MarshalerMIMERegistry) AddOutboundMarshaler(mime string, outbound Marshaler) { - mime = http.CanonicalHeaderKey(mime) - if len(mime) == 0 { - panic("Mime can't be an empty string") - } - - if _, ok := m.mimeMap[mime]; ok { - //Already have this mime, just change outbound - m.mimeMap[mime].outbound = outbound - } else { - m.mimeMap[mime] = &mimeMarshaler{ - inbound: nil, - outbound: outbound, - } - } - -} - -func (m *MarshalerMIMERegistry) lookup(mime string) *mimeMarshaler { - if m == nil { - return nil - } - return m.mimeMap[mime] -} - -// NewMarshalerMIMERegistry returns a new registry of marshalers. -// It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces. -// -// For example, you could allow the client to specify the use of the runtime.JSONPb marshaler -// with a "applicaton/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler -// with a "application/json" Content-Type. -// "*" can be used to match any Content-Type. -// This can be attached to a ServerMux with the MIMERegistry option. -func NewMarshalerMIMERegistry() *MarshalerMIMERegistry { - return &MarshalerMIMERegistry{ - mimeMap: make(map[string]*mimeMarshaler), - } -} - // Marshaler defines a conversion between byte sequence and gRPC payloads / fields. type Marshaler interface { // Marshal marshals "v" into byte sequence. diff --git a/runtime/marshaler_registry.go b/runtime/marshaler_registry.go new file mode 100644 index 00000000000..c32230a063f --- /dev/null +++ b/runtime/marshaler_registry.go @@ -0,0 +1,138 @@ +package runtime + +import ( + "errors" + "net/http" +) + +const mimeWildcard = "*" + +var ( + inboundDefaultMarshaler = new(JSONBuiltin) + outboundDefaultMarshaler = new(JSONBuiltin) + + contentTypeHeader = http.CanonicalHeaderKey("Content-Type") +) + +// MarshalerForRequest returns the inbound/outbound marshalers for this request. +// It checks the registry on the ServeMux for the MIME type set by the Content-Type header. +// If it isn't set (or the request Content-Type is empty), checks for "*". +// If there are multiple Content-Type headers set, choose the first one that it can +// exactly match in the registry. +// Otherwise, it follows the above logic for "*"/InboundMarshaler/OutboundMarshaler. +func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) { + headerVals := append(append([]string(nil), r.Header[contentTypeHeader]...), "*") + + for _, val := range headerVals { + m := mux.marshalers.lookup(val) + if m != nil { + if inbound == nil { + inbound = m.inbound + } + if outbound == nil { + outbound = m.outbound + } + } + if inbound != nil && outbound != nil { + // Got them both, return + return inbound, outbound + } + } + if inbound == nil { + inbound = inboundDefaultMarshaler + } + if outbound == nil { + outbound = outboundDefaultMarshaler + } + return inbound, outbound + +} + +// marshalerRegistry keeps a mapping from MIME types to mimeMarshalers. +type marshalerRegistry map[string]*mimeMarshaler + +type mimeMarshaler struct { + inbound Marshaler + outbound Marshaler +} + +// addMarshaler adds an inbound and outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). +// Inbound is the marshaler that is used when marshaling inbound requests from the client. +// Outbound is the marshaler that is used when marshaling outbound responses to the client. +func (r *marshalerRegistry) add(mime string, inbound, outbound Marshaler) error { + if mime == "" { + return errors.New("empty MIME type") + } + (*r)[mime] = &mimeMarshaler{ + inbound: inbound, + outbound: outbound, + } + return nil +} + +// addInboundMarshaler adds an inbound marshaler for a case-sensitive MIME type string ("*" to match any MIME type). +// Inbound is the marshaler that is used when marshaling inbound requests from the client. +func (r *marshalerRegistry) addInbound(mime string, inbound Marshaler) error { + if mime == "" { + return errors.New("empty MIME type") + } + if entry := (*r)[mime]; entry != nil { + entry.inbound = inbound + return nil + } + (*r)[mime] = &mimeMarshaler{inbound: inbound} + return nil +} + +// addOutBound adds an outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). +// Outbound is the marshaler that is used when marshaling outbound responses to the client. +func (r *marshalerRegistry) addOutbound(mime string, outbound Marshaler) error { + mime = http.CanonicalHeaderKey(mime) + if mime == "" { + return errors.New("empty MIME type") + } + if entry := (*r)[mime]; entry != nil { + entry.outbound = outbound + return nil + } + (*r)[mime] = &mimeMarshaler{outbound: outbound} + return nil + +} + +func (r *marshalerRegistry) lookup(mime string) *mimeMarshaler { + if r == nil { + return nil + } + return (*r)[mime] +} + +// WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound +// Marshalers to a MIME type in mux. +func WithMarshalerOption(mime string, in, out Marshaler) ServeMuxOption { + return func(mux *ServeMux) { + if err := mux.marshalers.add(mime, in, out); err != nil { + panic(err) + } + } +} + +// WithInboundMarshalerOption returns a ServeMuxOption which associates an inbound +// Marshaler to a MIME type in mux. +func WithInboundMarshalerOption(mime string, in Marshaler) ServeMuxOption { + return func(mux *ServeMux) { + if err := mux.marshalers.addInbound(mime, in); err != nil { + panic(err) + } + } +} + +// WithOutboundMarshalerOption returns a ServeMuxOption which associates an outbound +// Marshaler to a MIME type in mux. +func WithOutboundMarshalerOption(mime string, out Marshaler) ServeMuxOption { + return func(mux *ServeMux) { + if err := mux.marshalers.addOutbound(mime, out); err != nil { + panic(err) + } + } +} diff --git a/runtime/marshaler_registry_test.go b/runtime/marshaler_registry_test.go new file mode 100644 index 00000000000..d9006ec12dd --- /dev/null +++ b/runtime/marshaler_registry_test.go @@ -0,0 +1,116 @@ +package runtime_test + +import ( + "errors" + "io" + "net/http" + "testing" + + "github.com/gengo/grpc-gateway/runtime" +) + +func TestMarshalerForRequest(t *testing.T) { + r, err := http.NewRequest("GET", "http://example.com", nil) + if err != nil { + t.Fatalf(`http.NewRequest("GET", "http://example.com", nil) failed with %v; want success`, err) + } + r.Header.Set("Content-Type", "application/x-example") + + mux := runtime.NewServeMux() + + in, out := runtime.MarshalerForRequest(mux, r) + if _, ok := in.(*runtime.JSONBuiltin); !ok { + t.Errorf("in = %#v; want a runtime.JSONBuiltin", in) + } + if _, ok := out.(*runtime.JSONBuiltin); !ok { + t.Errorf("out = %#v; want a runtime.JSONBuiltin", in) + } + + var marshalers [6]dummyMarshaler + specs := []struct { + opt runtime.ServeMuxOption + + wantIn runtime.Marshaler + wantOut runtime.Marshaler + }{ + { + opt: runtime.WithMarshalerOption("*", &marshalers[0], &marshalers[0]), + wantIn: &marshalers[0], + wantOut: &marshalers[0], + }, + { + opt: runtime.WithInboundMarshalerOption("*", &marshalers[1]), + wantIn: &marshalers[1], + wantOut: &marshalers[0], + }, + { + opt: runtime.WithOutboundMarshalerOption("application/x-example", &marshalers[2]), + wantIn: &marshalers[1], + wantOut: &marshalers[2], + }, + { + opt: runtime.WithInboundMarshalerOption("application/x-example", &marshalers[3]), + wantIn: &marshalers[3], + wantOut: &marshalers[2], + }, + { + opt: runtime.WithMarshalerOption("application/x-example", &marshalers[4], &marshalers[5]), + wantIn: &marshalers[4], + wantOut: &marshalers[5], + }, + } + for i, spec := range specs { + var opts []runtime.ServeMuxOption + for _, s := range specs[:i+1] { + opts = append(opts, s.opt) + } + mux = runtime.NewServeMux(opts...) + + in, out = runtime.MarshalerForRequest(mux, r) + if got, want := in, spec.wantIn; got != want { + t.Errorf("in = %#v; want %#v", got, want) + } + if got, want := out, spec.wantOut; got != want { + t.Errorf("out = %#v; want %#v", got, want) + } + } + + r.Header.Set("Content-Type", "application/x-another") + in, out = runtime.MarshalerForRequest(mux, r) + if got, want := in, &marshalers[1]; got != want { + t.Errorf("in = %#v; want %#v", got, want) + } + if got, want := out, &marshalers[0]; got != want { + t.Errorf("out = %#v; want %#v", got, want) + } +} + +type dummyMarshaler struct{} + +func (dummyMarshaler) ContentType() string { return "" } +func (dummyMarshaler) Marshal(interface{}) ([]byte, error) { + return nil, errors.New("not implemented") +} + +func (dummyMarshaler) Unmarshal([]byte, interface{}) error { + return errors.New("not implemented") +} + +func (dummyMarshaler) NewDecoder(r io.Reader) runtime.Decoder { + return dummyDecoder{} +} +func (dummyMarshaler) NewEncoder(w io.Writer) runtime.Encoder { + return dummyEncoder{} +} + +type dummyDecoder struct{} + +func (dummyDecoder) Decode(interface{}) error { + return errors.New("not implemented") +} + +type dummyEncoder struct{} + +func (dummyEncoder) Encode(interface{}) error { + return errors.New("not implemented") +} diff --git a/runtime/marshaler_test.go b/runtime/marshaler_test.go deleted file mode 100644 index c416471e7db..00000000000 --- a/runtime/marshaler_test.go +++ /dev/null @@ -1,119 +0,0 @@ -package runtime_test - -import ( - "errors" - "io" - "net/http" - "testing" - - "github.com/gengo/grpc-gateway/runtime" -) - -func TestMarshalerForRequest(t *testing.T) { - r, err := http.NewRequest("GET", "http://example.com", nil) - if err != nil { - t.Fatalf(`http.NewRequest("GET", "http://example.com", nil) failed with %v; want success`, err) - } - r.Header.Set("Content-Type", "application/x-example") - - reg := runtime.NewMarshalerMIMERegistry() - mux := runtime.NewServeMux() - mux.MIMERegistry = reg - - in, out := runtime.MarshalerForRequest(mux, r) - if _, ok := in.(*runtime.JSONBuiltin); !ok { - t.Errorf("in = %#v; want a runtime.JSONBuiltin", in) - } - if _, ok := out.(*runtime.JSONBuiltin); !ok { - t.Errorf("out = %#v; want a runtime.JSONBuiltin", in) - } - - m1 := new(dummyMarshaler) - reg.AddMarshaler("*", m1, m1) - in, out = runtime.MarshalerForRequest(mux, r) - if got, want := in, m1; got != want { - t.Errorf("in = %#v; want %#v", got, want) - } - if got, want := out, m1; got != want { - t.Errorf("out = %#v; want %#v", got, want) - } - - m2 := new(dummyMarshaler) - reg.AddInboundMarshaler("*", m2) - in, out = runtime.MarshalerForRequest(mux, r) - if got, want := in, m2; got != want { - t.Errorf("in = %#v; want %#v", got, want) - } - if got, want := out, m1; got != want { - t.Errorf("out = %#v; want %#v", got, want) - } - - m3 := new(dummyMarshaler) - reg.AddOutboundMarshaler("application/x-example", m3) - in, out = runtime.MarshalerForRequest(mux, r) - if got, want := in, m2; got != want { - t.Errorf("in = %#v; want %#v", got, want) - } - if got, want := out, m3; got != want { - t.Errorf("out = %#v; want %#v", got, want) - } - - m4 := new(dummyMarshaler) - reg.AddInboundMarshaler("application/x-example", m4) - in, out = runtime.MarshalerForRequest(mux, r) - if got, want := in, m4; got != want { - t.Errorf("in = %#v; want %#v", got, want) - } - if got, want := out, m3; got != want { - t.Errorf("out = %#v; want %#v", got, want) - } - - m5, m6 := new(dummyMarshaler), new(dummyMarshaler) - reg.AddMarshaler("application/x-example", m5, m6) - in, out = runtime.MarshalerForRequest(mux, r) - if got, want := in, m5; got != want { - t.Errorf("in = %#v; want %#v", got, want) - } - if got, want := out, m6; got != want { - t.Errorf("out = %#v; want %#v", got, want) - } - - r.Header.Set("Content-Type", "application/x-another") - in, out = runtime.MarshalerForRequest(mux, r) - if got, want := in, m2; got != want { - t.Errorf("in = %#v; want %#v", got, want) - } - if got, want := out, m1; got != want { - t.Errorf("out = %#v; want %#v", got, want) - } -} - -type dummyMarshaler struct{} - -func (dummyMarshaler) ContentType() string { return "" } -func (dummyMarshaler) Marshal(interface{}) ([]byte, error) { - return nil, errors.New("not implemented") -} - -func (dummyMarshaler) Unmarshal([]byte, interface{}) error { - return errors.New("not implemented") -} - -func (dummyMarshaler) NewDecoder(r io.Reader) runtime.Decoder { - return dummyDecoder{} -} -func (dummyMarshaler) NewEncoder(w io.Writer) runtime.Encoder { - return dummyEncoder{} -} - -type dummyDecoder struct{} - -func (dummyDecoder) Decode(interface{}) error { - return errors.New("not implemented") -} - -type dummyEncoder struct{} - -func (dummyEncoder) Encode(interface{}) error { - return errors.New("not implemented") -} diff --git a/runtime/mux.go b/runtime/mux.go index 943c8916122..27bc8da6b51 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -18,13 +18,7 @@ type ServeMux struct { // handlers maps HTTP method to a list of handlers. handlers map[string][]handler forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error - // InboundMarshaler is the marshaler that is used when marshaling inbound requests from - // a client. Defaults to runtime.JSONBuiltin - InboundMarshaler Marshaler - // OutbutMarshaler is the marshaler that is used when marshaling outbound responses to - // a client. Defaults to runtime.JSONBuiltin - OutboundMarshaler Marshaler - MIMERegistry *MarshalerMIMERegistry + marshalers marshalerRegistry } // ServeMuxOption is an option that can be given to a ServeMux on construction. @@ -47,9 +41,7 @@ func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ handlers: make(map[string][]handler), forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), - InboundMarshaler: &JSONBuiltin{}, - OutboundMarshaler: &JSONBuiltin{}, - MIMERegistry: nil, + marshalers: make(marshalerRegistry), } for _, opt := range opts { From c192832f31d561529bb4376a727568a3f611d904 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 10 May 2016 16:49:05 +0900 Subject: [PATCH 028/552] Support non-message fields in JSONPb marshaler It allows us to specify non-message fields in google.apis.HttpRule.body while using JSONPb marshaler --- runtime/marshal_jsonpb.go | 165 ++++++++++++++------ runtime/marshal_jsonpb_test.go | 265 +++++++++++++++++++++++++++++++++ 2 files changed, 388 insertions(+), 42 deletions(-) diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index 73a86a38f7c..6a6f02159ca 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -3,8 +3,9 @@ package runtime import ( "bytes" "encoding/json" - "errors" + "fmt" "io" + "reflect" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" @@ -39,79 +40,159 @@ func (*JSONPb) ContentType() string { // Currently it can marshal only proto.Message. // TODO(yugui) Support fields of primitive types in a message. func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { + if _, ok := v.(proto.Message); !ok { + return j.marshalNonProtoField(v) + } + + var buf bytes.Buffer + if err := j.marshalTo(&buf, v); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error { + p, ok := v.(proto.Message) + if !ok { + buf, err := j.marshalNonProtoField(v) + if err != nil { + return err + } + _, err = w.Write(buf) + return err + } m := &jsonpb.Marshaler{ EnumsAsInts: j.EnumsAsInts, EmitDefaults: j.EmitDefaults, Indent: j.Indent, OrigName: j.OrigName, } - p, ok := v.(proto.Message) - if !ok { - return nil, errors.New("interface is not proto.Message") - } + return m.Marshal(w, p) +} - var buf bytes.Buffer - if err := m.Marshal(&buf, p); err != nil { - return nil, err +// marshalNonProto marshals a non-message field of a protobuf message. +// This function does not correctly marshals arbitary data structure into JSON, +// but it is only capable of marshaling non-message field values of protobuf, +// i.e. primitive types, enums; pointers to primitives or enums; maps from +// integer/string types to primitives/enums/pointers to messages. +func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) { + rv := reflect.ValueOf(v) + for rv.Kind() == reflect.Ptr { + if rv.IsNil() { + return []byte("null"), nil + } + rv = rv.Elem() } - return buf.Bytes(), nil + if rv.Kind() == reflect.Map { + m := make(map[string]*json.RawMessage) + for _, k := range rv.MapKeys() { + buf, err := j.Marshal(rv.MapIndex(k).Interface()) + if err != nil { + return nil, err + } + m[fmt.Sprintf("%v", k.Interface())] = (*json.RawMessage)(&buf) + } + if j.Indent != "" { + return json.MarshalIndent(m, "", j.Indent) + } + return json.Marshal(m) + } + if enum, ok := rv.Interface().(protoEnum); ok && !j.EnumsAsInts { + return json.Marshal(enum.String()) + } + return json.Marshal(rv.Interface()) } // Unmarshal unmarshals JSON "data" into "v" // Currently it can marshal only proto.Message. // TODO(yugui) Support fields of primitive types in a message. func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { - r := bytes.NewReader(data) - p, ok := v.(proto.Message) - if !ok { - return errors.New("interface is not proto.Message") - } - return jsonpb.Unmarshal(r, p) + return unmarshalJSONPb(data, v) } // NewDecoder returns a Decoder which reads JSON stream from "r". func (j *JSONPb) NewDecoder(r io.Reader) Decoder { - return &jsonPbDecoder{decoder: json.NewDecoder(r)} + d := json.NewDecoder(r) + return DecoderFunc(func(v interface{}) error { return decodeJSONPb(d, v) }) } // NewEncoder returns an Encoder which writes JSON stream into "w". func (j *JSONPb) NewEncoder(w io.Writer) Encoder { - m := &jsonpb.Marshaler{ - EnumsAsInts: j.EnumsAsInts, - EmitDefaults: j.EmitDefaults, - Indent: j.Indent, - OrigName: j.OrigName, - } - - return &jsonPbEncoder{ - marshal: m, - writer: w, - } + return EncoderFunc(func(v interface{}) error { return j.marshalTo(w, v) }) } -type jsonPbDecoder struct { - decoder *json.Decoder +func unmarshalJSONPb(data []byte, v interface{}) error { + d := json.NewDecoder(bytes.NewReader(data)) + return decodeJSONPb(d, v) } -func (j *jsonPbDecoder) Decode(v interface{}) error { +func decodeJSONPb(d *json.Decoder, v interface{}) error { p, ok := v.(proto.Message) if !ok { - return errors.New("interface is not proto.Message") + return decodeNonProtoField(d, v) } - - return jsonpb.UnmarshalNext(j.decoder, p) + return jsonpb.UnmarshalNext(d, p) } -type jsonPbEncoder struct { - marshal *jsonpb.Marshaler - writer io.Writer +func decodeNonProtoField(d *json.Decoder, v interface{}) error { + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr { + return fmt.Errorf("%T is not a pointer", v) + } + for rv.Kind() == reflect.Ptr { + if rv.IsNil() { + rv.Set(reflect.New(rv.Type().Elem())) + } + rv = rv.Elem() + } + if rv.Kind() == reflect.Map { + if rv.IsNil() { + rv.Set(reflect.MakeMap(rv.Type())) + } + conv, ok := convFromType[rv.Type().Key().Kind()] + if !ok { + return fmt.Errorf("unsupported type of map field key: %v", rv.Type().Key()) + } + + m := make(map[string]*json.RawMessage) + if err := d.Decode(&m); err != nil { + return err + } + for k, v := range m { + result := conv.Call([]reflect.Value{reflect.ValueOf(k)}) + if err := result[1].Interface(); err != nil { + return err.(error) + } + bk := result[0] + bv := reflect.New(rv.Type().Elem()) + if err := unmarshalJSONPb([]byte(*v), bv.Interface()); err != nil { + return err + } + rv.SetMapIndex(bk, bv.Elem()) + } + return nil + } + if _, ok := rv.Interface().(protoEnum); ok { + var repr interface{} + if err := d.Decode(&repr); err != nil { + return err + } + switch repr.(type) { + case string: + // TODO(yugui) Should use proto.StructProperties? + return fmt.Errorf("unmarshaling of symbolic enum %q not supported: %T", repr, rv.Interface()) + case float64: + rv.Set(reflect.ValueOf(int32(repr.(float64))).Convert(rv.Type())) + return nil + default: + return fmt.Errorf("cannot assign %#v into Go type %T", repr, rv.Interface()) + } + } + return d.Decode(v) } -func (j *jsonPbEncoder) Encode(v interface{}) error { - p, ok := v.(proto.Message) - if !ok { - return errors.New("interface is not proto.Message") - } - return j.marshal.Marshal(j.writer, p) +type protoEnum interface { + fmt.Stringer + EnumDescriptor() ([]byte, []int) } diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index de401f1bc19..28a95f3b1fd 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -9,6 +9,7 @@ import ( "github.com/gengo/grpc-gateway/examples/examplepb" "github.com/gengo/grpc-gateway/runtime" "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" ) func TestJSONPbMarshal(t *testing.T) { @@ -107,6 +108,78 @@ func TestJSONPbMarshal(t *testing.T) { } } +func TestJSONPbMarshalNonProto(t *testing.T) { + var m runtime.JSONPb + for _, spec := range []struct { + val interface{} + want string + }{ + {val: int32(1), want: "1"}, + {val: proto.Int32(1), want: "1"}, + {val: int64(1), want: "1"}, + {val: proto.Int64(1), want: "1"}, + {val: uint32(1), want: "1"}, + {val: proto.Uint32(1), want: "1"}, + {val: uint64(1), want: "1"}, + {val: proto.Uint64(1), want: "1"}, + {val: "abc", want: `"abc"`}, + {val: proto.String("abc"), want: `"abc"`}, + {val: float32(1.5), want: "1.5"}, + {val: proto.Float32(1.5), want: "1.5"}, + {val: float64(1.5), want: "1.5"}, + {val: proto.Float64(1.5), want: "1.5"}, + {val: true, want: "true"}, + {val: false, want: "false"}, + {val: (*string)(nil), want: "null"}, + {val: examplepb.NumericEnum_ONE, want: `"ONE"`}, + { + val: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + want: `"ONE"`, + }, + { + val: map[string]int32{ + "foo": 1, + }, + want: `{"foo":1}`, + }, + { + val: map[string]*examplepb.SimpleMessage{ + "foo": {Id: "bar"}, + }, + want: `{"foo":{"id":"bar"}}`, + }, + { + val: map[int32]*examplepb.SimpleMessage{ + 1: {Id: "foo"}, + }, + want: `{"1":{"id":"foo"}}`, + }, + { + val: map[bool]*examplepb.SimpleMessage{ + true: {Id: "foo"}, + }, + want: `{"true":{"id":"foo"}}`, + }, + } { + buf, err := m.Marshal(spec.val) + if err != nil { + t.Errorf("m.Marshal(%#v) failed with %v; want success", spec.val, err) + } + if got, want := string(buf), spec.want; got != want { + t.Errorf("m.Marshal(%#v) = %q; want %q", spec.val, got, want) + } + } + + m.EnumsAsInts = true + buf, err := m.Marshal(examplepb.NumericEnum_ONE) + if err != nil { + t.Errorf("m.Marshal(%#v) failed with %v; want success", examplepb.NumericEnum_ONE, err) + } + if got, want := string(buf), "1"; got != want { + t.Errorf("m.Marshal(%#v) = %q; want %q", examplepb.NumericEnum_ONE, got, want) + } +} + func TestJSONPbUnmarshal(t *testing.T) { var ( m runtime.JSONPb @@ -182,6 +255,65 @@ func TestJSONPbUnmarshal(t *testing.T) { } } +func TestJSONPbUnmarshalNonProto(t *testing.T) { + var m runtime.JSONPb + for _, spec := range []struct { + input string + want interface{} + }{ + {input: "1", want: int32(1)}, + {input: "1", want: proto.Int32(1)}, + {input: "1", want: int64(1)}, + {input: "1", want: proto.Int64(1)}, + {input: "1", want: uint32(1)}, + {input: "1", want: proto.Uint32(1)}, + {input: "1", want: uint64(1)}, + {input: "1", want: proto.Uint64(1)}, + {input: `"abc"`, want: "abc"}, + {input: `"abc"`, want: proto.String("abc")}, + {input: "1.5", want: float32(1.5)}, + {input: "1.5", want: proto.Float32(1.5)}, + {input: "1.5", want: float64(1.5)}, + {input: "1.5", want: proto.Float64(1.5)}, + {input: "true", want: true}, + {input: "false", want: false}, + {input: "null", want: (*string)(nil)}, + // TODO(yugui) Support symbolic enum + // {input: `"ONE"`, want: examplepb.NumericEnum_ONE}, + {input: `1`, want: examplepb.NumericEnum_ONE}, + { + input: `1`, + want: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + }, + { + input: `{"foo":{"id":"bar"}}`, + want: map[string]*examplepb.SimpleMessage{ + "foo": {Id: "bar"}, + }, + }, + { + input: `{"1":{"id":"foo"}}`, + want: map[int32]*examplepb.SimpleMessage{ + 1: {Id: "foo"}, + }, + }, + { + input: `{"true":{"id":"foo"}}`, + want: map[bool]*examplepb.SimpleMessage{ + true: {Id: "foo"}, + }, + }, + } { + dest := reflect.New(reflect.TypeOf(spec.want)) + if err := m.Unmarshal([]byte(spec.input), dest.Interface()); err != nil { + t.Errorf("m.Unmarshal(%q, %T) failed with %v; want success", spec.input, dest.Interface(), err) + } + if got, want := dest.Elem().Interface(), spec.want; !reflect.DeepEqual(got, want) { + t.Errorf("dest = %#v; want %#v; input = %v", got, want, spec.input) + } + } +} + func TestJSONPbEncoder(t *testing.T) { msg := examplepb.ABitOfEverything{ Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", @@ -279,6 +411,79 @@ func TestJSONPbEncoder(t *testing.T) { } } +func TestJSONPbEncoderNonProto(t *testing.T) { + var m runtime.JSONPb + for _, spec := range []struct { + val interface{} + want string + }{ + {val: int32(1), want: "1"}, + {val: proto.Int32(1), want: "1"}, + {val: int64(1), want: "1"}, + {val: proto.Int64(1), want: "1"}, + {val: uint32(1), want: "1"}, + {val: proto.Uint32(1), want: "1"}, + {val: uint64(1), want: "1"}, + {val: proto.Uint64(1), want: "1"}, + {val: "abc", want: `"abc"`}, + {val: proto.String("abc"), want: `"abc"`}, + {val: float32(1.5), want: "1.5"}, + {val: proto.Float32(1.5), want: "1.5"}, + {val: float64(1.5), want: "1.5"}, + {val: proto.Float64(1.5), want: "1.5"}, + {val: true, want: "true"}, + {val: false, want: "false"}, + {val: (*string)(nil), want: "null"}, + {val: examplepb.NumericEnum_ONE, want: `"ONE"`}, + { + val: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + want: `"ONE"`, + }, + { + val: map[string]int32{ + "foo": 1, + }, + want: `{"foo":1}`, + }, + { + val: map[string]*examplepb.SimpleMessage{ + "foo": {Id: "bar"}, + }, + want: `{"foo":{"id":"bar"}}`, + }, + { + val: map[int32]*examplepb.SimpleMessage{ + 1: {Id: "foo"}, + }, + want: `{"1":{"id":"foo"}}`, + }, + { + val: map[bool]*examplepb.SimpleMessage{ + true: {Id: "foo"}, + }, + want: `{"true":{"id":"foo"}}`, + }, + } { + var buf bytes.Buffer + enc := m.NewEncoder(&buf) + if err := enc.Encode(spec.val); err != nil { + t.Errorf("enc.Encode(%#v) failed with %v; want success", spec.val, err) + } + if got, want := buf.String(), spec.want; got != want { + t.Errorf("m.Marshal(%#v) = %q; want %q", spec.val, got, want) + } + } + + m.EnumsAsInts = true + buf, err := m.Marshal(examplepb.NumericEnum_ONE) + if err != nil { + t.Errorf("m.Marshal(%#v) failed with %v; want success", examplepb.NumericEnum_ONE, err) + } + if got, want := string(buf), "1"; got != want { + t.Errorf("m.Marshal(%#v) = %q; want %q", examplepb.NumericEnum_ONE, got, want) + } +} + func TestJSONPbDecoder(t *testing.T) { var ( m runtime.JSONPb @@ -354,3 +559,63 @@ func TestJSONPbDecoder(t *testing.T) { } } } + +func TestJSONPbDecoderNonProto(t *testing.T) { + var m runtime.JSONPb + for _, spec := range []struct { + input string + want interface{} + }{ + {input: "1", want: int32(1)}, + {input: "1", want: proto.Int32(1)}, + {input: "1", want: int64(1)}, + {input: "1", want: proto.Int64(1)}, + {input: "1", want: uint32(1)}, + {input: "1", want: proto.Uint32(1)}, + {input: "1", want: uint64(1)}, + {input: "1", want: proto.Uint64(1)}, + {input: `"abc"`, want: "abc"}, + {input: `"abc"`, want: proto.String("abc")}, + {input: "1.5", want: float32(1.5)}, + {input: "1.5", want: proto.Float32(1.5)}, + {input: "1.5", want: float64(1.5)}, + {input: "1.5", want: proto.Float64(1.5)}, + {input: "true", want: true}, + {input: "false", want: false}, + {input: "null", want: (*string)(nil)}, + // TODO(yugui) Support symbolic enum + // {input: `"ONE"`, want: examplepb.NumericEnum_ONE}, + {input: `1`, want: examplepb.NumericEnum_ONE}, + { + input: `1`, + want: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + }, + { + input: `{"foo":{"id":"bar"}}`, + want: map[string]*examplepb.SimpleMessage{ + "foo": {Id: "bar"}, + }, + }, + { + input: `{"1":{"id":"foo"}}`, + want: map[int32]*examplepb.SimpleMessage{ + 1: {Id: "foo"}, + }, + }, + { + input: `{"true":{"id":"foo"}}`, + want: map[bool]*examplepb.SimpleMessage{ + true: {Id: "foo"}, + }, + }, + } { + dest := reflect.New(reflect.TypeOf(spec.want)) + dec := m.NewDecoder(strings.NewReader(spec.input)) + if err := dec.Decode(dest.Interface()); err != nil { + t.Errorf("dec.Decode(%T) failed with %v; want success; input = %q", dest.Interface(), err, spec.input) + } + if got, want := dest.Elem().Interface(), spec.want; !reflect.DeepEqual(got, want) { + t.Errorf("dest = %#v; want %#v; input = %v", got, want, spec.input) + } + } +} From dbccf70616fd85078a31ec69706ca04a0089ca2e Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 10 May 2016 17:57:14 +0900 Subject: [PATCH 029/552] Fix wrong marshal format of oneof fields in stream --- Makefile | 11 +++-- examples/integration_test.go | 86 ++++++++++++++++++++---------------- runtime/handler.go | 54 +++++++++------------- runtime/marshaler.go | 12 +++++ runtime/stream_chunk.pb.go | 58 ++++++++++++++++++++++++ runtime/stream_chunk.proto | 10 +++++ 6 files changed, 156 insertions(+), 75 deletions(-) create mode 100644 runtime/stream_chunk.pb.go create mode 100644 runtime/stream_chunk.proto diff --git a/Makefile b/Makefile index 01828324c49..34e364b6921 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,9 @@ OPTIONS_PROTO=$(GOOGLEAPIS_DIR)/google/api/annotations.proto $(GOOGLEAPIS_DIR)/g OPTIONS_GO=$(OPTIONS_PROTO:.proto=.pb.go) OUTPUT_DIR=_output +RUNTIME_PROTO=runtime/stream_chunk.proto +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 @@ -54,7 +57,7 @@ EXAMPLE_DEPS=examples/sub/message.proto examples/sub2/message.proto EXAMPLE_DEPSRCS=$(EXAMPLE_DEPS:.proto=.pb.go) PROTOC_INC_PATH=$(dir $(shell which protoc))/../include -generate: $(OPTIONS_GO) +generate: $(OPTIONS_GO) $(RUNTIME_GO) .SUFFIXES: .go .proto @@ -63,9 +66,11 @@ $(GO_PLUGIN): go build -o $@ $(GO_PLUGIN_PKG) $(OPTIONS_GO): $(OPTIONS_PROTO) $(GO_PLUGIN) - protoc -I $(PROTOC_INC_PATH) -I$(GOOGLEAPIS_DIR) --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP):$(GOOGLEAPIS_DIR) $(OPTIONS_PROTO) + protoc -I $(PROTOC_INC_PATH) -I$(GOOGLEAPIS_DIR) --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP):$(GOOGLEAPIS_DIR) $(OPTIONS_PROTO) +$(RUNTIME_GO): $(RUNTIME_PROTO) $(GO_PLUGIN) + protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP):. $(RUNTIME_PROTO) -$(GATEWAY_PLUGIN): $(OPTIONS_GO) $(GATEWAY_PLUGIN_SRC) +$(GATEWAY_PLUGIN): $(OPTIONS_GO) $(RUNTIME_GO) $(GATEWAY_PLUGIN_SRC) go build -o $@ $(GATEWAY_PLUGIN_PKG) $(SWAGGER_PLUGIN): $(OPTIONS_GO) $(SWAGGER_PLUGIN_SRC) diff --git a/examples/integration_test.go b/examples/integration_test.go index 426f4ce49b2..9425a7bb6ef 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -1,7 +1,6 @@ package main import ( - "bytes" "encoding/json" "fmt" "io" @@ -13,13 +12,13 @@ import ( "testing" "time" - "golang.org/x/net/context" - gw "github.com/gengo/grpc-gateway/examples/examplepb" server "github.com/gengo/grpc-gateway/examples/server" sub "github.com/gengo/grpc-gateway/examples/sub" "github.com/gengo/grpc-gateway/runtime" + "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + "golang.org/x/net/context" "google.golang.org/grpc/codes" ) @@ -97,8 +96,8 @@ func testEcho(t *testing.T, port int, contentType string) { } var msg gw.SimpleMessage - if err := json.Unmarshal(buf, &msg); err != nil { - t.Errorf("json.Unmarshal(%s, &msg) failed with %v; want success", buf, err) + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) return } if got, want := msg.Id, "myid"; got != want { @@ -112,19 +111,20 @@ func testEcho(t *testing.T, port int, contentType string) { func testEchoBody(t *testing.T) { sent := gw.SimpleMessage{Id: "example"} - buf, err := json.Marshal(sent) + var m jsonpb.Marshaler + payload, err := m.MarshalToString(&sent) if err != nil { - t.Fatalf("json.Marshal(%#v) failed with %v; want success", sent, err) + t.Fatalf("m.MarshalToString(%#v) failed with %v; want success", payload, err) } url := "http://localhost:8080/v1/example/echo_body" - resp, err := http.Post(url, "", bytes.NewReader(buf)) + resp, err := http.Post(url, "", strings.NewReader(payload)) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", url, err) return } defer resp.Body.Close() - buf, err = ioutil.ReadAll(resp.Body) + buf, err := ioutil.ReadAll(resp.Body) if err != nil { t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) return @@ -136,8 +136,8 @@ func testEchoBody(t *testing.T) { } var received gw.SimpleMessage - if err := json.Unmarshal(buf, &received); err != nil { - t.Errorf("json.Unmarshal(%s, &msg) failed with %v; want success", buf, err) + if err := jsonpb.UnmarshalString(string(buf), &received); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) return } if got, want := received, sent; !reflect.DeepEqual(got, want) { @@ -197,8 +197,8 @@ func testABECreate(t *testing.T) { } var msg gw.ABitOfEverything - if err := json.Unmarshal(buf, &msg); err != nil { - t.Errorf("json.Unmarshal(%s, &msg) failed with %v; want success", buf, err) + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) return } if msg.Uuid == "" { @@ -240,18 +240,19 @@ func testABECreateBody(t *testing.T) { }, } url := "http://localhost:8080/v1/example/a_bit_of_everything" - buf, err := json.Marshal(want) + var m jsonpb.Marshaler + payload, err := m.MarshalToString(&want) if err != nil { - t.Fatalf("json.Marshal(%#v) failed with %v; want success", want, err) + t.Fatalf("m.MarshalToString(%#v) failed with %v; want success", want, err) } - resp, err := http.Post(url, "application/json", bytes.NewReader(buf)) + resp, err := http.Post(url, "application/json", strings.NewReader(payload)) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", url, err) return } defer resp.Body.Close() - buf, err = ioutil.ReadAll(resp.Body) + buf, err := ioutil.ReadAll(resp.Body) if err != nil { t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) return @@ -263,8 +264,8 @@ func testABECreateBody(t *testing.T) { } var msg gw.ABitOfEverything - if err := json.Unmarshal(buf, &msg); err != nil { - t.Errorf("json.Unmarshal(%s, &msg) failed with %v; want success", buf, err) + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) return } if msg.Uuid == "" { @@ -316,16 +317,12 @@ func testABEBulkCreate(t *testing.T) { }, }, } - buf, err := json.Marshal(want) - if err != nil { - t.Fatalf("json.Marshal(%#v) failed with %v; want success", want, err) - } - if _, err := w.Write(buf); err != nil { - t.Errorf("w.Write(%s) failed with %v; want success", buf, err) - return + var m jsonpb.Marshaler + if err := m.Marshal(w, &want); err != nil { + t.Fatalf("m.Marshal(%#v, w) failed with %v; want success", want, err) } if _, err := io.WriteString(w, "\n"); err != nil { - t.Errorf("w.Write(%s) failed with %v; want success", buf, err) + t.Errorf("w.Write(%q) failed with %v; want success", "\n", err) return } count++ @@ -350,8 +347,8 @@ func testABEBulkCreate(t *testing.T) { } var msg gw.EmptyMessage - if err := json.Unmarshal(buf, &msg); err != nil { - t.Errorf("json.Unmarshal(%s, &msg) failed with %v; want success", buf, err) + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) return } @@ -389,8 +386,8 @@ func testABELookup(t *testing.T) { } var want gw.ABitOfEverything - if err := json.Unmarshal(buf, &want); err != nil { - t.Errorf("json.Unmarshal(%s, &want) failed with %v; want success", buf, err) + if err := jsonpb.UnmarshalString(string(buf), &want); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &want) failed with %v; want success", buf, err) return } @@ -409,8 +406,8 @@ func testABELookup(t *testing.T) { } var msg gw.ABitOfEverything - if err := json.Unmarshal(buf, &msg); err != nil { - t.Errorf("json.Unmarshal(%s, &msg) failed with %v; want success", buf, err) + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) return } if got := msg; !reflect.DeepEqual(got, want) { @@ -447,7 +444,7 @@ func testABELookupNotFound(t *testing.T) { var msg errorBody if err := json.Unmarshal(buf, &msg); err != nil { - t.Errorf("json.Unmarshal(%s, &msg) failed with %v; want success", buf, err) + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) return } @@ -473,13 +470,24 @@ func testABEList(t *testing.T) { dec := json.NewDecoder(resp.Body) var i int for i = 0; ; i++ { - var msg gw.ABitOfEverything - err := dec.Decode(&msg) + var item struct { + Result json.RawMessage `json:"result"` + Error map[string]interface{} `json:"error"` + } + err := dec.Decode(&item) if err == io.EOF { break } if err != nil { - t.Errorf("dec.Decode(&msg) failed with %v; want success; i = %d", err, i) + t.Errorf("dec.Decode(&item) failed with %v; want success; i = %d", err, i) + } + if len(item.Error) != 0 { + t.Errorf("item.Error = %#v; want empty; i = %d", item.Error, i) + continue + } + var msg gw.ABitOfEverything + if err := jsonpb.UnmarshalString(string(item.Result), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", item.Result, err) } } if i <= 0 { @@ -548,8 +556,8 @@ func testAdditionalBindings(t *testing.T) { } var msg sub.StringMessage - if err := json.Unmarshal(buf, &msg); err != nil { - t.Errorf("json.Unmarshal(%s, &msg) failed with %v; want success; %d", buf, err, i) + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success; %d", buf, err, i) return } if got, want := msg.GetValue(), "hello"; got != want { diff --git a/runtime/handler.go b/runtime/handler.go index ca113bc7c29..52ac0b3dce4 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -12,28 +12,6 @@ import ( "google.golang.org/grpc/grpclog" ) -type responseStreamChunk struct { - Result proto.Message `json:"result,omitempty"` - Error *responseStreamError `json:"error,omitempty"` -} - -//Make this also conform to proto.Message for builtin JSONPb Marshaler -func (m *responseStreamChunk) Reset() { *m = responseStreamChunk{} } -func (m *responseStreamChunk) String() string { return proto.CompactTextString(m) } -func (*responseStreamChunk) ProtoMessage() {} - -type responseStreamError struct { - GrpcCode int `json:"grpc_code,omitempty"` - HTTPCode int `json:"http_code,omitempty"` - Message string `json:"message,omitempty"` - HTTPStatus string `json:"http_status,omitempty"` -} - -//Make this also conform to proto.Message for builtin JSONPb Marshaler -func (m *responseStreamError) Reset() { *m = responseStreamError{} } -func (m *responseStreamError) String() string { return proto.CompactTextString(m) } -func (*responseStreamError) ProtoMessage() {} - // ForwardResponseStream forwards the stream from gRPC server to REST client. func ForwardResponseStream(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { f, ok := w.(http.Flusher) @@ -73,7 +51,7 @@ func ForwardResponseStream(ctx context.Context, marshaler Marshaler, w http.Resp return } - buf, err := marshaler.Marshal(&responseStreamChunk{Result: resp}) + buf, err := marshaler.Marshal(streamChunk(resp, nil)) if err != nil { grpclog.Printf("Failed to marshal response chunk: %v", err) return @@ -154,16 +132,7 @@ func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, re } func handleForwardResponseStreamError(marshaler Marshaler, w http.ResponseWriter, err error) { - grpcCode := grpc.Code(err) - httpCode := HTTPStatusFromCode(grpcCode) - resp := &responseStreamChunk{ - Error: &responseStreamError{ - GrpcCode: int(grpcCode), - HTTPCode: httpCode, - Message: err.Error(), - HTTPStatus: http.StatusText(httpCode), - }} - buf, merr := marshaler.Marshal(resp) + buf, merr := marshaler.Marshal(streamChunk(nil, err)) if merr != nil { grpclog.Printf("Failed to marshal an error: %v", merr) return @@ -173,3 +142,22 @@ func handleForwardResponseStreamError(marshaler Marshaler, w http.ResponseWriter return } } + +func streamChunk(result proto.Message, err error) map[string]proto.Message { + if err != nil { + grpcCode := grpc.Code(err) + httpCode := HTTPStatusFromCode(grpcCode) + return map[string]proto.Message{ + "error": &StreamError{ + GrpcCode: int32(grpcCode), + HttpCode: int32(httpCode), + Message: err.Error(), + HttpStatus: http.StatusText(httpCode), + }, + } + } + if result == nil { + return streamChunk(nil, fmt.Errorf("empty response")) + } + return map[string]proto.Message{"result": result} +} diff --git a/runtime/marshaler.go b/runtime/marshaler.go index a7dbc0b43bd..6d434f13cb4 100644 --- a/runtime/marshaler.go +++ b/runtime/marshaler.go @@ -28,3 +28,15 @@ type Decoder interface { type Encoder interface { Encode(v interface{}) error } + +// DecoderFunc adapts an decoder function into Decoder. +type DecoderFunc func(v interface{}) error + +// Decode delegates invocations to the underlying function itself. +func (f DecoderFunc) Decode(v interface{}) error { return f(v) } + +// EncoderFunc adapts an encoder function into Encoder +type EncoderFunc func(v interface{}) error + +// Encode delegates invocations to the underlying function itself. +func (f EncoderFunc) Encode(v interface{}) error { return f(v) } diff --git a/runtime/stream_chunk.pb.go b/runtime/stream_chunk.pb.go new file mode 100644 index 00000000000..bdd065f910a --- /dev/null +++ b/runtime/stream_chunk.pb.go @@ -0,0 +1,58 @@ +// Code generated by protoc-gen-go. +// source: runtime/stream_chunk.proto +// DO NOT EDIT! + +/* +Package runtime is a generated protocol buffer package. + +It is generated from these files: + runtime/stream_chunk.proto + +It has these top-level messages: + StreamError +*/ +package runtime + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +const _ = proto.ProtoPackageIsVersion1 + +type StreamError struct { + GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode" json:"grpc_code,omitempty"` + HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode" json:"http_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` + HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus" json:"http_status,omitempty"` +} + +func (m *StreamError) Reset() { *m = StreamError{} } +func (m *StreamError) String() string { return proto.CompactTextString(m) } +func (*StreamError) ProtoMessage() {} +func (*StreamError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func init() { + proto.RegisterType((*StreamError)(nil), "gengo.grpc.gateway.runtime.StreamError") +} + +var fileDescriptor0 = []byte{ + // 175 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0x8e, 0xbd, 0x0e, 0x82, 0x30, + 0x14, 0x85, 0x83, 0x7f, 0x48, 0xd9, 0x98, 0x1a, 0x1c, 0x34, 0x4e, 0x4e, 0x75, 0xf0, 0x0d, 0x34, + 0xbe, 0x00, 0x6c, 0x2e, 0xa4, 0xe2, 0x4d, 0x31, 0x06, 0x4a, 0x6e, 0x6f, 0x63, 0x5c, 0x7d, 0x72, + 0xe9, 0x05, 0xc7, 0xf3, 0x7d, 0xe7, 0x24, 0x47, 0xe4, 0xe8, 0x3b, 0x7a, 0xb6, 0x70, 0x74, 0x84, + 0xa0, 0xdb, 0xaa, 0x6e, 0x7c, 0xf7, 0x52, 0x3d, 0x5a, 0xb2, 0x59, 0x6e, 0xa0, 0x33, 0x56, 0x19, + 0xec, 0x6b, 0x65, 0x34, 0xc1, 0x5b, 0x7f, 0xd4, 0x54, 0xdf, 0x7f, 0x23, 0x91, 0x96, 0x3c, 0xb9, + 0x22, 0x5a, 0xcc, 0x36, 0x22, 0x09, 0xbd, 0xaa, 0xb6, 0x0f, 0x90, 0xd1, 0x2e, 0x3a, 0x2c, 0x8b, + 0x75, 0x00, 0x97, 0x21, 0x07, 0xd9, 0x10, 0xf5, 0xa3, 0x9c, 0x8d, 0x32, 0x00, 0x96, 0x52, 0xc4, + 0x2d, 0x38, 0xa7, 0x0d, 0xc8, 0xf9, 0xa0, 0x92, 0xe2, 0x1f, 0xb3, 0xad, 0x48, 0x79, 0xe6, 0x48, + 0x93, 0x77, 0x72, 0xc1, 0x56, 0x04, 0x54, 0x32, 0x39, 0x27, 0xb7, 0x78, 0xfa, 0x73, 0x5f, 0xf1, + 0xe5, 0xd3, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x19, 0x38, 0x42, 0xd0, 0x00, 0x00, 0x00, +} diff --git a/runtime/stream_chunk.proto b/runtime/stream_chunk.proto new file mode 100644 index 00000000000..f419ec7bd44 --- /dev/null +++ b/runtime/stream_chunk.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package gengo.grpc.gateway.runtime; +option go_package = "runtime"; + +message StreamError { + int32 grpc_code = 1; + int32 http_code = 2; + string message = 3; + string http_status = 4; +} From a2c3ae5c6bac92fd3ebd3447e6e00b353230f347 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 9 May 2016 22:38:21 +0900 Subject: [PATCH 030/552] Make JSONPb default --- runtime/marshaler_registry.go | 7 +++---- runtime/marshaler_registry_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/runtime/marshaler_registry.go b/runtime/marshaler_registry.go index c32230a063f..bc98a6ef1a5 100644 --- a/runtime/marshaler_registry.go +++ b/runtime/marshaler_registry.go @@ -8,8 +8,7 @@ import ( const mimeWildcard = "*" var ( - inboundDefaultMarshaler = new(JSONBuiltin) - outboundDefaultMarshaler = new(JSONBuiltin) + defaultMarshaler = &JSONPb{OrigName: true} contentTypeHeader = http.CanonicalHeaderKey("Content-Type") ) @@ -39,10 +38,10 @@ func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, out } } if inbound == nil { - inbound = inboundDefaultMarshaler + inbound = defaultMarshaler } if outbound == nil { - outbound = outboundDefaultMarshaler + outbound = defaultMarshaler } return inbound, outbound diff --git a/runtime/marshaler_registry_test.go b/runtime/marshaler_registry_test.go index d9006ec12dd..38a47b462cd 100644 --- a/runtime/marshaler_registry_test.go +++ b/runtime/marshaler_registry_test.go @@ -19,11 +19,11 @@ func TestMarshalerForRequest(t *testing.T) { mux := runtime.NewServeMux() in, out := runtime.MarshalerForRequest(mux, r) - if _, ok := in.(*runtime.JSONBuiltin); !ok { - t.Errorf("in = %#v; want a runtime.JSONBuiltin", in) + if _, ok := in.(*runtime.JSONPb); !ok { + t.Errorf("in = %#v; want a runtime.JSONPb", in) } - if _, ok := out.(*runtime.JSONBuiltin); !ok { - t.Errorf("out = %#v; want a runtime.JSONBuiltin", in) + if _, ok := out.(*runtime.JSONPb); !ok { + t.Errorf("out = %#v; want a runtime.JSONPb", in) } var marshalers [6]dummyMarshaler From 29a87eb793b5fa614cc7e23f6bf7c2e8d198a531 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 10 May 2016 23:07:37 +0900 Subject: [PATCH 031/552] Support more types in JSONPb marshaler --- examples/integration_test.go | 16 ++ runtime/marshal_jsonpb.go | 5 + runtime/marshal_jsonpb_test.go | 385 ++++++++++++++++----------------- 3 files changed, 206 insertions(+), 200 deletions(-) diff --git a/examples/integration_test.go b/examples/integration_test.go index 9425a7bb6ef..c004da89507 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -238,6 +238,22 @@ func testABECreateBody(t *testing.T) { Amount: 20, }, }, + RepeatedStringValue: []string{"a", "b", "c"}, + OneofValue: &gw.ABitOfEverything_OneofString{ + OneofString: "x", + }, + MapValue: map[string]gw.NumericEnum{ + "a": gw.NumericEnum_ONE, + "b": gw.NumericEnum_ZERO, + }, + MappedStringValue: map[string]string{ + "a": "x", + "b": "y", + }, + MappedNestedValue: map[string]*gw.ABitOfEverything_Nested{ + "a": {Name: "x", Amount: 1}, + "b": {Name: "y", Amount: 2}, + }, } url := "http://localhost:8080/v1/example/a_bit_of_everything" var m jsonpb.Marshaler diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index 6a6f02159ca..ac43434c7c8 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -144,6 +144,9 @@ func decodeNonProtoField(d *json.Decoder, v interface{}) error { if rv.IsNil() { rv.Set(reflect.New(rv.Type().Elem())) } + if rv.Type().ConvertibleTo(typeProtoMessage) { + return jsonpb.UnmarshalNext(d, rv.Interface().(proto.Message)) + } rv = rv.Elem() } if rv.Kind() == reflect.Map { @@ -196,3 +199,5 @@ type protoEnum interface { fmt.Stringer EnumDescriptor() ([]byte, []int) } + +var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem() diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index 28a95f3b1fd..9b72f6d9ee3 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -10,6 +10,11 @@ import ( "github.com/gengo/grpc-gateway/runtime" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/duration" + "github.com/golang/protobuf/ptypes/empty" + structpb "github.com/golang/protobuf/ptypes/struct" + "github.com/golang/protobuf/ptypes/timestamp" + "github.com/golang/protobuf/ptypes/wrappers" ) func TestJSONPbMarshal(t *testing.T) { @@ -108,59 +113,12 @@ func TestJSONPbMarshal(t *testing.T) { } } -func TestJSONPbMarshalNonProto(t *testing.T) { +func TestJSONPbMarshalFields(t *testing.T) { var m runtime.JSONPb for _, spec := range []struct { val interface{} want string - }{ - {val: int32(1), want: "1"}, - {val: proto.Int32(1), want: "1"}, - {val: int64(1), want: "1"}, - {val: proto.Int64(1), want: "1"}, - {val: uint32(1), want: "1"}, - {val: proto.Uint32(1), want: "1"}, - {val: uint64(1), want: "1"}, - {val: proto.Uint64(1), want: "1"}, - {val: "abc", want: `"abc"`}, - {val: proto.String("abc"), want: `"abc"`}, - {val: float32(1.5), want: "1.5"}, - {val: proto.Float32(1.5), want: "1.5"}, - {val: float64(1.5), want: "1.5"}, - {val: proto.Float64(1.5), want: "1.5"}, - {val: true, want: "true"}, - {val: false, want: "false"}, - {val: (*string)(nil), want: "null"}, - {val: examplepb.NumericEnum_ONE, want: `"ONE"`}, - { - val: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), - want: `"ONE"`, - }, - { - val: map[string]int32{ - "foo": 1, - }, - want: `{"foo":1}`, - }, - { - val: map[string]*examplepb.SimpleMessage{ - "foo": {Id: "bar"}, - }, - want: `{"foo":{"id":"bar"}}`, - }, - { - val: map[int32]*examplepb.SimpleMessage{ - 1: {Id: "foo"}, - }, - want: `{"1":{"id":"foo"}}`, - }, - { - val: map[bool]*examplepb.SimpleMessage{ - true: {Id: "foo"}, - }, - want: `{"true":{"id":"foo"}}`, - }, - } { + }{} { buf, err := m.Marshal(spec.val) if err != nil { t.Errorf("m.Marshal(%#v) failed with %v; want success", spec.val, err) @@ -255,61 +213,19 @@ func TestJSONPbUnmarshal(t *testing.T) { } } -func TestJSONPbUnmarshalNonProto(t *testing.T) { +func TestJSONPbUnmarshalFields(t *testing.T) { var m runtime.JSONPb - for _, spec := range []struct { - input string - want interface{} - }{ - {input: "1", want: int32(1)}, - {input: "1", want: proto.Int32(1)}, - {input: "1", want: int64(1)}, - {input: "1", want: proto.Int64(1)}, - {input: "1", want: uint32(1)}, - {input: "1", want: proto.Uint32(1)}, - {input: "1", want: uint64(1)}, - {input: "1", want: proto.Uint64(1)}, - {input: `"abc"`, want: "abc"}, - {input: `"abc"`, want: proto.String("abc")}, - {input: "1.5", want: float32(1.5)}, - {input: "1.5", want: proto.Float32(1.5)}, - {input: "1.5", want: float64(1.5)}, - {input: "1.5", want: proto.Float64(1.5)}, - {input: "true", want: true}, - {input: "false", want: false}, - {input: "null", want: (*string)(nil)}, - // TODO(yugui) Support symbolic enum - // {input: `"ONE"`, want: examplepb.NumericEnum_ONE}, - {input: `1`, want: examplepb.NumericEnum_ONE}, - { - input: `1`, - want: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), - }, - { - input: `{"foo":{"id":"bar"}}`, - want: map[string]*examplepb.SimpleMessage{ - "foo": {Id: "bar"}, - }, - }, - { - input: `{"1":{"id":"foo"}}`, - want: map[int32]*examplepb.SimpleMessage{ - 1: {Id: "foo"}, - }, - }, - { - input: `{"true":{"id":"foo"}}`, - want: map[bool]*examplepb.SimpleMessage{ - true: {Id: "foo"}, - }, - }, - } { - dest := reflect.New(reflect.TypeOf(spec.want)) - if err := m.Unmarshal([]byte(spec.input), dest.Interface()); err != nil { - t.Errorf("m.Unmarshal(%q, %T) failed with %v; want success", spec.input, dest.Interface(), err) + for _, fixt := range fieldFixtures { + if fixt.skipUnmarshal { + continue + } + + dest := reflect.New(reflect.TypeOf(fixt.data)) + if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err != nil { + t.Errorf("m.Unmarshal(%q, %T) failed with %v; want success", fixt.json, dest.Interface(), err) } - if got, want := dest.Elem().Interface(), spec.want; !reflect.DeepEqual(got, want) { - t.Errorf("dest = %#v; want %#v; input = %v", got, want, spec.input) + if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) { + t.Errorf("dest = %#v; want %#v; input = %v", got, want, fixt.json) } } } @@ -411,66 +327,16 @@ func TestJSONPbEncoder(t *testing.T) { } } -func TestJSONPbEncoderNonProto(t *testing.T) { +func TestJSONPbEncoderFields(t *testing.T) { var m runtime.JSONPb - for _, spec := range []struct { - val interface{} - want string - }{ - {val: int32(1), want: "1"}, - {val: proto.Int32(1), want: "1"}, - {val: int64(1), want: "1"}, - {val: proto.Int64(1), want: "1"}, - {val: uint32(1), want: "1"}, - {val: proto.Uint32(1), want: "1"}, - {val: uint64(1), want: "1"}, - {val: proto.Uint64(1), want: "1"}, - {val: "abc", want: `"abc"`}, - {val: proto.String("abc"), want: `"abc"`}, - {val: float32(1.5), want: "1.5"}, - {val: proto.Float32(1.5), want: "1.5"}, - {val: float64(1.5), want: "1.5"}, - {val: proto.Float64(1.5), want: "1.5"}, - {val: true, want: "true"}, - {val: false, want: "false"}, - {val: (*string)(nil), want: "null"}, - {val: examplepb.NumericEnum_ONE, want: `"ONE"`}, - { - val: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), - want: `"ONE"`, - }, - { - val: map[string]int32{ - "foo": 1, - }, - want: `{"foo":1}`, - }, - { - val: map[string]*examplepb.SimpleMessage{ - "foo": {Id: "bar"}, - }, - want: `{"foo":{"id":"bar"}}`, - }, - { - val: map[int32]*examplepb.SimpleMessage{ - 1: {Id: "foo"}, - }, - want: `{"1":{"id":"foo"}}`, - }, - { - val: map[bool]*examplepb.SimpleMessage{ - true: {Id: "foo"}, - }, - want: `{"true":{"id":"foo"}}`, - }, - } { + for _, fixt := range fieldFixtures { var buf bytes.Buffer enc := m.NewEncoder(&buf) - if err := enc.Encode(spec.val); err != nil { - t.Errorf("enc.Encode(%#v) failed with %v; want success", spec.val, err) + if err := enc.Encode(fixt.data); err != nil { + t.Errorf("enc.Encode(%#v) failed with %v; want success", fixt.data, err) } - if got, want := buf.String(), spec.want; got != want { - t.Errorf("m.Marshal(%#v) = %q; want %q", spec.val, got, want) + if got, want := buf.String(), fixt.json; got != want { + t.Errorf("enc.Encode(%#v) = %q; want %q", fixt.data, got, want) } } @@ -560,62 +426,181 @@ func TestJSONPbDecoder(t *testing.T) { } } -func TestJSONPbDecoderNonProto(t *testing.T) { +func TestJSONPbDecoderFields(t *testing.T) { var m runtime.JSONPb - for _, spec := range []struct { - input string - want interface{} + for _, fixt := range fieldFixtures { + if fixt.skipUnmarshal { + continue + } + + dest := reflect.New(reflect.TypeOf(fixt.data)) + dec := m.NewDecoder(strings.NewReader(fixt.json)) + if err := dec.Decode(dest.Interface()); err != nil { + t.Errorf("dec.Decode(%T) failed with %v; want success; input = %q", dest.Interface(), err, fixt.json) + } + if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) { + t.Errorf("dest = %#v; want %#v; input = %v", got, want, fixt.json) + } + } +} + +var ( + fieldFixtures = []struct { + data interface{} + json string + skipUnmarshal bool }{ - {input: "1", want: int32(1)}, - {input: "1", want: proto.Int32(1)}, - {input: "1", want: int64(1)}, - {input: "1", want: proto.Int64(1)}, - {input: "1", want: uint32(1)}, - {input: "1", want: proto.Uint32(1)}, - {input: "1", want: uint64(1)}, - {input: "1", want: proto.Uint64(1)}, - {input: `"abc"`, want: "abc"}, - {input: `"abc"`, want: proto.String("abc")}, - {input: "1.5", want: float32(1.5)}, - {input: "1.5", want: proto.Float32(1.5)}, - {input: "1.5", want: float64(1.5)}, - {input: "1.5", want: proto.Float64(1.5)}, - {input: "true", want: true}, - {input: "false", want: false}, - {input: "null", want: (*string)(nil)}, - // TODO(yugui) Support symbolic enum - // {input: `"ONE"`, want: examplepb.NumericEnum_ONE}, - {input: `1`, want: examplepb.NumericEnum_ONE}, + {data: int32(1), json: "1"}, + {data: proto.Int32(1), json: "1"}, + {data: int64(1), json: "1"}, + {data: proto.Int64(1), json: "1"}, + {data: uint32(1), json: "1"}, + {data: proto.Uint32(1), json: "1"}, + {data: uint64(1), json: "1"}, + {data: proto.Uint64(1), json: "1"}, + {data: "abc", json: `"abc"`}, + {data: proto.String("abc"), json: `"abc"`}, + {data: float32(1.5), json: "1.5"}, + {data: proto.Float32(1.5), json: "1.5"}, + {data: float64(1.5), json: "1.5"}, + {data: proto.Float64(1.5), json: "1.5"}, + {data: true, json: "true"}, + {data: false, json: "false"}, + {data: (*string)(nil), json: "null"}, { - input: `1`, - want: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + data: examplepb.NumericEnum_ONE, + json: `"ONE"`, + // TODO(yugui) support unmarshaling of symbolic enum + skipUnmarshal: true, }, { - input: `{"foo":{"id":"bar"}}`, - want: map[string]*examplepb.SimpleMessage{ + data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + json: `"ONE"`, + // TODO(yugui) support unmarshaling of symbolic enum + skipUnmarshal: true, + }, + + { + data: map[string]int32{ + "foo": 1, + }, + json: `{"foo":1}`, + }, + { + data: map[string]*examplepb.SimpleMessage{ "foo": {Id: "bar"}, }, + json: `{"foo":{"id":"bar"}}`, }, { - input: `{"1":{"id":"foo"}}`, - want: map[int32]*examplepb.SimpleMessage{ + data: map[int32]*examplepb.SimpleMessage{ 1: {Id: "foo"}, }, + json: `{"1":{"id":"foo"}}`, }, { - input: `{"true":{"id":"foo"}}`, - want: map[bool]*examplepb.SimpleMessage{ + data: map[bool]*examplepb.SimpleMessage{ true: {Id: "foo"}, }, + json: `{"true":{"id":"foo"}}`, }, - } { - dest := reflect.New(reflect.TypeOf(spec.want)) - dec := m.NewDecoder(strings.NewReader(spec.input)) - if err := dec.Decode(dest.Interface()); err != nil { - t.Errorf("dec.Decode(%T) failed with %v; want success; input = %q", dest.Interface(), err, spec.input) - } - if got, want := dest.Elem().Interface(), spec.want; !reflect.DeepEqual(got, want) { - t.Errorf("dest = %#v; want %#v; input = %v", got, want, spec.input) - } + { + data: &duration.Duration{ + Seconds: 123, + Nanos: 456000000, + }, + json: `"123.456s"`, + }, + { + data: ×tamp.Timestamp{ + Seconds: 1462875553, + Nanos: 123000000, + }, + json: `"2016-05-10T10:19:13.123Z"`, + }, + { + data: new(empty.Empty), + json: "{}", + }, + + // TODO(yugui) Enable unmarshaling of the following examples + // once jsonpb supports them. + { + data: &structpb.Value{ + Kind: new(structpb.Value_NullValue), + }, + json: "null", + skipUnmarshal: true, + }, + { + data: &structpb.Value{ + Kind: &structpb.Value_NumberValue{ + NumberValue: 123.4, + }, + }, + json: "123.4", + skipUnmarshal: true, + }, + { + data: &structpb.Value{ + Kind: &structpb.Value_StringValue{ + StringValue: "abc", + }, + }, + json: `"abc"`, + skipUnmarshal: true, + }, + { + data: &structpb.Value{ + Kind: &structpb.Value_BoolValue{ + BoolValue: true, + }, + }, + json: "true", + skipUnmarshal: true, + }, + { + data: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "foo_bar": { + Kind: &structpb.Value_BoolValue{ + BoolValue: true, + }, + }, + }, + }, + json: `{"foo_bar":true}`, + skipUnmarshal: true, + }, + + { + data: &wrappers.BoolValue{Value: true}, + json: "true", + }, + { + data: &wrappers.DoubleValue{Value: 123.456}, + json: "123.456", + }, + { + data: &wrappers.FloatValue{Value: 123.456}, + json: "123.456", + }, + { + data: &wrappers.Int32Value{Value: -123}, + json: "-123", + }, + { + data: &wrappers.Int64Value{Value: -123}, + json: `"-123"`, + }, + { + data: &wrappers.UInt32Value{Value: 123}, + json: "123", + }, + { + data: &wrappers.UInt64Value{Value: 123}, + json: `"123"`, + }, + // TODO(yugui) Add other well-known types once jsonpb supports them } -} +) From c1af7b0df17e471cae7fd134295caf7db3eb309d Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Wed, 11 May 2016 11:42:24 +0900 Subject: [PATCH 032/552] Add more tests to JSON marshaler --- runtime/marshal_json_test.go | 189 ++++++++++++++++++++++------------- 1 file changed, 118 insertions(+), 71 deletions(-) diff --git a/runtime/marshal_json_test.go b/runtime/marshal_json_test.go index 44165e31b06..e476db588d5 100644 --- a/runtime/marshal_json_test.go +++ b/runtime/marshal_json_test.go @@ -9,6 +9,11 @@ import ( "github.com/gengo/grpc-gateway/examples/examplepb" "github.com/gengo/grpc-gateway/runtime" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" + structpb "github.com/golang/protobuf/ptypes/struct" + "github.com/golang/protobuf/ptypes/timestamp" + "github.com/golang/protobuf/ptypes/wrappers" ) func TestJSONBuiltinMarshal(t *testing.T) { @@ -31,28 +36,28 @@ func TestJSONBuiltinMarshal(t *testing.T) { } } -func TestJSONBuiltinMarshalPrimitive(t *testing.T) { +func TestJSONBuiltinMarshalField(t *testing.T) { var m runtime.JSONBuiltin - for _, v := range []interface{}{ - "", - "foo", - 1, - 0, - -1, - -0.0, - 1.5, - } { - buf, err := m.Marshal(v) + for _, fixt := range builtinFieldFixtures { + buf, err := m.Marshal(fixt.data) if err != nil { - t.Errorf("m.Marshal(%v) failed with %v; want success", v, err) + t.Errorf("m.Marshal(%v) failed with %v; want success", fixt.data, err) } + if got, want := string(buf), fixt.json; got != want { + t.Errorf("got = %q; want %q; data = %#v", got, want, fixt.data) + } + } +} - dest := reflect.New(reflect.TypeOf(v)) - if err := json.Unmarshal(buf, dest.Interface()); err != nil { - t.Errorf("json.Unmarshal(%q, unmarshaled) failed with %v; want success", buf, err) +func TestJSONBuiltinMarshalFieldKnownErrors(t *testing.T) { + var m runtime.JSONBuiltin + for _, fixt := range builtinKnownErrors { + buf, err := m.Marshal(fixt.data) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success", fixt.data, err) } - if got, want := dest.Elem().Interface(), v; !reflect.DeepEqual(got, want) { - t.Errorf("got = %v; want %v", &got, &want) + if got, want := string(buf), fixt.json; got == want { + t.Errorf("surprisingly got = %q; as want %q; data = %#v", got, want, fixt.data) } } } @@ -76,27 +81,26 @@ func TestJSONBuiltinsnmarshal(t *testing.T) { } } -func TestJSONBuiltinUnmarshalPrimitive(t *testing.T) { +func TestJSONBuiltinUnmarshalField(t *testing.T) { var m runtime.JSONBuiltin - for _, spec := range []struct { - data string - want interface{} - }{ - {data: `""`, want: ""}, - {data: `"foo"`, want: "foo"}, - {data: `1`, want: 1}, - {data: `0`, want: 0}, - {data: `-1`, want: -1}, - {data: `-0.0`, want: -0.0}, - {data: `1.5`, want: 1.5}, - } { - dest := reflect.New(reflect.TypeOf(spec.want)) - if err := m.Unmarshal([]byte(spec.data), dest.Interface()); err != nil { - t.Errorf("m.Unmarshal(%q, dest) failed with %v; want success", spec.data, err) + for _, fixt := range builtinFieldFixtures { + dest := reflect.New(reflect.TypeOf(fixt.data)) + if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err != nil { + t.Errorf("m.Unmarshal(%q, dest) failed with %v; want success", fixt.json, err) + } + + if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) { + t.Errorf("got = %#v; want = %#v; input = %q", got, want, fixt.json) } + } +} - if got, want := dest.Elem().Interface(), spec.want; !reflect.DeepEqual(got, want) { - t.Errorf("got = %v; want = %v", got, want) +func TestJSONBuiltinUnmarshalFieldKnownErrors(t *testing.T) { + var m runtime.JSONBuiltin + for _, fixt := range builtinKnownErrors { + dest := reflect.New(reflect.TypeOf(fixt.data)) + if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err == nil { + t.Errorf("m.Unmarshal(%q, dest) succeeded; want ane error", fixt.json) } } } @@ -122,29 +126,17 @@ func TestJSONBuiltinEncoder(t *testing.T) { } } -func TestJSONBuiltinEncoderPrimitive(t *testing.T) { +func TestJSONBuiltinEncoderFields(t *testing.T) { var m runtime.JSONBuiltin - for _, v := range []interface{}{ - "", - "foo", - 1, - 0, - -1, - -0.0, - 1.5, - } { + for _, fixt := range builtinFieldFixtures { var buf bytes.Buffer enc := m.NewEncoder(&buf) - if err := enc.Encode(v); err != nil { - t.Errorf("enc.Encode(%v) failed with %v; want success", v, err) + if err := enc.Encode(fixt.data); err != nil { + t.Errorf("enc.Encode(%#v) failed with %v; want success", fixt.data, err) } - dest := reflect.New(reflect.TypeOf(v)) - if err := json.Unmarshal(buf.Bytes(), dest.Interface()); err != nil { - t.Errorf("json.Unmarshal(%q, unmarshaled) failed with %v; want success", buf.String(), err) - } - if got, want := dest.Elem().Interface(), v; !reflect.DeepEqual(got, want) { - t.Errorf("got = %v; want %v", &got, &want) + if got, want := buf.String(), fixt.json+"\n"; got != want { + t.Errorf("got = %q; want %q; data = %#v", got, want, fixt.data) } } } @@ -170,29 +162,84 @@ func TestJSONBuiltinDecoder(t *testing.T) { } } -func TestJSONBuiltinDecoderPrimitive(t *testing.T) { +func TestJSONBuiltinDecoderFields(t *testing.T) { var m runtime.JSONBuiltin - for _, spec := range []struct { - data string - want interface{} - }{ - {data: `""`, want: ""}, - {data: `"foo"`, want: "foo"}, - {data: `1`, want: 1}, - {data: `0`, want: 0}, - {data: `-1`, want: -1}, - {data: `-0.0`, want: -0.0}, - {data: `1.5`, want: 1.5}, - } { - r := strings.NewReader(spec.data) + for _, fixt := range builtinFieldFixtures { + r := strings.NewReader(fixt.json) dec := m.NewDecoder(r) - dest := reflect.New(reflect.TypeOf(spec.want)) + dest := reflect.New(reflect.TypeOf(fixt.data)) if err := dec.Decode(dest.Interface()); err != nil { - t.Errorf("dec.Decode(dest) failed with %v; want success; data=%q", err, spec.data) + t.Errorf("dec.Decode(dest) failed with %v; want success; data = %q", err, fixt.json) } - if got, want := dest.Elem().Interface(), spec.want; !reflect.DeepEqual(got, want) { - t.Errorf("got = %v; want = %v", got, want) + if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v; input = %q", got, want, fixt.json) } } } + +var ( + builtinFieldFixtures = []struct { + data interface{} + json string + }{ + {data: "", json: `""`}, + {data: proto.String(""), json: `""`}, + {data: "foo", json: `"foo"`}, + {data: proto.String("foo"), json: `"foo"`}, + {data: int32(-1), json: "-1"}, + {data: proto.Int32(-1), json: "-1"}, + {data: int64(-1), json: "-1"}, + {data: proto.Int64(-1), json: "-1"}, + {data: uint32(123), json: "123"}, + {data: proto.Uint32(123), json: "123"}, + {data: uint64(123), json: "123"}, + {data: proto.Uint64(123), json: "123"}, + {data: float32(-1.5), json: "-1.5"}, + {data: proto.Float32(-1.5), json: "-1.5"}, + {data: float64(-1.5), json: "-1.5"}, + {data: proto.Float64(-1.5), json: "-1.5"}, + {data: true, json: "true"}, + {data: proto.Bool(true), json: "true"}, + {data: (*string)(nil), json: "null"}, + {data: new(empty.Empty), json: "{}"}, + {data: examplepb.NumericEnum_ONE, json: "1"}, + { + data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + json: "1", + }, + } + builtinKnownErrors = []struct { + data interface{} + json string + }{ + {data: examplepb.NumericEnum_ONE, json: "ONE"}, + { + data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + json: "ONE", + }, + { + data: &examplepb.ABitOfEverything_OneofString{OneofString: "abc"}, + json: `"abc"`, + }, + { + data: ×tamp.Timestamp{ + Seconds: 1462875553, + Nanos: 123000000, + }, + json: `"2016-05-10T10:19:13.123Z"`, + }, + { + data: &wrappers.Int32Value{Value: 123}, + json: "123", + }, + { + data: &structpb.Value{ + Kind: &structpb.Value_StringValue{ + StringValue: "abc", + }, + }, + json: `"abc"`, + }, + } +) From cca2382ec623e77a9f1525c21196bb14b64b8472 Mon Sep 17 00:00:00 2001 From: Michal Witkowski Date: Thu, 12 May 2016 11:22:12 +0100 Subject: [PATCH 033/552] add support for x-forwaded-for and x-forwarded-host --- runtime/context.go | 19 +++++++++++++- runtime/context_test.go | 57 +++++++++++++++++++++++++++++++++++------ 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/runtime/context.go b/runtime/context.go index 83557fa72fc..0291b7369b1 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -4,12 +4,16 @@ import ( "net/http" "strings" + "net" + "golang.org/x/net/context" "google.golang.org/grpc/metadata" ) const metadataHeaderPrefix = "Grpc-Metadata-" const metadataTrailerPrefix = "Grpc-Trailer-" +const xForwardedFor = "X-Forwarded-For" +const xForwardedHost = "X-Forwarded-Host" /* AnnotateContext adds context information such as metadata from the request. @@ -22,7 +26,7 @@ func AnnotateContext(ctx context.Context, req *http.Request) context.Context { for key, vals := range req.Header { for _, val := range vals { if key == "Authorization" { - pairs = append(pairs, key, val) + pairs = append(pairs, "authorization", val) continue } if strings.HasPrefix(key, metadataHeaderPrefix) { @@ -30,6 +34,19 @@ func AnnotateContext(ctx context.Context, req *http.Request) context.Context { } } } + if host := req.Header.Get(xForwardedHost); host != "" { + pairs = append(pairs, strings.ToLower(xForwardedHost), host) + } else if req.Host != "" { + pairs = append(pairs, strings.ToLower(xForwardedHost), req.Host) + } + remoteIp, _, err := net.SplitHostPort(req.RemoteAddr) + if err == nil { + if req.Header.Get(xForwardedFor) == "" { + pairs = append(pairs, strings.ToLower(xForwardedFor), remoteIp) + } else { + pairs = append(pairs, strings.ToLower(xForwardedFor), req.Header.Get(xForwardedFor)+", "+remoteIp) + } + } if len(pairs) == 0 { return ctx diff --git a/runtime/context_test.go b/runtime/context_test.go index a2a85925f54..7420c6be4ef 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -10,27 +10,45 @@ import ( "google.golang.org/grpc/metadata" ) -func TestAnnotateContext(t *testing.T) { +const ( + emptyForwardMetaCount = 2 +) + +func TestAnnotateContext_WorksWithEmpty(t *testing.T) { ctx := context.Background() - request, err := http.NewRequest("GET", "http://localhost", nil) + request, err := http.NewRequest("GET", "http://www.example.com", nil) if err != nil { - t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://localhost", err) + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) } + // Make sure we set a remote. + request.RemoteAddr = "192.168.0.1:12345" + request.Header.Add("Some-Irrelevant-Header", "some value") annotated := runtime.AnnotateContext(ctx, request) - if annotated != ctx { - t.Errorf("AnnotateContext(ctx, request) = %v; want %v", annotated, ctx) + md, ok := metadata.FromContext(annotated) + if !ok || len(md) != emptyForwardMetaCount { + t.Errorf("Expected 2 metadata items in context; got %v", md) } +} +func TestAnnotateContext_ForwardsGrpcMetadata(t *testing.T) { + ctx := context.Background() + request, err := http.NewRequest("GET", "http://www.example.com", nil) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) + } + request.RemoteAddr = "192.168.0.1:12345" + + request.Header.Add("Some-Irrelevant-Header", "some value") request.Header.Add("Grpc-Metadata-FooBar", "Value1") request.Header.Add("Grpc-Metadata-Foo-BAZ", "Value2") request.Header.Add("Grpc-Metadata-foo-bAz", "Value3") request.Header.Add("Authorization", "Token 1234567890") - annotated = runtime.AnnotateContext(ctx, request) + annotated := runtime.AnnotateContext(ctx, request) md, ok := metadata.FromContext(annotated) - if !ok || len(md) != 3 { - t.Errorf("Expected 3 metadata items in context; got %v", md) + if !ok || len(md) != emptyForwardMetaCount+3 { + t.Errorf("Expected 5 metadata items in context; got %v", md) } if got, want := md["foobar"], []string{"Value1"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["foobar"] = %q; want %q`, got, want) @@ -42,3 +60,26 @@ func TestAnnotateContext(t *testing.T) { t.Errorf(`md["authorization"] = %q want %q`, got, want) } } + +func TestAnnotateContext_XForwardedFor(t *testing.T) { + ctx := context.Background() + request, err := http.NewRequest("GET", "http://bar.foo.example.com", nil) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://bar.foo.example.com", err) + } + request.Header.Add("X-Forwarded-For", "192.168.0.100") // client + request.RemoteAddr = "8.8.8.8:12345" // proxy + + annotated := runtime.AnnotateContext(ctx, request) + md, ok := metadata.FromContext(annotated) + if !ok || len(md) != emptyForwardMetaCount { + t.Errorf("Expected 2 metadata items in context; got %v", md) + } + if got, want := md["x-forwarded-host"], []string{"bar.foo.example.com"}; !reflect.DeepEqual(got, want) { + t.Errorf("md[\"host\"] = %v; want %v", got, want) + } + // Note: it must be in order client, proxy1, proxy2 + if got, want := md["x-forwarded-for"], []string{"192.168.0.100, 8.8.8.8"}; !reflect.DeepEqual(got, want) { + t.Errorf("md[\"x-forwarded-for\"] = %v want %v", got, want) + } +} From f00a755880b808898b3173a6100c2e48a738d2c2 Mon Sep 17 00:00:00 2001 From: Michal Witkowski Date: Thu, 12 May 2016 12:30:39 +0100 Subject: [PATCH 034/552] support Grpc-Timeout header for passing to the backend --- README.md | 1 + runtime/context.go | 57 ++++++++++++++++++++++++++++++++++++++--- runtime/context_test.go | 20 +++++++++++++++ 3 files changed, 75 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b01b3706397..d7b95c151ee 100644 --- a/README.md +++ b/README.md @@ -198,6 +198,7 @@ More examples are available under `examples` directory. * Mapping streaming APIs to JSON streams * Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata * Optionally emitting API definition for [Swagger](http://swagger.io). +* Setting [gRPC timeouts](http://www.grpc.io/docs/guides/wire.html) through inbound HTTP `Grpc-Timeout` header. ### Want to support But not yet. diff --git a/runtime/context.go b/runtime/context.go index 0291b7369b1..6bc2a271621 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -1,10 +1,12 @@ package runtime import ( + "fmt" + "net" "net/http" + "strconv" "strings" - - "net" + "time" "golang.org/x/net/context" "google.golang.org/grpc/metadata" @@ -12,9 +14,17 @@ import ( const metadataHeaderPrefix = "Grpc-Metadata-" const metadataTrailerPrefix = "Grpc-Trailer-" +const metadataGrpcTimeout = "Grpc-Timeout" + const xForwardedFor = "X-Forwarded-For" const xForwardedHost = "X-Forwarded-Host" +var ( + // DefaultContextTimeout is used for gRPC call context.WithTimeout whenever a Grpc-Timeout inbound + // header isn't present. If the value is 0 the sent `context` will not have a timeout. + DefaultContextTimeout = 0 * time.Second +) + /* AnnotateContext adds context information such as metadata from the request. @@ -23,6 +33,10 @@ will be the same context. */ func AnnotateContext(ctx context.Context, req *http.Request) context.Context { var pairs []string + timeout := DefaultContextTimeout + if tm := req.Header.Get(metadataGrpcTimeout); tm != "" { + timeout, _ = timeoutDecode(tm) + } for key, vals := range req.Header { for _, val := range vals { if key == "Authorization" { @@ -47,7 +61,9 @@ func AnnotateContext(ctx context.Context, req *http.Request) context.Context { pairs = append(pairs, strings.ToLower(xForwardedFor), req.Header.Get(xForwardedFor)+", "+remoteIp) } } - + if timeout != 0 { + ctx, _ = context.WithTimeout(ctx, timeout) + } if len(pairs) == 0 { return ctx } @@ -72,3 +88,38 @@ func ServerMetadataFromContext(ctx context.Context) (md ServerMetadata, ok bool) md, ok = ctx.Value(serverMetadataKey{}).(ServerMetadata) return } + +func timeoutDecode(s string) (time.Duration, error) { + size := len(s) + if size < 2 { + return 0, fmt.Errorf("timeout string is too short: %q", s) + } + d, ok := timeoutUnitToDuration(s[size-1]) + if !ok { + return 0, fmt.Errorf("timeout unit is not recognized: %q", s) + } + t, err := strconv.ParseInt(s[:size-1], 10, 64) + if err != nil { + return 0, err + } + return d * time.Duration(t), nil +} + +func timeoutUnitToDuration(u uint8) (d time.Duration, ok bool) { + switch u { + case 'H': + return time.Hour, true + case 'M': + return time.Minute, true + case 'S': + return time.Second, true + case 'm': + return time.Millisecond, true + case 'u': + return time.Microsecond, true + case 'n': + return time.Nanosecond, true + default: + } + return +} diff --git a/runtime/context_test.go b/runtime/context_test.go index 7420c6be4ef..157d94894a8 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -4,6 +4,7 @@ import ( "net/http" "reflect" "testing" + "time" "github.com/gengo/grpc-gateway/runtime" "golang.org/x/net/context" @@ -83,3 +84,22 @@ func TestAnnotateContext_XForwardedFor(t *testing.T) { t.Errorf("md[\"x-forwarded-for\"] = %v want %v", got, want) } } + +func TestAnnotateContext_SupportsTimeouts(t *testing.T) { + ctx := context.Background() + request, _ := http.NewRequest("GET", "http://bar.foo.example.com", nil) + annotated := runtime.AnnotateContext(ctx, request) + if _, exists := annotated.Deadline(); exists { + t.Errorf("by default Timeouts should not be set") + } + runtime.DefaultContextTimeout = 10 * time.Second + annotated = runtime.AnnotateContext(ctx, request) + if _, exists := annotated.Deadline(); !exists { + t.Errorf("if DefaultContextTimeout is set, the annotated context should have a timeout") + } + request.Header.Add("Grpc-Timeout", "50S") + annotated = runtime.AnnotateContext(ctx, request) + if deadline, _ := annotated.Deadline(); deadline.Sub(time.Now()) < 2*time.Second { // in case time.Now() drifts + t.Errorf("if Grpc-Timeout=50s is present, the timeout should be 50s") + } +} From c423b4db440f8bb92f3260f9e3136bb728883b4a Mon Sep 17 00:00:00 2001 From: Yukinari Toyota Date: Fri, 13 May 2016 10:01:24 +0900 Subject: [PATCH 035/552] Fixes index out of range panic when empty. --- protoc-gen-swagger/genswagger/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 7f539984694..dcbd1a1381b 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -510,7 +510,7 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er summary := strings.TrimSpace(paragraphs[0]) description := strings.TrimSpace(strings.Join(paragraphs[1:], "\n\n")) - if !usingTitle || summary[len(summary)-1] != '.' { + if !usingTitle || summary == "" || summary[len(summary)-1] != '.' { if len(summary) > 0 { summaryValue.Set(reflect.ValueOf(summary)) } From 1e12e26bb6fa524df5bf35cea81d60f77eb920f6 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Fri, 13 May 2016 10:37:27 +0900 Subject: [PATCH 036/552] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index b01b3706397..6e1369e655c 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,12 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. path/to/your_service.proto ``` +## Parameters and flags +`protoc-gen-grpc-gateway` supports custom mapping from Protobuf `import` to Golang import path. +They are compatible to [the parameters with same names in `protoc-gen-go`](https://github.com/golang/protobuf#parameters). + +`protoc-gen-grpc-gateway` also supports some more command line flags to control logging. You can give these flags together with parameters above. Run `protoc-gen-grpc-gateway --help` for more details about the flags. + ## More Examples More examples are available under `examples` directory. * `examplepb/echo_service.proto`, `examplepb/a_bit_of_everything.proto`: service definition @@ -198,11 +204,13 @@ More examples are available under `examples` directory. * Mapping streaming APIs to JSON streams * Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata * Optionally emitting API definition for [Swagger](http://swagger.io). +* Import path parameters compatible to protoc-gen-go. ### Want to support But not yet. * bytes and enum fields in path parameter. #5 * Optionally generating the entrypoint. #8 +* `import_path` parameter ### No plan to support But patch is welcome. From 9579da4b4018fdc6a324673e0c2601d7032327db Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Fri, 13 May 2016 10:49:48 +0900 Subject: [PATCH 037/552] Add godoc comment --- protoc-gen-grpc-gateway/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 32a719c2b23..f84742cadef 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -1,3 +1,11 @@ +// Command protoc-gen-grpc-gateway is a plugin for Google protocol buffer +// compiler to generate a reverse-proxy, which converts incoming RESTful +// HTTP/1 requests gRPC invocation. +// You rarely need to run this program directly. Instead, put this program +// into your $PATH with a name "protoc-gen-grpc-gateway" and run +// protoc --grpc-gateway_out=output_directory path/to/input.proto +// +// See README.md for more details. package main import ( From 73c163ddf556f02eb6f49a78040b87b6a7de766a Mon Sep 17 00:00:00 2001 From: Yukinari Toyota Date: Fri, 13 May 2016 20:35:27 +0900 Subject: [PATCH 038/552] Fixes missing field descriptions if the Message has index 2 --- examples/examplepb/streamless_everything.proto | 1 + examples/examplepb/streamless_everything.swagger.json | 3 ++- protoc-gen-swagger/genswagger/template.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/examplepb/streamless_everything.proto b/examples/examplepb/streamless_everything.proto index 4e9f20387a9..8284826646f 100644 --- a/examples/examplepb/streamless_everything.proto +++ b/examples/examplepb/streamless_everything.proto @@ -59,6 +59,7 @@ message EmptyMessage { } message IdMessage { + // uuid is UUID value string uuid = 1; } diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index a9eca281655..d16aa6b16d4 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -520,7 +520,8 @@ "properties": { "uuid": { "type": "string", - "format": "string" + "format": "string", + "title": "uuid is UUID value" } } }, diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index dcbd1a1381b..caf12df68d6 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -564,7 +564,7 @@ func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []str packageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") L1: for _, loc := range file.SourceCodeInfo.Location { - if typeIndex != packageProtoPath { + if typeName != "Package" || typeIndex != packageProtoPath { if len(loc.Path) < len(outerPaths)*2+2+len(fieldPaths) { continue } From c4d2c59f34688716410c56437368172a24e3962f Mon Sep 17 00:00:00 2001 From: Yukinari Toyota Date: Fri, 13 May 2016 21:19:21 +0900 Subject: [PATCH 039/552] Refactor proto comment extractor --- protoc-gen-swagger/genswagger/template.go | 101 ++++++++++++---------- 1 file changed, 54 insertions(+), 47 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index caf12df68d6..93bf01ebc68 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -559,54 +559,9 @@ func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []str outerPaths[i] = int32(msg.Index) } - messageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "MessageType") - nestedProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "NestedType") - packageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") -L1: for _, loc := range file.SourceCodeInfo.Location { - if typeName != "Package" || typeIndex != packageProtoPath { - if len(loc.Path) < len(outerPaths)*2+2+len(fieldPaths) { - continue - } - for i, v := range outerPaths { - if i == 0 && loc.Path[i*2+0] != messageProtoPath { - continue L1 - } - if i != 0 && loc.Path[i*2+0] != nestedProtoPath { - continue L1 - } - if loc.Path[i*2+1] != v { - continue L1 - } - } - - outerOffset := len(outerPaths) * 2 - if outerOffset == 0 && loc.Path[outerOffset] != protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), typeName) { - continue - } - if outerOffset != 0 { - if typeName == "MessageType" { - typeName = "NestedType" - } - if loc.Path[outerOffset] != protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), typeName) { - continue - } - } - if loc.Path[outerOffset+1] != typeIndex { - continue - } - - for i, v := range fieldPaths { - if loc.Path[outerOffset+2+i] != v { - continue L1 - } - } - } else { - // path for package comments is just [2], and all the other processing - // is too complex for it. - if len(loc.Path) == 0 || typeIndex != loc.Path[0] { - continue - } + if !isProtoPathMatches(loc.Path, outerPaths, typeName, typeIndex, fieldPaths) { + continue } comments := "" if loc.LeadingComments != nil { @@ -625,6 +580,58 @@ L1: return "" } +var messageProtoPath = protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "MessageType") +var nestedProtoPath = protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "NestedType") +var packageProtoPath = protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") + +func isProtoPathMatches(paths []int32, outerPaths []int32, typeName string, typeIndex int32, fieldPaths []int32) bool { + if typeName == "Package" && typeIndex == packageProtoPath { + // path for package comments is just [2], and all the other processing + // is too complex for it. + if len(paths) == 0 || typeIndex != paths[0] { + return false + } + return true + } + + if len(paths) != len(outerPaths)*2+2+len(fieldPaths) { + return false + } + + typeNameDescriptor := reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)) + if len(outerPaths) > 0 { + if paths[0] != messageProtoPath || paths[1] != outerPaths[0] { + return false + } + paths = paths[2:] + outerPaths = outerPaths[1:] + + for i, v := range outerPaths { + if paths[i*2] != nestedProtoPath || paths[i*2+1] != v { + return false + } + } + paths = paths[len(outerPaths)*2:] + + if typeName == "MessageType" { + typeName = "NestedType" + } + typeNameDescriptor = reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)) + } + + if paths[0] != protoPathIndex(typeNameDescriptor, typeName) || paths[1] != typeIndex { + return false + } + paths = paths[2:] + + for i, v := range fieldPaths { + if paths[i] != v { + return false + } + } + return true +} + // protoPathIndex returns a path component for google.protobuf.descriptor.SourceCode_Location. // // Specifically, it returns an id as generated from descriptor proto which From f8d8331be06a0f4ff6674a3b6a5d9093829097c0 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 9 May 2016 14:07:28 -0400 Subject: [PATCH 040/552] custom marshaler: handle `Accept` headers correctly Also greatly simplifies existing logic to avoid special casing of defaults. --- runtime/marshaler_registry.go | 132 ++++++++++------------------- runtime/marshaler_registry_test.go | 21 ++--- runtime/mux.go | 2 +- 3 files changed, 50 insertions(+), 105 deletions(-) diff --git a/runtime/marshaler_registry.go b/runtime/marshaler_registry.go index bc98a6ef1a5..501d37eb3b2 100644 --- a/runtime/marshaler_registry.go +++ b/runtime/marshaler_registry.go @@ -5,12 +5,15 @@ import ( "net/http" ) -const mimeWildcard = "*" +// MIMEWildCard is the fallback MIME type used for requests which do not match +// a registered MIME type. +const MIMEWildcard = "*" var ( - defaultMarshaler = &JSONPb{OrigName: true} - + acceptHeader = http.CanonicalHeaderKey("Accept") contentTypeHeader = http.CanonicalHeaderKey("Content-Type") + + defaultMarshaler = &JSONPb{OrigName: true} ) // MarshalerForRequest returns the inbound/outbound marshalers for this request. @@ -20,117 +23,68 @@ var ( // exactly match in the registry. // Otherwise, it follows the above logic for "*"/InboundMarshaler/OutboundMarshaler. func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) { - headerVals := append(append([]string(nil), r.Header[contentTypeHeader]...), "*") - - for _, val := range headerVals { - m := mux.marshalers.lookup(val) - if m != nil { - if inbound == nil { - inbound = m.inbound - } - if outbound == nil { - outbound = m.outbound - } + for _, acceptVal := range r.Header[acceptHeader] { + if m, ok := mux.marshalers.mimeMap[acceptVal]; ok { + outbound = m + break } - if inbound != nil && outbound != nil { - // Got them both, return - return inbound, outbound + } + + for _, contentTypeVal := range r.Header[contentTypeHeader] { + if m, ok := mux.marshalers.mimeMap[contentTypeVal]; ok { + inbound = m + break } } + if inbound == nil { - inbound = defaultMarshaler + inbound = mux.marshalers.mimeMap[MIMEWildcard] } if outbound == nil { - outbound = defaultMarshaler + outbound = inbound } - return inbound, outbound + return inbound, outbound } -// marshalerRegistry keeps a mapping from MIME types to mimeMarshalers. -type marshalerRegistry map[string]*mimeMarshaler - -type mimeMarshaler struct { - inbound Marshaler - outbound Marshaler +// marshalerRegistry is a mapping from MIME types to Marshalers. +type marshalerRegistry struct { + mimeMap map[string]Marshaler } -// addMarshaler adds an inbound and outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). -// Inbound is the marshaler that is used when marshaling inbound requests from the client. -// Outbound is the marshaler that is used when marshaling outbound responses to the client. -func (r *marshalerRegistry) add(mime string, inbound, outbound Marshaler) error { - if mime == "" { +// add adds a marshaler for a case-sensitive MIME type string ("*" to match any +// MIME type). +func (m marshalerRegistry) add(mime string, marshaler Marshaler) error { + if len(mime) == 0 { return errors.New("empty MIME type") } - (*r)[mime] = &mimeMarshaler{ - inbound: inbound, - outbound: outbound, - } - return nil -} -// addInboundMarshaler adds an inbound marshaler for a case-sensitive MIME type string ("*" to match any MIME type). -// Inbound is the marshaler that is used when marshaling inbound requests from the client. -func (r *marshalerRegistry) addInbound(mime string, inbound Marshaler) error { - if mime == "" { - return errors.New("empty MIME type") - } - if entry := (*r)[mime]; entry != nil { - entry.inbound = inbound - return nil - } - (*r)[mime] = &mimeMarshaler{inbound: inbound} - return nil -} + m.mimeMap[mime] = marshaler -// addOutBound adds an outbund marshaler for a case-sensitive MIME type string ("*" to match any MIME type). -// Outbound is the marshaler that is used when marshaling outbound responses to the client. -func (r *marshalerRegistry) addOutbound(mime string, outbound Marshaler) error { - mime = http.CanonicalHeaderKey(mime) - if mime == "" { - return errors.New("empty MIME type") - } - if entry := (*r)[mime]; entry != nil { - entry.outbound = outbound - return nil - } - (*r)[mime] = &mimeMarshaler{outbound: outbound} return nil - } -func (r *marshalerRegistry) lookup(mime string) *mimeMarshaler { - if r == nil { - return nil +// makeMarshalerMIMERegistry returns a new registry of marshalers. +// It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces. +// +// For example, you could allow the client to specify the use of the runtime.JSONPb marshaler +// with a "applicaton/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler +// with a "application/json" Content-Type. +// "*" can be used to match any Content-Type. +// This can be attached to a ServerMux with the marshaler option. +func makeMarshalerMIMERegistry() marshalerRegistry { + return marshalerRegistry{ + mimeMap: map[string]Marshaler{ + MIMEWildcard: defaultMarshaler, + }, } - return (*r)[mime] } // WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound // Marshalers to a MIME type in mux. -func WithMarshalerOption(mime string, in, out Marshaler) ServeMuxOption { - return func(mux *ServeMux) { - if err := mux.marshalers.add(mime, in, out); err != nil { - panic(err) - } - } -} - -// WithInboundMarshalerOption returns a ServeMuxOption which associates an inbound -// Marshaler to a MIME type in mux. -func WithInboundMarshalerOption(mime string, in Marshaler) ServeMuxOption { - return func(mux *ServeMux) { - if err := mux.marshalers.addInbound(mime, in); err != nil { - panic(err) - } - } -} - -// WithOutboundMarshalerOption returns a ServeMuxOption which associates an outbound -// Marshaler to a MIME type in mux. -func WithOutboundMarshalerOption(mime string, out Marshaler) ServeMuxOption { +func WithMarshalerOption(mime string, marshaler Marshaler) ServeMuxOption { return func(mux *ServeMux) { - if err := mux.marshalers.addOutbound(mime, out); err != nil { + if err := mux.marshalers.add(mime, marshaler); err != nil { panic(err) } } diff --git a/runtime/marshaler_registry_test.go b/runtime/marshaler_registry_test.go index 38a47b462cd..206f6ed9a77 100644 --- a/runtime/marshaler_registry_test.go +++ b/runtime/marshaler_registry_test.go @@ -14,7 +14,8 @@ func TestMarshalerForRequest(t *testing.T) { if err != nil { t.Fatalf(`http.NewRequest("GET", "http://example.com", nil) failed with %v; want success`, err) } - r.Header.Set("Content-Type", "application/x-example") + r.Header.Set("Accept", "application/x-out") + r.Header.Set("Content-Type", "application/x-in") mux := runtime.NewServeMux() @@ -26,7 +27,7 @@ func TestMarshalerForRequest(t *testing.T) { t.Errorf("out = %#v; want a runtime.JSONPb", in) } - var marshalers [6]dummyMarshaler + var marshalers [3]dummyMarshaler specs := []struct { opt runtime.ServeMuxOption @@ -34,30 +35,20 @@ func TestMarshalerForRequest(t *testing.T) { wantOut runtime.Marshaler }{ { - opt: runtime.WithMarshalerOption("*", &marshalers[0], &marshalers[0]), + opt: runtime.WithMarshalerOption(runtime.MIMEWildcard, &marshalers[0]), wantIn: &marshalers[0], wantOut: &marshalers[0], }, { - opt: runtime.WithInboundMarshalerOption("*", &marshalers[1]), + opt: runtime.WithMarshalerOption("application/x-in", &marshalers[1]), wantIn: &marshalers[1], wantOut: &marshalers[0], }, { - opt: runtime.WithOutboundMarshalerOption("application/x-example", &marshalers[2]), + opt: runtime.WithMarshalerOption("application/x-out", &marshalers[2]), wantIn: &marshalers[1], wantOut: &marshalers[2], }, - { - opt: runtime.WithInboundMarshalerOption("application/x-example", &marshalers[3]), - wantIn: &marshalers[3], - wantOut: &marshalers[2], - }, - { - opt: runtime.WithMarshalerOption("application/x-example", &marshalers[4], &marshalers[5]), - wantIn: &marshalers[4], - wantOut: &marshalers[5], - }, } for i, spec := range specs { var opts []runtime.ServeMuxOption diff --git a/runtime/mux.go b/runtime/mux.go index 27bc8da6b51..2e6c5621302 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -41,7 +41,7 @@ func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ handlers: make(map[string][]handler), forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), - marshalers: make(marshalerRegistry), + marshalers: makeMarshalerMIMERegistry(), } for _, opt := range opts { From 9b004021e3d1aa1bf0388a4fda26e8b188ae3500 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 16 May 2016 15:15:37 -0400 Subject: [PATCH 041/552] jsonpb: avoid duplicating upstream's struct --- runtime/marshal_jsonpb.go | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index ac43434c7c8..9a42191119a 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -14,22 +14,7 @@ import ( // JSONPb is a Marshaler which marshals/unmarshals into/from JSON // with the "github.com/golang/protobuf/jsonpb". // It supports fully functionality of protobuf unlike JSONBuiltin. -type JSONPb struct { - // Whether to render enum values as integers, as opposed to string values. - EnumsAsInts bool - - // Whether to render fields with zero values. - EmitDefaults bool - - // A string to indent each level by. The presence of this field will - // also cause a space to appear between the field separator and - // value, and for newlines to be appear between fields and array - // elements. - Indent string - - // Whether to use the original (.proto) name for fields. - OrigName bool -} +type JSONPb jsonpb.Marshaler // ContentType always returns "application/json". func (*JSONPb) ContentType() string { @@ -61,13 +46,7 @@ func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error { _, err = w.Write(buf) return err } - m := &jsonpb.Marshaler{ - EnumsAsInts: j.EnumsAsInts, - EmitDefaults: j.EmitDefaults, - Indent: j.Indent, - OrigName: j.OrigName, - } - return m.Marshal(w, p) + return (*jsonpb.Marshaler)(j).Marshal(w, p) } // marshalNonProto marshals a non-message field of a protobuf message. From c446521c740852040e098f4df76d52e305a8ea1c Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 22 May 2016 16:35:10 -0700 Subject: [PATCH 042/552] make Authorization header check case-insensitive to comply with RFC 2616 4.2 --- runtime/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/context.go b/runtime/context.go index 83557fa72fc..1322ccf940d 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -21,7 +21,7 @@ func AnnotateContext(ctx context.Context, req *http.Request) context.Context { var pairs []string for key, vals := range req.Header { for _, val := range vals { - if key == "Authorization" { + if strings.ToLower(key) == "authorization" { pairs = append(pairs, key, val) continue } From a9c0b77628202b7b548bfae62faef588a6644936 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Thu, 2 Jun 2016 10:18:37 +0900 Subject: [PATCH 043/552] Update dependencies --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 443cf069d3e..53c2f252adf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,13 @@ branches: language: go sudo: false go: -- 1.5 +- 1.6.2 - tip cache: directories: - $HOME/local before_install: -- ./.travis.build-protoc.sh 3.0.0-beta-2 +- ./.travis.build-protoc.sh 3.0.0-beta-3 - go get github.com/golang/lint/golint install: - go get github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway From f3df73216b2fafd31abdf0c859f16c326fa48a28 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Thu, 2 Jun 2016 10:34:44 +0900 Subject: [PATCH 044/552] Regenerate files with the latest protoc-gen-go --- examples/examplepb/echo_service.pb.go | 4 +++- examples/sub/message.pb.go | 4 +++- examples/sub2/message.pb.go | 4 +++- runtime/stream_chunk.pb.go | 4 +++- third_party/googleapis/google/api/annotations.pb.go | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index fb676c649f4..1eadb59e9d9 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -44,7 +44,9 @@ var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. -const _ = proto.ProtoPackageIsVersion1 +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // SimpleMessage represents a simple message sent to the Echo service. type SimpleMessage struct { diff --git a/examples/sub/message.pb.go b/examples/sub/message.pb.go index 841d9401588..dc117712bb7 100644 --- a/examples/sub/message.pb.go +++ b/examples/sub/message.pb.go @@ -24,7 +24,9 @@ var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. -const _ = proto.ProtoPackageIsVersion1 +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type StringMessage struct { Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` diff --git a/examples/sub2/message.pb.go b/examples/sub2/message.pb.go index 44550d528d8..20e67f637db 100644 --- a/examples/sub2/message.pb.go +++ b/examples/sub2/message.pb.go @@ -24,7 +24,9 @@ var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. -const _ = proto.ProtoPackageIsVersion1 +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type IdMessage struct { Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` diff --git a/runtime/stream_chunk.pb.go b/runtime/stream_chunk.pb.go index bdd065f910a..f45504e2291 100644 --- a/runtime/stream_chunk.pb.go +++ b/runtime/stream_chunk.pb.go @@ -24,7 +24,9 @@ var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. -const _ = proto.ProtoPackageIsVersion1 +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type StreamError struct { GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode" json:"grpc_code,omitempty"` diff --git a/third_party/googleapis/google/api/annotations.pb.go b/third_party/googleapis/google/api/annotations.pb.go index 1243ecca485..21fca4856a2 100644 --- a/third_party/googleapis/google/api/annotations.pb.go +++ b/third_party/googleapis/google/api/annotations.pb.go @@ -27,7 +27,9 @@ var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. -const _ = proto.ProtoPackageIsVersion1 +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package var E_Http = &proto.ExtensionDesc{ ExtendedType: (*google_protobuf.MethodOptions)(nil), From 9226ccd23e0d3c6579df3138f9cf21a9b6d2f2c4 Mon Sep 17 00:00:00 2001 From: Mike Atlas Date: Fri, 3 Jun 2016 18:37:10 -0400 Subject: [PATCH 045/552] Include HTTP req.remoteAddr in gRPC ctx --- runtime/context.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/runtime/context.go b/runtime/context.go index 1322ccf940d..771b2560e06 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -14,14 +14,19 @@ const metadataTrailerPrefix = "Grpc-Trailer-" /* AnnotateContext adds context information such as metadata from the request. -If there are no metadata headers in the request, then the context returned -will be the same context. +At a minimum, the RemoteAddr is included in the fashion of "X-Forwarded-For", +except that the forwarded destination is not another HTTP service but rather +a gRPC service. */ func AnnotateContext(ctx context.Context, req *http.Request) context.Context { var pairs []string + + // Include the original RemoteAddr, something the gRPC service may need in the ctx + pairs = append(pairs, "RemoteAddr", req.RemoteAddr) + for key, vals := range req.Header { for _, val := range vals { - if strings.ToLower(key) == "authorization" { + if key == "Authorization" { pairs = append(pairs, key, val) continue } From c0d5241983633b8339f2063df2c28ed3f6e22eaa Mon Sep 17 00:00:00 2001 From: Mike Atlas Date: Fri, 3 Jun 2016 18:42:52 -0400 Subject: [PATCH 046/552] Pull forward string comparison change for authorization header --- runtime/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/context.go b/runtime/context.go index 771b2560e06..85faef608ec 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -26,7 +26,7 @@ func AnnotateContext(ctx context.Context, req *http.Request) context.Context { for key, vals := range req.Header { for _, val := range vals { - if key == "Authorization" { + if strings.ToLower(key) == "authorization" { pairs = append(pairs, key, val) continue } From abe31e858dc466bff8477ab59d996c0276678dc0 Mon Sep 17 00:00:00 2001 From: Mike Atlas Date: Fri, 3 Jun 2016 19:01:59 -0400 Subject: [PATCH 047/552] update tests --- runtime/context_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/context_test.go b/runtime/context_test.go index a2a85925f54..26f0ff15d7e 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -17,8 +17,11 @@ func TestAnnotateContext(t *testing.T) { if err != nil { t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://localhost", err) } + + request.RemoteAddr = "127.0.0.1" request.Header.Add("Some-Irrelevant-Header", "some value") annotated := runtime.AnnotateContext(ctx, request) + ctx = metadata.NewContext(ctx, metadata.Pairs("RemoteAddr", "127.0.0.1")) if annotated != ctx { t.Errorf("AnnotateContext(ctx, request) = %v; want %v", annotated, ctx) } @@ -29,8 +32,8 @@ func TestAnnotateContext(t *testing.T) { request.Header.Add("Authorization", "Token 1234567890") annotated = runtime.AnnotateContext(ctx, request) md, ok := metadata.FromContext(annotated) - if !ok || len(md) != 3 { - t.Errorf("Expected 3 metadata items in context; got %v", md) + if !ok || len(md) != 4 { + t.Errorf("Expected 4 metadata items in context; got %v", md) } if got, want := md["foobar"], []string{"Value1"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["foobar"] = %q; want %q`, got, want) From ff3273281c04fe9bcdc047afffadce35b10f84f0 Mon Sep 17 00:00:00 2001 From: Mike Atlas Date: Fri, 3 Jun 2016 19:05:52 -0400 Subject: [PATCH 048/552] update tests - try DeepEqual comparison for metadata background with context --- runtime/context_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/context_test.go b/runtime/context_test.go index 26f0ff15d7e..ccdbeaa5906 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -22,7 +22,7 @@ func TestAnnotateContext(t *testing.T) { request.Header.Add("Some-Irrelevant-Header", "some value") annotated := runtime.AnnotateContext(ctx, request) ctx = metadata.NewContext(ctx, metadata.Pairs("RemoteAddr", "127.0.0.1")) - if annotated != ctx { + if !reflect.DeepEqual(annotated, ctx) { t.Errorf("AnnotateContext(ctx, request) = %v; want %v", annotated, ctx) } From 720326f346e50903a5d4b54490c65257a89e3ee3 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 7 Jun 2016 13:24:20 +0900 Subject: [PATCH 049/552] Avoid errors when req.RemoteAddr is empty Fixes #177 --- runtime/context.go | 15 +++++++++------ runtime/context_test.go | 12 +++++------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/runtime/context.go b/runtime/context.go index 373c3491711..ad42535662a 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -62,14 +62,17 @@ func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, e } else if req.Host != "" { pairs = append(pairs, strings.ToLower(xForwardedHost), req.Host) } - if remoteIP, _, err := net.SplitHostPort(req.RemoteAddr); err == nil { - if fwd := req.Header.Get(xForwardedFor); fwd == "" { - pairs = append(pairs, strings.ToLower(xForwardedFor), remoteIP) + + if addr := req.RemoteAddr; addr != "" { + if remoteIP, _, err := net.SplitHostPort(addr); err == nil { + if fwd := req.Header.Get(xForwardedFor); fwd == "" { + pairs = append(pairs, strings.ToLower(xForwardedFor), remoteIP) + } else { + pairs = append(pairs, strings.ToLower(xForwardedFor), fmt.Sprintf("%s, %s", fwd, remoteIP)) + } } else { - pairs = append(pairs, strings.ToLower(xForwardedFor), fmt.Sprintf("%s, %s", fwd, remoteIP)) + grpclog.Printf("invalid remote addr: %s", addr) } - } else { - grpclog.Printf("invalid remote addr: %s", req.RemoteAddr) } if timeout != 0 { diff --git a/runtime/context_test.go b/runtime/context_test.go index 02229b07308..349438879d5 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -12,7 +12,7 @@ import ( ) const ( - emptyForwardMetaCount = 2 + emptyForwardMetaCount = 1 ) func TestAnnotateContext_WorksWithEmpty(t *testing.T) { @@ -22,7 +22,6 @@ func TestAnnotateContext_WorksWithEmpty(t *testing.T) { if err != nil { t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) } - request.RemoteAddr = "192.0.2.1:12345" request.Header.Add("Some-Irrelevant-Header", "some value") annotated, err := runtime.AnnotateContext(ctx, request) if err != nil { @@ -31,7 +30,7 @@ func TestAnnotateContext_WorksWithEmpty(t *testing.T) { } md, ok := metadata.FromContext(annotated) if !ok || len(md) != emptyForwardMetaCount { - t.Errorf("Expected 2 metadata items in context; got %v", md) + t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount, md) } } @@ -41,7 +40,6 @@ func TestAnnotateContext_ForwardsGrpcMetadata(t *testing.T) { if err != nil { t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) } - request.RemoteAddr = "192.168.0.1:12345" request.Header.Add("Some-Irrelevant-Header", "some value") request.Header.Add("Grpc-Metadata-FooBar", "Value1") request.Header.Add("Grpc-Metadata-Foo-BAZ", "Value2") @@ -54,7 +52,7 @@ func TestAnnotateContext_ForwardsGrpcMetadata(t *testing.T) { } md, ok := metadata.FromContext(annotated) if !ok || len(md) != emptyForwardMetaCount+3 { - t.Errorf("Expected 5 metadata items in context; got %v", md) + t.Errorf("Expected %d metadata items in context; got %v", md) } if got, want := md["foobar"], []string{"Value1"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["foobar"] = %q; want %q`, got, want) @@ -82,8 +80,8 @@ func TestAnnotateContext_XForwardedFor(t *testing.T) { return } md, ok := metadata.FromContext(annotated) - if !ok || len(md) != emptyForwardMetaCount { - t.Errorf("Expected 2 metadata items in context; got %v", md) + if !ok || len(md) != emptyForwardMetaCount+1 { + t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) } if got, want := md["x-forwarded-host"], []string{"bar.foo.example.com"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["host"] = %v; want %v`, got, want) From e717a8622ca5c2852dea0e96d354b684cb550d9b Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Thu, 26 May 2016 17:39:14 -0700 Subject: [PATCH 050/552] Add bidirectional streaming support by interleaving Send() and Recv() calls. --- .../examplepb/a_bit_of_everything.pb.gw.go | 61 ++++++++++++------ examples/examplepb/flow_combination.pb.gw.go | 61 ++++++++++++------ .../gengateway/template.go | 64 ++++++++++++++++++- 3 files changed, 143 insertions(+), 43 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 1621993de27..41adbcfa480 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -439,35 +439,54 @@ func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, marshaler r return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) - for { - var protoReq sub.StringMessage - 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) + sendErrs := make(chan error, 1) + go func(errs chan<- error) { + for { + var protoReq sub.StringMessage + err = dec.Decode(&protoReq) + if err == nil { + select { + case errs <- err: + default: + } + } + if err == io.EOF { + select { + case errs <- err: + default: + } + return + } + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + select { + case errs <- grpc.Errorf(codes.InvalidArgument, "%v", err): + default: + } + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + select { + case errs <- err: + default: + } + } } - 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) + select { + case errs <- err: + default: + } } - } - - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - return nil, metadata, err - } + }(sendErrs) 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 - + return stream, metadata, <-sendErrs } 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) { diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index ca2e4a9caa9..83357ee9198 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -102,35 +102,54 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) - for { - var protoReq EmptyProto - 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) + sendErrs := make(chan error, 1) + go func(errs chan<- error) { + for { + var protoReq EmptyProto + err = dec.Decode(&protoReq) + if err == nil { + select { + case errs <- err: + default: + } + } + if err == io.EOF { + select { + case errs <- err: + default: + } + return + } + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + select { + case errs <- grpc.Errorf(codes.InvalidArgument, "%v", err): + default: + } + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + select { + case errs <- err: + default: + } + } } - 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) + select { + case errs <- err: + default: + } } - } - - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - return nil, metadata, err - } + }(sendErrs) 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 - + return stream, metadata, <-sendErrs } func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index f9782172b66..f0d48f1636f 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -117,7 +117,9 @@ var _ = utilities.NewDoubleArray `)) handlerTemplate = template.Must(template.New("handler").Parse(` -{{if .Method.GetClientStreaming}} +{{if and .Method.GetClientStreaming .Method.GetServerStreaming}} +{{template "bidi-streaming-request-func" .}} +{{else if .Method.GetClientStreaming}} {{template "client-streaming-request-func" .}} {{else}} {{template "client-rpc-request-func" .}} @@ -234,6 +236,66 @@ var ( {{end}} }`)) + _ = template.Must(handlerTemplate.New("bidi-streaming-request-func").Parse(` +{{template "request-func-signature" .}} { + var metadata runtime.ServerMetadata + stream, err := client.{{.Method.GetName}}(ctx) + if err != nil { + grpclog.Printf("Failed to start streaming: %v", err) + return nil, metadata, err + } + dec := marshaler.NewDecoder(req.Body) + sendErrs := make(chan error, 1) + go func(errs chan<- error) { + for { + var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} + err = dec.Decode(&protoReq) + if err == nil { + select { + case errs <- err: + default: + } + } + if err == io.EOF { + select { + case errs <- err: + default: + } + return + } + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + select { + case errs <- grpc.Errorf(codes.InvalidArgument, "%v", err): + default: + } + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + select { + case errs <- err: + default: + } + } + } + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + select { + case errs <- err: + default: + } + } + }(sendErrs) + 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, <-sendErrs +} +`)) + trailerTemplate = template.Must(template.New("trailer").Parse(` {{range $svc := .}} // Register{{$svc.GetName}}HandlerFromEndpoint is same as Register{{$svc.GetName}}Handler but From 238b2d8e4a173e9e2f5ef0e98bbb790b8db72b1f Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 7 Jun 2016 12:38:18 -0700 Subject: [PATCH 051/552] ensure CloseSend is called, exit on errors --- .../examplepb/a_bit_of_everything.pb.gw.go | 20 +++++++++---------- examples/examplepb/flow_combination.pb.gw.go | 20 +++++++++---------- .../gengateway/template.go | 20 +++++++++---------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 41adbcfa480..e463c0cb11a 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -439,8 +439,13 @@ func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, marshaler r return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) - sendErrs := make(chan error, 1) + firstSend := make(chan error, 1) go func(errs chan<- error) { + defer func() { + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + } + }() for { var protoReq sub.StringMessage err = dec.Decode(&protoReq) @@ -463,6 +468,7 @@ func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, marshaler r case errs <- grpc.Errorf(codes.InvalidArgument, "%v", err): default: } + return } if err = stream.Send(&protoReq); err != nil { grpclog.Printf("Failed to send request: %v", err) @@ -470,23 +476,17 @@ func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, marshaler r case errs <- err: default: } + return } } - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - select { - case errs <- err: - default: - } - } - }(sendErrs) + }(firstSend) 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, <-sendErrs + return stream, metadata, <-firstSend } 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) { diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 83357ee9198..78892385a22 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -102,8 +102,13 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) - sendErrs := make(chan error, 1) + firstSend := make(chan error, 1) go func(errs chan<- error) { + defer func() { + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + } + }() for { var protoReq EmptyProto err = dec.Decode(&protoReq) @@ -126,6 +131,7 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler case errs <- grpc.Errorf(codes.InvalidArgument, "%v", err): default: } + return } if err = stream.Send(&protoReq); err != nil { grpclog.Printf("Failed to send request: %v", err) @@ -133,23 +139,17 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler case errs <- err: default: } + return } } - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - select { - case errs <- err: - default: - } - } - }(sendErrs) + }(firstSend) 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, <-sendErrs + return stream, metadata, <-firstSend } func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index f0d48f1636f..302c055a03d 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -245,8 +245,13 @@ var ( return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) - sendErrs := make(chan error, 1) + firstSend:= make(chan error, 1) go func(errs chan<- error) { + defer func(){ + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + } + }() for { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} err = dec.Decode(&protoReq) @@ -269,6 +274,7 @@ var ( case errs <- grpc.Errorf(codes.InvalidArgument, "%v", err): default: } + return } if err = stream.Send(&protoReq); err != nil { grpclog.Printf("Failed to send request: %v", err) @@ -276,23 +282,17 @@ var ( case errs <- err: default: } + return } } - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - select { - case errs <- err: - default: - } - } - }(sendErrs) + }(firstSend) 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, <-sendErrs + return stream, metadata, <-firstSend } `)) From 843be9e4169dc731aa8e1cae072246c27a161c5e Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 7 Jun 2016 13:15:58 -0700 Subject: [PATCH 052/552] eliminate confusing errs channel --- .../examplepb/a_bit_of_everything.pb.gw.go | 61 +++++++------------ examples/examplepb/flow_combination.pb.gw.go | 61 +++++++------------ .../gengateway/template.go | 61 +++++++------------ 3 files changed, 66 insertions(+), 117 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index e463c0cb11a..4ef03a4ffc6 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -439,54 +439,37 @@ func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, marshaler r return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) - firstSend := make(chan error, 1) - go func(errs chan<- error) { - defer func() { - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - } - }() + 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 + } + firstResult := handleSend() + go func() { for { - var protoReq sub.StringMessage - err = dec.Decode(&protoReq) - if err == nil { - select { - case errs <- err: - default: - } - } - if err == io.EOF { - select { - case errs <- err: - default: - } - return - } - if err != nil { - grpclog.Printf("Failed to decode request: %v", err) - select { - case errs <- grpc.Errorf(codes.InvalidArgument, "%v", err): - default: - } - return - } - if err = stream.Send(&protoReq); err != nil { - grpclog.Printf("Failed to send request: %v", err) - select { - case errs <- err: - default: - } - return + if err := handleSend(); err != nil { + break } } - }(firstSend) + 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, <-firstSend + return stream, metadata, firstResult } 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) { diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 78892385a22..17f62f34a5e 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -102,54 +102,37 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) - firstSend := make(chan error, 1) - go func(errs chan<- error) { - defer func() { - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - } - }() + handleSend := func() error { + var protoReq EmptyProto + 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 + } + firstResult := handleSend() + go func() { for { - var protoReq EmptyProto - err = dec.Decode(&protoReq) - if err == nil { - select { - case errs <- err: - default: - } - } - if err == io.EOF { - select { - case errs <- err: - default: - } - return - } - if err != nil { - grpclog.Printf("Failed to decode request: %v", err) - select { - case errs <- grpc.Errorf(codes.InvalidArgument, "%v", err): - default: - } - return - } - if err = stream.Send(&protoReq); err != nil { - grpclog.Printf("Failed to send request: %v", err) - select { - case errs <- err: - default: - } - return + if err := handleSend(); err != nil { + break } } - }(firstSend) + 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, <-firstSend + return stream, metadata, firstResult } func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 302c055a03d..5fdaa52392a 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -245,54 +245,37 @@ var ( return nil, metadata, err } dec := marshaler.NewDecoder(req.Body) - firstSend:= make(chan error, 1) - go func(errs chan<- error) { - defer func(){ - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - } - }() + handleSend := func() error { + var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} + 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 + } + firstResult := handleSend() + go func() { for { - var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} - err = dec.Decode(&protoReq) - if err == nil { - select { - case errs <- err: - default: - } - } - if err == io.EOF { - select { - case errs <- err: - default: - } - return - } - if err != nil { - grpclog.Printf("Failed to decode request: %v", err) - select { - case errs <- grpc.Errorf(codes.InvalidArgument, "%v", err): - default: - } - return - } - if err = stream.Send(&protoReq); err != nil { - grpclog.Printf("Failed to send request: %v", err) - select { - case errs <- err: - default: - } - return + if err := handleSend(); err != nil { + break } } - }(firstSend) + 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, <-firstSend + return stream, metadata, firstResult } `)) From 7fc6ecf8a4c3be48f6f958c71a88bf78e8f9ac45 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 12 Jun 2016 23:45:16 -0700 Subject: [PATCH 053/552] return earlier when first Send fails --- examples/examplepb/a_bit_of_everything.pb.gw.go | 9 +++++++-- examples/examplepb/flow_combination.pb.gw.go | 9 +++++++-- protoc-gen-grpc-gateway/gengateway/template.go | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 4ef03a4ffc6..c50f6bfcef7 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -452,7 +452,12 @@ func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, marshaler r } return nil } - firstResult := handleSend() + 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 { @@ -469,7 +474,7 @@ func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, marshaler r return nil, metadata, err } metadata.HeaderMD = header - return stream, metadata, firstResult + 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) { diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 17f62f34a5e..9901591b3a4 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -115,7 +115,12 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler } return nil } - firstResult := handleSend() + 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 { @@ -132,7 +137,7 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler return nil, metadata, err } metadata.HeaderMD = header - return stream, metadata, firstResult + return stream, metadata, nil } func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 5fdaa52392a..ff34f396584 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -258,7 +258,12 @@ var ( } return nil } - firstResult := handleSend() + 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 { @@ -275,7 +280,7 @@ var ( return nil, metadata, err } metadata.HeaderMD = header - return stream, metadata, firstResult + return stream, metadata, nil } `)) From c8dd1b7688f44b5b86ab2ef240c9b09c400f4057 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 12 Jun 2016 23:56:40 -0700 Subject: [PATCH 054/552] run realclean and examples targets with latest proto --- examples/examplepb/a_bit_of_everything.pb.go | 2 ++ examples/examplepb/echo_service.pb.go | 2 ++ examples/examplepb/flow_combination.pb.go | 2 ++ examples/sub/message.pb.go | 2 ++ examples/sub2/message.pb.go | 2 ++ runtime/stream_chunk.pb.go | 2 ++ third_party/googleapis/google/api/annotations.pb.go | 2 ++ third_party/googleapis/google/api/http.pb.go | 2 ++ 8 files changed, 16 insertions(+) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 6c48370b972..470928b33ca 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -765,6 +765,8 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ }, } +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, diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 1eadb59e9d9..68e395dc7fa 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -177,6 +177,8 @@ var _EchoService_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, } +func init() { proto.RegisterFile("examples/examplepb/echo_service.proto", fileDescriptor0) } + var fileDescriptor0 = []byte{ // 233 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc, diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 345f7ed5a8a..a924a96dc04 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -632,6 +632,8 @@ var _FlowCombination_serviceDesc = grpc.ServiceDesc{ }, } +func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fileDescriptor2) } + var fileDescriptor2 = []byte{ // 658 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x96, 0xbf, 0x6f, 0xd3, 0x40, diff --git a/examples/sub/message.pb.go b/examples/sub/message.pb.go index dc117712bb7..8ac5568bbf0 100644 --- a/examples/sub/message.pb.go +++ b/examples/sub/message.pb.go @@ -49,6 +49,8 @@ func init() { proto.RegisterType((*StringMessage)(nil), "gengo.grpc.gateway.examples.sub.StringMessage") } +func init() { proto.RegisterFile("examples/sub/message.proto", fileDescriptor0) } + var fileDescriptor0 = []byte{ // 115 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0x48, 0xcc, diff --git a/examples/sub2/message.pb.go b/examples/sub2/message.pb.go index 20e67f637db..8f6f432b49a 100644 --- a/examples/sub2/message.pb.go +++ b/examples/sub2/message.pb.go @@ -41,6 +41,8 @@ func init() { proto.RegisterType((*IdMessage)(nil), "sub2.IdMessage") } +func init() { proto.RegisterFile("examples/sub2/message.proto", fileDescriptor0) } + var fileDescriptor0 = []byte{ // 124 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, diff --git a/runtime/stream_chunk.pb.go b/runtime/stream_chunk.pb.go index f45504e2291..2905054a3a0 100644 --- a/runtime/stream_chunk.pb.go +++ b/runtime/stream_chunk.pb.go @@ -44,6 +44,8 @@ func init() { proto.RegisterType((*StreamError)(nil), "gengo.grpc.gateway.runtime.StreamError") } +func init() { proto.RegisterFile("runtime/stream_chunk.proto", fileDescriptor0) } + var fileDescriptor0 = []byte{ // 175 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0x8e, 0xbd, 0x0e, 0x82, 0x30, diff --git a/third_party/googleapis/google/api/annotations.pb.go b/third_party/googleapis/google/api/annotations.pb.go index 21fca4856a2..f051b70b873 100644 --- a/third_party/googleapis/google/api/annotations.pb.go +++ b/third_party/googleapis/google/api/annotations.pb.go @@ -43,6 +43,8 @@ func init() { proto.RegisterExtension(E_Http) } +func init() { proto.RegisterFile("google/api/annotations.proto", fileDescriptor0) } + var fileDescriptor0 = []byte{ // 167 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, diff --git a/third_party/googleapis/google/api/http.pb.go b/third_party/googleapis/google/api/http.pb.go index 022102dd569..d340935a293 100644 --- a/third_party/googleapis/google/api/http.pb.go +++ b/third_party/googleapis/google/api/http.pb.go @@ -335,6 +335,8 @@ func init() { proto.RegisterType((*CustomHttpPattern)(nil), "google.api.CustomHttpPattern") } +func init() { proto.RegisterFile("google/api/http.proto", fileDescriptor1) } + var fileDescriptor1 = []byte{ // 277 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x51, 0xbd, 0x6a, 0xf3, 0x40, From 685f7ffde5945b5639ed4bb1b603934326526bca Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 13 Jun 2016 17:45:45 +0900 Subject: [PATCH 055/552] 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,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, 0x7e, 0x1b, 0x3c, 0xe6, 0x88, 0x29, - 0x40, 0x48, 0x5a, 0x91, 0xef, 0x71, 0x08, 0x70, 0x18, 0x96, 0xf7, 0xde, 0xfd, 0x10, 0x31, 0x0d, - 0x88, 0xac, 0x86, 0xd8, 0x56, 0xcc, 0xe1, 0x8b, 0x88, 0x1c, 0x20, 0xa6, 0xb4, 0xa2, 0x2f, 0x40, - 0x38, 0xc7, 0x6a, 0x23, 0x44, 0xcc, 0x00, 0x62, 0x9a, 0x71, 0xac, 0x36, 0x38, 0xe0, 0x0d, 0x54, - 0x3e, 0x30, 0x9e, 0x92, 0x6e, 0x4c, 0x92, 0x07, 0x48, 0x4e, 0x2b, 0x85, 0x9b, 0x49, 0x50, 0xcc, - 0x53, 0x00, 0xd0, 0x4c, 0x08, 0x8a, 0x98, 0xfe, 0x8f, 0x50, 0x9b, 0xd2, 0x7e, 0x88, 0x40, 0x80, - 0xc8, 0x6b, 0x85, 0x60, 0x27, 0x16, 0xeb, 0x7a, 0x0e, 0x84, 0x2a, 0x04, 0x14, 0x59, 0x16, 0x8a, - 0x7c, 0x2f, 0xe1, 0x4f, 0x6c, 0xa5, 0x0c, 0x90, 0x32, 0xf7, 0x27, 0x32, 0xf2, 0x25, 0x42, 0xc4, - 0xf2, 0xcd, 0x10, 0x50, 0x01, 0x40, 0xa5, 0xd1, 0x98, 0x30, 0x67, 0x5b, 0xbe, 0x49, 0x1c, 0xa3, - 0xd3, 0x84, 0xf7, 0xb5, 0x42, 0xc0, 0xc2, 0x29, 0xef, 0xa0, 0x8a, 0x9b, 0xf4, 0xee, 0x2a, 0xd0, - 0x5e, 0xd5, 0xca, 0x6e, 0xc2, 0xbd, 0x18, 0x16, 0x47, 0xaa, 0x0a, 0xb0, 0x6a, 0x04, 0x13, 0x72, - 0xe2, 0x8a, 0x3e, 0xcc, 0x02, 0x68, 0x16, 0xdc, 0x14, 0x7c, 0x08, 0x21, 0x31, 0x0f, 0x06, 0x08, - 0xe6, 0x90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7, 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, 0xb3, 0x8a, 0x77, 0x67, 0xb5, 0x1f, 0xa6, 0x56, + 0x94, 0xfe, 0xa8, 0xb8, 0x00, 0x24, 0x2e, 0x01, 0x09, 0x89, 0x4a, 0x70, 0x0f, 0xfc, 0x44, 0xfc, + 0xe4, 0x16, 0xb8, 0x01, 0xee, 0x80, 0xb3, 0x33, 0xbb, 0x9b, 0x59, 0x27, 0x25, 0xc1, 0xa9, 0xe0, + 0x97, 0x77, 0xce, 0x3c, 0xfb, 0x9c, 0xe7, 0x9c, 0x33, 0xe7, 0xcc, 0x1a, 0xee, 0xd2, 0x67, 0xa6, + 0xed, 0x0e, 0xa8, 0xaf, 0xc5, 0x0f, 0x6e, 0x47, 0x33, 0xdb, 0x1d, 0x2b, 0x68, 0xb3, 0x83, 0x36, + 0x1d, 0x52, 0x6f, 0x14, 0x1c, 0x5a, 0x4e, 0x5f, 0x75, 0x3d, 0x16, 0x30, 0x72, 0xbb, 0x4f, 0x9d, + 0x3e, 0x53, 0xfb, 0x9e, 0xdb, 0x55, 0xfb, 0x66, 0x40, 0xbf, 0x36, 0x47, 0x6a, 0x42, 0xa0, 0xa6, + 0x04, 0x8d, 0xff, 0xf5, 0x19, 0xeb, 0x0f, 0xa8, 0x66, 0xba, 0x96, 0x66, 0x3a, 0x0e, 0x0b, 0xcc, + 0xc0, 0x62, 0x8e, 0x2f, 0x48, 0x1a, 0x8d, 0xd4, 0xa5, 0x1f, 0x76, 0x34, 0x9b, 0xfa, 0xbe, 0xd9, + 0xa7, 0xf1, 0xde, 0x2d, 0x79, 0x4f, 0xcf, 0x6e, 0x36, 0xff, 0xac, 0x42, 0xed, 0xc1, 0x86, 0x15, + 0x6c, 0x1f, 0xb4, 0x52, 0x61, 0xa4, 0x0b, 0x15, 0x1f, 0x7f, 0x07, 0xb4, 0xed, 0x50, 0x3f, 0xa0, + 0xbd, 0xfa, 0xcd, 0x15, 0xe5, 0x4e, 0x49, 0xff, 0x48, 0xbd, 0x94, 0x54, 0x75, 0x9c, 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, 0xd6, 0x6c, 0x2b, 0xb4, 0xa9, 0x67, 0x75, 0x5b, 0xf8, + 0xbe, 0x51, 0x8c, 0x58, 0x04, 0xe5, 0x6d, 0xa8, 0xfa, 0xd9, 0xe8, 0xe6, 0x90, 0x76, 0xce, 0xa8, + 0xf8, 0x99, 0xf0, 0x52, 0x58, 0x9a, 0xa9, 0x1a, 0xc2, 0x6a, 0x09, 0x4c, 0xaa, 0x89, 0x2f, 0xc7, + 0x30, 0x8f, 0xa0, 0x79, 0x0c, 0x53, 0x8a, 0x21, 0x86, 0xa4, 0x3c, 0x04, 0x21, 0x44, 0x40, 0x12, + 0x16, 0x1d, 0x16, 0x3d, 0xea, 0x52, 0x8c, 0xa5, 0xd7, 0xce, 0x64, 0x6d, 0x01, 0x4f, 0x69, 0xd1, + 0x58, 0x48, 0x36, 0x77, 0xa4, 0xec, 0xed, 0x41, 0x89, 0x39, 0x34, 0x6a, 0x78, 0xdb, 0x0d, 0x46, + 0xf5, 0xeb, 0xbc, 0x83, 0xd6, 0x2e, 0x99, 0x9b, 0x56, 0xf4, 0xce, 0x13, 0xd1, 0xa8, 0x8f, 0xae, + 0x19, 0xc0, 0x99, 0xb8, 0x11, 0x8b, 0x5f, 0x16, 0xbc, 0x42, 0x48, 0x7d, 0x31, 0x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xe6, 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, } 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,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bd, 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 82e46bf6fe649077b3be9563287d8b2100097897 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 13 Jun 2016 18:07:26 +0900 Subject: [PATCH 056/552] 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, 0xfe, 0xa8, 0xb8, 0x00, 0x24, 0x2e, 0x01, 0x09, 0x89, 0x4a, 0x70, 0x0f, 0xfc, 0x44, 0xfc, - 0xe4, 0x16, 0xb8, 0x01, 0xee, 0x80, 0xb3, 0x33, 0xbb, 0x9b, 0x59, 0x27, 0x25, 0xc1, 0xa9, 0xe0, - 0x97, 0x77, 0xce, 0x3c, 0xfb, 0x9c, 0xe7, 0x9c, 0x33, 0xe7, 0xcc, 0x1a, 0xee, 0xd2, 0x67, 0xa6, - 0xed, 0x0e, 0xa8, 0xaf, 0xc5, 0x0f, 0x6e, 0x47, 0x33, 0xdb, 0x1d, 0x2b, 0x68, 0xb3, 0x83, 0x36, - 0x1d, 0x52, 0x6f, 0x14, 0x1c, 0x5a, 0x4e, 0x5f, 0x75, 0x3d, 0x16, 0x30, 0x72, 0xbb, 0x4f, 0x9d, - 0x3e, 0x53, 0xfb, 0x9e, 0xdb, 0x55, 0xfb, 0x66, 0x40, 0xbf, 0x36, 0x47, 0x6a, 0x42, 0xa0, 0xa6, - 0x04, 0x8d, 0xff, 0xf5, 0x19, 0xeb, 0x0f, 0xa8, 0x66, 0xba, 0x96, 0x66, 0x3a, 0x0e, 0x0b, 0xcc, - 0xc0, 0x62, 0x8e, 0x2f, 0x48, 0x1a, 0x8d, 0xd4, 0xa5, 0x1f, 0x76, 0x34, 0x9b, 0xfa, 0xbe, 0xd9, - 0xa7, 0xf1, 0xde, 0x2d, 0x79, 0x4f, 0xcf, 0x6e, 0x36, 0xff, 0xac, 0x42, 0xed, 0xc1, 0x86, 0x15, - 0x6c, 0x1f, 0xb4, 0x52, 0x61, 0xa4, 0x0b, 0x15, 0x1f, 0x7f, 0x07, 0xb4, 0xed, 0x50, 0x3f, 0xa0, - 0xbd, 0xfa, 0xcd, 0x15, 0xe5, 0x4e, 0x49, 0xff, 0x48, 0xbd, 0x94, 0x54, 0x75, 0x9c, 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, 0xd6, 0x6c, 0x2b, 0xb4, 0xa9, 0x67, 0x75, 0x5b, 0xf8, - 0xbe, 0x51, 0x8c, 0x58, 0x04, 0xe5, 0x6d, 0xa8, 0xfa, 0xd9, 0xe8, 0xe6, 0x90, 0x76, 0xce, 0xa8, - 0xf8, 0x99, 0xf0, 0x52, 0x58, 0x9a, 0xa9, 0x1a, 0xc2, 0x6a, 0x09, 0x4c, 0xaa, 0x89, 0x2f, 0xc7, - 0x30, 0x8f, 0xa0, 0x79, 0x0c, 0x53, 0x8a, 0x21, 0x86, 0xa4, 0x3c, 0x04, 0x21, 0x44, 0x40, 0x12, - 0x16, 0x1d, 0x16, 0x3d, 0xea, 0x52, 0x8c, 0xa5, 0xd7, 0xce, 0x64, 0x6d, 0x01, 0x4f, 0x69, 0xd1, - 0x58, 0x48, 0x36, 0x77, 0xa4, 0xec, 0xed, 0x41, 0x89, 0x39, 0x34, 0x6a, 0x78, 0xdb, 0x0d, 0x46, - 0xf5, 0xeb, 0xbc, 0x83, 0xd6, 0x2e, 0x99, 0x9b, 0x56, 0xf4, 0xce, 0x13, 0xd1, 0xa8, 0x8f, 0xae, - 0x19, 0xc0, 0x99, 0xb8, 0x11, 0x8b, 0x5f, 0x16, 0xbc, 0x42, 0x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f, 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, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x57, 0xdd, 0x6e, 0x1b, 0x45, + 0x14, 0xee, 0xda, 0x89, 0x13, 0x9f, 0x8d, 0x53, 0x67, 0xd2, 0xa4, 0xae, 0x0b, 0x4a, 0x30, 0x14, + 0x55, 0xa1, 0xda, 0x55, 0x37, 0x15, 0xd0, 0x48, 0x80, 0x9a, 0xc6, 0x50, 0xa4, 0x36, 0x81, 0x4d, + 0x1a, 0xa4, 0x48, 0xc8, 0x5a, 0xdb, 0x13, 0x67, 0x15, 0xef, 0xce, 0x6a, 0x7f, 0x4c, 0xad, 0x28, + 0x5c, 0x54, 0x5c, 0x72, 0xc7, 0x23, 0x20, 0x71, 0x51, 0x09, 0xde, 0x81, 0x6b, 0x2e, 0xe9, 0x23, + 0xf0, 0x20, 0x9c, 0x9d, 0xd9, 0xdd, 0xcc, 0x3a, 0x31, 0x09, 0x49, 0x05, 0x57, 0xde, 0x39, 0xe7, + 0x9b, 0xef, 0xfc, 0xcd, 0x39, 0x33, 0x86, 0x7b, 0xf4, 0x85, 0xe5, 0x78, 0x7d, 0x1a, 0xe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2, 0xc9, 0x82, 0x09, 0x5c, 0xb4, 0x1b, 0x4b, 0xc8, 0x3b, 0x30, 0xd3, 0x65, + 0x51, 0x1b, 0x23, 0x16, 0x88, 0x09, 0x44, 0x28, 0xa6, 0x2a, 0x64, 0x02, 0x82, 0x1c, 0xb6, 0x1b, + 0x7e, 0xf8, 0x20, 0x41, 0x4c, 0x22, 0xa2, 0x68, 0x02, 0x17, 0x65, 0x1c, 0x91, 0x8c, 0x28, 0x21, + 0x62, 0xc2, 0x54, 0x23, 0x09, 0x22, 0x38, 0x56, 0x8d, 0x04, 0x31, 0x85, 0x88, 0x49, 0xce, 0xb1, + 0x6a, 0x08, 0xc0, 0xbb, 0x50, 0xd9, 0xb7, 0x5f, 0xd0, 0x6e, 0x46, 0x32, 0x8d, 0x90, 0x92, 0x39, + 0x93, 0x08, 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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, 0x80, + 0x11, 0xed, 0x1f, 0xe3, 0x45, 0xeb, 0x9a, 0x18, 0x86, 0xa9, 0x03, 0xff, 0x12, 0xdf, 0xe8, 0x70, + 0xc7, 0xbe, 0x25, 0xf7, 0xce, 0x73, 0x8c, 0xa2, 0x37, 0xfa, 0x91, 0x38, 0xdd, 0x7b, 0xb7, 0x1a, + 0x55, 0x7d, 0x60, 0x64, 0xf8, 0x58, 0xb7, 0x26, 0x66, 0xdb, 0x1e, 0x21, 0xa7, 0x54, 0xe4, 0x77, + 0x05, 0x66, 0xe2, 0xbb, 0xe4, 0x2b, 0x2b, 0x3c, 0xe0, 0x51, 0xfd, 0xf7, 0x67, 0xfe, 0x33, 0x1e, + 0xe7, 0xc3, 0xc6, 0x83, 0x73, 0x0b, 0x90, 0xfb, 0x23, 0xa3, 0xc5, 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, 0x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a8, 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, + // 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, 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a, 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() From 9fa943b17d89c626e32b8d81f059d9b81c2bf9fd Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 13 Jun 2016 17:35:01 +0900 Subject: [PATCH 057/552] Add integration with clients generated by swagger-codegen --- .travis.yml | 6 +- .../build-protoc.sh | 2 +- .travis/install-swagger-codegen.sh | 9 + Makefile | 30 +- examples/client_test.go | 162 +++++ .../clients/abe/ABitOfEverythingNested.go | 11 + .../clients/abe/ABitOfEverythingServiceApi.go | 648 ++++++++++++++++++ .../clients/abe/ExamplepbABitOfEverything.go | 33 + examples/clients/abe/ExamplepbNumericEnum.go | 8 + examples/clients/abe/NestedDeepEnum.go | 8 + examples/clients/abe/ProtobufEmpty.go | 8 + examples/clients/abe/Sub2IdMessage.go | 9 + examples/clients/abe/SubStringMessage.go | 9 + examples/clients/echo/EchoServiceApi.go | 145 ++++ .../clients/echo/ExamplepbSimpleMessage.go | 9 + .../a_bit_of_everything.swagger.json | 36 +- examples/integration_test.go | 44 +- examples/main_test.go | 45 ++ protoc-gen-swagger/genswagger/template.go | 20 +- 19 files changed, 1189 insertions(+), 53 deletions(-) rename .travis.build-protoc.sh => .travis/build-protoc.sh (91%) create mode 100755 .travis/install-swagger-codegen.sh create mode 100644 examples/client_test.go create mode 100644 examples/clients/abe/ABitOfEverythingNested.go create mode 100644 examples/clients/abe/ABitOfEverythingServiceApi.go create mode 100644 examples/clients/abe/ExamplepbABitOfEverything.go create mode 100644 examples/clients/abe/ExamplepbNumericEnum.go create mode 100644 examples/clients/abe/NestedDeepEnum.go create mode 100644 examples/clients/abe/ProtobufEmpty.go create mode 100644 examples/clients/abe/Sub2IdMessage.go create mode 100644 examples/clients/abe/SubStringMessage.go create mode 100644 examples/clients/echo/EchoServiceApi.go create mode 100644 examples/clients/echo/ExamplepbSimpleMessage.go create mode 100644 examples/main_test.go diff --git a/.travis.yml b/.travis.yml index 53c2f252adf..c52d41a6587 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,15 +10,17 @@ cache: directories: - $HOME/local before_install: -- ./.travis.build-protoc.sh 3.0.0-beta-3 +- ./.travis/build-protoc.sh 3.0.0-beta-3 +- ./.travis/install-swagger-codegen.sh 2.1.6 - go get github.com/golang/lint/golint +- go get github.com/dghubble/sling install: - go get github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway - go get github.com/gengo/grpc-gateway/runtime - go get github.com/gengo/grpc-gateway/examples - go get github.com/gengo/grpc-gateway/examples/server script: -- make realclean && make examples +- make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" - if ! go version | grep devel; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi - env GLOG_logtostderr=1 go test -race -v github.com/gengo/grpc-gateway/... - golint github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/... diff --git a/.travis.build-protoc.sh b/.travis/build-protoc.sh similarity index 91% rename from .travis.build-protoc.sh rename to .travis/build-protoc.sh index 0aabd2c3cbe..0dc92a8e2a7 100755 --- a/.travis.build-protoc.sh +++ b/.travis/build-protoc.sh @@ -1,7 +1,7 @@ #!/bin/sh -eu protoc_version=$1 if test -z "${protoc_version}"; then - echo "Usage: .travis.build-protoc.sh protoc-version" + echo "Usage: .travis/build-protoc.sh protoc-version" exit 1 fi if ! $HOME/local/bin/protoc-${protoc_version} --version 2>/dev/null; then diff --git a/.travis/install-swagger-codegen.sh b/.travis/install-swagger-codegen.sh new file mode 100755 index 00000000000..ad4c8b56815 --- /dev/null +++ b/.travis/install-swagger-codegen.sh @@ -0,0 +1,9 @@ +#!/bin/sh -eu +codegen_version=$1 +if test -z "${codegen_version}"; then + echo "Usage: .travis/install-swagger-codegen.sh codegen-version" + exit 1 +fi + +wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${codegen_version}/swagger-codegen-cli-${codegen_version}.jar \ + -O $HOME/local/swagger-codegen-cli.jar diff --git a/Makefile b/Makefile index 7a56ac69bc3..3299297a953 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,24 @@ EXAMPLE_GWSRCS=$(EXAMPLES:.proto=.pb.gw.go) EXAMPLE_SWAGGERSRCS=$(EXAMPLES:.proto=.swagger.json) EXAMPLE_DEPS=examples/sub/message.proto examples/sub2/message.proto EXAMPLE_DEPSRCS=$(EXAMPLE_DEPS:.proto=.pb.go) + +EXAMPLE_CLIENT_DIR=examples/clients +ECHO_EXAMPLE_SPEC=examples/examplepb/echo_service.swagger.json +ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/echo/EchoServiceApi.go \ + $(EXAMPLE_CLIENT_DIR)/echo/ExamplepbSimpleMessage.go +ABE_EXAMPLE_SPEC=examples/examplepb/a_bit_of_everything.swagger.json +ABE_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/abe/ABitOfEverythingServiceApi.go \ + $(EXAMPLE_CLIENT_DIR)/abe/ABitOfEverythingNested.go \ + $(EXAMPLE_CLIENT_DIR)/abe/ExamplepbABitOfEverything.go \ + $(EXAMPLE_CLIENT_DIR)/abe/ExamplepbNumericEnum.go \ + $(EXAMPLE_CLIENT_DIR)/abe/ExamplepbIdMessage.go \ + $(EXAMPLE_CLIENT_DIR)/abe/NestedDeepEnum.go \ + $(EXAMPLE_CLIENT_DIR)/abe/ProtobufEmpty.go \ + $(EXAMPLE_CLIENT_DIR)/abe/Sub2IdMessage.go \ + $(EXAMPLE_CLIENT_DIR)/abe/SubStringMessage.go +EXAMPLE_CLIENT_SRCS=$(ECHO_EXAMPLE_SRCS) $(ABE_EXAMPLE_SRCS) +SWAGGER_CODEGEN=swagger-codegen + PROTOC_INC_PATH=$(dir $(shell which protoc))/../include generate: $(OPTIONS_GO) $(RUNTIME_GO) @@ -88,7 +106,16 @@ $(EXAMPLE_GWSRCS): $(GATEWAY_PLUGIN) $(EXAMPLES) $(EXAMPLE_SWAGGERSRCS): $(SWAGGER_PLUGIN) $(SWAGGER_EXAMPLES) protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(SWAGGER_PLUGIN) --swagger_out=logtostderr=true,$(PKGMAP):. $(SWAGGER_EXAMPLES) -examples: $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_DEPSRCS) $(EXAMPLE_SWAGGERSRCS) +$(ECHO_EXAMPLE_SRCS): $(ECHO_EXAMPLE_SPEC) + $(SWAGGER_CODEGEN) generate -i $(ECHO_EXAMPLE_SPEC) \ + -l go -o examples/clients --additional-properties packageName=echo + @rm -f $(EXAMPLE_CLIENT_DIR)/README.md $(EXAMPLE_CLIENT_DIR)/git_push.sh $(EXAMPLE_CLIENT_DIR)/.gitignore +$(ABE_EXAMPLE_SRCS): $(ABE_EXAMPLE_SPEC) + $(SWAGGER_CODEGEN) generate -i $(ABE_EXAMPLE_SPEC) \ + -l go -o examples/clients --additional-properties packageName=abe + @rm -f $(EXAMPLE_CLIENT_DIR)/README.md $(EXAMPLE_CLIENT_DIR)/git_push.sh $(EXAMPLE_CLIENT_DIR)/.gitignore + +examples: $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_DEPSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) test: examples go test -race $(PKG)/... @@ -101,5 +128,6 @@ realclean: distclean rm -f $(EXAMPLE_SWAGGERSRCS) rm -f $(GO_PLUGIN) rm -f $(SWAGGER_PLUGIN) + rm -f $(EXAMPLE_CLIENT_SRCS) .PHONY: generate examples test clean distclean realclean diff --git a/examples/client_test.go b/examples/client_test.go new file mode 100644 index 00000000000..41f29fc593f --- /dev/null +++ b/examples/client_test.go @@ -0,0 +1,162 @@ +package main + +import ( + "reflect" + "testing" + + "github.com/gengo/grpc-gateway/examples/clients/abe" + "github.com/gengo/grpc-gateway/examples/clients/echo" +) + +func TestClientIntegration(t *testing.T) { +} + +func TestEchoClient(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + + cl := echo.NewEchoServiceApiWithBasePath("http://localhost:8080") + resp, err := cl.Echo("foo") + if err != nil { + t.Errorf(`cl.Echo("foo") failed with %v; want success`, err) + } + if got, want := resp.Id, "foo"; got != want { + t.Errorf("resp.Id = %q; want %q", got, want) + } +} + +func TestEchoBodyClient(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + + cl := echo.NewEchoServiceApiWithBasePath("http://localhost:8080") + req := echo.ExamplepbSimpleMessage{Id: "foo"} + resp, err := cl.EchoBody(req) + if err != nil { + t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err) + } + if got, want := resp.Id, "foo"; got != want { + t.Errorf("resp.Id = %q; want %q", got, want) + } +} + +func TestAbitOfEverythingClient(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + + cl := abe.NewABitOfEverythingServiceApiWithBasePath("http://localhost:8080") + testABEClientCreate(t, cl) + testABEClientCreateBody(t, cl) +} + +func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { + want := abe.ExamplepbABitOfEverything{ + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: "4294967296", + Uint64Value: "9223372036854775807", + Int32Value: -2147483648, + Fixed64Value: "9223372036854775807", + Fixed32Value: 4294967295, + BoolValue: true, + StringValue: "strprefix/foo", + Uint32Value: 4294967295, + Sfixed32Value: 2147483647, + Sfixed64Value: "-4611686018427387904", + Sint32Value: 2147483647, + Sint64Value: "4611686018427387903", + NonConventionalNameValue: "camelCase", + } + resp, err := cl.Create( + want.FloatValue, + want.DoubleValue, + want.Int64Value, + want.Uint64Value, + want.Int32Value, + want.Fixed64Value, + want.Fixed32Value, + want.BoolValue, + want.StringValue, + want.Uint32Value, + want.Sfixed32Value, + want.Sfixed64Value, + want.Sint32Value, + want.Sint64Value, + want.NonConventionalNameValue, + ) + if err != nil { + t.Errorf("cl.Create(%#v) failed with %v; want success", want, err) + } + if resp.Uuid == "" { + t.Errorf("resp.Uuid is empty; want not empty") + } + resp.Uuid = "" + if got := resp; !reflect.DeepEqual(got, want) { + t.Errorf("resp = %#v; want %#v", got, want) + } +} + +func testABEClientCreateBody(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { + t.Log("TODO: support enum") + return + + want := abe.ExamplepbABitOfEverything{ + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: "4294967296", + Uint64Value: "9223372036854775807", + Int32Value: -2147483648, + Fixed64Value: "9223372036854775807", + Fixed32Value: 4294967295, + BoolValue: true, + StringValue: "strprefix/foo", + Uint32Value: 4294967295, + Sfixed32Value: 2147483647, + Sfixed64Value: "-4611686018427387904", + Sint32Value: 2147483647, + Sint64Value: "4611686018427387903", + NonConventionalNameValue: "camelCase", + + Nested: []abe.ABitOfEverythingNested{ + { + Name: "bar", + Amount: 10, + }, + { + Name: "baz", + Amount: 20, + }, + }, + RepeatedStringValue: []string{"a", "b", "c"}, + OneofString: "x", + MapValue: map[string]abe.ExamplepbNumericEnum{ + // "a": abe.ExamplepbNumericEnum_ONE, + // "b": abe.ExamplepbNumericEnum_ZERO, + }, + MappedStringValue: map[string]string{ + "a": "x", + "b": "y", + }, + MappedNestedValue: map[string]abe.ABitOfEverythingNested{ + "a": {Name: "x", Amount: 1}, + "b": {Name: "y", Amount: 2}, + }, + } + resp, err := cl.CreateBody(want) + if err != nil { + t.Errorf("cl.CreateBody(%#v) failed with %v; want success", want, err) + } + if resp.Uuid == "" { + t.Errorf("resp.Uuid is empty; want not empty") + } + resp.Uuid = "" + if got := resp; !reflect.DeepEqual(got, want) { + t.Errorf("resp = %#v; want %#v", got, want) + } +} diff --git a/examples/clients/abe/ABitOfEverythingNested.go b/examples/clients/abe/ABitOfEverythingNested.go new file mode 100644 index 00000000000..ab15b89cfbd --- /dev/null +++ b/examples/clients/abe/ABitOfEverythingNested.go @@ -0,0 +1,11 @@ +package abe + +import ( +) + +type ABitOfEverythingNested struct { + Amount int64 `json:"amount,omitempty"` + Name string `json:"name,omitempty"` + Ok NestedDeepEnum `json:"ok,omitempty"` + +} diff --git a/examples/clients/abe/ABitOfEverythingServiceApi.go b/examples/clients/abe/ABitOfEverythingServiceApi.go new file mode 100644 index 00000000000..855d2755155 --- /dev/null +++ b/examples/clients/abe/ABitOfEverythingServiceApi.go @@ -0,0 +1,648 @@ +package abe + +import ( + "strings" + "fmt" + "encoding/json" + "errors" + "github.com/dghubble/sling" +) + +type ABitOfEverythingServiceApi struct { + basePath string +} + +func NewABitOfEverythingServiceApi() *ABitOfEverythingServiceApi{ + return &ABitOfEverythingServiceApi { + basePath: "http://localhost", + } +} + +func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythingServiceApi{ + return &ABitOfEverythingServiceApi { + basePath: basePath, + } +} + +/** + * + * + * @param floatValue + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param uint32Value + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param nonConventionalNameValue + * @return ExamplepbABitOfEverything + */ +//func (a ABitOfEverythingServiceApi) Create (floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string) (ExamplepbABitOfEverything, error) { +func (a ABitOfEverythingServiceApi) Create (floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string) (ExamplepbABitOfEverything, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}" + path = strings.Replace(path, "{" + "float_value" + "}", fmt.Sprintf("%v", floatValue), -1) + path = strings.Replace(path, "{" + "double_value" + "}", fmt.Sprintf("%v", doubleValue), -1) + path = strings.Replace(path, "{" + "int64_value" + "}", fmt.Sprintf("%v", int64Value), -1) + path = strings.Replace(path, "{" + "uint64_value" + "}", fmt.Sprintf("%v", uint64Value), -1) + path = strings.Replace(path, "{" + "int32_value" + "}", fmt.Sprintf("%v", int32Value), -1) + path = strings.Replace(path, "{" + "fixed64_value" + "}", fmt.Sprintf("%v", fixed64Value), -1) + path = strings.Replace(path, "{" + "fixed32_value" + "}", fmt.Sprintf("%v", fixed32Value), -1) + path = strings.Replace(path, "{" + "bool_value" + "}", fmt.Sprintf("%v", boolValue), -1) + path = strings.Replace(path, "{" + "string_value" + "}", fmt.Sprintf("%v", stringValue), -1) + path = strings.Replace(path, "{" + "uint32_value" + "}", fmt.Sprintf("%v", uint32Value), -1) + path = strings.Replace(path, "{" + "sfixed32_value" + "}", fmt.Sprintf("%v", sfixed32Value), -1) + path = strings.Replace(path, "{" + "sfixed64_value" + "}", fmt.Sprintf("%v", sfixed64Value), -1) + path = strings.Replace(path, "{" + "sint32_value" + "}", fmt.Sprintf("%v", sint32Value), -1) + path = strings.Replace(path, "{" + "sint64_value" + "}", fmt.Sprintf("%v", sint64Value), -1) + path = strings.Replace(path, "{" + "nonConventionalNameValue" + "}", fmt.Sprintf("%v", nonConventionalNameValue), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ExamplepbABitOfEverything) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param body + * @return ExamplepbABitOfEverything + */ +//func (a ABitOfEverythingServiceApi) CreateBody (body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { +func (a ABitOfEverythingServiceApi) CreateBody (body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything" + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + +// body params + _sling = _sling.BodyJSON(body) + + var successPayload = new(ExamplepbABitOfEverything) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param singleNestedName + * @param body + * @return ExamplepbABitOfEverything + */ +//func (a ABitOfEverythingServiceApi) DeepPathEcho (singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { +func (a ABitOfEverythingServiceApi) DeepPathEcho (singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/{single_nested.name}" + path = strings.Replace(path, "{" + "single_nested.name" + "}", fmt.Sprintf("%v", singleNestedName), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + +// body params + _sling = _sling.BodyJSON(body) + + var successPayload = new(ExamplepbABitOfEverything) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param uuid + * @return ProtobufEmpty + */ +//func (a ABitOfEverythingServiceApi) Delete (uuid string) (ProtobufEmpty, error) { +func (a ABitOfEverythingServiceApi) Delete (uuid string) (ProtobufEmpty, error) { + + _sling := sling.New().Delete(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/{uuid}" + path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ProtobufEmpty) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param value + * @return SubStringMessage + */ +//func (a ABitOfEverythingServiceApi) Echo (value string) (SubStringMessage, error) { +func (a ABitOfEverythingServiceApi) Echo (value string) (SubStringMessage, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/echo/{value}" + path = strings.Replace(path, "{" + "value" + "}", fmt.Sprintf("%v", value), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(SubStringMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @return SubStringMessage + */ +//func (a ABitOfEverythingServiceApi) Echo_1 () (SubStringMessage, error) { +func (a ABitOfEverythingServiceApi) Echo_1 () (SubStringMessage, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v2/example/echo" + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(SubStringMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param body + * @return SubStringMessage + */ +//func (a ABitOfEverythingServiceApi) Echo_2 (body SubStringMessage) (SubStringMessage, error) { +func (a ABitOfEverythingServiceApi) Echo_2 (body SubStringMessage) (SubStringMessage, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v2/example/echo" + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + +// body params + _sling = _sling.BodyJSON(body) + + var successPayload = new(SubStringMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param uuid + * @return ExamplepbABitOfEverything + */ +//func (a ABitOfEverythingServiceApi) Lookup (uuid string) (ExamplepbABitOfEverything, error) { +func (a ABitOfEverythingServiceApi) Lookup (uuid string) (ExamplepbABitOfEverything, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/{uuid}" + path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ExamplepbABitOfEverything) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @return ProtobufEmpty + */ +//func (a ABitOfEverythingServiceApi) Timeout () (ProtobufEmpty, error) { +func (a ABitOfEverythingServiceApi) Timeout () (ProtobufEmpty, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v2/example/timeout" + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ProtobufEmpty) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param uuid + * @param body + * @return ProtobufEmpty + */ +//func (a ABitOfEverythingServiceApi) Update (uuid string, body ExamplepbABitOfEverything) (ProtobufEmpty, error) { +func (a ABitOfEverythingServiceApi) Update (uuid string, body ExamplepbABitOfEverything) (ProtobufEmpty, error) { + + _sling := sling.New().Put(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/{uuid}" + path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + +// body params + _sling = _sling.BodyJSON(body) + + var successPayload = new(ProtobufEmpty) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} diff --git a/examples/clients/abe/ExamplepbABitOfEverything.go b/examples/clients/abe/ExamplepbABitOfEverything.go new file mode 100644 index 00000000000..25084255678 --- /dev/null +++ b/examples/clients/abe/ExamplepbABitOfEverything.go @@ -0,0 +1,33 @@ +package abe + +import ( +) + +type ExamplepbABitOfEverything struct { + BoolValue bool `json:"bool_value,omitempty"` + DoubleValue float64 `json:"double_value,omitempty"` + EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"` + Fixed32Value int64 `json:"fixed32_value,omitempty"` + Fixed64Value string `json:"fixed64_value,omitempty"` + FloatValue float32 `json:"float_value,omitempty"` + Int32Value int32 `json:"int32_value,omitempty"` + Int64Value string `json:"int64_value,omitempty"` + MapValue map[string]ExamplepbNumericEnum `json:"map_value,omitempty"` + MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"` + MappedStringValue map[string]string `json:"mapped_string_value,omitempty"` + Nested []ABitOfEverythingNested `json:"nested,omitempty"` + NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` + OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"` + OneofString string `json:"oneof_string,omitempty"` + RepeatedStringValue []string `json:"repeated_string_value,omitempty"` + Sfixed32Value int32 `json:"sfixed32_value,omitempty"` + Sfixed64Value string `json:"sfixed64_value,omitempty"` + SingleNested ABitOfEverythingNested `json:"single_nested,omitempty"` + Sint32Value int32 `json:"sint32_value,omitempty"` + Sint64Value string `json:"sint64_value,omitempty"` + StringValue string `json:"string_value,omitempty"` + Uint32Value int64 `json:"uint32_value,omitempty"` + Uint64Value string `json:"uint64_value,omitempty"` + Uuid string `json:"uuid,omitempty"` + +} diff --git a/examples/clients/abe/ExamplepbNumericEnum.go b/examples/clients/abe/ExamplepbNumericEnum.go new file mode 100644 index 00000000000..51cffc77f69 --- /dev/null +++ b/examples/clients/abe/ExamplepbNumericEnum.go @@ -0,0 +1,8 @@ +package abe + +import ( +) + +type ExamplepbNumericEnum struct { + +} diff --git a/examples/clients/abe/NestedDeepEnum.go b/examples/clients/abe/NestedDeepEnum.go new file mode 100644 index 00000000000..b48e231216c --- /dev/null +++ b/examples/clients/abe/NestedDeepEnum.go @@ -0,0 +1,8 @@ +package abe + +import ( +) + +type NestedDeepEnum struct { + +} diff --git a/examples/clients/abe/ProtobufEmpty.go b/examples/clients/abe/ProtobufEmpty.go new file mode 100644 index 00000000000..ac37afeb862 --- /dev/null +++ b/examples/clients/abe/ProtobufEmpty.go @@ -0,0 +1,8 @@ +package abe + +import ( +) + +type ProtobufEmpty struct { + +} diff --git a/examples/clients/abe/Sub2IdMessage.go b/examples/clients/abe/Sub2IdMessage.go new file mode 100644 index 00000000000..77ebe152ba0 --- /dev/null +++ b/examples/clients/abe/Sub2IdMessage.go @@ -0,0 +1,9 @@ +package abe + +import ( +) + +type Sub2IdMessage struct { + Uuid string `json:"uuid,omitempty"` + +} diff --git a/examples/clients/abe/SubStringMessage.go b/examples/clients/abe/SubStringMessage.go new file mode 100644 index 00000000000..f278dbf258b --- /dev/null +++ b/examples/clients/abe/SubStringMessage.go @@ -0,0 +1,9 @@ +package abe + +import ( +) + +type SubStringMessage struct { + Value string `json:"value,omitempty"` + +} diff --git a/examples/clients/echo/EchoServiceApi.go b/examples/clients/echo/EchoServiceApi.go new file mode 100644 index 00000000000..0cf5b582740 --- /dev/null +++ b/examples/clients/echo/EchoServiceApi.go @@ -0,0 +1,145 @@ +package echo + +import ( + "strings" + "fmt" + "encoding/json" + "errors" + "github.com/dghubble/sling" +) + +type EchoServiceApi struct { + basePath string +} + +func NewEchoServiceApi() *EchoServiceApi{ + return &EchoServiceApi { + basePath: "http://localhost", + } +} + +func NewEchoServiceApiWithBasePath(basePath string) *EchoServiceApi{ + return &EchoServiceApi { + basePath: basePath, + } +} + +/** + * Echo method receives a simple message and returns it. + * The message posted as the id parameter will also be\nreturned. + * @param id + * @return ExamplepbSimpleMessage + */ +//func (a EchoServiceApi) Echo (id string) (ExamplepbSimpleMessage, error) { +func (a EchoServiceApi) Echo (id string) (ExamplepbSimpleMessage, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v1/example/echo/{id}" + path = strings.Replace(path, "{" + "id" + "}", fmt.Sprintf("%v", id), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ExamplepbSimpleMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * EchoBody method receives a simple message and returns it. + * + * @param body + * @return ExamplepbSimpleMessage + */ +//func (a EchoServiceApi) EchoBody (body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, error) { +func (a EchoServiceApi) EchoBody (body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v1/example/echo_body" + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + +// body params + _sling = _sling.BodyJSON(body) + + var successPayload = new(ExamplepbSimpleMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} diff --git a/examples/clients/echo/ExamplepbSimpleMessage.go b/examples/clients/echo/ExamplepbSimpleMessage.go new file mode 100644 index 00000000000..ed9ada35b70 --- /dev/null +++ b/examples/clients/echo/ExamplepbSimpleMessage.go @@ -0,0 +1,9 @@ +package echo + +import ( +) + +type ExamplepbSimpleMessage struct { + Id string `json:"id,omitempty"` + +} diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 801180b197c..fc6611d210f 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -96,15 +96,15 @@ "name": "int64_value", "in": "path", "required": true, - "type": "integer", + "type": "string", "format": "int64" }, { "name": "uint64_value", "in": "path", "required": true, - "type": "integer", - "format": "int64" + "type": "string", + "format": "uint64" }, { "name": "int32_value", @@ -117,15 +117,15 @@ "name": "fixed64_value", "in": "path", "required": true, - "type": "integer", - "format": "int64" + "type": "string", + "format": "uint64" }, { "name": "fixed32_value", "in": "path", "required": true, "type": "integer", - "format": "int32" + "format": "int64" }, { "name": "bool_value", @@ -159,8 +159,8 @@ "name": "sfixed64_value", "in": "path", "required": true, - "type": "integer", - "format": "int32" + "type": "string", + "format": "int64" }, { "name": "sint32_value", @@ -173,7 +173,7 @@ "name": "sint64_value", "in": "path", "required": true, - "type": "integer", + "type": "string", "format": "int64" }, { @@ -402,11 +402,11 @@ }, "fixed32_value": { "type": "integer", - "format": "int32" + "format": "int64" }, "fixed64_value": { - "type": "integer", - "format": "int64" + "type": "string", + "format": "uint64" }, "float_value": { "type": "number", @@ -417,7 +417,7 @@ "format": "int32" }, "int64_value": { - "type": "integer", + "type": "string", "format": "int64" }, "map_value": { @@ -468,8 +468,8 @@ "format": "int32" }, "sfixed64_value": { - "type": "integer", - "format": "int32" + "type": "string", + "format": "int64" }, "single_nested": { "$ref": "#/definitions/ABitOfEverythingNested" @@ -479,7 +479,7 @@ "format": "int32" }, "sint64_value": { - "type": "integer", + "type": "string", "format": "int64" }, "string_value": { @@ -492,8 +492,8 @@ "title": "TODO(yugui) add bytes_value" }, "uint64_value": { - "type": "integer", - "format": "int64" + "type": "string", + "format": "uint64" }, "uuid": { "type": "string", diff --git a/examples/integration_test.go b/examples/integration_test.go index 60599ba714d..eee2a6d6d4b 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -13,7 +13,6 @@ import ( "time" gw "github.com/gengo/grpc-gateway/examples/examplepb" - server "github.com/gengo/grpc-gateway/examples/server" sub "github.com/gengo/grpc-gateway/examples/sub" "github.com/gengo/grpc-gateway/runtime" "github.com/golang/protobuf/jsonpb" @@ -28,37 +27,17 @@ type errorBody struct { Code int `json:"code"` } -func TestIntegration(t *testing.T) { +func TestEcho(t *testing.T) { if testing.Short() { t.Skip() return } - go func() { - if err := server.Run(); err != nil { - t.Errorf("server.Run() failed with %v; want success", err) - return - } - }() - go func() { - if err := Run(":8080"); err != nil { - t.Errorf("gw.Run() failed with %v; want success", err) - return - } - }() - - time.Sleep(100 * time.Millisecond) testEcho(t, 8080, "application/json") testEchoBody(t) - testABECreate(t) - testABECreateBody(t) - testABEBulkCreate(t) - testABELookup(t) - testABELookupNotFound(t) - testABEList(t) - testAdditionalBindings(t) - testTimeout(t) +} +func TestForwardResponseOption(t *testing.T) { go func() { if err := Run( ":8081", @@ -161,6 +140,21 @@ func testEchoBody(t *testing.T) { } } +func TestABE(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + + testABECreate(t) + testABECreateBody(t) + testABEBulkCreate(t) + testABELookup(t) + testABELookupNotFound(t) + testABEList(t) + testAdditionalBindings(t) +} + func testABECreate(t *testing.T) { want := gw.ABitOfEverything{ FloatValue: 1.5, @@ -584,7 +578,7 @@ func testAdditionalBindings(t *testing.T) { } } -func testTimeout(t *testing.T) { +func TestTimeout(t *testing.T) { url := "http://localhost:8080/v2/example/timeout" req, err := http.NewRequest("GET", url, nil) if err != nil { diff --git a/examples/main_test.go b/examples/main_test.go new file mode 100644 index 00000000000..c5ed4d46638 --- /dev/null +++ b/examples/main_test.go @@ -0,0 +1,45 @@ +package main + +import ( + "flag" + "fmt" + "os" + "testing" + "time" + + server "github.com/gengo/grpc-gateway/examples/server" +) + +func runServers() <-chan error { + ch := make(chan error, 2) + go func() { + if err := server.Run(); err != nil { + ch <- fmt.Errorf("cannot run grpc service: %v", err) + } + }() + go func() { + if err := Run(":8080"); err != nil { + ch <- fmt.Errorf("cannot run gateway service: %v", err) + } + }() + return ch +} + +func TestMain(m *testing.M) { + flag.Parse() + errCh := runServers() + + ch := make(chan int, 1) + go func() { + time.Sleep(100 * time.Millisecond) + ch <- m.Run() + }() + + select { + case err := <-errCh: + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + case status := <-ch: + os.Exit(status) + } +} diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 93bf01ebc68..c12f78ce573 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -146,15 +146,22 @@ func primitiveSchema(t pbdescriptor.FieldDescriptorProto_Type) (ftype, format st case pbdescriptor.FieldDescriptorProto_TYPE_FLOAT: return "number", "float", true case pbdescriptor.FieldDescriptorProto_TYPE_INT64: - return "integer", "int64", true + return "string", "int64", true case pbdescriptor.FieldDescriptorProto_TYPE_UINT64: - return "integer", "int64", true + // 64bit integer types are marshaled as string in the default JSONPb marshaler. + // TODO(yugui) Add an option to declare 64bit integers as int64. + // + // NOTE: uint64 is not a predefined format of integer type in Swagger spec. + // So we cannot expect that uint64 is commonly supported by swagger processor. + return "string", "uint64", true case pbdescriptor.FieldDescriptorProto_TYPE_INT32: return "integer", "int32", true case pbdescriptor.FieldDescriptorProto_TYPE_FIXED64: - return "integer", "int64", true + // Ditto. + return "string", "uint64", true case pbdescriptor.FieldDescriptorProto_TYPE_FIXED32: - return "integer", "int32", true + // Ditto. + return "integer", "int64", true case pbdescriptor.FieldDescriptorProto_TYPE_BOOL: return "boolean", "boolean", true case pbdescriptor.FieldDescriptorProto_TYPE_STRING: @@ -162,15 +169,16 @@ func primitiveSchema(t pbdescriptor.FieldDescriptorProto_Type) (ftype, format st case pbdescriptor.FieldDescriptorProto_TYPE_BYTES: return "string", "byte", true case pbdescriptor.FieldDescriptorProto_TYPE_UINT32: + // Ditto. return "integer", "int64", true case pbdescriptor.FieldDescriptorProto_TYPE_SFIXED32: return "integer", "int32", true case pbdescriptor.FieldDescriptorProto_TYPE_SFIXED64: - return "integer", "int32", true + return "string", "int64", true case pbdescriptor.FieldDescriptorProto_TYPE_SINT32: return "integer", "int32", true case pbdescriptor.FieldDescriptorProto_TYPE_SINT64: - return "integer", "int64", true + return "string", "int64", true default: return "", "", false } From f50e3d8378daf528d1992305e7eec8121056a742 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 14 Jun 2016 11:16:35 +0900 Subject: [PATCH 058/552] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a05ff2a657..35ffba6e4bd 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ That's what grpc-gateway helps you to do. You just need to implement your gRPC s Then the reverse-proxy generated by grpc-gateway serves RESTful API on top of the gRPC service. ## Installation -First you need to install ProtocolBuffers 3.0 or later. +First you need to install ProtocolBuffers 3.0.0-beta-3 or later. ```sh mkdir tmp From 37dafe852bade365ecd22fbbb8f447265bd6f184 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 14 Jun 2016 11:55:52 +0900 Subject: [PATCH 059/552] Fix golint and go vet errors --- .travis.yml | 7 +--- Makefile | 14 ++++++-- protoc-gen-swagger/genswagger/generator.go | 3 +- protoc-gen-swagger/genswagger/template.go | 6 ++-- protoc-gen-swagger/genswagger/types.go | 2 +- runtime/context_test.go | 4 +-- runtime/errors.go | 9 +++--- runtime/handler.go | 3 +- runtime/{ => internal}/stream_chunk.pb.go | 37 ++++++++++++---------- runtime/{ => internal}/stream_chunk.proto | 4 ++- runtime/marshaler_registry.go | 2 +- 11 files changed, 52 insertions(+), 39 deletions(-) rename runtime/{ => internal}/stream_chunk.pb.go (52%) rename runtime/{ => internal}/stream_chunk.proto (57%) diff --git a/.travis.yml b/.travis.yml index c52d41a6587..ea404af78f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,12 +23,7 @@ script: - make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" - if ! go version | grep devel; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi - env GLOG_logtostderr=1 go test -race -v github.com/gengo/grpc-gateway/... -- golint github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/... -- golint github.com/gengo/grpc-gateway/runtime/... -- golint github.com/gengo/grpc-gateway/utilities/... -- go vet github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/... -- go vet github.com/gengo/grpc-gateway/runtime/... || true -- go vet github.com/gengo/grpc-gateway/utilities/... +- make lint env: global: - "PATH=$PATH:$HOME/local/bin" diff --git a/Makefile b/Makefile index 3299297a953..f2c4a4d2a20 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ OPTIONS_PROTO=$(GOOGLEAPIS_DIR)/google/api/annotations.proto $(GOOGLEAPIS_DIR)/g OPTIONS_GO=$(OPTIONS_PROTO:.proto=.pb.go) OUTPUT_DIR=_output -RUNTIME_PROTO=runtime/stream_chunk.proto +RUNTIME_PROTO=runtime/internal/stream_chunk.proto 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 @@ -119,6 +119,16 @@ examples: $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_DEPSRCS) $(EXAMPLE_SWAG test: examples go test -race $(PKG)/... +lint: + golint --set_exit_status $(PKG)/runtime + golint --set_exit_status $(PKG)/utilities/... + golint --set_exit_status $(PKG)/protoc-gen-grpc-gateway/... + golint --set_exit_status $(PKG)/protoc-gen-swagger/... + go vet $(PKG)/runtime || true + go vet $(PKG)/utilities/... + go vet $(PKG)/protoc-gen-grpc-gateway/... + go vet $(PKG)/protoc-gen-swagger/... + clean distclean: rm -f $(GATEWAY_PLUGIN) realclean: distclean @@ -130,4 +140,4 @@ realclean: distclean rm -f $(SWAGGER_PLUGIN) rm -f $(EXAMPLE_CLIENT_SRCS) -.PHONY: generate examples test clean distclean realclean +.PHONY: generate examples test lint clean distclean realclean diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go index c8bff5c1571..01219b46330 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/genswagger/generator.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/generator" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" @@ -23,7 +24,7 @@ type generator struct { } // New returns a new generator which generates grpc gateway files. -func New(reg *descriptor.Registry) *generator { +func New(reg *descriptor.Registry) gen.Generator { return &generator{reg: reg} } diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index c12f78ce573..2c616b2cb7e 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -293,7 +293,7 @@ func templateToSwaggerPath(path string) string { switch char { case '{': // Push on the stack - depth += 1 + depth++ buffer += string(char) break case '}': @@ -301,7 +301,7 @@ func templateToSwaggerPath(path string) string { panic("Encountered } without matching { before it.") } // Pop from the stack - depth -= 1 + depth-- buffer += "}" case '/': if depth == 0 { @@ -389,7 +389,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re methProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.ServiceDescriptorProto)(nil)), "Method") operationObject := &swaggerOperationObject{ Tags: []string{svc.GetName()}, - OperationId: fmt.Sprintf("%s", meth.GetName()), + OperationID: fmt.Sprintf("%s", meth.GetName()), Parameters: parameters, Responses: swaggerResponsesObject{ "200": swaggerResponseObject{ diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index d119773fee1..7dea2209a65 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -72,7 +72,7 @@ type swaggerPathItemObject struct { type swaggerOperationObject struct { Summary string `json:"summary,omitempty"` Description string `json:"description,omitempty"` - OperationId string `json:"operationId"` + OperationID string `json:"operationId"` Responses swaggerResponsesObject `json:"responses"` Parameters swaggerParametersObject `json:"parameters,omitempty"` Tags []string `json:"tags,omitempty"` diff --git a/runtime/context_test.go b/runtime/context_test.go index 349438879d5..403b733329c 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -51,8 +51,8 @@ func TestAnnotateContext_ForwardsGrpcMetadata(t *testing.T) { return } md, ok := metadata.FromContext(annotated) - if !ok || len(md) != emptyForwardMetaCount+3 { - t.Errorf("Expected %d metadata items in context; got %v", md) + if got, want := len(md), emptyForwardMetaCount+3; !ok || got != want { + t.Errorf("Expected %d metadata items in context; got %d", got, want) } if got, want := md["foobar"], []string{"Value1"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["foobar"] = %q; want %q`, got, want) diff --git a/runtime/errors.go b/runtime/errors.go index 4d19b645607..c499eb35a47 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -5,7 +5,6 @@ import ( "net/http" "github.com/golang/protobuf/proto" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -59,7 +58,7 @@ var ( // HTTPError replies to the request with the error. // You can set a custom function to this variable to customize error format. HTTPError = DefaultHTTPError - // This handles the following error used by the gateway: StatusMethodNotAllowed StatusNotFound and StatusBadRequest + // OtherErrorHandler handles the following error used by the gateway: StatusMethodNotAllowed StatusNotFound and StatusBadRequest OtherErrorHandler = DefaultOtherErrorHandler ) @@ -114,6 +113,8 @@ func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseW handleForwardResponseTrailer(w, md) } -func DefaultOtherErrorHandler(w http.ResponseWriter, _ *http.Request, error string, code int) { - http.Error(w, error, code) +// DefaultOtherErrorHandler is the default implementation of OtherErrorHandler. +// It simply writes a string representation of the given error into "w". +func DefaultOtherErrorHandler(w http.ResponseWriter, _ *http.Request, msg string, code int) { + http.Error(w, msg, code) } diff --git a/runtime/handler.go b/runtime/handler.go index 52ac0b3dce4..a9c48782cfa 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -6,6 +6,7 @@ import ( "net/http" "net/textproto" + "github.com/gengo/grpc-gateway/runtime/internal" "github.com/golang/protobuf/proto" "golang.org/x/net/context" "google.golang.org/grpc" @@ -148,7 +149,7 @@ func streamChunk(result proto.Message, err error) map[string]proto.Message { grpcCode := grpc.Code(err) httpCode := HTTPStatusFromCode(grpcCode) return map[string]proto.Message{ - "error": &StreamError{ + "error": &internal.StreamError{ GrpcCode: int32(grpcCode), HttpCode: int32(httpCode), Message: err.Error(), diff --git a/runtime/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go similarity index 52% rename from runtime/stream_chunk.pb.go rename to runtime/internal/stream_chunk.pb.go index 2905054a3a0..b5e9069e5c0 100644 --- a/runtime/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -1,17 +1,17 @@ // Code generated by protoc-gen-go. -// source: runtime/stream_chunk.proto +// source: runtime/internal/stream_chunk.proto // DO NOT EDIT! /* -Package runtime is a generated protocol buffer package. +Package internal is a generated protocol buffer package. It is generated from these files: - runtime/stream_chunk.proto + runtime/internal/stream_chunk.proto It has these top-level messages: StreamError */ -package runtime +package internal import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -28,6 +28,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +// StreamError is a response type which is returned when +// streaming rpc returns an error. type StreamError struct { GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode" json:"grpc_code,omitempty"` HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode" json:"http_code,omitempty"` @@ -44,19 +46,20 @@ func init() { proto.RegisterType((*StreamError)(nil), "gengo.grpc.gateway.runtime.StreamError") } -func init() { proto.RegisterFile("runtime/stream_chunk.proto", fileDescriptor0) } +func init() { proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 175 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0x8e, 0xbd, 0x0e, 0x82, 0x30, - 0x14, 0x85, 0x83, 0x7f, 0x48, 0xd9, 0x98, 0x1a, 0x1c, 0x34, 0x4e, 0x4e, 0x75, 0xf0, 0x0d, 0x34, - 0xbe, 0x00, 0x6c, 0x2e, 0xa4, 0xe2, 0x4d, 0x31, 0x06, 0x4a, 0x6e, 0x6f, 0x63, 0x5c, 0x7d, 0x72, - 0xe9, 0x05, 0xc7, 0xf3, 0x7d, 0xe7, 0x24, 0x47, 0xe4, 0xe8, 0x3b, 0x7a, 0xb6, 0x70, 0x74, 0x84, - 0xa0, 0xdb, 0xaa, 0x6e, 0x7c, 0xf7, 0x52, 0x3d, 0x5a, 0xb2, 0x59, 0x6e, 0xa0, 0x33, 0x56, 0x19, - 0xec, 0x6b, 0x65, 0x34, 0xc1, 0x5b, 0x7f, 0xd4, 0x54, 0xdf, 0x7f, 0x23, 0x91, 0x96, 0x3c, 0xb9, - 0x22, 0x5a, 0xcc, 0x36, 0x22, 0x09, 0xbd, 0xaa, 0xb6, 0x0f, 0x90, 0xd1, 0x2e, 0x3a, 0x2c, 0x8b, - 0x75, 0x00, 0x97, 0x21, 0x07, 0xd9, 0x10, 0xf5, 0xa3, 0x9c, 0x8d, 0x32, 0x00, 0x96, 0x52, 0xc4, - 0x2d, 0x38, 0xa7, 0x0d, 0xc8, 0xf9, 0xa0, 0x92, 0xe2, 0x1f, 0xb3, 0xad, 0x48, 0x79, 0xe6, 0x48, - 0x93, 0x77, 0x72, 0xc1, 0x56, 0x04, 0x54, 0x32, 0x39, 0x27, 0xb7, 0x78, 0xfa, 0x73, 0x5f, 0xf1, - 0xe5, 0xd3, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x19, 0x38, 0x42, 0xd0, 0x00, 0x00, 0x00, + // 182 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0x8e, 0x3d, 0xef, 0x82, 0x30, + 0x10, 0x87, 0xc3, 0xff, 0x15, 0x8e, 0x8d, 0xa9, 0xd1, 0x41, 0xa3, 0x8b, 0x53, 0x19, 0xfc, 0x06, + 0x1a, 0xbf, 0x00, 0x6c, 0x2e, 0xa4, 0xe2, 0xa5, 0x10, 0xa5, 0x25, 0xd7, 0x23, 0xc6, 0xd5, 0x4f, + 0x2e, 0x2d, 0x32, 0xde, 0xf3, 0xdc, 0x93, 0xfc, 0x60, 0x4b, 0x83, 0xe1, 0xb6, 0xc3, 0xbc, 0x35, + 0x8c, 0x64, 0xd4, 0x3d, 0x77, 0x4c, 0xa8, 0xba, 0xaa, 0x6e, 0x06, 0x73, 0x93, 0x3d, 0x59, 0xb6, + 0xd9, 0x42, 0xa3, 0xd1, 0x56, 0x6a, 0xea, 0x6b, 0xa9, 0x15, 0xe3, 0x43, 0x3d, 0xe5, 0xa7, 0xdb, + 0xbc, 0x22, 0x48, 0xcb, 0x90, 0x9c, 0x88, 0x2c, 0x65, 0x4b, 0x48, 0xfc, 0x5f, 0x55, 0xdb, 0x2b, + 0x8a, 0x68, 0x1d, 0xed, 0x7e, 0x8b, 0xd8, 0x83, 0xe3, 0x78, 0x7b, 0xd9, 0x30, 0xf7, 0x93, 0xfc, + 0x9a, 0xa4, 0x07, 0x41, 0x0a, 0xf8, 0xef, 0xd0, 0x39, 0xa5, 0x51, 0x7c, 0x8f, 0x2a, 0x29, 0xe6, + 0x33, 0x5b, 0x41, 0x1a, 0x32, 0xc7, 0x8a, 0x07, 0x27, 0x7e, 0x82, 0x05, 0x8f, 0xca, 0x40, 0x0e, + 0x70, 0x8e, 0xe7, 0xfd, 0x97, 0xbf, 0xb0, 0x79, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x7f, + 0x7d, 0x56, 0xda, 0x00, 0x00, 0x00, } diff --git a/runtime/stream_chunk.proto b/runtime/internal/stream_chunk.proto similarity index 57% rename from runtime/stream_chunk.proto rename to runtime/internal/stream_chunk.proto index f419ec7bd44..c076b9b3be8 100644 --- a/runtime/stream_chunk.proto +++ b/runtime/internal/stream_chunk.proto @@ -1,7 +1,9 @@ syntax = "proto3"; package gengo.grpc.gateway.runtime; -option go_package = "runtime"; +option go_package = "internal"; +// StreamError is a response type which is returned when +// streaming rpc returns an error. message StreamError { int32 grpc_code = 1; int32 http_code = 2; diff --git a/runtime/marshaler_registry.go b/runtime/marshaler_registry.go index 501d37eb3b2..928f0733214 100644 --- a/runtime/marshaler_registry.go +++ b/runtime/marshaler_registry.go @@ -5,7 +5,7 @@ import ( "net/http" ) -// MIMEWildCard is the fallback MIME type used for requests which do not match +// MIMEWildcard is the fallback MIME type used for requests which do not match // a registered MIME type. const MIMEWildcard = "*" From 60b4a9cfbe808f4e2723ae686f014913fe87bccb Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Mon, 13 Jun 2016 20:13:12 -0700 Subject: [PATCH 060/552] generate swagger output for streaming endpoints with a basic note --- .../a_bit_of_everything.swagger.json | 20 +++++++++---------- examples/examplepb/echo_service.swagger.json | 4 ++-- protoc-gen-swagger/genswagger/template.go | 20 ++++++++++++------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index fc6611d210f..e52f7c70e8b 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -20,7 +20,7 @@ "operationId": "CreateBody", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } @@ -46,7 +46,7 @@ "operationId": "Echo", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/subStringMessage" } @@ -71,7 +71,7 @@ "operationId": "Create", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } @@ -194,7 +194,7 @@ "operationId": "DeepPathEcho", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } @@ -227,7 +227,7 @@ "operationId": "Lookup", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } @@ -250,7 +250,7 @@ "operationId": "Delete", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/protobufEmpty" } @@ -273,7 +273,7 @@ "operationId": "Update", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/protobufEmpty" } @@ -306,7 +306,7 @@ "operationId": "Echo", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/subStringMessage" } @@ -320,7 +320,7 @@ "operationId": "Echo", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/subStringMessage" } @@ -346,7 +346,7 @@ "operationId": "Timeout", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/protobufEmpty" } diff --git a/examples/examplepb/echo_service.swagger.json b/examples/examplepb/echo_service.swagger.json index 94e1abde9ac..f6c6d8b9814 100644 --- a/examples/examplepb/echo_service.swagger.json +++ b/examples/examplepb/echo_service.swagger.json @@ -23,7 +23,7 @@ "operationId": "Echo", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } @@ -49,7 +49,7 @@ "operationId": "EchoBody", "responses": { "200": { - "description": "Description", + "description": "", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 2c616b2cb7e..fd7b1dfe00d 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -335,9 +335,6 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. for svcIdx, svc := range services { for methIdx, meth := range svc.Methods { - if meth.GetClientStreaming() || meth.GetServerStreaming() { - return fmt.Errorf(`service uses streaming, which is not currently supported. Maybe you would like to implement it? It wouldn't be that hard and we don't bite. Why don't you send a pull request to https://github.com/gengo/grpc-gateway?`) - } for _, b := range meth.Bindings { // Iterate over all the swagger parameters parameters := swaggerParametersObject{} @@ -369,10 +366,15 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } // Now check if there is a body parameter if b.Body != nil { + desc := "" + if meth.GetClientStreaming() { + desc = "(streaming inputs)" + } parameters = append(parameters, swaggerParameterObject{ - Name: "body", - In: "body", - Required: true, + Name: "body", + Description: desc, + In: "body", + Required: true, Schema: &swaggerSchemaObject{ schemaCore: schemaCore{ Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)), @@ -387,13 +389,17 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } methProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.ServiceDescriptorProto)(nil)), "Method") + desc := "" + if meth.GetServerStreaming() { + desc += "(streaming responses)" + } operationObject := &swaggerOperationObject{ Tags: []string{svc.GetName()}, OperationID: fmt.Sprintf("%s", meth.GetName()), Parameters: parameters, Responses: swaggerResponsesObject{ "200": swaggerResponseObject{ - Description: "Description", + Description: desc, Schema: swaggerSchemaObject{ schemaCore: schemaCore{ Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)), From 0c0a34831c34defae52c38d3bb689f01b7d7e1a2 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Wed, 15 Jun 2016 16:32:31 +0900 Subject: [PATCH 061/552] Regenerate files with the latest protoc-gen-go Follows github.com/golang/protobuf@0c1f6d65b5a189c2250d10e71a5506f06f9fa0a0 --- examples/examplepb/a_bit_of_everything.pb.go | 5 +++-- examples/examplepb/echo_service.pb.go | 5 +++-- examples/examplepb/flow_combination.pb.go | 3 ++- examples/examplepb/stream.pb.go | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 0cc2f023fc1..b5d656b7b05 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -276,7 +276,7 @@ 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 +const _ = grpc.SupportPackageIsVersion3 // Client API for ABitOfEverythingService service @@ -569,7 +569,8 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ Handler: _ABitOfEverythingService_Timeout_Handler, }, }, - Streams: []grpc.StreamDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: fileDescriptor1, } func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 81d47454bff..4bafb938354 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -69,7 +69,7 @@ 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 +const _ = grpc.SupportPackageIsVersion3 // Client API for EchoService service @@ -174,7 +174,8 @@ var _EchoService_serviceDesc = grpc.ServiceDesc{ Handler: _EchoService_EchoBody_Handler, }, }, - Streams: []grpc.StreamDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: fileDescriptor0, } func init() { proto.RegisterFile("examples/examplepb/echo_service.proto", fileDescriptor0) } diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 5a82086ffb8..020e2225667 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -95,7 +95,7 @@ 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 +const _ = grpc.SupportPackageIsVersion3 // Client API for FlowCombination service @@ -630,6 +630,7 @@ var _FlowCombination_serviceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, + Metadata: fileDescriptor3, } func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fileDescriptor3) } diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index 9c9688f8a1d..190a7487160 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -27,7 +27,7 @@ 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 +const _ = grpc.SupportPackageIsVersion3 // Client API for StreamService service @@ -249,6 +249,7 @@ var _StreamService_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, + Metadata: fileDescriptor2, } func init() { proto.RegisterFile("examples/examplepb/stream.proto", fileDescriptor2) } From 53d4ca4b2e414e2811e242a1e2767fc892e9e0b7 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 14 Jun 2016 19:48:19 +0900 Subject: [PATCH 062/552] Add an example of calling gateway from browser --- examples/browser/.gitignore | 2 + examples/browser/README.md | 31 +++ .../a_bit_of_everything_service.spec.js | 185 ++++++++++++++++++ examples/browser/bin/.gitignore | 2 + examples/browser/bower.json | 21 ++ examples/browser/echo_service.spec.js | 43 ++++ examples/browser/gulpfile.js | 81 ++++++++ examples/browser/index.html | 22 +++ examples/browser/package.json | 23 +++ examples/main.go | 73 ++++++- 10 files changed, 474 insertions(+), 9 deletions(-) create mode 100644 examples/browser/.gitignore create mode 100644 examples/browser/README.md create mode 100644 examples/browser/a_bit_of_everything_service.spec.js create mode 100644 examples/browser/bin/.gitignore create mode 100644 examples/browser/bower.json create mode 100644 examples/browser/echo_service.spec.js create mode 100644 examples/browser/gulpfile.js create mode 100644 examples/browser/index.html create mode 100644 examples/browser/package.json diff --git a/examples/browser/.gitignore b/examples/browser/.gitignore new file mode 100644 index 00000000000..75ce18e9269 --- /dev/null +++ b/examples/browser/.gitignore @@ -0,0 +1,2 @@ +/bower_components +/node_modules diff --git a/examples/browser/README.md b/examples/browser/README.md new file mode 100644 index 00000000000..be4fbd31141 --- /dev/null +++ b/examples/browser/README.md @@ -0,0 +1,31 @@ +# Browser example + +This directory contains an example use of grpc-gateway with web browsers. +The following commands automatically runs integration tests with phantomjs. + +```shell-session +$ npm install -g gulp-cli +$ npm install +$ gulp +``` + +## Other examples + +### Very simple example +Run +```shell-session +$ gulp bower +$ gulp backends +``` + +then, open `index.html`. + + +### Integration test with your browser + +Run +```shell-session +$ gulp serve +``` + +then, open `http://localhost:8000` with your browser. diff --git a/examples/browser/a_bit_of_everything_service.spec.js b/examples/browser/a_bit_of_everything_service.spec.js new file mode 100644 index 00000000000..edcbebe11d6 --- /dev/null +++ b/examples/browser/a_bit_of_everything_service.spec.js @@ -0,0 +1,185 @@ +'use strict'; + +var SwaggerClient = require('swagger-client'); + +describe('ABitOfEverythingService', function() { + var client; + + beforeEach(function(done) { + new SwaggerClient({ + url: "http://localhost:8080/swagger/a_bit_of_everything.swagger.json", + usePromise: true, + }).then(function(c) { + client = c; + }).catch(function(err) { + done.fail(err); + }).then(done); + }); + + describe('Create', function() { + var created; + var expected = { + float_value: 1.5, + double_value: 2.5, + int64_value: "4294967296", + uint64_value: "9223372036854775807", + int32_value: -2147483648, + fixed64_value: "9223372036854775807", + fixed32_value: 4294967295, + bool_value: true, + string_value: "strprefix/foo", + uint32_value: 4294967295, + sfixed32_value: 2147483647, + sfixed64_value: "-4611686018427387904", + sint32_value: 2147483647, + sint64_value: "4611686018427387903", + nonConventionalNameValue: "camelCase", + }; + + beforeEach(function(done) { + client.ABitOfEverythingService.Create(expected).then(function(resp) { + created = resp.obj; + }).catch(function(err) { + done.fail(err); + }).then(done); + }); + + it('should assign id', function() { + expect(created.uuid).not.toBe(""); + }); + + it('should echo the request back', function() { + delete created.uuid; + expect(created).toEqual(expected); + }); + }); + + describe('CreateBody', function() { + var created; + var expected = { + float_value: 1.5, + double_value: 2.5, + int64_value: "4294967296", + uint64_value: "9223372036854775807", + int32_value: -2147483648, + fixed64_value: "9223372036854775807", + fixed32_value: 4294967295, + bool_value: true, + string_value: "strprefix/foo", + uint32_value: 4294967295, + sfixed32_value: 2147483647, + sfixed64_value: "-4611686018427387904", + sint32_value: 2147483647, + sint64_value: "4611686018427387903", + nonConventionalNameValue: "camelCase", + + nested: [ + { name: "bar", amount: 10 }, + { name: "baz", amount: 20 }, + ], + repeated_string_value: ["a", "b", "c"], + oneof_string: "x", + // TODO(yugui) Support enum by name + map_value: { a: 1, b: 2 }, + mapped_string_value: { a: "x", b: "y" }, + mapped_nested_value: { + a: { name: "x", amount: 1 }, + b: { name: "y", amount: 2 }, + }, + }; + + beforeEach(function(done) { + client.ABitOfEverythingService.CreateBody({ + body: expected, + }).then(function(resp) { + created = resp.obj; + }).catch(function(err) { + done.fail(err); + }).then(done); + }); + + it('should assign id', function() { + expect(created.uuid).not.toBe(""); + }); + + it('should echo the request back', function() { + delete created.uuid; + expect(created).toEqual(expected); + }); + }); + + describe('lookup', function() { + var created; + var expected = { + bool_value: true, + string_value: "strprefix/foo", + }; + + beforeEach(function(done) { + client.ABitOfEverythingService.CreateBody({ + body: expected, + }).then(function(resp) { + created = resp.obj; + }).catch(function(err) { + fail(err); + }).finally(done); + }); + + it('should look up an object by uuid', function(done) { + client.ABitOfEverythingService.Lookup({ + uuid: created.uuid + }).then(function(resp) { + expect(resp.obj).toEqual(created); + }).catch(function(err) { + fail(err.errObj); + }).finally(done); + }); + + it('should fail if no such object', function(done) { + client.ABitOfEverythingService.Lookup({ + uuid: 'not_exist', + }).then(function(resp) { + fail('expected failure but succeeded'); + }).catch(function(err) { + expect(err.status).toBe(404); + }).finally(done); + }); + }); + + describe('Delete', function() { + var created; + var expected = { + bool_value: true, + string_value: "strprefix/foo", + }; + + beforeEach(function(done) { + client.ABitOfEverythingService.CreateBody({ + body: expected, + }).then(function(resp) { + created = resp.obj; + }).catch(function(err) { + fail(err); + }).finally(done); + }); + + it('should delete an object by id', function(done) { + client.ABitOfEverythingService.Delete({ + uuid: created.uuid + }).then(function(resp) { + expect(resp.obj).toEqual({}); + }).catch(function(err) { + fail(err.errObj); + }).then(function() { + return client.ABitOfEverythingService.Lookup({ + uuid: created.uuid + }); + }).then(function(resp) { + fail('expected failure but succeeded'); + }). catch(function(err) { + expect(err.status).toBe(404); + }).finally(done); + }); + }); +}); + diff --git a/examples/browser/bin/.gitignore b/examples/browser/bin/.gitignore new file mode 100644 index 00000000000..a68d087bfe5 --- /dev/null +++ b/examples/browser/bin/.gitignore @@ -0,0 +1,2 @@ +/* +!/.gitignore diff --git a/examples/browser/bower.json b/examples/browser/bower.json new file mode 100644 index 00000000000..eb2c258d6f2 --- /dev/null +++ b/examples/browser/bower.json @@ -0,0 +1,21 @@ +{ + "name": "grpc-gateway-example-browser", + "description": "Example use of grpc-gateway from browser", + "main": "index.js", + "authors": [ + "Yuki Yugui Sonoda " + ], + "license": "SEE LICENSE IN LICENSE file", + "homepage": "https://github.com/gengo/grpc-gateway", + "private": true, + "dependencies": { + "swagger-js": "~> 2.1" + }, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/examples/browser/echo_service.spec.js b/examples/browser/echo_service.spec.js new file mode 100644 index 00000000000..97888c3e6c7 --- /dev/null +++ b/examples/browser/echo_service.spec.js @@ -0,0 +1,43 @@ +'use strict'; + +var SwaggerClient = require('swagger-client'); + +describe('EchoService', function() { + var client; + + beforeEach(function(done) { + new SwaggerClient({ + url: "http://localhost:8080/swagger/echo_service.swagger.json", + usePromise: true, + }).then(function(c) { + client = c; + done(); + }); + }); + + describe('Echo', function() { + it('should echo the request back', function(done) { + client.EchoService.Echo( + {id: "foo"}, + {responseContentType: "application/json"} + ).then(function(resp) { + expect(resp.obj).toEqual({id: "foo"}); + }).catch(function(err) { + done.fail(err); + }).then(done); + }); + }); + + describe('EchoBody', function() { + it('should echo the request back', function(done) { + client.EchoService.EchoBody( + {body: {id: "foo"}}, + {responseContentType: "application/json"} + ).then(function(resp) { + expect(resp.obj).toEqual({id: "foo"}); + }).catch(function(err) { + done.fail(err); + }).then(done); + }); + }); +}); diff --git a/examples/browser/gulpfile.js b/examples/browser/gulpfile.js new file mode 100644 index 00000000000..c095a3e6cbb --- /dev/null +++ b/examples/browser/gulpfile.js @@ -0,0 +1,81 @@ +"use strict"; + +var gulp = require('gulp'); + +var path = require('path'); + +var bower = require('gulp-bower'); +var exit = require('gulp-exit'); +var gprocess = require('gulp-process'); +var shell = require('gulp-shell'); +var jasmineBrowser = require('gulp-jasmine-browser'); +var webpack = require('webpack-stream'); + +gulp.task('bower', function(){ + return bower(); +}); + +gulp.task('server', shell.task([ + 'go build -o bin/example-server github.com/gengo/grpc-gateway/examples/server', +])); + +gulp.task('gateway', shell.task([ + 'go build -o bin/example-gw github.com/gengo/grpc-gateway/examples', +])); + +gulp.task('serve-server', ['server'], function(){ + gprocess.start('server-server', 'bin/example-server', [ + '--logtostderr', + ]); + gulp.watch('bin/example-server', ['serve-server']); +}); + +gulp.task('serve-gateway', ['gateway', 'serve-server'], function(){ + gprocess.start('gateway-server', 'bin/example-gw', [ + '--logtostderr', '--swagger_dir', path.join(__dirname, "../examplepb"), + ]); + gulp.watch('bin/example-gateway', ['serve-gateway']); +}); + +gulp.task('backends', ['serve-gateway', 'serve-server']); + +var specFiles = ['*.spec.js']; +gulp.task('test', ['backends'], function(done) { + return gulp.src(specFiles) + .pipe(webpack({output: {filename: 'spec.js'}})) + .pipe(jasmineBrowser.specRunner({ + console: true, + sourceMappedStacktrace: true, + })) + .pipe(jasmineBrowser.headless({ + findOpenPort: true, + catch: true, + throwFailures: true, + })) + .on('error', function(err) { + done(err); + process.exit(1); + }) + .pipe(exit()); +}); + +gulp.task('serve', ['backends'], function(done) { + var JasminePlugin = require('gulp-jasmine-browser/webpack/jasmine-plugin'); + var plugin = new JasminePlugin(); + + return gulp.src(specFiles) + .pipe(webpack({ + output: {filename: 'spec.js'}, + watch: true, + plugins: [plugin], + })) + .pipe(jasmineBrowser.specRunner({ + sourceMappedStacktrace: true, + })) + .pipe(jasmineBrowser.server({ + port: 8000, + whenReady: plugin.whenReady, + })); +}); + +gulp.task('default', ['test']); diff --git a/examples/browser/index.html b/examples/browser/index.html new file mode 100644 index 00000000000..7817451ca82 --- /dev/null +++ b/examples/browser/index.html @@ -0,0 +1,22 @@ + + + + + + + +
+ + diff --git a/examples/browser/package.json b/examples/browser/package.json new file mode 100644 index 00000000000..c78bdcbf0c9 --- /dev/null +++ b/examples/browser/package.json @@ -0,0 +1,23 @@ +{ + "name": "grpc-gateway-example", + "version": "1.0.0", + "description": "Example use of grpc-gateway from browser", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "SEE LICENSE IN LICENSE.txt", + "devDependencies": { + "bower": "^1.7.9", + "gulp": "^3.9.1", + "gulp-bower": "0.0.13", + "gulp-exit": "0.0.2", + "gulp-jasmine-browser": "^1.3.2", + "gulp-process": "^0.1.2", + "gulp-shell": "^0.5.2", + "jasmine": "^2.4.1", + "phantomjs": "^2.1.7", + "swagger-client": "^2.1.14", + "webpack-stream": "^3.2.0" + } +} diff --git a/examples/main.go b/examples/main.go index f9111c9d93b..2d8a1a54aff 100644 --- a/examples/main.go +++ b/examples/main.go @@ -3,6 +3,8 @@ package main import ( "flag" "net/http" + "path" + "strings" "github.com/gengo/grpc-gateway/examples/examplepb" "github.com/gengo/grpc-gateway/runtime" @@ -15,33 +17,86 @@ var ( echoEndpoint = flag.String("echo_endpoint", "localhost:9090", "endpoint of EchoService") abeEndpoint = flag.String("more_endpoint", "localhost:9090", "endpoint of ABitOfEverythingService") flowEndpoint = flag.String("flow_endpoint", "localhost:9090", "endpoint of FlowCombination") -) -func Run(address string, opts ...runtime.ServeMuxOption) error { - ctx := context.Background() - ctx, cancel := context.WithCancel(ctx) - defer cancel() + swaggerDir = flag.String("swagger_dir", "examples/examplepb", "path to the directory which contains swagger definitions") +) +// newGateway returns a new gateway server which translates HTTP into gRPC. +func newGateway(ctx context.Context, opts ...runtime.ServeMuxOption) (http.Handler, error) { mux := runtime.NewServeMux(opts...) dialOpts := []grpc.DialOption{grpc.WithInsecure()} err := examplepb.RegisterEchoServiceHandlerFromEndpoint(ctx, mux, *echoEndpoint, dialOpts) if err != nil { - return err + return nil, err } err = examplepb.RegisterStreamServiceHandlerFromEndpoint(ctx, mux, *abeEndpoint, dialOpts) if err != nil { - return err + return nil, err } err = examplepb.RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx, mux, *abeEndpoint, dialOpts) if err != nil { - return err + return nil, err } err = examplepb.RegisterFlowCombinationHandlerFromEndpoint(ctx, mux, *flowEndpoint, dialOpts) + if err != nil { + return nil, err + } + return mux, nil +} + +func serveSwagger(w http.ResponseWriter, r *http.Request) { + if !strings.HasSuffix(r.URL.Path, ".swagger.json") { + glog.Errorf("Not Found: %s", r.URL.Path) + http.NotFound(w, r) + return + } + + glog.Infof("Serving %s", r.URL.Path) + p := strings.TrimPrefix(r.URL.Path, "/swagger/") + p = path.Join(*swaggerDir, p) + http.ServeFile(w, r, p) +} + +// allowCORS allows Cross Origin Resoruce Sharing from any origin. +// Don't do this without consideration in production systems. +func allowCORS(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if origin := r.Header.Get("Origin"); origin != "" { + w.Header().Set("Access-Control-Allow-Origin", origin) + if r.Method == "OPTIONS" && r.Header.Get("Access-Control-Request-Method") != "" { + preflightHandler(w, r) + return + } + } + h.ServeHTTP(w, r) + }) +} + +func preflightHandler(w http.ResponseWriter, r *http.Request) { + headers := []string{"Content-Type", "Accept"} + w.Header().Set("Access-Control-Allow-Headers", strings.Join(headers, ",")) + methods := []string{"GET", "HEAD", "POST", "PUT", "DELETE"} + w.Header().Set("Access-Control-Allow-Methods", strings.Join(methods, ",")) + glog.Infof("preflight request for %s", r.URL.Path) + return +} + +// Run starts a HTTP server and blocks forever if successful. +func Run(address string, opts ...runtime.ServeMuxOption) error { + ctx := context.Background() + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + mux := http.NewServeMux() + mux.HandleFunc("/swagger/", serveSwagger) + + gw, err := newGateway(ctx, opts...) if err != nil { return err } + mux.Handle("/", gw) - http.ListenAndServe(address, mux) + http.ListenAndServe(address, allowCORS(mux)) return nil } From 62814bacec2e16eef36ab3a7f379a557733ac7fe Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Wed, 15 Jun 2016 16:22:25 +0900 Subject: [PATCH 063/552] Configure Travis CI with browser integration test --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index ea404af78f4..92008a5daa4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,11 @@ go: cache: directories: - $HOME/local + - ${TRAVIS_BUILD_DIR}/examples/browser/node_modules before_install: - ./.travis/build-protoc.sh 3.0.0-beta-3 - ./.travis/install-swagger-codegen.sh 2.1.6 +- nvm install v6.1 && nvm use v6.1 && node --version - go get github.com/golang/lint/golint - go get github.com/dghubble/sling install: @@ -19,11 +21,14 @@ install: - go get github.com/gengo/grpc-gateway/runtime - go get github.com/gengo/grpc-gateway/examples - go get github.com/gengo/grpc-gateway/examples/server +before_script: +- sh -c 'cd examples/browser && npm install' script: - make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" - if ! go version | grep devel; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi - env GLOG_logtostderr=1 go test -race -v github.com/gengo/grpc-gateway/... - make lint +- sh -c 'cd examples/browser && gulp' env: global: - "PATH=$PATH:$HOME/local/bin" From 5231f6593f035a417f0dbc01376a39bc88212456 Mon Sep 17 00:00:00 2001 From: Masahiro Sano Date: Tue, 5 Jul 2016 14:45:05 +0900 Subject: [PATCH 064/552] send trailer on error --- examples/integration_test.go | 6 ++++++ runtime/errors.go | 1 + 2 files changed, 7 insertions(+) diff --git a/examples/integration_test.go b/examples/integration_test.go index eee2a6d6d4b..4681da37908 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -468,6 +468,12 @@ func testABELookupNotFound(t *testing.T) { if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), uuid; got != want { t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want) } + if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want { + t.Errorf("Grpc-Trailer-Foo was %q, wanted %q", got, want) + } + if got, want := resp.Trailer.Get("Grpc-Trailer-Bar"), "bar2"; got != want { + t.Errorf("Grpc-Trailer-Bar was %q, wanted %q", got, want) + } } func testABEList(t *testing.T) { diff --git a/runtime/errors.go b/runtime/errors.go index c499eb35a47..7d7a9b22415 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -104,6 +104,7 @@ func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseW } handleForwardResponseServerMetadata(w, md) + handleForwardResponseTrailerHeader(w, md) st := HTTPStatusFromCode(grpc.Code(err)) w.WriteHeader(st) if _, err := w.Write(buf); err != nil { From fde504644184e55f51736bea793b6fb4fe6ee553 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Fri, 24 Jun 2016 10:27:28 -0700 Subject: [PATCH 065/552] return err early if EOF to prevent logging in normal conditions This matches the client streaming case more closely --- protoc-gen-grpc-gateway/gengateway/template.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index ff34f396584..cd2dc6d7412 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -248,6 +248,9 @@ var ( handleSend := func() error { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} err = dec.Decode(&protoReq) + if err == io.EOF { + return err + } if err != nil { grpclog.Printf("Failed to decode request: %v", err) return err From ffb23b218de25869b9f947feff3144ef956df12d Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 12 Jul 2016 13:46:56 -0600 Subject: [PATCH 066/552] regenerate examples --- examples/examplepb/flow_combination.pb.gw.go | 3 +++ examples/examplepb/stream.pb.gw.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 9901591b3a4..795271857c3 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -105,6 +105,9 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler handleSend := func() error { var protoReq EmptyProto err = dec.Decode(&protoReq) + if err == io.EOF { + return err + } if err != nil { grpclog.Printf("Failed to decode request: %v", err) return err diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index c6fcebe55ab..4d90046320a 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -98,6 +98,9 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar handleSend := func() error { var protoReq sub.StringMessage err = dec.Decode(&protoReq) + if err == io.EOF { + return err + } if err != nil { grpclog.Printf("Failed to decode request: %v", err) return err From a466f98670ac0e2aa6b71c5681b03a47c7c1133a Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Wed, 13 Jul 2016 14:37:56 +0900 Subject: [PATCH 067/552] Rename packages to follow the repository transfer github.com/gengo/grpc-gateway was transferred to github.com/grpc-ecosystem/grpc-gateway. --- .travis.yml | 10 ++++----- Makefile | 2 +- README.md | 22 +++++++++---------- examples/browser/bower.json | 2 +- examples/browser/gulpfile.js | 4 ++-- examples/client_test.go | 4 ++-- examples/examplepb/a_bit_of_everything.proto | 4 ++-- examples/examplepb/echo_service.proto | 2 +- examples/examplepb/flow_combination.proto | 2 +- examples/examplepb/stream.proto | 4 ++-- examples/integration_test.go | 6 ++--- examples/main.go | 4 ++-- examples/main_test.go | 2 +- examples/server/a_bit_of_everything.go | 6 ++--- examples/server/echo.go | 2 +- examples/server/flow_combination.go | 2 +- examples/server/main.go | 2 +- examples/sub/message.proto | 2 +- examples/sub2/message.proto | 2 +- .../descriptor/services.go | 4 ++-- .../descriptor/services_test.go | 2 +- protoc-gen-grpc-gateway/descriptor/types.go | 2 +- .../descriptor/types_test.go | 6 ++--- .../generator/generator.go | 2 +- .../gengateway/generator.go | 8 +++---- .../gengateway/template.go | 4 ++-- .../gengateway/template_test.go | 4 ++-- protoc-gen-grpc-gateway/httprule/compile.go | 2 +- .../httprule/compile_test.go | 2 +- protoc-gen-grpc-gateway/main.go | 4 ++-- protoc-gen-swagger/genswagger/generator.go | 4 ++-- protoc-gen-swagger/genswagger/template.go | 2 +- .../genswagger/template_test.go | 4 ++-- protoc-gen-swagger/genswagger/types.go | 2 +- protoc-gen-swagger/main.go | 4 ++-- runtime/context_test.go | 2 +- runtime/errors_test.go | 2 +- runtime/handler.go | 2 +- runtime/internal/stream_chunk.proto | 2 +- runtime/marshal_json_test.go | 4 ++-- runtime/marshal_jsonpb_test.go | 4 ++-- runtime/marshaler_registry_test.go | 2 +- runtime/mux_test.go | 4 ++-- runtime/pattern.go | 2 +- runtime/pattern_test.go | 2 +- runtime/query.go | 2 +- runtime/query_test.go | 4 ++-- utilities/trie_test.go | 2 +- 48 files changed, 87 insertions(+), 87 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92008a5daa4..9d3b2a30eb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,16 +17,16 @@ before_install: - go get github.com/golang/lint/golint - go get github.com/dghubble/sling install: -- go get github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway -- go get github.com/gengo/grpc-gateway/runtime -- go get github.com/gengo/grpc-gateway/examples -- go get github.com/gengo/grpc-gateway/examples/server +- go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway +- go get github.com/grpc-ecosystem/grpc-gateway/runtime +- go get github.com/grpc-ecosystem/grpc-gateway/examples +- go get github.com/grpc-ecosystem/grpc-gateway/examples/server before_script: - sh -c 'cd examples/browser && npm install' script: - make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" - if ! go version | grep devel; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi -- env GLOG_logtostderr=1 go test -race -v github.com/gengo/grpc-gateway/... +- env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... - make lint - sh -c 'cd examples/browser && gulp' env: diff --git a/Makefile b/Makefile index f2c4a4d2a20..756f678aeaa 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # You don't have to rebuild these targets by yourself unless you develop # grpc-gateway itself. -PKG=github.com/gengo/grpc-gateway +PKG=github.com/grpc-ecosystem/grpc-gateway GO_PLUGIN=bin/protoc-gen-go GO_PLUGIN_PKG=github.com/golang/protobuf/protoc-gen-go SWAGGER_PLUGIN=bin/protoc-gen-swagger diff --git a/README.md b/README.md index 35ffba6e4bd..8701c15034f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # grpc-gateway -[![Build Status](https://travis-ci.org/gengo/grpc-gateway.svg?branch=master)](https://travis-ci.org/gengo/grpc-gateway) +[![Build Status](https://travis-ci.org/grpc-ecosystem/grpc-gateway.svg?branch=master)](https://travis-ci.org/grpc-ecosystem/grpc-gateway) grpc-gateway is a plugin of [protoc](http://github.com/google/protobuf). It reads [gRPC](http://github.com/grpc/grpc-common) service definition, @@ -38,8 +38,8 @@ sudo make install Then, `go get -u` as usual. ```sh -go get -u github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway -go get -u github.com/gengo/grpc-gateway/protoc-gen-swagger +go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway +go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger go get -u github.com/golang/protobuf/protoc-gen-go ``` @@ -88,8 +88,8 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. ```sh protoc -I/usr/local/include -I. \ -I$GOPATH/src \ - -I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \ - --go_out=Mgoogle/api/annotations.proto=github.com/gengo/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --go_out=Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \ path/to/your_service.proto ``` @@ -101,13 +101,13 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. ```sh protoc -I/usr/local/include -I. \ -I$GOPATH/src \ - -I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --ruby_out=. \ path/to/your/service_proto protoc -I/usr/local/include -I. \ -I$GOPATH/src \ - -I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --plugin=protoc-gen-grpc-ruby=grpc_ruby_plugin \ --grpc-ruby_out=. \ path/to/your/service.proto @@ -118,7 +118,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. ```sh protoc -I/usr/local/include -I. \ -I$GOPATH/src \ - -I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --grpc-gateway_out=logtostderr=true:. \ path/to/your_service.proto ``` @@ -135,7 +135,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. "github.com/golang/glog" "golang.org/x/net/context" - "github.com/gengo/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc" gw "path/to/your_service_package" @@ -176,7 +176,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. ```sh protoc -I/usr/local/include -I. \ -I$GOPATH/src \ - -I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --swagger_out=logtostderr=true:. \ path/to/your_service.proto ``` @@ -221,4 +221,4 @@ But patch is welcome. # License grpc-gateway is licensed under the BSD 3-Clause License. -See [LICENSE.txt](https://github.com/gengo/grpc-gateway/blob/master/LICENSE.txt) for more details. +See [LICENSE.txt](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt) for more details. diff --git a/examples/browser/bower.json b/examples/browser/bower.json index eb2c258d6f2..2454691ae08 100644 --- a/examples/browser/bower.json +++ b/examples/browser/bower.json @@ -6,7 +6,7 @@ "Yuki Yugui Sonoda " ], "license": "SEE LICENSE IN LICENSE file", - "homepage": "https://github.com/gengo/grpc-gateway", + "homepage": "https://github.com/grpc-ecosystem/grpc-gateway", "private": true, "dependencies": { "swagger-js": "~> 2.1" diff --git a/examples/browser/gulpfile.js b/examples/browser/gulpfile.js index c095a3e6cbb..0d8e15864de 100644 --- a/examples/browser/gulpfile.js +++ b/examples/browser/gulpfile.js @@ -16,11 +16,11 @@ gulp.task('bower', function(){ }); gulp.task('server', shell.task([ - 'go build -o bin/example-server github.com/gengo/grpc-gateway/examples/server', + 'go build -o bin/example-server github.com/grpc-ecosystem/grpc-gateway/examples/server', ])); gulp.task('gateway', shell.task([ - 'go build -o bin/example-gw github.com/gengo/grpc-gateway/examples', + 'go build -o bin/example-gw github.com/grpc-ecosystem/grpc-gateway/examples', ])); gulp.task('serve-server', ['server'], function(){ diff --git a/examples/client_test.go b/examples/client_test.go index 41f29fc593f..0574d9fbb0c 100644 --- a/examples/client_test.go +++ b/examples/client_test.go @@ -4,8 +4,8 @@ import ( "reflect" "testing" - "github.com/gengo/grpc-gateway/examples/clients/abe" - "github.com/gengo/grpc-gateway/examples/clients/echo" + "github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe" + "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo" ) func TestClientIntegration(t *testing.T) { diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index addd2ebb3bd..05843baeeef 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -1,6 +1,6 @@ syntax = "proto3"; option go_package = "examplepb"; -package gengo.grpc.gateway.examples.examplepb; +package grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; @@ -94,7 +94,7 @@ service ABitOfEverythingService { delete: "/v1/example/a_bit_of_everything/{uuid}" }; } - rpc Echo(gengo.grpc.gateway.examples.sub.StringMessage) returns (gengo.grpc.gateway.examples.sub.StringMessage) { + rpc Echo(grpc.gateway.examples.sub.StringMessage) returns (grpc.gateway.examples.sub.StringMessage) { option (google.api.http) = { get: "/v1/example/a_bit_of_everything/echo/{value}" additional_bindings { diff --git a/examples/examplepb/echo_service.proto b/examples/examplepb/echo_service.proto index 0573f29f052..44555e8553f 100644 --- a/examples/examplepb/echo_service.proto +++ b/examples/examplepb/echo_service.proto @@ -5,7 +5,7 @@ option go_package = "examplepb"; // // Echo Service API consists of a single service which returns // a message. -package gengo.grpc.gateway.examples.examplepb; +package grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; diff --git a/examples/examplepb/flow_combination.proto b/examples/examplepb/flow_combination.proto index 9c321fe0fba..60096081ee1 100644 --- a/examples/examplepb/flow_combination.proto +++ b/examples/examplepb/flow_combination.proto @@ -1,6 +1,6 @@ syntax = "proto3"; option go_package = "examplepb"; -package gengo.grpc.gateway.examples.examplepb; +package grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; diff --git a/examples/examplepb/stream.proto b/examples/examplepb/stream.proto index dbf5ac4633d..573a2f4d725 100644 --- a/examples/examplepb/stream.proto +++ b/examples/examplepb/stream.proto @@ -1,6 +1,6 @@ syntax = "proto3"; option go_package = "examplepb"; -package gengo.grpc.gateway.examples.examplepb; +package grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; @@ -20,7 +20,7 @@ service StreamService { get: "/v1/example/a_bit_of_everything" }; } - rpc BulkEcho(stream gengo.grpc.gateway.examples.sub.StringMessage) returns (stream gengo.grpc.gateway.examples.sub.StringMessage) { + rpc BulkEcho(stream grpc.gateway.examples.sub.StringMessage) returns (stream grpc.gateway.examples.sub.StringMessage) { option (google.api.http) = { post: "/v1/example/a_bit_of_everything/echo" body: "*" diff --git a/examples/integration_test.go b/examples/integration_test.go index 4681da37908..2d345540cfe 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -12,12 +12,12 @@ import ( "testing" "time" - gw "github.com/gengo/grpc-gateway/examples/examplepb" - sub "github.com/gengo/grpc-gateway/examples/sub" - "github.com/gengo/grpc-gateway/runtime" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" + gw "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc/codes" ) diff --git a/examples/main.go b/examples/main.go index 2d8a1a54aff..748ab36186b 100644 --- a/examples/main.go +++ b/examples/main.go @@ -6,9 +6,9 @@ import ( "path" "strings" - "github.com/gengo/grpc-gateway/examples/examplepb" - "github.com/gengo/grpc-gateway/runtime" "github.com/golang/glog" + "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/examples/main_test.go b/examples/main_test.go index c5ed4d46638..2742c385bb2 100644 --- a/examples/main_test.go +++ b/examples/main_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - server "github.com/gengo/grpc-gateway/examples/server" + server "github.com/grpc-ecosystem/grpc-gateway/examples/server" ) func runServers() <-chan error { diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 64ae39c6387..37001d69dfe 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -5,11 +5,11 @@ import ( "io" "sync" - examples "github.com/gengo/grpc-gateway/examples/examplepb" - 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" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" "github.com/rogpeppe/fastuuid" "golang.org/x/net/context" "google.golang.org/grpc" diff --git a/examples/server/echo.go b/examples/server/echo.go index 0f07fbbd496..92ac950a2c7 100644 --- a/examples/server/echo.go +++ b/examples/server/echo.go @@ -1,8 +1,8 @@ package main import ( - examples "github.com/gengo/grpc-gateway/examples/examplepb" "github.com/golang/glog" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/metadata" diff --git a/examples/server/flow_combination.go b/examples/server/flow_combination.go index b6aa0d92f01..2c9fcd99e68 100644 --- a/examples/server/flow_combination.go +++ b/examples/server/flow_combination.go @@ -3,7 +3,7 @@ package main import ( "io" - examples "github.com/gengo/grpc-gateway/examples/examplepb" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "golang.org/x/net/context" ) diff --git a/examples/server/main.go b/examples/server/main.go index 844ace623e3..136034ad83b 100644 --- a/examples/server/main.go +++ b/examples/server/main.go @@ -4,8 +4,8 @@ import ( "flag" "net" - examples "github.com/gengo/grpc-gateway/examples/examplepb" "github.com/golang/glog" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "google.golang.org/grpc" ) diff --git a/examples/sub/message.proto b/examples/sub/message.proto index 56e917804bc..7702a930d98 100644 --- a/examples/sub/message.proto +++ b/examples/sub/message.proto @@ -1,6 +1,6 @@ syntax = "proto2"; option go_package = "sub"; -package gengo.grpc.gateway.examples.sub; +package grpc.gateway.examples.sub; message StringMessage { required string value = 1; diff --git a/examples/sub2/message.proto b/examples/sub2/message.proto index 5d686d62c68..9c266430958 100644 --- a/examples/sub2/message.proto +++ b/examples/sub2/message.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/gengo/grpc-gateway/examples/sub2"; +option go_package = "github.com/grpc-ecosystem/grpc-gateway/examples/sub2"; package sub2; message IdMessage { diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index aa3dffe8156..8f7cb43c669 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -4,11 +4,11 @@ import ( "fmt" "strings" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/httprule" - options "github.com/gengo/grpc-gateway/third_party/googleapis/google/api" "github.com/golang/glog" "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + options "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" ) // loadServices registers services and their methods from "targetFile" to "r". diff --git a/protoc-gen-grpc-gateway/descriptor/services_test.go b/protoc-gen-grpc-gateway/descriptor/services_test.go index f2df37011d5..7b4af4e6898 100644 --- a/protoc-gen-grpc-gateway/descriptor/services_test.go +++ b/protoc-gen-grpc-gateway/descriptor/services_test.go @@ -4,9 +4,9 @@ import ( "reflect" "testing" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/httprule" "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func compilePath(t *testing.T, path string) httprule.Template { diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index 1a3caf96220..248538e7bad 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -4,9 +4,9 @@ import ( "fmt" "strings" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/httprule" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) // GoPackage represents a golang package diff --git a/protoc-gen-grpc-gateway/descriptor/types_test.go b/protoc-gen-grpc-gateway/descriptor/types_test.go index 4b7caea6f3d..ef2162a61fb 100644 --- a/protoc-gen-grpc-gateway/descriptor/types_test.go +++ b/protoc-gen-grpc-gateway/descriptor/types_test.go @@ -29,7 +29,7 @@ func TestGoPackageStandard(t *testing.T) { want: false, }, { - pkg: GoPackage{Path: "github.com/gengo/grpc-gateway", Name: "main"}, + pkg: GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"}, want: false, }, { @@ -65,8 +65,8 @@ func TestGoPackageString(t *testing.T) { want: `"golang.org/x/net/context"`, }, { - pkg: GoPackage{Path: "github.com/gengo/grpc-gateway", Name: "main"}, - want: `"github.com/gengo/grpc-gateway"`, + pkg: GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"}, + want: `"github.com/grpc-ecosystem/grpc-gateway"`, }, { pkg: GoPackage{Path: "github.com/google/googleapis/google/api/http.pb", Name: "http_pb", Alias: "htpb"}, diff --git a/protoc-gen-grpc-gateway/generator/generator.go b/protoc-gen-grpc-gateway/generator/generator.go index b4de256c912..df55da44445 100644 --- a/protoc-gen-grpc-gateway/generator/generator.go +++ b/protoc-gen-grpc-gateway/generator/generator.go @@ -2,8 +2,8 @@ package generator import ( - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) // Generator is an abstraction of code generators. diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index 33cf6cc65f1..b4cce8695eb 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -8,11 +8,11 @@ import ( "path/filepath" "strings" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - gen "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/generator" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" ) var ( @@ -30,8 +30,8 @@ func New(reg *descriptor.Registry) gen.Generator { for _, pkgpath := range []string{ "io", "net/http", - "github.com/gengo/grpc-gateway/runtime", - "github.com/gengo/grpc-gateway/utilities", + "github.com/grpc-ecosystem/grpc-gateway/runtime", + "github.com/grpc-ecosystem/grpc-gateway/utilities", "github.com/golang/protobuf/proto", "golang.org/x/net/context", "google.golang.org/grpc", diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index ff34f396584..5b760220210 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -6,9 +6,9 @@ import ( "strings" "text/template" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/gengo/grpc-gateway/utilities" "github.com/golang/glog" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) type param struct { diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index cfad4312fee..c5fb2f93e39 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -4,10 +4,10 @@ import ( "strings" "testing" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/httprule" "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { diff --git a/protoc-gen-grpc-gateway/httprule/compile.go b/protoc-gen-grpc-gateway/httprule/compile.go index 256477df933..437039a3dae 100644 --- a/protoc-gen-grpc-gateway/httprule/compile.go +++ b/protoc-gen-grpc-gateway/httprule/compile.go @@ -1,7 +1,7 @@ package httprule import ( - "github.com/gengo/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) const ( diff --git a/protoc-gen-grpc-gateway/httprule/compile_test.go b/protoc-gen-grpc-gateway/httprule/compile_test.go index 451ae2ad467..9ef297573f8 100644 --- a/protoc-gen-grpc-gateway/httprule/compile_test.go +++ b/protoc-gen-grpc-gateway/httprule/compile_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/gengo/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) const ( diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index f84742cadef..1c01d8756ce 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -15,11 +15,11 @@ import ( "os" "strings" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/gengateway" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway" ) var ( diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go index 01219b46330..697e540b4ae 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/genswagger/generator.go @@ -8,11 +8,11 @@ import ( "path/filepath" "strings" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - gen "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/generator" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" ) var ( diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index fd7b1dfe00d..e2bd125bda7 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -9,8 +9,8 @@ import ( "strconv" "strings" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) // findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service. diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 270b38d3560..1c897be8acd 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -5,10 +5,10 @@ import ( "reflect" "testing" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/httprule" "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 7dea2209a65..b91e457c006 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -1,7 +1,7 @@ package genswagger import ( - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) type param struct { diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index acad8854fa9..fc3a0030a11 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -7,11 +7,11 @@ import ( "os" "strings" - "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/gengo/grpc-gateway/protoc-gen-swagger/genswagger" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger" ) var ( diff --git a/runtime/context_test.go b/runtime/context_test.go index 403b733329c..abc1873fad9 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/gengo/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc/metadata" ) diff --git a/runtime/errors_test.go b/runtime/errors_test.go index 3cc9acfde35..2bdfca637c1 100644 --- a/runtime/errors_test.go +++ b/runtime/errors_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/gengo/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/runtime/handler.go b/runtime/handler.go index a9c48782cfa..bafa4285f91 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -6,8 +6,8 @@ import ( "net/http" "net/textproto" - "github.com/gengo/grpc-gateway/runtime/internal" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" diff --git a/runtime/internal/stream_chunk.proto b/runtime/internal/stream_chunk.proto index c076b9b3be8..f7fba56c35b 100644 --- a/runtime/internal/stream_chunk.proto +++ b/runtime/internal/stream_chunk.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package gengo.grpc.gateway.runtime; +package grpc.gateway.runtime; option go_package = "internal"; // StreamError is a response type which is returned when diff --git a/runtime/marshal_json_test.go b/runtime/marshal_json_test.go index e476db588d5..e6efa291072 100644 --- a/runtime/marshal_json_test.go +++ b/runtime/marshal_json_test.go @@ -7,13 +7,13 @@ import ( "strings" "testing" - "github.com/gengo/grpc-gateway/examples/examplepb" - "github.com/gengo/grpc-gateway/runtime" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" structpb "github.com/golang/protobuf/ptypes/struct" "github.com/golang/protobuf/ptypes/timestamp" "github.com/golang/protobuf/ptypes/wrappers" + "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" ) func TestJSONBuiltinMarshal(t *testing.T) { diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index 9b72f6d9ee3..01e7ce87251 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -6,8 +6,6 @@ import ( "strings" "testing" - "github.com/gengo/grpc-gateway/examples/examplepb" - "github.com/gengo/grpc-gateway/runtime" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/duration" @@ -15,6 +13,8 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "github.com/golang/protobuf/ptypes/timestamp" "github.com/golang/protobuf/ptypes/wrappers" + "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" ) func TestJSONPbMarshal(t *testing.T) { diff --git a/runtime/marshaler_registry_test.go b/runtime/marshaler_registry_test.go index 206f6ed9a77..194de6fee11 100644 --- a/runtime/marshaler_registry_test.go +++ b/runtime/marshaler_registry_test.go @@ -6,7 +6,7 @@ import ( "net/http" "testing" - "github.com/gengo/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime" ) func TestMarshalerForRequest(t *testing.T) { diff --git a/runtime/mux_test.go b/runtime/mux_test.go index fcea9867874..bb90a7306a1 100644 --- a/runtime/mux_test.go +++ b/runtime/mux_test.go @@ -7,8 +7,8 @@ import ( "net/http/httptest" "testing" - "github.com/gengo/grpc-gateway/runtime" - "github.com/gengo/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) func TestMuxServeHTTP(t *testing.T) { diff --git a/runtime/pattern.go b/runtime/pattern.go index 1c3aa1110db..3947dbea023 100644 --- a/runtime/pattern.go +++ b/runtime/pattern.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/gengo/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "google.golang.org/grpc/grpclog" ) diff --git a/runtime/pattern_test.go b/runtime/pattern_test.go index 55d6cb8b161..8f5a664aba5 100644 --- a/runtime/pattern_test.go +++ b/runtime/pattern_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/gengo/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) const ( diff --git a/runtime/query.go b/runtime/query.go index 3455b2b728d..56a919a52f1 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -6,8 +6,8 @@ import ( "reflect" "strings" - "github.com/gengo/grpc-gateway/utilities" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "google.golang.org/grpc/grpclog" ) diff --git a/runtime/query_test.go b/runtime/query_test.go index 968baa4149d..cf2d4285616 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -4,9 +4,9 @@ import ( "net/url" "testing" - "github.com/gengo/grpc-gateway/runtime" - "github.com/gengo/grpc-gateway/utilities" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) func TestPopulateParameters(t *testing.T) { diff --git a/utilities/trie_test.go b/utilities/trie_test.go index e5d0271dc52..0178aa827a0 100644 --- a/utilities/trie_test.go +++ b/utilities/trie_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/gengo/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) func TestMaxCommonPrefix(t *testing.T) { From 231843b261db2eaaeb6c324ac0ecc8f5b5c76690 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Wed, 13 Jul 2016 14:43:50 +0900 Subject: [PATCH 068/552] Regenerate automatically generated files --- examples/examplepb/a_bit_of_everything.pb.go | 212 +++++++++--------- .../examplepb/a_bit_of_everything.pb.gw.go | 8 +- examples/examplepb/echo_service.pb.go | 42 ++-- examples/examplepb/echo_service.pb.gw.go | 4 +- examples/examplepb/flow_combination.pb.go | 127 ++++++----- examples/examplepb/flow_combination.pb.gw.go | 4 +- examples/examplepb/stream.pb.go | 74 +++--- examples/examplepb/stream.pb.gw.go | 6 +- examples/sub/message.pb.go | 15 +- examples/sub2/message.pb.go | 10 +- runtime/internal/stream_chunk.pb.go | 28 +-- 11 files changed, 264 insertions(+), 266 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index b5d656b7b05..3b919655a4c 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -7,10 +7,10 @@ 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 _ "github.com/grpc-ecosystem/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" +import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" +import sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" import ( context "golang.org/x/net/context" @@ -89,7 +89,7 @@ type ABitOfEverything struct { StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` // TODO(yugui) add bytes_value Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` - EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=gengo.grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` + EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` @@ -99,7 +99,7 @@ type ABitOfEverything struct { // *ABitOfEverything_OneofEmpty // *ABitOfEverything_OneofString OneofValue isABitOfEverything_OneofValue `protobuf_oneof:"oneof_value"` - MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=gengo.grpc.gateway.examples.examplepb.NumericEnum"` + MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=grpc.gateway.examples.examplepb.NumericEnum"` MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue" json:"nonConventionalNameValue,omitempty"` @@ -255,7 +255,7 @@ 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"` + Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,enum=grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` } func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested{} } @@ -264,10 +264,10 @@ func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0, 0} } 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.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) + proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything") + proto.RegisterType((*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.Nested") + proto.RegisterEnum("grpc.gateway.examples.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) + proto.RegisterEnum("grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value) } // Reference imports to suppress errors if they are not otherwise used. @@ -286,7 +286,7 @@ type ABitOfEverythingServiceClient interface { Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, 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) + Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } @@ -301,7 +301,7 @@ func NewABitOfEverythingServiceClient(cc *grpc.ClientConn) ABitOfEverythingServi func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -310,7 +310,7 @@ func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEv func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -319,7 +319,7 @@ func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABit 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...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -328,7 +328,7 @@ func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdM 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...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -337,16 +337,16 @@ func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEv 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...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *gengo_grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*gengo_grpc_gateway_examples_sub.StringMessage, error) { - out := new(gengo_grpc_gateway_examples_sub.StringMessage) - err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", in, out, c.cc, opts...) +func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) { + out := new(grpc_gateway_examples_sub.StringMessage) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -355,7 +355,7 @@ func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *gengo_grpc 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...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -364,7 +364,7 @@ func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *AB 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...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -379,7 +379,7 @@ type ABitOfEverythingServiceServer interface { Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, 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) + Echo(context.Context, *grpc_gateway_examples_sub.StringMessage) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) Timeout(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) } @@ -398,7 +398,7 @@ func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Create(ctx, req.(*ABitOfEverything)) @@ -416,7 +416,7 @@ func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, req.(*ABitOfEverything)) @@ -434,7 +434,7 @@ func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Lookup(ctx, req.(*sub2.IdMessage)) @@ -452,7 +452,7 @@ func _ABitOfEverythingService_Update_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Update(ctx, req.(*ABitOfEverything)) @@ -470,7 +470,7 @@ func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Delete(ctx, req.(*sub2.IdMessage)) @@ -479,7 +479,7 @@ func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Contex } func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(gengo_grpc_gateway_examples_sub.StringMessage) + in := new(grpc_gateway_examples_sub.StringMessage) if err := dec(in); err != nil { return nil, err } @@ -488,10 +488,10 @@ func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ABitOfEverythingServiceServer).Echo(ctx, req.(*gengo_grpc_gateway_examples_sub.StringMessage)) + return srv.(ABitOfEverythingServiceServer).Echo(ctx, req.(*grpc_gateway_examples_sub.StringMessage)) } return interceptor(ctx, in, info, handler) } @@ -506,7 +506,7 @@ func _ABitOfEverythingService_DeepPathEcho_Handler(srv interface{}, ctx context. } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).DeepPathEcho(ctx, req.(*ABitOfEverything)) @@ -524,7 +524,7 @@ func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Timeout(ctx, req.(*google_protobuf1.Empty)) @@ -533,7 +533,7 @@ func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Conte } var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService", + ServiceName: "grpc.gateway.examples.examplepb.ABitOfEverythingService", HandlerType: (*ABitOfEverythingServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -576,77 +576,77 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1150 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x57, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0xee, 0xda, 0x89, 0x13, 0x9f, 0x8d, 0x53, 0x67, 0xd2, 0xa4, 0xae, 0x0b, 0x4a, 0x30, 0x14, - 0x55, 0xa1, 0xda, 0x55, 0x37, 0x15, 0xd0, 0x48, 0x80, 0x9a, 0xc6, 0x50, 0xa4, 0x36, 0x81, 0x4d, - 0x1a, 0xa4, 0x48, 0xc8, 0x5a, 0xdb, 0x13, 0x67, 0x15, 0xef, 0xce, 0x6a, 0x7f, 0x4c, 0xad, 0x28, - 0x5c, 0x54, 0x5c, 0x72, 0xc7, 0x23, 0x20, 0x71, 0x51, 0x09, 0xde, 0x81, 0x6b, 0x2e, 0xe9, 0x23, - 0xf0, 0x20, 0x9c, 0x9d, 0xd9, 0xdd, 0xcc, 0x3a, 0x31, 0x09, 0x49, 0x05, 0x57, 0xde, 0x39, 0xe7, - 0x9b, 0xef, 0xfc, 0xcd, 0x39, 0x33, 0x86, 0x7b, 0xf4, 0x85, 0xe5, 0x78, 0x7d, 0x1a, 0xe8, 0xc9, - 0x87, 0xd7, 0xd6, 0xad, 0x56, 0xdb, 0x0e, 0x5b, 0x6c, 0xbf, 0x45, 0x07, 0xd4, 0x1f, 0x86, 0x07, - 0xb6, 0xdb, 0xd3, 0x3c, 0x9f, 0x85, 0x8c, 0xdc, 0xe9, 0x51, 0xb7, 0xc7, 0xb4, 0x9e, 0xef, 0x75, - 0xb4, 0x9e, 0x15, 0xd2, 0xef, 0xac, 0x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 0x8c, 0x28, 0x21, - 0x62, 0xc2, 0x54, 0x23, 0x09, 0x22, 0x38, 0x56, 0x8d, 0x04, 0x31, 0x85, 0x88, 0x49, 0xce, 0xb1, - 0x6a, 0x08, 0xc0, 0xbb, 0x50, 0xd9, 0xb7, 0x5f, 0xd0, 0x6e, 0x46, 0x32, 0x8d, 0x90, 0x92, 0x39, - 0x93, 0x08, 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, 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, 0x66, 0xdb, 0x1e, 0x21, 0xa7, 0x54, 0xe4, 0x77, - 0x05, 0x66, 0xe2, 0xbb, 0xe4, 0x2b, 0x2b, 0x3c, 0xe0, 0x51, 0xfd, 0xf7, 0x67, 0xfe, 0x33, 0x1e, - 0xe7, 0xc3, 0xc6, 0x83, 0x73, 0x0b, 0x90, 0xfb, 0x23, 0xa3, 0xc5, 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, + // 1144 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0x4d, 0x4f, 0x1b, 0x47, + 0x18, 0xce, 0xda, 0x60, 0xf0, 0xbb, 0x18, 0xcc, 0x10, 0x88, 0xe3, 0xb4, 0x82, 0xba, 0x1f, 0x42, + 0x14, 0xed, 0x0a, 0x13, 0x55, 0x09, 0x52, 0x15, 0x41, 0x70, 0x95, 0xaa, 0x09, 0xa4, 0x4b, 0x92, + 0x03, 0x6a, 0x64, 0xad, 0xf1, 0x60, 0x56, 0x78, 0x77, 0x56, 0xfb, 0xe1, 0x62, 0x51, 0x7a, 0xe8, + 0xa1, 0x7f, 0xa0, 0x87, 0x9e, 0x9a, 0x4b, 0xa5, 0xaa, 0x97, 0x1e, 0x7b, 0xee, 0x8f, 0xe8, 0x5f, + 0xe8, 0x0f, 0xe9, 0xbb, 0x33, 0xbb, 0xcb, 0xac, 0xc1, 0x32, 0x1f, 0x52, 0x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 0x15, 0xf3, 0x90, 0x45, 0x50, 0x0f, 0xbb, 0xcc, 0x0c, 0x9a, 0x3d, 0xb3, 0x1b, 0xd2, 0x4a, 0x1e, + 0xc5, 0x72, 0x06, 0xf0, 0xad, 0x37, 0xd1, 0x0e, 0xf9, 0x08, 0xa6, 0xda, 0x2c, 0x6c, 0x61, 0x94, + 0x02, 0x31, 0x86, 0x08, 0xc5, 0x50, 0xc5, 0x9e, 0x80, 0x20, 0x87, 0xe5, 0x04, 0x5f, 0x3c, 0x8c, + 0x11, 0xe3, 0x88, 0xc8, 0x1b, 0xc0, 0xb7, 0x52, 0x8e, 0x50, 0x46, 0x14, 0x10, 0x31, 0x66, 0xa8, + 0xa1, 0x04, 0x11, 0x1c, 0xeb, 0xf5, 0x18, 0x31, 0x81, 0x88, 0x71, 0xce, 0xb1, 0x5e, 0x17, 0x80, + 0x8f, 0xa1, 0x74, 0x68, 0x9d, 0xd0, 0x76, 0x4a, 0x32, 0x89, 0x90, 0x82, 0x31, 0x15, 0x6f, 0x66, + 0x41, 0x29, 0x4f, 0x11, 0x41, 0x13, 0x31, 0x28, 0x61, 0xfa, 0x10, 0xa0, 0xc5, 0x58, 0x37, 0x46, + 0x00, 0x22, 0x26, 0x8d, 0x62, 0xb4, 0x93, 0x3a, 0xeb, 0x07, 0x1e, 0xa6, 0x2a, 0x06, 0xa8, 0x3c, + 0xff, 0xaa, 0xd8, 0xcb, 0xc4, 0x93, 0xaa, 0x94, 0x10, 0x52, 0x12, 0xf1, 0x24, 0x22, 0xdf, 0x00, + 0x50, 0x27, 0xb4, 0x63, 0xc0, 0x34, 0x02, 0xa6, 0xeb, 0xab, 0x23, 0xab, 0xb5, 0x13, 0xda, 0xd4, + 0xb3, 0x0e, 0x1a, 0x68, 0x69, 0x14, 0x23, 0x7b, 0x41, 0xf6, 0x29, 0x4c, 0xfb, 0xd9, 0xb8, 0x66, + 0x90, 0x70, 0xc6, 0x28, 0xf9, 0x99, 0xc0, 0x52, 0x58, 0x9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f, 0x2e, 0xa4, 0x61, 0x98, 0x4a, 0x1c, 0xeb, + 0xca, 0x55, 0x63, 0xfd, 0x47, 0x81, 0xb1, 0xc6, 0xc1, 0x11, 0x23, 0xcb, 0x43, 0x22, 0x45, 0x5d, + 0x4d, 0x8c, 0xb6, 0x44, 0xfa, 0xca, 0xc8, 0xda, 0x01, 0x77, 0xe6, 0x2d, 0x59, 0x1d, 0xe5, 0x0c, + 0x45, 0x0f, 0xf4, 0x53, 0xf1, 0xe2, 0xee, 0xdf, 0xaf, 0x95, 0xf5, 0x5e, 0x3d, 0xc5, 0x47, 0x67, + 0x1b, 0x62, 0x54, 0xed, 0x13, 0x72, 0xe1, 0x88, 0xfc, 0xad, 0xc0, 0x54, 0x74, 0x1b, 0xbc, 0x34, + 0x83, 0x23, 0x1e, 0xc9, 0xfb, 0x79, 0x9d, 0x9f, 0xf0, 0xd8, 0x1e, 0xd7, 0x1e, 0x8e, 0x4c, 0x74, + 0xe6, 0x4f, 0x85, 0x16, 0xdd, 0x95, 0xbc, 0xb8, 0x6f, 0x60, 0xe2, 0x95, 0x65, 0x53, 0x16, 0x06, + 0x64, 0x48, 0x31, 0x87, 0x16, 0xf9, 0x01, 0xd7, 0x9e, 0x27, 0x73, 0x72, 0x32, 0x02, 0x41, 0xb6, + 0xa5, 0xee, 0x17, 0x53, 0xb7, 0x5b, 0x05, 0x6e, 0xb9, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x7f, 0xc8, 0x3e, 0x80, 0xb4, 0x0d, 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 ae91750b167..213f5415fcd 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -13,12 +13,12 @@ import ( "io" "net/http" - "github.com/gengo/grpc-gateway/examples/sub" - "github.com/gengo/grpc-gateway/examples/sub2" - "github.com/gengo/grpc-gateway/runtime" - "github.com/gengo/grpc-gateway/utilities" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" + "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 4bafb938354..fa882fb5196 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -30,7 +30,7 @@ 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 _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" import ( context "golang.org/x/net/context" @@ -60,7 +60,7 @@ func (*SimpleMessage) ProtoMessage() {} func (*SimpleMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func init() { - proto.RegisterType((*SimpleMessage)(nil), "gengo.grpc.gateway.examples.examplepb.SimpleMessage") + proto.RegisterType((*SimpleMessage)(nil), "grpc.gateway.examples.examplepb.SimpleMessage") } // Reference imports to suppress errors if they are not otherwise used. @@ -93,7 +93,7 @@ func NewEchoServiceClient(cc *grpc.ClientConn) EchoServiceClient { func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.EchoService/Echo", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/Echo", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -102,7 +102,7 @@ func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts .. func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.EchoService/EchoBody", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoBody", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -135,7 +135,7 @@ func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.EchoService/Echo", + FullMethod: "/grpc.gateway.examples.examplepb.EchoService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EchoServiceServer).Echo(ctx, req.(*SimpleMessage)) @@ -153,7 +153,7 @@ func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.EchoService/EchoBody", + FullMethod: "/grpc.gateway.examples.examplepb.EchoService/EchoBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EchoServiceServer).EchoBody(ctx, req.(*SimpleMessage)) @@ -162,7 +162,7 @@ func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec fun } var _EchoService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gengo.grpc.gateway.examples.examplepb.EchoService", + ServiceName: "grpc.gateway.examples.examplepb.EchoService", HandlerType: (*EchoServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -181,20 +181,20 @@ var _EchoService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/echo_service.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 233 bytes of a gzipped FileDescriptorProto + // 226 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 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 0xfc, 0x94, 0x4a, 0xba, - 0xba, 0x4b, 0x01, 0xec, 0x2e, 0x29, 0x4c, 0x77, 0xc5, 0x27, 0x01, 0x9d, 0x62, 0xc5, 0xa8, 0xe5, - 0xc4, 0x1d, 0xc5, 0x09, 0xd7, 0x9c, 0xc4, 0x06, 0x0e, 0x73, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x2a, 0x5f, 0x67, 0x79, 0xe1, 0x01, 0x00, 0x00, + 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xe4, 0xd3, 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, 0xda, 0x95, 0xe4, 0xb9, 0x78, 0x83, 0x33, + 0x41, 0x2a, 0x7d, 0x53, 0x8b, 0x8b, 0x13, 0xd3, 0x53, 0x85, 0xf8, 0xb8, 0x98, 0x32, 0x53, 0x24, + 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x80, 0x2c, 0xa3, 0x25, 0x4c, 0x5c, 0xdc, 0xae, 0x40, 0x6b, + 0x83, 0x21, 0xb6, 0x0a, 0xb5, 0x32, 0x72, 0xb1, 0x80, 0xf8, 0x42, 0x7a, 0x7a, 0x04, 0x6c, 0xd6, + 0x43, 0x31, 0x58, 0x8a, 0x44, 0xf5, 0x4a, 0xb2, 0x4d, 0x97, 0x9f, 0x4c, 0x66, 0x12, 0x57, 0x12, + 0xd5, 0x2f, 0x33, 0x84, 0x05, 0x01, 0x38, 0x00, 0xf4, 0xab, 0x33, 0x53, 0x6a, 0x85, 0x7a, 0x18, + 0xb9, 0x38, 0x40, 0xee, 0x70, 0xca, 0x4f, 0xa9, 0xa4, 0xb9, 0x5b, 0x14, 0xc0, 0x6e, 0x91, 0xc2, + 0x74, 0x4b, 0x7c, 0x12, 0xd0, 0x7a, 0x2b, 0x46, 0x2d, 0x27, 0xee, 0x28, 0x4e, 0xb8, 0xe6, 0x24, + 0x36, 0x70, 0xd8, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x26, 0x96, 0x37, 0xac, 0xc3, 0x01, + 0x00, 0x00, } diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 5d4693784f1..19130064d5c 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -13,9 +13,9 @@ import ( "io" "net/http" - "github.com/gengo/grpc-gateway/runtime" - "github.com/gengo/grpc-gateway/utilities" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 020e2225667..0a115f5d93c 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -7,7 +7,7 @@ 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 _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" import ( context "golang.org/x/net/context" @@ -82,11 +82,11 @@ func (m *SingleNestedProto) GetA() *UnaryProto { } func init() { - proto.RegisterType((*EmptyProto)(nil), "gengo.grpc.gateway.examples.examplepb.EmptyProto") - proto.RegisterType((*NonEmptyProto)(nil), "gengo.grpc.gateway.examples.examplepb.NonEmptyProto") - proto.RegisterType((*UnaryProto)(nil), "gengo.grpc.gateway.examples.examplepb.UnaryProto") - proto.RegisterType((*NestedProto)(nil), "gengo.grpc.gateway.examples.examplepb.NestedProto") - proto.RegisterType((*SingleNestedProto)(nil), "gengo.grpc.gateway.examples.examplepb.SingleNestedProto") + proto.RegisterType((*EmptyProto)(nil), "grpc.gateway.examples.examplepb.EmptyProto") + proto.RegisterType((*NonEmptyProto)(nil), "grpc.gateway.examples.examplepb.NonEmptyProto") + proto.RegisterType((*UnaryProto)(nil), "grpc.gateway.examples.examplepb.UnaryProto") + proto.RegisterType((*NestedProto)(nil), "grpc.gateway.examples.examplepb.NestedProto") + proto.RegisterType((*SingleNestedProto)(nil), "grpc.gateway.examples.examplepb.SingleNestedProto") } // Reference imports to suppress errors if they are not otherwise used. @@ -122,7 +122,7 @@ func NewFlowCombinationClient(cc *grpc.ClientConn) FlowCombinationClient { func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -130,7 +130,7 @@ func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, } func (c *flowCombinationClient) RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[0], c.cc, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[0], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyStream", opts...) if err != nil { return nil, err } @@ -162,7 +162,7 @@ func (x *flowCombinationRpcEmptyStreamClient) Recv() (*EmptyProto, error) { } func (c *flowCombinationClient) StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[1], c.cc, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyRpc", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[1], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyRpc", opts...) if err != nil { return nil, err } @@ -196,7 +196,7 @@ func (x *flowCombinationStreamEmptyRpcClient) CloseAndRecv() (*EmptyProto, error } func (c *flowCombinationClient) StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[2], c.cc, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[2], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyStream", opts...) if err != nil { return nil, err } @@ -228,7 +228,7 @@ func (x *flowCombinationStreamEmptyStreamClient) Recv() (*EmptyProto, error) { func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -237,7 +237,7 @@ func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProt func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -246,7 +246,7 @@ func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in * func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -254,7 +254,7 @@ func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *Nested } func (c *flowCombinationClient) RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[3], c.cc, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcBodyStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[3], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyStream", opts...) if err != nil { return nil, err } @@ -286,7 +286,7 @@ func (x *flowCombinationRpcBodyStreamClient) Recv() (*EmptyProto, error) { } func (c *flowCombinationClient) RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[4], c.cc, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[4], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...) if err != nil { return nil, err } @@ -318,7 +318,7 @@ func (x *flowCombinationRpcPathSingleNestedStreamClient) Recv() (*EmptyProto, er } func (c *flowCombinationClient) RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[5], c.cc, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[5], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedStream", opts...) if err != nil { return nil, err } @@ -378,7 +378,7 @@ func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", + FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, req.(*EmptyProto)) @@ -469,7 +469,7 @@ func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", + FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcBodyRpc(ctx, req.(*NonEmptyProto)) @@ -487,7 +487,7 @@ func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", + FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, req.(*SingleNestedProto)) @@ -505,7 +505,7 @@ func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", + FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, req.(*NestedProto)) @@ -577,7 +577,7 @@ func (x *flowCombinationRpcPathNestedStreamServer) Send(m *EmptyProto) error { } var _FlowCombination_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gengo.grpc.gateway.examples.examplepb.FlowCombination", + ServiceName: "grpc.gateway.examples.examplepb.FlowCombination", HandlerType: (*FlowCombinationServer)(nil), Methods: []grpc.MethodDesc{ { @@ -636,47 +636,46 @@ var _FlowCombination_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fileDescriptor3) } 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, - 0x08, 0x48, 0xd8, 0x25, 0x30, 0x00, 0x0b, 0x52, 0x11, 0x8c, 0x55, 0xd5, 0xc2, 0xe2, 0x05, 0x9d, - 0x5d, 0xe3, 0x06, 0x25, 0x3e, 0xd7, 0x31, 0x0a, 0x55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1f, 0x08, 0xd7, 0x32, 0xbe, - 0x57, 0xbc, 0x05, 0x59, 0x7f, 0x04, 0xa4, 0x07, 0xe4, 0xca, 0x1f, 0xad, 0xaf, 0x9b, 0x30, 0xbb, - 0xa6, 0xb4, 0x9b, 0xd3, 0x8f, 0xf0, 0x44, 0x1b, 0x68, 0xb3, 0x6c, 0xcf, 0xa7, 0x48, 0xce, 0x39, - 0xf8, 0x19, 0x76, 0xfb, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x90, 0xd0, 0xd7, 0xf8, 0x09, - 0x00, 0x00, + // 652 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x6f, 0x13, 0x4d, + 0x10, 0xc6, 0xb5, 0x8e, 0xf4, 0x4a, 0x19, 0xc7, 0x89, 0x73, 0x7e, 0x65, 0x6c, 0x63, 0xe2, 0x64, + 0x89, 0x84, 0xf9, 0x77, 0x17, 0x99, 0x2a, 0x94, 0x41, 0x50, 0x5a, 0x51, 0x22, 0x9a, 0x6b, 0xd0, + 0xde, 0xf9, 0x70, 0x2c, 0xd9, 0x77, 0x97, 0xf3, 0x21, 0x13, 0x45, 0x11, 0x12, 0x0d, 0x25, 0x05, + 0x1f, 0x80, 0x92, 0x8a, 0x2f, 0x40, 0x47, 0x45, 0x83, 0x44, 0x81, 0x44, 0x47, 0x47, 0xc7, 0x97, + 0x60, 0x77, 0x76, 0xef, 0xd6, 0x07, 0x36, 0x27, 0x23, 0x4c, 0x11, 0xe5, 0x76, 0x77, 0x66, 0xf6, + 0xb7, 0xcf, 0x3c, 0x13, 0x05, 0xae, 0x7b, 0x4f, 0xd9, 0x28, 0x1c, 0x7a, 0x63, 0x4b, 0x7d, 0x84, + 0x8e, 0xf5, 0x78, 0x18, 0x4c, 0x1e, 0xb9, 0xc1, 0xc8, 0x19, 0xf8, 0x2c, 0x1e, 0x04, 0xbe, 0x19, + 0x46, 0x41, 0x1c, 0x18, 0xad, 0x7e, 0x14, 0xba, 0x66, 0x9f, 0xc5, 0xde, 0x84, 0x9d, 0x99, 0x49, + 0x9e, 0x99, 0xe6, 0x35, 0x9a, 0xfd, 0x20, 0xe8, 0x0f, 0x3d, 0x8b, 0x85, 0x03, 0x8b, 0xf9, 0x7e, + 0x10, 0x63, 0xf6, 0x58, 0xa6, 0xd3, 0x35, 0x80, 0xfb, 0xa3, 0x30, 0x3e, 0x3b, 0xc4, 0xd5, 0x3e, + 0x94, 0xba, 0x81, 0xaf, 0x37, 0x8c, 0x35, 0x20, 0xac, 0x46, 0xb6, 0x49, 0x7b, 0xf5, 0x88, 0x30, + 0xb1, 0x72, 0x6a, 0x05, 0xb9, 0x72, 0xc4, 0xca, 0xad, 0xad, 0xc8, 0x95, 0x4b, 0xb7, 0x00, 0x1e, + 0xfa, 0x2c, 0x52, 0x79, 0x65, 0x58, 0x19, 0xc7, 0x91, 0xca, 0x14, 0x9f, 0xb4, 0x07, 0xc5, 0xae, + 0x37, 0x8e, 0xbd, 0x9e, 0x0c, 0xd8, 0x4f, 0x0a, 0x17, 0x3b, 0x37, 0xcd, 0x9c, 0x27, 0x98, 0xba, + 0x70, 0x1e, 0x45, 0x17, 0x36, 0x8f, 0x07, 0x3e, 0x7f, 0xee, 0xdf, 0xb9, 0xab, 0xf3, 0x71, 0x03, + 0x36, 0x1e, 0x70, 0xe1, 0xef, 0x69, 0xdd, 0x8d, 0x67, 0x50, 0x3c, 0x0a, 0x5d, 0x14, 0x89, 0xff, + 0x36, 0xf2, 0x4b, 0x6a, 0x3d, 0x1b, 0x8b, 0x04, 0xd3, 0xea, 0xf3, 0xcf, 0xdf, 0x5e, 0x15, 0xca, + 0x74, 0xdd, 0xe2, 0x39, 0x96, 0x27, 0x0e, 0xc4, 0x97, 0xf1, 0x82, 0xc0, 0x7a, 0x42, 0x70, 0x1c, + 0x47, 0x1e, 0x1b, 0x2d, 0x11, 0xa2, 0x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 0xa5, 0xf2, 0x91, + 0xea, 0x84, 0x6e, 0xcf, 0xa5, 0x9a, 0x6a, 0x4b, 0x0e, 0x7c, 0xda, 0x9c, 0x39, 0xe7, 0xbc, 0x84, + 0xf1, 0xa1, 0x00, 0x25, 0xe5, 0x58, 0x35, 0x3f, 0x4b, 0x35, 0xed, 0x17, 0x69, 0xda, 0x4f, 0x84, + 0x96, 0xb5, 0x6d, 0xe4, 0x00, 0x09, 0xdf, 0x4e, 0x3f, 0x28, 0xe3, 0x5b, 0x19, 0x62, 0x27, 0x7f, + 0x92, 0xa4, 0x83, 0xd4, 0x26, 0xa5, 0x57, 0xe6, 0xb8, 0x37, 0x29, 0xec, 0xf2, 0x81, 0xa8, 0xfe, + 0x6c, 0x60, 0x7d, 0xb8, 0x4b, 0x5b, 0x73, 0x3d, 0xac, 0xa3, 0x9a, 0x6a, 0x48, 0x66, 0x06, 0xf0, + 0xd9, 0x7f, 0x43, 0xa0, 0x3e, 0xc3, 0xcb, 0x4a, 0xd5, 0xa5, 0xdb, 0xf9, 0x1a, 0x0a, 0xbb, 0xa3, + 0x9e, 0x32, 0xab, 0xe3, 0x29, 0xe9, 0x77, 0x02, 0x95, 0x8c, 0xa7, 0x15, 0xe3, 0x12, 0x6d, 0x3d, + 0x41, 0xba, 0x53, 0x7a, 0xf5, 0xb7, 0xb6, 0xd6, 0x62, 0xe7, 0xbf, 0x23, 0xed, 0xda, 0xfc, 0x10, + 0x5e, 0x68, 0x8f, 0x1c, 0x14, 0xed, 0xd5, 0x14, 0xc9, 0xf9, 0x0f, 0xff, 0x03, 0xba, 0xf3, 0x23, + 0x00, 0x00, 0xff, 0xff, 0xaf, 0x85, 0xaf, 0x3c, 0x6d, 0x09, 0x00, 0x00, } diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 9901591b3a4..e6569a963b5 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -13,9 +13,9 @@ import ( "io" "net/http" - "github.com/gengo/grpc-gateway/runtime" - "github.com/gengo/grpc-gateway/utilities" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index 190a7487160..a9c870c64f3 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -7,9 +7,9 @@ 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 _ "github.com/grpc-ecosystem/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 grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" import ( context "golang.org/x/net/context" @@ -46,7 +46,7 @@ func NewStreamServiceClient(cc *grpc.ClientConn) StreamServiceClient { } 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...) + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[0], c.cc, "/grpc.gateway.examples.examplepb.StreamService/BulkCreate", opts...) if err != nil { return nil, err } @@ -80,7 +80,7 @@ func (x *streamServiceBulkCreateClient) CloseAndRecv() (*google_protobuf1.Empty, } 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...) + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[1], c.cc, "/grpc.gateway.examples.examplepb.StreamService/List", opts...) if err != nil { return nil, err } @@ -112,7 +112,7 @@ func (x *streamServiceListClient) Recv() (*ABitOfEverything, error) { } 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...) + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[2], c.cc, "/grpc.gateway.examples.examplepb.StreamService/BulkEcho", opts...) if err != nil { return nil, err } @@ -121,8 +121,8 @@ func (c *streamServiceClient) BulkEcho(ctx context.Context, opts ...grpc.CallOpt } type StreamService_BulkEchoClient interface { - Send(*gengo_grpc_gateway_examples_sub.StringMessage) error - Recv() (*gengo_grpc_gateway_examples_sub.StringMessage, error) + Send(*grpc_gateway_examples_sub.StringMessage) error + Recv() (*grpc_gateway_examples_sub.StringMessage, error) grpc.ClientStream } @@ -130,12 +130,12 @@ type streamServiceBulkEchoClient struct { grpc.ClientStream } -func (x *streamServiceBulkEchoClient) Send(m *gengo_grpc_gateway_examples_sub.StringMessage) error { +func (x *streamServiceBulkEchoClient) Send(m *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) +func (x *streamServiceBulkEchoClient) Recv() (*grpc_gateway_examples_sub.StringMessage, error) { + m := new(grpc_gateway_examples_sub.StringMessage) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -206,8 +206,8 @@ func _StreamService_BulkEcho_Handler(srv interface{}, stream grpc.ServerStream) } type StreamService_BulkEchoServer interface { - Send(*gengo_grpc_gateway_examples_sub.StringMessage) error - Recv() (*gengo_grpc_gateway_examples_sub.StringMessage, error) + Send(*grpc_gateway_examples_sub.StringMessage) error + Recv() (*grpc_gateway_examples_sub.StringMessage, error) grpc.ServerStream } @@ -215,12 +215,12 @@ type streamServiceBulkEchoServer struct { grpc.ServerStream } -func (x *streamServiceBulkEchoServer) Send(m *gengo_grpc_gateway_examples_sub.StringMessage) error { +func (x *streamServiceBulkEchoServer) Send(m *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) +func (x *streamServiceBulkEchoServer) Recv() (*grpc_gateway_examples_sub.StringMessage, error) { + m := new(grpc_gateway_examples_sub.StringMessage) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err } @@ -228,7 +228,7 @@ func (x *streamServiceBulkEchoServer) Recv() (*gengo_grpc_gateway_examples_sub.S } var _StreamService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gengo.grpc.gateway.examples.examplepb.StreamService", + ServiceName: "grpc.gateway.examples.examplepb.StreamService", HandlerType: (*StreamServiceServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ @@ -255,25 +255,25 @@ var _StreamService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/stream.proto", fileDescriptor2) } var fileDescriptor2 = []byte{ - // 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, 0x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d, 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, + // 314 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x90, 0xbd, 0x4e, 0xf3, 0x30, + 0x14, 0x86, 0xe5, 0xef, 0x43, 0x08, 0x8c, 0x58, 0x3c, 0x30, 0x18, 0xa4, 0x8a, 0x0a, 0x89, 0x82, + 0x90, 0xdd, 0xc2, 0xc6, 0x46, 0x51, 0x37, 0x10, 0x43, 0x37, 0x96, 0xca, 0xae, 0x4e, 0x5d, 0x8b, + 0x24, 0xb6, 0x62, 0x27, 0x10, 0x89, 0x89, 0x91, 0xb5, 0x37, 0xc2, 0xbd, 0x70, 0x0b, 0x5c, 0x08, + 0x6e, 0xfe, 0xa6, 0x56, 0x2d, 0x5b, 0x92, 0xf3, 0x9e, 0xbc, 0xcf, 0x79, 0x70, 0x07, 0xde, 0x44, + 0x6c, 0x23, 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2a, 0x46, 0xd3, 0xb9, 0x21, 0xbd, 0x35, 0x55, 0xc1, + 0x29, 0x0b, 0x06, 0xc3, 0xc6, 0x63, 0x65, 0x96, 0x6e, 0x9d, 0xdc, 0xde, 0x08, 0x04, 0x82, 0xd2, + 0x48, 0x1f, 0x0d, 0x0f, 0x9e, 0xf7, 0xdb, 0xf3, 0xe4, 0x6e, 0x29, 0xe4, 0xe6, 0x37, 0x00, 0x00, + 0xff, 0xff, 0xbc, 0x52, 0x49, 0x85, 0x8f, 0x02, 0x00, 0x00, } diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index c6fcebe55ab..f0baafe8f4d 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -13,11 +13,11 @@ 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" "github.com/golang/protobuf/ptypes/empty" + "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/sub/message.pb.go b/examples/sub/message.pb.go index 8ac5568bbf0..e5c1e15dfb9 100644 --- a/examples/sub/message.pb.go +++ b/examples/sub/message.pb.go @@ -46,19 +46,18 @@ func (m *StringMessage) GetValue() string { } func init() { - proto.RegisterType((*StringMessage)(nil), "gengo.grpc.gateway.examples.sub.StringMessage") + proto.RegisterType((*StringMessage)(nil), "grpc.gateway.examples.sub.StringMessage") } func init() { proto.RegisterFile("examples/sub/message.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 115 bytes of a gzipped FileDescriptorProto + // 109 bytes of a gzipped FileDescriptorProto 0x1f, 0x8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xbc, 0x10, 0x60, 0xa9, 0x65, 0x00, 0x00, 0x00, } diff --git a/examples/sub2/message.pb.go b/examples/sub2/message.pb.go index 8f6f432b49a..37d6ee759fb 100644 --- a/examples/sub2/message.pb.go +++ b/examples/sub2/message.pb.go @@ -44,13 +44,13 @@ func init() { func init() { proto.RegisterFile("examples/sub2/message.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 124 bytes of a gzipped FileDescriptorProto + // 128 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x29, 0xc9, 0x73, 0x71, 0x7a, 0xa6, 0xf8, 0x42, 0x24, 0x84, 0x84, 0xb8, 0x58, 0x4a, 0x4b, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18, - 0x35, 0x38, 0x83, 0xc0, 0x6c, 0x27, 0xdd, 0x28, 0xed, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, - 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xd4, 0xbc, 0xf4, 0x7c, 0xfd, 0xf4, 0xa2, 0x82, 0x64, 0xdd, 0xf4, - 0xc4, 0x92, 0xd4, 0xf2, 0xc4, 0x4a, 0x7d, 0x14, 0x3b, 0x92, 0xd8, 0xc0, 0x86, 0x1b, 0x03, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x98, 0xc9, 0xee, 0x80, 0x7b, 0x00, 0x00, 0x00, + 0x35, 0x38, 0x83, 0xc0, 0x6c, 0x27, 0xb3, 0x28, 0x93, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, + 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xa2, 0x82, 0x64, 0xdd, 0xd4, 0xe4, 0xfc, 0xe2, 0xca, 0xe2, 0x92, + 0x54, 0x28, 0x37, 0x3d, 0xb1, 0x24, 0xb5, 0x3c, 0xb1, 0x52, 0x1f, 0xc5, 0xb2, 0x24, 0x36, 0xb0, + 0x2d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53, 0x75, 0xef, 0xe0, 0x84, 0x00, 0x00, 0x00, } diff --git a/runtime/internal/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go index b5e9069e5c0..524e0d3c34c 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -43,23 +43,23 @@ func (*StreamError) ProtoMessage() {} func (*StreamError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func init() { - proto.RegisterType((*StreamError)(nil), "gengo.grpc.gateway.runtime.StreamError") + proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError") } func init() { proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 182 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0x8e, 0x3d, 0xef, 0x82, 0x30, - 0x10, 0x87, 0xc3, 0xff, 0x15, 0x8e, 0x8d, 0xa9, 0xd1, 0x41, 0xa3, 0x8b, 0x53, 0x19, 0xfc, 0x06, - 0x1a, 0xbf, 0x00, 0x6c, 0x2e, 0xa4, 0xe2, 0xa5, 0x10, 0xa5, 0x25, 0xd7, 0x23, 0xc6, 0xd5, 0x4f, - 0x2e, 0x2d, 0x32, 0xde, 0xf3, 0xdc, 0x93, 0xfc, 0x60, 0x4b, 0x83, 0xe1, 0xb6, 0xc3, 0xbc, 0x35, - 0x8c, 0x64, 0xd4, 0x3d, 0x77, 0x4c, 0xa8, 0xba, 0xaa, 0x6e, 0x06, 0x73, 0x93, 0x3d, 0x59, 0xb6, - 0xd9, 0x42, 0xa3, 0xd1, 0x56, 0x6a, 0xea, 0x6b, 0xa9, 0x15, 0xe3, 0x43, 0x3d, 0xe5, 0xa7, 0xdb, - 0xbc, 0x22, 0x48, 0xcb, 0x90, 0x9c, 0x88, 0x2c, 0x65, 0x4b, 0x48, 0xfc, 0x5f, 0x55, 0xdb, 0x2b, - 0x8a, 0x68, 0x1d, 0xed, 0x7e, 0x8b, 0xd8, 0x83, 0xe3, 0x78, 0x7b, 0xd9, 0x30, 0xf7, 0x93, 0xfc, - 0x9a, 0xa4, 0x07, 0x41, 0x0a, 0xf8, 0xef, 0xd0, 0x39, 0xa5, 0x51, 0x7c, 0x8f, 0x2a, 0x29, 0xe6, - 0x33, 0x5b, 0x41, 0x1a, 0x32, 0xc7, 0x8a, 0x07, 0x27, 0x7e, 0x82, 0x05, 0x8f, 0xca, 0x40, 0x0e, - 0x70, 0x8e, 0xe7, 0xfd, 0x97, 0xbf, 0xb0, 0x79, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x7f, - 0x7d, 0x56, 0xda, 0x00, 0x00, 0x00, + // 180 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0x2a, 0xcd, 0x2b, + 0xc9, 0xcc, 0x4d, 0xd5, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x2f, 0x2e, 0x29, + 0x4a, 0x4d, 0xcc, 0x8d, 0x4f, 0xce, 0x28, 0xcd, 0xcb, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x12, 0x49, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0x4f, 0x2c, 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0xea, + 0x50, 0x6a, 0x62, 0xe4, 0xe2, 0x0e, 0x06, 0x2b, 0x76, 0x2d, 0x2a, 0xca, 0x2f, 0x12, 0x92, 0xe6, + 0xe2, 0x04, 0xa9, 0x8b, 0x4f, 0xce, 0x4f, 0x49, 0x95, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x0d, 0xe2, + 0x00, 0x09, 0x38, 0x03, 0xf9, 0x20, 0xc9, 0x8c, 0x92, 0x92, 0x02, 0x88, 0x24, 0x13, 0x44, 0x12, + 0x24, 0x00, 0x96, 0x94, 0xe0, 0x62, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x95, 0x60, 0x06, + 0x4a, 0x71, 0x06, 0xc1, 0xb8, 0x42, 0xf2, 0x5c, 0xdc, 0x60, 0x6d, 0xc5, 0x25, 0x89, 0x25, 0xa5, + 0xc5, 0x12, 0x2c, 0x60, 0x59, 0x2e, 0x90, 0x50, 0x30, 0x58, 0xc4, 0x89, 0x2b, 0x8a, 0x03, 0xe6, + 0xf2, 0x24, 0x36, 0xb0, 0x6b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x07, 0x92, 0xb6, + 0xd4, 0x00, 0x00, 0x00, } From bd22e9b1b8f52a98afe57fd7a9a32983937da8ce Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 25 Jul 2016 21:32:28 +0900 Subject: [PATCH 069/552] Avoid Internal Server Error on zero-length input for bidi streaming Fixes #195 --- examples/examplepb/flow_combination.pb.gw.go | 7 +- examples/examplepb/stream.pb.gw.go | 7 +- examples/integration_test.go | 114 ++++++++++++++++++ .../gengateway/template.go | 7 +- 4 files changed, 129 insertions(+), 6 deletions(-) diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 2845b8dbdbc..af9da8d5f95 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -119,8 +119,11 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler return nil } if err := handleSend(); err != nil { - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) + if cerr := stream.CloseSend(); cerr != nil { + grpclog.Printf("Failed to terminate client stream: %v", cerr) + } + if err == io.EOF { + return stream, metadata, nil } return nil, metadata, err } diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index ae24644cadf..f256228759a 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -112,8 +112,11 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar return nil } if err := handleSend(); err != nil { - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) + if cerr := stream.CloseSend(); cerr != nil { + grpclog.Printf("Failed to terminate client stream: %v", cerr) + } + if err == io.EOF { + return stream, metadata, nil } return nil, metadata, err } diff --git a/examples/integration_test.go b/examples/integration_test.go index 2d345540cfe..ba011497b6a 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -1,6 +1,7 @@ package main import ( + "bytes" "encoding/json" "fmt" "io" @@ -9,6 +10,7 @@ import ( "reflect" "strconv" "strings" + "sync" "testing" "time" @@ -152,6 +154,8 @@ func TestABE(t *testing.T) { testABELookup(t) testABELookupNotFound(t) testABEList(t) + testABEBulkEcho(t) + testABEBulkEchoZeroLength(t) testAdditionalBindings(t) } @@ -527,6 +531,116 @@ func testABEList(t *testing.T) { } } +func testABEBulkEcho(t *testing.T) { + reqr, reqw := io.Pipe() + var wg sync.WaitGroup + var want []*sub.StringMessage + wg.Add(1) + go func() { + defer wg.Done() + defer reqw.Close() + var m jsonpb.Marshaler + for i := 0; i < 1000; i++ { + msg := sub.StringMessage{Value: proto.String(fmt.Sprintf("message %d", i))} + buf, err := m.MarshalToString(&msg) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success", &msg, err) + return + } + if _, err := fmt.Fprintln(reqw, buf); err != nil { + t.Errorf("fmt.Fprintln(reqw, %q) failed with %v; want success", buf, err) + return + } + want = append(want, &msg) + } + }() + + url := "http://localhost:8080/v1/example/a_bit_of_everything/echo" + req, err := http.NewRequest("POST", url, reqr) + if err != nil { + t.Errorf("http.NewRequest(%q, %q, reqr) failed with %v; want success", "POST", url, err) + return + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Transfer-Encoding", "chunked") + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Errorf("http.Post(%q, %q, req) failed with %v; want success", url, "application/json", err) + return + } + defer resp.Body.Close() + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + } + + var got []*sub.StringMessage + wg.Add(1) + go func() { + defer wg.Done() + + dec := json.NewDecoder(resp.Body) + for i := 0; ; i++ { + var item struct { + Result json.RawMessage `json:"result"` + Error map[string]interface{} `json:"error"` + } + err := dec.Decode(&item) + if err == io.EOF { + break + } + if err != nil { + t.Errorf("dec.Decode(&item) failed with %v; want success; i = %d", err, i) + } + if len(item.Error) != 0 { + t.Errorf("item.Error = %#v; want empty; i = %d", item.Error, i) + continue + } + var msg sub.StringMessage + if err := jsonpb.UnmarshalString(string(item.Result), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%q, &msg) failed with %v; want success", item.Result, err) + } + got = append(got, &msg) + } + }() + + wg.Wait() + if !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v", got, want) + } +} + +func testABEBulkEchoZeroLength(t *testing.T) { + url := "http://localhost:8080/v1/example/a_bit_of_everything/echo" + req, err := http.NewRequest("POST", url, bytes.NewReader(nil)) + if err != nil { + t.Errorf("http.NewRequest(%q, %q, bytes.NewReader(nil)) failed with %v; want success", "POST", url, err) + return + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Transfer-Encoding", "chunked") + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Errorf("http.Post(%q, %q, req) failed with %v; want success", url, "application/json", err) + return + } + defer resp.Body.Close() + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + } + + dec := json.NewDecoder(resp.Body) + var item struct { + Result json.RawMessage `json:"result"` + Error map[string]interface{} `json:"error"` + } + if err := dec.Decode(&item); err == nil { + t.Errorf("dec.Decode(&item) succeeded; want io.EOF; item = %#v", item) + } else if err != io.EOF { + t.Errorf("dec.Decode(&item) failed with %v; want success", err) + return + } +} + func testAdditionalBindings(t *testing.T) { for i, f := range []func() *http.Response{ func() *http.Response { diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index a5781dd7689..3c3da539b95 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -262,8 +262,11 @@ var ( return nil } if err := handleSend(); err != nil { - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) + if cerr := stream.CloseSend(); cerr != nil { + grpclog.Printf("Failed to terminate client stream: %v", cerr) + } + if err == io.EOF { + return stream, metadata, nil } return nil, metadata, err } From d3e7af739d71f10dfa7f7653bdbd7ea80cbce292 Mon Sep 17 00:00:00 2001 From: Srinivasan Venkatachary Date: Wed, 3 Aug 2016 22:40:19 -0700 Subject: [PATCH 070/552] Allowing unknown fields to be dropped instead of returning error from grpc gateway --- runtime/marshal_jsonpb.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index 9a42191119a..9bcce983e11 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -111,7 +111,8 @@ func decodeJSONPb(d *json.Decoder, v interface{}) error { if !ok { return decodeNonProtoField(d, v) } - return jsonpb.UnmarshalNext(d, p) + unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: true} + return unmarshaler.UnmarshalNext(d, p) } func decodeNonProtoField(d *json.Decoder, v interface{}) error { From 90e2d72ea20bb0709f773053215063beb671f50c Mon Sep 17 00:00:00 2001 From: Srinivasan Venkatachary Date: Thu, 4 Aug 2016 07:57:22 -0700 Subject: [PATCH 071/552] Allowing unknown fields in json unmarshal --- runtime/marshal_jsonpb.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index 9bcce983e11..49f13f7fc74 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -125,7 +125,8 @@ func decodeNonProtoField(d *json.Decoder, v interface{}) error { rv.Set(reflect.New(rv.Type().Elem())) } if rv.Type().ConvertibleTo(typeProtoMessage) { - return jsonpb.UnmarshalNext(d, rv.Interface().(proto.Message)) + unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: true} + return unmarshaler.UnmarshalNext(d, rv.Interface().(proto.Message)) } rv = rv.Elem() } From 1f50d11093fe97e4d34bf3b7297a13d4abec1e92 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 16 Aug 2016 15:07:21 +0900 Subject: [PATCH 072/552] Add contribution guideline (#210) --- CONTRIBUTING.md | 20 ++++++++++++++++++++ README.md | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000000..dbf0132094b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,20 @@ +# How to contribute + +Thank you for your contribution to grpc-gateway. +Here's the recommended process of contribution. + +1. `go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway` +2. `cd $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway` +3. hack, hack, hack... +4. Make sure that your change follows best practices in Go + * [Effective Go](https://golang.org/doc/effective_go.html) + * [Go Code Review Comments](https://golang.org/wiki/CodeReviewComments) +5. Make sure that `make test` passes. +6. Sign [a Contributor License Agreement](https://cla.developers.google.com/clas) +7. Open a pull request in Github + +When you work on a larger contribution, it is also recommended that you get in touch +with us through the issue tracker. + +### Code reviews +All submissions, including submissions by project members, require review. diff --git a/README.md b/README.md index 8701c15034f..60b5abdbc97 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,9 @@ But patch is welcome. * Encoding request/response body in XML * True bi-directional streaming. (Probably impossible?) +# Contribution +See [CONTRIBUTING.md](http://github.com/grpc-ecosystem/grpc-gateway/blob/master/CONTRIBUTING.md). + # License grpc-gateway is licensed under the BSD 3-Clause License. See [LICENSE.txt](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt) for more details. From ac8622eeceb28d0e689488a3b87268d9a35f10b1 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 16 Aug 2016 15:58:30 +0900 Subject: [PATCH 073/552] Use a released version of protoc --- .travis.yml | 2 +- .travis/build-protoc.sh | 23 ----------------------- .travis/install-protoc.sh | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 24 deletions(-) delete mode 100755 .travis/build-protoc.sh create mode 100755 .travis/install-protoc.sh diff --git a/.travis.yml b/.travis.yml index 9d3b2a30eb4..fc690dbea8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ cache: - $HOME/local - ${TRAVIS_BUILD_DIR}/examples/browser/node_modules before_install: -- ./.travis/build-protoc.sh 3.0.0-beta-3 +- ./.travis/install-protoc.sh 3.0.0 - ./.travis/install-swagger-codegen.sh 2.1.6 - nvm install v6.1 && nvm use v6.1 && node --version - go get github.com/golang/lint/golint diff --git a/.travis/build-protoc.sh b/.travis/build-protoc.sh deleted file mode 100755 index 0dc92a8e2a7..00000000000 --- a/.travis/build-protoc.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -eu -protoc_version=$1 -if test -z "${protoc_version}"; then - echo "Usage: .travis/build-protoc.sh protoc-version" - exit 1 -fi -if ! $HOME/local/bin/protoc-${protoc_version} --version 2>/dev/null; then - rm -rf $HOME/local - - mkdir -p $HOME/tmp - cd $HOME/tmp - wget https://github.com/google/protobuf/archive/v${protoc_version}.tar.gz - tar xvzf v${protoc_version}.tar.gz - cd protobuf-${protoc_version} - ./autogen.sh - ./configure --prefix=$HOME/local --program-suffix=-${protoc_version} - make -j 4 - make install -fi -ln -sf $HOME/local/bin/protoc-${protoc_version} $HOME/local/bin/protoc - -echo \$ $HOME/local/bin/protoc --version -$HOME/local/bin/protoc --version diff --git a/.travis/install-protoc.sh b/.travis/install-protoc.sh new file mode 100755 index 00000000000..d96c259272a --- /dev/null +++ b/.travis/install-protoc.sh @@ -0,0 +1,19 @@ +#!/bin/sh -eu +protoc_version=$1 +if test -z "${protoc_version}"; then + echo "Usage: .travis/install-protoc.sh protoc-version" + exit 1 +fi +if [ "`$HOME/local/bin/protoc-${protoc_version} --version 2>/dev/null | cut -d' ' -f 2`" != ${protoc_version} ]; then + rm -rf $HOME/local/bin $HOME/local/include + + mkdir -p $HOME/tmp $HOME/local + cd $HOME/tmp + wget https://github.com/google/protobuf/releases/download/v${protoc_version}/protoc-${protoc_version}-linux-x86_64.zip + unzip protoc-${protoc_version}-linux-x86_64.zip + mv bin $HOME/local/bin + mv include $HOME/local/include +fi + +echo \$ $HOME/local/bin/protoc --version +$HOME/local/bin/protoc --version From a2d6e1adc35e8c031ff65151fb79cc0d8b4018c7 Mon Sep 17 00:00:00 2001 From: EranAvidor Date: Thu, 4 Aug 2016 10:14:16 +0300 Subject: [PATCH 074/552] improve(genswagger:template):added support for google.protobuf.Timestamp --- protoc-gen-swagger/genswagger/template.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index e2bd125bda7..d33aba5de98 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -50,7 +50,11 @@ func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descrip } func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { - for _, msg := range messages { + for name, msg := range messages { + switch name { + case ".google.protobuf.Timestamp": + continue + } if opt := msg.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { continue } @@ -105,8 +109,15 @@ func schemaOfField(f *descriptor.Field, reg *descriptor.Registry) swaggerSchemaO switch ft := fd.GetType(); ft { case pbdescriptor.FieldDescriptorProto_TYPE_ENUM, pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE, pbdescriptor.FieldDescriptorProto_TYPE_GROUP: - core = schemaCore{ - Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(fd.GetTypeName(), reg), + if fd.GetTypeName() == ".google.protobuf.Timestamp" && pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE == ft { + core = schemaCore{ + Type: "string", + Format: "date-time", + } + } else { + core = schemaCore{ + Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(fd.GetTypeName(), reg), + } } default: ftype, format, ok := primitiveSchema(ft) From c50ea33f0881c317b4d1bea243a822ca88c84d5c Mon Sep 17 00:00:00 2001 From: EranAvidor Date: Sat, 6 Aug 2016 12:21:23 +0300 Subject: [PATCH 075/552] improve(examplepb):added example for google.protobuf.Timestamp usage --- .../clients/abe/ExamplepbABitOfEverything.go | 2 + examples/examplepb/a_bit_of_everything.pb.go | 155 ++++++++++-------- examples/examplepb/a_bit_of_everything.proto | 3 + .../a_bit_of_everything.swagger.json | 4 + 4 files changed, 92 insertions(+), 72 deletions(-) diff --git a/examples/clients/abe/ExamplepbABitOfEverything.go b/examples/clients/abe/ExamplepbABitOfEverything.go index 25084255678..2ca345dcc08 100644 --- a/examples/clients/abe/ExamplepbABitOfEverything.go +++ b/examples/clients/abe/ExamplepbABitOfEverything.go @@ -1,6 +1,7 @@ package abe import ( + "time" ) type ExamplepbABitOfEverything struct { @@ -26,6 +27,7 @@ type ExamplepbABitOfEverything struct { Sint32Value int32 `json:"sint32_value,omitempty"` Sint64Value string `json:"sint64_value,omitempty"` StringValue string `json:"string_value,omitempty"` + TimestampValue time.Time `json:"timestamp_value,omitempty"` Uint32Value int64 `json:"uint32_value,omitempty"` Uint64Value string `json:"uint64_value,omitempty"` Uuid string `json:"uuid,omitempty"` diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 3b919655a4c..86985a3f5a4 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -11,6 +11,7 @@ import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/a import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" import sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" +import google_protobuf2 "github.com/golang/protobuf/ptypes/timestamp" import ( context "golang.org/x/net/context" @@ -103,6 +104,7 @@ type ABitOfEverything struct { MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue" json:"nonConventionalNameValue,omitempty"` + TimestampValue *google_protobuf2.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` } func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } @@ -180,6 +182,13 @@ func (m *ABitOfEverything) GetMappedNestedValue() map[string]*ABitOfEverything_N return nil } +func (m *ABitOfEverything) GetTimestampValue() *google_protobuf2.Timestamp { + if m != nil { + return m.TimestampValue + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*ABitOfEverything) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _ABitOfEverything_OneofMarshaler, _ABitOfEverything_OneofUnmarshaler, _ABitOfEverything_OneofSizer, []interface{}{ @@ -576,77 +585,79 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1144 bytes of a gzipped FileDescriptorProto + // 1175 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0x4d, 0x4f, 0x1b, 0x47, - 0x18, 0xce, 0xda, 0x60, 0xf0, 0xbb, 0x18, 0xcc, 0x10, 0x88, 0xe3, 0xb4, 0x82, 0xba, 0x1f, 0x42, - 0x14, 0xed, 0x0a, 0x13, 0x55, 0x09, 0x52, 0x15, 0x41, 0x70, 0x95, 0xaa, 0x09, 0xa4, 0x4b, 0x92, - 0x03, 0x6a, 0x64, 0xad, 0xf1, 0x60, 0x56, 0x78, 0x77, 0x56, 0xfb, 0xe1, 0x62, 0x51, 0x7a, 0xe8, - 0xa1, 0x7f, 0xa0, 0x87, 0x9e, 0x9a, 0x4b, 0xa5, 0xaa, 0x97, 0x1e, 0x7b, 0xee, 0x8f, 0xe8, 0x5f, - 0xe8, 0x0f, 0xe9, 0xbb, 0x33, 0xbb, 0xcb, 0xac, 0xc1, 0x32, 0x1f, 0x52, 0x4e, 0xde, 0x99, 0x79, - 0xde, 0xe7, 0x79, 0x3f, 0xf6, 0x7d, 0x67, 0x0d, 0xab, 0xf4, 0xc4, 0xb4, 0xdd, 0x2e, 0xf5, 0xf5, - 0xf8, 0xc1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37, 0xd1, 0x0e, 0xf9, 0x08, 0xa6, 0xda, 0x2c, 0x6c, 0x61, 0x94, - 0x02, 0x31, 0x86, 0x08, 0xc5, 0x50, 0xc5, 0x9e, 0x80, 0x20, 0x87, 0xe5, 0x04, 0x5f, 0x3c, 0x8c, - 0x11, 0xe3, 0x88, 0xc8, 0x1b, 0xc0, 0xb7, 0x52, 0x8e, 0x50, 0x46, 0x14, 0x10, 0x31, 0x66, 0xa8, - 0xa1, 0x04, 0x11, 0x1c, 0xeb, 0xf5, 0x18, 0x31, 0x81, 0x88, 0x71, 0xce, 0xb1, 0x5e, 0x17, 0x80, - 0x8f, 0xa1, 0x74, 0x68, 0x9d, 0xd0, 0x76, 0x4a, 0x32, 0x89, 0x90, 0x82, 0x31, 0x15, 0x6f, 0x66, - 0x41, 0x29, 0x4f, 0x11, 0x41, 0x13, 0x31, 0x28, 0x61, 0xfa, 0x10, 0xa0, 0xc5, 0x58, 0x37, 0x46, - 0x00, 0x22, 0x26, 0x8d, 0x62, 0xb4, 0x93, 0x3a, 0xeb, 0x07, 0x1e, 0xa6, 0x2a, 0x06, 0xa8, 0x3c, - 0xff, 0xaa, 0xd8, 0xcb, 0xc4, 0x93, 0xaa, 0x94, 0x10, 0x52, 0x12, 0xf1, 0x24, 0x22, 0xdf, 0x00, - 0x50, 0x27, 0xb4, 0x63, 0xc0, 0x34, 0x02, 0xa6, 0xeb, 0xab, 0x23, 0xab, 0xb5, 0x13, 0xda, 0xd4, - 0xb3, 0x0e, 0x1a, 0x68, 0x69, 0x14, 0x23, 0x7b, 0x41, 0xf6, 0x29, 0x4c, 0xfb, 0xd9, 0xb8, 0x66, - 0x90, 0x70, 0xc6, 0x28, 0xf9, 0x99, 0xc0, 0x52, 0x58, 0x9a, 0xa3, 0x32, 0xc2, 0xca, 0x09, 0x4c, - 0xaa, 0x86, 0x2f, 0x7b, 0x3f, 0x8b, 0xa0, 0x59, 0x0c, 0x50, 0xf2, 0x3e, 0x86, 0xa4, 0x3c, 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08, 0x81, 0xb1, 0x20, 0xb0, 0x5a, 0xe5, 0x14, 0xb2, 0xe6, 0x0c, 0xfe, 0x4d, + 0x5e, 0x42, 0x56, 0x6a, 0xa5, 0x97, 0x32, 0x77, 0xd2, 0x92, 0x3c, 0x64, 0x11, 0xf2, 0x47, 0x1d, + 0x66, 0xfa, 0x8d, 0x9e, 0xd9, 0x09, 0x68, 0x39, 0x83, 0x62, 0x69, 0x03, 0xf8, 0xd4, 0x9b, 0x70, + 0x86, 0x7c, 0x04, 0x53, 0x2d, 0x16, 0x34, 0x31, 0x4a, 0x81, 0x18, 0x43, 0x44, 0xca, 0xc8, 0x8b, + 0x39, 0x01, 0x41, 0x0e, 0xcb, 0xf6, 0xbf, 0x78, 0x24, 0x11, 0xe3, 0x88, 0xc8, 0x18, 0xc0, 0xa7, + 0x62, 0x8e, 0x40, 0x45, 0x64, 0x11, 0x31, 0x66, 0xe4, 0x03, 0x05, 0x22, 0x38, 0xd6, 0x6b, 0x12, + 0x31, 0x81, 0x88, 0x71, 0xce, 0xb1, 0x5e, 0x13, 0x80, 0x8f, 0xa1, 0x70, 0x64, 0x9d, 0xd2, 0x56, + 0x4c, 0x32, 0x89, 0x90, 0xac, 0x31, 0x25, 0x27, 0x93, 0xa0, 0x98, 0x27, 0x87, 0xa0, 0x09, 0x09, + 0x8a, 0x98, 0x3e, 0x04, 0x68, 0x32, 0xd6, 0x91, 0x08, 0x40, 0xc4, 0xa4, 0x91, 0x0b, 0x67, 0x62, + 0x67, 0x3d, 0xdf, 0xc5, 0x54, 0x49, 0x40, 0x9e, 0xe7, 0x3f, 0x2f, 0xe6, 0x12, 0xf1, 0xc4, 0x2a, + 0x05, 0x84, 0x14, 0x44, 0x3c, 0x91, 0xc8, 0x37, 0x00, 0xd4, 0x0e, 0xba, 0x12, 0x50, 0x44, 0x40, + 0xb1, 0xb6, 0x3a, 0xb2, 0x5a, 0xbb, 0x41, 0x97, 0xba, 0xd6, 0x61, 0x1d, 0x2d, 0x8d, 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 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 05843baeeef..85b44edfe42 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -6,6 +6,7 @@ import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "examples/sub/message.proto"; import "examples/sub2/message.proto"; +import "google/protobuf/timestamp.proto"; // Intentionaly complicated message type to cover much features of Protobuf. // NEXT ID: 27 @@ -55,6 +56,8 @@ message ABitOfEverything { map mapped_nested_value = 24; string nonConventionalNameValue = 26; + + google.protobuf.Timestamp timestamp_value = 27; } // NumericEnum is one or zero. diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index e52f7c70e8b..840c0ddde03 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -486,6 +486,10 @@ "type": "string", "format": "string" }, + "timestamp_value": { + "type": "string", + "format": "date-time" + }, "uint32_value": { "type": "integer", "format": "int64", From c645fde0312604106b0c6a2f0e41b4b3bd00f0df Mon Sep 17 00:00:00 2001 From: Stephen Demos Date: Wed, 7 Sep 2016 15:09:18 -0400 Subject: [PATCH 076/552] readme: added links to additional documentation This commit adds links to the google cloud platform's documentation on the custom options used by grpc-gateway to generate your http proxy. This documentation has information about how path, query, and body parameters are handled, as well as specific assumptions about the arguments present for different http methods. Fixes #212 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 60b5abdbc97..7677c7018e1 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ grpc-gateway is a plugin of [protoc](http://github.com/google/protobuf). It reads [gRPC](http://github.com/grpc/grpc-common) service definition, and generates a reverse-proxy server which translates a RESTful JSON API into gRPC. +This server is generated according to [custom options](https://cloud.google.com/service-management/reference/rpc/google.api#http) in your gRPC definition. It helps you to provide your APIs in both gRPC and RESTful style at the same time. @@ -60,7 +61,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. rpc Echo(StringMessage) returns (StringMessage) {} } ``` -2. Add a custom option to the .proto file +2. Add a [custom option](https://cloud.google.com/service-management/reference/rpc/google.api#http) to the .proto file your_service.proto: ```diff From 3bbdad732547b88e8a39603a86c0c72c21392e85 Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Tue, 4 Oct 2016 02:02:50 -0700 Subject: [PATCH 077/552] Docs - Add section about how HTTP maps to gRPC (#227) * Docs - Add section about how HTTP maps to gRPC * README - Incorporate code review feedback Feedback from @achew22 for github.com/grpc-ecosystem/grpc-gateway#227 --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 7677c7018e1..20b68161555 100644 --- a/README.md +++ b/README.md @@ -220,6 +220,14 @@ But patch is welcome. * Encoding request/response body in XML * True bi-directional streaming. (Probably impossible?) +# Mapping gRPC to HTTP + +* [How gRPC error codes map to HTTP status codes in the response](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15) +* HTTP request source IP is added as `X-Forwarded-For` gRPC request header +* HTTP request host is added as `X-Forwarded-Host` gRPC request header +* HTTP `Authorization` header is added as `authorization` gRPC request header +* Remaining HTTP header keys are prefixed with `Grpc-Metadata-` and added with their values to gRPC request header + # Contribution See [CONTRIBUTING.md](http://github.com/grpc-ecosystem/grpc-gateway/blob/master/CONTRIBUTING.md). From 525bf796014ff27c44e6d8431a97a5af087c5f94 Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Wed, 12 Oct 2016 22:12:12 -0700 Subject: [PATCH 078/552] README - Add CoreOS example (#231) Show users how to combine these different projects in a unified way, e.g. how to serve the generated `swagger.json` on the API Closes #230 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 20b68161555..718047f3234 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,8 @@ More examples are available under `examples` directory. * `server/main.go`: service implementation * `main.go`: entrypoint of the generated reverse proxy +To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRPC-gateway, and a gRPC server, see [this code example by CoreOS](https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go) (and its accompanying [blog post](https://coreos.com/blog/gRPC-protobufs-swagger.html)) + ## Features ### Supported * Generating JSON API handlers From ff2d574620d6caab0c735487d9942a1c234d16fe Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Thu, 20 Oct 2016 22:32:21 -0700 Subject: [PATCH 079/552] runtime - export prefix constants (#236) --- runtime/context.go | 12 ++++++++---- runtime/handler.go | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/runtime/context.go b/runtime/context.go index ad42535662a..f248c738b23 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -15,8 +15,12 @@ import ( "google.golang.org/grpc/metadata" ) -const metadataHeaderPrefix = "Grpc-Metadata-" -const metadataTrailerPrefix = "Grpc-Trailer-" +// MetadataHeaderPrefix is prepended to HTTP headers in order to convert them to +// gRPC metadata for incoming requests processed by grpc-gateway +const MetadataHeaderPrefix = "Grpc-Metadata-" +// MetadataTrailerPrefix is prepended to gRPC metadata as it is converted to +// HTTP headers in a response handled by grpc-gateway +const MetadataTrailerPrefix = "Grpc-Trailer-" const metadataGrpcTimeout = "Grpc-Timeout" const xForwardedFor = "X-Forwarded-For" @@ -52,8 +56,8 @@ func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, e pairs = append(pairs, "authorization", val) continue } - if strings.HasPrefix(key, metadataHeaderPrefix) { - pairs = append(pairs, key[len(metadataHeaderPrefix):], val) + if strings.HasPrefix(key, MetadataHeaderPrefix) { + pairs = append(pairs, key[len(MetadataHeaderPrefix):], val) } } } diff --git a/runtime/handler.go b/runtime/handler.go index bafa4285f91..d7040851ae9 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -67,7 +67,7 @@ func ForwardResponseStream(ctx context.Context, marshaler Marshaler, w http.Resp func handleForwardResponseServerMetadata(w http.ResponseWriter, md ServerMetadata) { for k, vs := range md.HeaderMD { - hKey := fmt.Sprintf("%s%s", metadataHeaderPrefix, k) + hKey := fmt.Sprintf("%s%s", MetadataHeaderPrefix, k) for i := range vs { w.Header().Add(hKey, vs[i]) } @@ -76,14 +76,14 @@ func handleForwardResponseServerMetadata(w http.ResponseWriter, md ServerMetadat func handleForwardResponseTrailerHeader(w http.ResponseWriter, md ServerMetadata) { for k := range md.TrailerMD { - tKey := textproto.CanonicalMIMEHeaderKey(fmt.Sprintf("%s%s", metadataTrailerPrefix, k)) + tKey := textproto.CanonicalMIMEHeaderKey(fmt.Sprintf("%s%s", MetadataTrailerPrefix, k)) w.Header().Add("Trailer", tKey) } } func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) { for k, vs := range md.TrailerMD { - tKey := fmt.Sprintf("%s%s", metadataTrailerPrefix, k) + tKey := fmt.Sprintf("%s%s", MetadataTrailerPrefix, k) for i := range vs { w.Header().Add(tKey, vs[i]) } From 50dd35eec7a214f3fa27fa5cdf6222863eb1914c Mon Sep 17 00:00:00 2001 From: Nathan Borror Date: Mon, 24 Oct 2016 21:45:27 -0700 Subject: [PATCH 080/552] Error output should have lowercase attribute names (#244) Adding protobuf tags to `errorBody` to get proper lowercased output when marshaled. --- runtime/errors.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/errors.go b/runtime/errors.go index 7d7a9b22415..0d3cb3bf3ca 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -63,8 +63,8 @@ var ( ) type errorBody struct { - Error string `json:"error"` - Code int `json:"code"` + Error string `protobuf:"bytes,1,name=error" json:"error"` + Code int `protobuf:"bytes,2,name=code" json:"code"` } //Make this also conform to proto.Message for builtin JSONPb Marshaler From cb8ada91d8100188a14136ea70e4e79f97619285 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Thu, 3 Nov 2016 18:12:30 -0700 Subject: [PATCH 081/552] regenerate examples --- .travis.yml | 2 +- examples/examplepb/a_bit_of_everything.pb.go | 155 +++++++++--------- examples/examplepb/echo_service.pb.go | 22 +-- examples/examplepb/flow_combination.pb.go | 88 +++++----- examples/examplepb/stream.pb.go | 42 ++--- examples/sub/message.pb.go | 10 +- runtime/internal/stream_chunk.pb.go | 26 +-- .../googleapis/google/api/annotations.pb.go | 20 +-- third_party/googleapis/google/api/http.pb.go | 38 ++--- 9 files changed, 202 insertions(+), 201 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc690dbea8f..33032f1292b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ cache: - $HOME/local - ${TRAVIS_BUILD_DIR}/examples/browser/node_modules before_install: -- ./.travis/install-protoc.sh 3.0.0 +- ./.travis/install-protoc.sh 3.1.0 - ./.travis/install-swagger-codegen.sh 2.1.6 - nvm install v6.1 && nvm use v6.1 && node --version - go get github.com/golang/lint/golint diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 86985a3f5a4..4a3548496ee 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -285,7 +285,7 @@ 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.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for ABitOfEverythingService service @@ -579,85 +579,86 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: fileDescriptor1, + Metadata: "examples/examplepb/a_bit_of_everything.proto", } func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1175 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0x4d, 0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x3c, 0xb3, 0x4d, 0x23, 0x43, 0x75, 0xad, 0x36, 0xb0, 0xb8, 0x38, 0xc8, 0xea, 0x5b, - 0x08, 0xf0, 0xd1, 0x40, 0x00, 0xaa, 0xff, 0x16, 0xa1, 0xb4, 0xb9, 0x65, 0xf9, 0x7b, 0x47, 0xf5, - 0x38, 0x20, 0xf2, 0x16, 0x0a, 0x1e, 0xfe, 0x76, 0x68, 0xc3, 0x46, 0x30, 0x6d, 0x95, 0x1f, 0x2e, - 0xa5, 0x96, 0xf3, 0xb5, 0xc7, 0xda, 0x88, 0x10, 0xb5, 0x41, 0x26, 0x6d, 0x97, 0xdb, 0x1b, 0x53, - 0x82, 0x4e, 0x8c, 0x08, 0x81, 0xb1, 0x20, 0xb0, 0x5a, 0xe5, 0x14, 0xb2, 0xe6, 0x0c, 0xfe, 0x4d, - 0x5e, 0x42, 0x56, 0x6a, 0xa5, 0x97, 0x32, 0x77, 0xd2, 0x92, 0x3c, 0x64, 0x11, 0xf2, 0x47, 0x1d, - 0x66, 0xfa, 0x8d, 0x9e, 0xd9, 0x09, 0x68, 0x39, 0x83, 0x62, 0x69, 0x03, 0xf8, 0xd4, 0x9b, 0x70, - 0x86, 0x7c, 0x04, 0x53, 0x2d, 0x16, 0x34, 0x31, 0x4a, 0x81, 0x18, 0x43, 0x44, 0xca, 0xc8, 0x8b, - 0x39, 0x01, 0x41, 0x0e, 0xcb, 0xf6, 0xbf, 0x78, 0x24, 0x11, 0xe3, 0x88, 0xc8, 0x18, 0xc0, 0xa7, - 0x62, 0x8e, 0x40, 0x45, 0x64, 0x11, 0x31, 0x66, 0xe4, 0x03, 0x05, 0x22, 0x38, 0xd6, 0x6b, 0x12, - 0x31, 0x81, 0x88, 0x71, 0xce, 0xb1, 0x5e, 0x13, 0x80, 0x8f, 0xa1, 0x70, 0x64, 0x9d, 0xd2, 0x56, - 0x4c, 0x32, 0x89, 0x90, 0xac, 0x31, 0x25, 0x27, 0x93, 0xa0, 0x98, 0x27, 0x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3, 0x9d, 0x9f, 0xf2, 0xd8, 0x9e, 0x54, 0x1f, 0x8d, 0x4c, 0x74, - 0xe2, 0x9f, 0x89, 0x16, 0xde, 0x95, 0xbc, 0xb8, 0x6f, 0x60, 0x22, 0xbc, 0x6b, 0x59, 0xe0, 0x93, - 0x21, 0xc5, 0x1c, 0x5a, 0xe4, 0x05, 0xae, 0x3d, 0x47, 0x66, 0xd5, 0x64, 0xf8, 0x82, 0x6c, 0x2b, - 0x7f, 0x90, 0x8b, 0xdd, 0x6e, 0x66, 0xb9, 0xe5, 0xfa, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdb, - 0xf3, 0x9f, 0xf3, 0x1a, 0x0e, 0x00, 0x00, + // 1198 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0xcb, 0x6e, 0xdb, 0x46, + 0x17, 0xf6, 0x48, 0xb6, 0x6c, 0x1d, 0x5a, 0xb2, 0x3c, 0x8e, 0x1d, 0x45, 0xfe, 0x7f, 0x88, 0x55, + 0xda, 0x82, 0x70, 0x0d, 0x12, 0x96, 0x83, 0x22, 0x31, 0x50, 0x04, 0xbe, 0xa8, 0x70, 0xd1, 0xc4, + 0x4e, 0xe9, 0x24, 0x0b, 0xa3, 0x81, 0x40, 0x49, 0x23, 0x99, 0xb0, 0xc8, 0x21, 0xc8, 0xa1, 0x6a, + 0x41, 0x55, 0x17, 0x5d, 0xf4, 0x05, 0xba, 0xe8, 0x2e, 0x9b, 0x02, 0x45, 0x37, 0x5d, 0x76, 0xdd, + 0x87, 0xe8, 0x1b, 0x14, 0x7d, 0x90, 0x82, 0x33, 0x24, 0x4d, 0xc9, 0x16, 0xe4, 0x0b, 0x90, 0x9d, + 0x66, 0xe6, 0x3b, 0xdf, 0x77, 0x2e, 0x73, 0xce, 0x50, 0xb0, 0x49, 0x2e, 0x0c, 0xcb, 0xe9, 0x12, + 0x4f, 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, 0x62, 0x5a, 0x46, 0x4a, 0x4a, 0x07, 0xbe, + 0xf5, 0x36, 0xd8, 0xc1, 0x1f, 0xc1, 0x62, 0x8b, 0xfa, 0x8d, 0x2e, 0x09, 0x11, 0xb3, 0x32, 0x52, + 0x90, 0x2e, 0x89, 0x3d, 0x01, 0x29, 0x83, 0x64, 0xda, 0xec, 0xf3, 0x27, 0x21, 0x62, 0x4e, 0x46, + 0x4a, 0x5a, 0x07, 0xbe, 0x15, 0x73, 0xf8, 0x49, 0x44, 0x46, 0x46, 0xca, 0xac, 0x2e, 0xf9, 0x09, + 0x88, 0xe0, 0xd8, 0xae, 0x86, 0x88, 0x79, 0x19, 0x29, 0x73, 0x9c, 0x63, 0xbb, 0x2a, 0x00, 0x8f, + 0x21, 0xd7, 0x36, 0x2f, 0x48, 0x2b, 0x26, 0x59, 0x90, 0x91, 0x92, 0xd1, 0x17, 0xc3, 0xcd, 0x51, + 0x50, 0xcc, 0x93, 0x95, 0x91, 0x32, 0x1f, 0x82, 0x22, 0xa6, 0xff, 0x03, 0x34, 0x28, 0xed, 0x86, + 0x08, 0x90, 0x91, 0xb2, 0xa0, 0x67, 0x83, 0x9d, 0xd8, 0x59, 0x8f, 0xb9, 0xa6, 0xdd, 0x09, 0x01, + 0x12, 0xcf, 0xbf, 0x24, 0xf6, 0x46, 0xe2, 0x89, 0x55, 0x72, 0x32, 0x52, 0x72, 0x22, 0x9e, 0x48, + 0xe4, 0x6b, 0x00, 0x62, 0xfb, 0x56, 0x08, 0xc8, 0xcb, 0x48, 0xc9, 0x57, 0x37, 0xa7, 0x56, 0xeb, + 0xc8, 0xb7, 0x88, 0x6b, 0x36, 0x6b, 0xb6, 0x6f, 0xe9, 0xd9, 0xc0, 0x5e, 0x90, 0x7d, 0x02, 0x79, + 0x6f, 0x34, 0xae, 0x25, 0x19, 0x29, 0x4b, 0x7a, 0xce, 0x1b, 0x09, 0x2c, 0x86, 0xc5, 0x39, 0x2a, + 0xc8, 0x48, 0x29, 0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x7f, 0x42, 0x90, 0x79, 0xe3, 0xb4, 0xee, 0x78, 0x7f, 0x27, 0x3c, 0xa2, 0x95, + 0x2d, 0xee, 0xc5, 0x67, 0xa5, 0x1b, 0x7a, 0x11, 0xa4, 0xc1, 0x80, 0xcc, 0x01, 0xe9, 0x12, 0x46, + 0xae, 0xa6, 0x61, 0x92, 0x4a, 0x18, 0xeb, 0xc6, 0x4d, 0x63, 0xfd, 0x0b, 0xc1, 0x6c, 0xad, 0x79, + 0x46, 0xb1, 0x32, 0x21, 0x52, 0xcf, 0x6f, 0xa8, 0x62, 0xb4, 0x45, 0xd2, 0x37, 0x46, 0x56, 0x9a, + 0xdc, 0x99, 0x77, 0x78, 0x73, 0x9a, 0x33, 0xa4, 0x79, 0x46, 0xb5, 0x81, 0xb8, 0xb8, 0xa7, 0x8f, + 0x2a, 0x05, 0xad, 0x57, 0x8d, 0xf1, 0xc1, 0xd9, 0x8e, 0x18, 0x55, 0xa7, 0x18, 0x5f, 0x39, 0xc2, + 0x7f, 0x22, 0x58, 0x0c, 0x5e, 0x83, 0x57, 0x06, 0x3b, 0xe3, 0x91, 0x7c, 0x98, 0xeb, 0xfc, 0x9c, + 0xc7, 0xf6, 0xac, 0xf2, 0x64, 0x6a, 0xa2, 0x47, 0xfe, 0x99, 0xa8, 0xc1, 0x5b, 0xc9, 0x8b, 0xfb, + 0x16, 0xe6, 0x83, 0xb7, 0x96, 0xfa, 0x0c, 0x4f, 0x28, 0xe6, 0xc4, 0x22, 0xaf, 0x73, 0xed, 0x55, + 0xbc, 0x92, 0x4c, 0x06, 0x13, 0x64, 0x7b, 0xd2, 0x69, 0x36, 0x76, 0xbb, 0x91, 0xe1, 0x96, 0xdb, + 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xf3, 0x9f, 0xf3, 0x1a, 0x0e, 0x00, 0x00, } diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index fa882fb5196..756fe4c8d98 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -69,7 +69,7 @@ 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.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for EchoService service @@ -175,13 +175,13 @@ var _EchoService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: fileDescriptor0, + Metadata: "examples/examplepb/echo_service.proto", } func init() { proto.RegisterFile("examples/examplepb/echo_service.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 226 bytes of a gzipped FileDescriptorProto + // 229 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x87, 0x32, 0x0a, 0x92, 0xf4, 0x53, 0x93, 0x33, 0xf2, 0xe3, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xe4, 0xd3, 0x8b, @@ -189,12 +189,12 @@ var fileDescriptor0 = []byte{ 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, 0xda, 0x95, 0xe4, 0xb9, 0x78, 0x83, 0x33, 0x41, 0x2a, 0x7d, 0x53, 0x8b, 0x8b, 0x13, 0xd3, 0x53, 0x85, 0xf8, 0xb8, 0x98, 0x32, 0x53, 0x24, - 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x80, 0x2c, 0xa3, 0x25, 0x4c, 0x5c, 0xdc, 0xae, 0x40, 0x6b, - 0x83, 0x21, 0xb6, 0x0a, 0xb5, 0x32, 0x72, 0xb1, 0x80, 0xf8, 0x42, 0x7a, 0x7a, 0x04, 0x6c, 0xd6, - 0x43, 0x31, 0x58, 0x8a, 0x44, 0xf5, 0x4a, 0xb2, 0x4d, 0x97, 0x9f, 0x4c, 0x66, 0x12, 0x57, 0x12, - 0xd5, 0x2f, 0x33, 0x84, 0x05, 0x01, 0x38, 0x00, 0xf4, 0xab, 0x33, 0x53, 0x6a, 0x85, 0x7a, 0x18, - 0xb9, 0x38, 0x40, 0xee, 0x70, 0xca, 0x4f, 0xa9, 0xa4, 0xb9, 0x5b, 0x14, 0xc0, 0x6e, 0x91, 0xc2, - 0x74, 0x4b, 0x7c, 0x12, 0xd0, 0x7a, 0x2b, 0x46, 0x2d, 0x27, 0xee, 0x28, 0x4e, 0xb8, 0xe6, 0x24, - 0x36, 0x70, 0xd8, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x26, 0x96, 0x37, 0xac, 0xc3, 0x01, - 0x00, 0x00, + 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x98, 0x32, 0x53, 0x8c, 0x96, 0x30, 0x71, 0x71, 0xbb, 0x26, + 0x67, 0xe4, 0x07, 0x43, 0x6c, 0x15, 0x6a, 0x65, 0xe4, 0x62, 0x01, 0xf1, 0x85, 0xf4, 0xf4, 0x08, + 0xd8, 0xac, 0x87, 0x62, 0xb0, 0x14, 0x89, 0xea, 0x95, 0x64, 0x9b, 0x2e, 0x3f, 0x99, 0xcc, 0x24, + 0xae, 0x24, 0xaa, 0x5f, 0x66, 0x08, 0x0b, 0x02, 0x70, 0x00, 0xe8, 0x57, 0x67, 0xa6, 0xd4, 0x0a, + 0xf5, 0x30, 0x72, 0x71, 0x80, 0xdc, 0xe1, 0x94, 0x9f, 0x52, 0x49, 0x73, 0xb7, 0x28, 0x80, 0xdd, + 0x22, 0x85, 0xe9, 0x96, 0xf8, 0xa4, 0xfc, 0x94, 0x4a, 0x2b, 0x46, 0x2d, 0x27, 0xee, 0x28, 0x4e, + 0xb8, 0xe6, 0x24, 0x36, 0x70, 0xd8, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x26, 0x96, 0x37, + 0xac, 0xc3, 0x01, 0x00, 0x00, } diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 0a115f5d93c..f6620070863 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -95,7 +95,7 @@ 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.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for FlowCombination service @@ -630,52 +630,52 @@ var _FlowCombination_serviceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: fileDescriptor3, + Metadata: "examples/examplepb/flow_combination.proto", } func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fileDescriptor3) } var fileDescriptor3 = []byte{ - // 652 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x6f, 0x13, 0x4d, - 0x10, 0xc6, 0xb5, 0x8e, 0xf4, 0x4a, 0x19, 0xc7, 0x89, 0x73, 0x7e, 0x65, 0x6c, 0x63, 0xe2, 0x64, - 0x89, 0x84, 0xf9, 0x77, 0x17, 0x99, 0x2a, 0x94, 0x41, 0x50, 0x5a, 0x51, 0x22, 0x9a, 0x6b, 0xd0, - 0xde, 0xf9, 0x70, 0x2c, 0xd9, 0x77, 0x97, 0xf3, 0x21, 0x13, 0x45, 0x11, 0x12, 0x0d, 0x25, 0x05, - 0x1f, 0x80, 0x92, 0x8a, 0x2f, 0x40, 0x47, 0x45, 0x83, 0x44, 0x81, 0x44, 0x47, 0x47, 0xc7, 0x97, - 0x60, 0x77, 0x76, 0xef, 0xd6, 0x07, 0x36, 0x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 0xff, 0x03, 0xba, 0xf3, 0x23, - 0x00, 0x00, 0xff, 0xff, 0xaf, 0x85, 0xaf, 0x3c, 0x6d, 0x09, 0x00, 0x00, + // 656 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x8f, 0x12, 0x4f, + 0x18, 0xc7, 0xf3, 0x70, 0xc9, 0x2f, 0xb9, 0xe1, 0xfe, 0x70, 0xcb, 0x2f, 0x08, 0x1c, 0x1e, 0x77, + 0xe3, 0x25, 0xe2, 0xbf, 0x5d, 0x82, 0xd5, 0x51, 0x9e, 0xd1, 0x92, 0x5c, 0xb8, 0xd8, 0x6c, 0x63, + 0x66, 0x87, 0x15, 0x48, 0x60, 0x67, 0x6e, 0x77, 0x0d, 0x5e, 0x08, 0x31, 0xb1, 0xb1, 0xb4, 0xf0, + 0x05, 0x58, 0x5a, 0xf9, 0x06, 0xec, 0xac, 0x6c, 0x4c, 0x2c, 0x4c, 0xec, 0xec, 0xec, 0x7c, 0x13, + 0x66, 0x67, 0x66, 0x77, 0x58, 0x05, 0x37, 0x18, 0xb1, 0xdb, 0x99, 0x79, 0x9e, 0x67, 0x3e, 0xf3, + 0x7d, 0xbe, 0x0f, 0x01, 0xdd, 0x70, 0x9f, 0x92, 0x31, 0x1f, 0xb9, 0x81, 0xa5, 0x3e, 0xb8, 0x63, + 0x3d, 0x1e, 0xb1, 0xc9, 0x23, 0xca, 0xc6, 0xce, 0xd0, 0x23, 0xe1, 0x90, 0x79, 0x26, 0xf7, 0x59, + 0xc8, 0x8c, 0x7a, 0xdf, 0xe7, 0xd4, 0xec, 0x93, 0xd0, 0x9d, 0x90, 0x4b, 0x33, 0xce, 0x33, 0x93, + 0xbc, 0x6a, 0xad, 0xcf, 0x58, 0x7f, 0xe4, 0x5a, 0x84, 0x0f, 0x2d, 0xe2, 0x79, 0x2c, 0x14, 0xd9, + 0x81, 0x4c, 0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b, 0x34, + 0xed, 0x27, 0xc0, 0x05, 0x6d, 0x1b, 0x39, 0x40, 0x91, 0x6f, 0xe7, 0x1f, 0x94, 0xf2, 0xad, 0x0c, + 0xb1, 0xe3, 0x9f, 0x24, 0xe9, 0x20, 0xb5, 0x89, 0xf1, 0xd5, 0x25, 0xee, 0x8d, 0x0b, 0x53, 0x7b, + 0x1f, 0x97, 0x7e, 0x36, 0xb0, 0x3e, 0x3c, 0xc6, 0xf5, 0xa5, 0x1e, 0xd6, 0x51, 0x35, 0x35, 0x24, + 0x0b, 0x03, 0x9a, 0x60, 0xbc, 0x01, 0x54, 0x59, 0xe0, 0x65, 0xa5, 0xea, 0xda, 0xed, 0x7c, 0x5d, + 0x08, 0x7b, 0xa4, 0x9e, 0xb2, 0xa8, 0xe3, 0x09, 0xe9, 0x77, 0x40, 0xc5, 0x94, 0xa7, 0x15, 0xe3, + 0x1a, 0x6d, 0x3d, 0x11, 0x74, 0x17, 0xf8, 0xda, 0x6f, 0x6d, 0xad, 0xc5, 0xce, 0x7e, 0x47, 0xd2, + 0xb5, 0xe5, 0x21, 0x6d, 0xa0, 0x4d, 0x38, 0xcd, 0xdb, 0x9b, 0x09, 0x92, 0xf3, 0x9f, 0xf8, 0x07, + 0x74, 0xf7, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x85, 0xaf, 0x3c, 0x6d, 0x09, 0x00, 0x00, } diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index a9c870c64f3..9bc4de296f1 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -27,7 +27,7 @@ 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.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for StreamService service @@ -249,31 +249,31 @@ var _StreamService_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: fileDescriptor2, + Metadata: "examples/examplepb/stream.proto", } func init() { proto.RegisterFile("examples/examplepb/stream.proto", fileDescriptor2) } var fileDescriptor2 = []byte{ // 314 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x90, 0xbd, 0x4e, 0xf3, 0x30, - 0x14, 0x86, 0xe5, 0xef, 0x43, 0x08, 0x8c, 0x58, 0x3c, 0x30, 0x18, 0xa4, 0x8a, 0x0a, 0x89, 0x82, - 0x90, 0xdd, 0xc2, 0xc6, 0x46, 0x51, 0x37, 0x10, 0x43, 0x37, 0x96, 0xca, 0xae, 0x4e, 0x5d, 0x8b, - 0x24, 0xb6, 0x62, 0x27, 0x10, 0x89, 0x89, 0x91, 0xb5, 0x37, 0xc2, 0xbd, 0x70, 0x0b, 0x5c, 0x08, - 0x6e, 0xfe, 0xa6, 0x56, 0x2d, 0x5b, 0x92, 0xf3, 0x9e, 0xbc, 0xcf, 0x79, 0x70, 0x07, 0xde, 0x44, - 0x6c, 0x23, 0x70, 0xbc, 0x7e, 0xb0, 0x92, 0x3b, 0x9f, 0x82, 0x88, 0x99, 0x4d, 0x8d, 0x37, 0xa4, - 0xa3, 0x52, 0x3b, 0x65, 0x4a, 0x78, 0x78, 0x15, 0x05, 0x6b, 0xd2, 0xac, 0x4d, 0xd3, 0x13, 0x65, - 0x8c, 0x8a, 0x80, 0x0b, 0xab, 0xb9, 0x48, 0x12, 0xe3, 0x85, 0xd7, 0x26, 0x71, 0xd5, 0x3a, 0x3d, - 0xae, 0xa7, 0xe5, 0x9b, 0xcc, 0x66, 0x1c, 0x62, 0xeb, 0x8b, 0x7a, 0x78, 0xb5, 0xa2, 0x5c, 0x4c, - 0xa4, 0xf6, 0x13, 0x33, 0x9b, 0x40, 0x0e, 0x69, 0xe1, 0xe7, 0x3a, 0x51, 0x75, 0x9a, 0xb6, 0x69, - 0x97, 0x49, 0x1e, 0x83, 0x73, 0x42, 0x41, 0x35, 0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5, 0xc9, 0xf4, 0x3e, 0xba, 0xee, 0x44, 0xf4, 0x83, 0xec, 0x3d, 0x99, 0x80, + 0x74, 0xcd, 0x97, 0xec, 0xff, 0x74, 0xed, 0xcb, 0x82, 0xe2, 0x9c, 0xb6, 0x36, 0x50, 0x74, 0x23, + 0xba, 0x88, 0xc8, 0xc1, 0x52, 0xc5, 0x20, 0x9e, 0x58, 0xda, 0x59, 0x53, 0x15, 0x72, 0xc5, 0x87, + 0xe8, 0x4d, 0xa6, 0x9f, 0x4b, 0xb3, 0x6c, 0xeb, 0xe4, 0xf6, 0x46, 0x20, 0x9e, 0xd8, 0xc2, 0x48, + 0x37, 0xea, 0x1f, 0xbd, 0x1e, 0x36, 0xeb, 0xa9, 0xfd, 0x42, 0xc8, 0xdd, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x52, 0x49, 0x85, 0x8f, 0x02, 0x00, 0x00, } diff --git a/examples/sub/message.pb.go b/examples/sub/message.pb.go index e5c1e15dfb9..58a9be92c13 100644 --- a/examples/sub/message.pb.go +++ b/examples/sub/message.pb.go @@ -52,12 +52,12 @@ func init() { func init() { proto.RegisterFile("examples/sub/message.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 109 bytes of a gzipped FileDescriptorProto + // 111 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4c, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0x4f, 0x2c, - 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0x29, 0xd4, 0x03, 0x2a, 0x54, 0x52, 0xe5, 0xe2, 0x0d, 0x2e, - 0x29, 0xca, 0xcc, 0x4b, 0xf7, 0x85, 0xe8, 0x10, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, - 0x95, 0x60, 0x54, 0x60, 0xd2, 0xe0, 0x0c, 0x82, 0x70, 0x9c, 0x58, 0xa3, 0x98, 0x81, 0xaa, 0x01, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x10, 0x60, 0xa9, 0x65, 0x00, 0x00, 0x00, + 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0x29, 0xd4, 0x2b, 0x2e, 0x4d, 0x52, 0x52, 0xe5, 0xe2, 0x0d, + 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0xf7, 0x85, 0xe8, 0x10, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, + 0x4d, 0x95, 0x60, 0x54, 0x60, 0xd2, 0xe0, 0x0c, 0x82, 0x70, 0x9c, 0x58, 0xa3, 0x98, 0x8b, 0x4b, + 0x93, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x10, 0x60, 0xa9, 0x65, 0x00, 0x00, 0x00, } diff --git a/runtime/internal/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go index 524e0d3c34c..6f837cfd5d9 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -49,17 +49,17 @@ func init() { func init() { proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 180 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0x2a, 0xcd, 0x2b, - 0xc9, 0xcc, 0x4d, 0xd5, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x2f, 0x2e, 0x29, - 0x4a, 0x4d, 0xcc, 0x8d, 0x4f, 0xce, 0x28, 0xcd, 0xcb, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0x12, 0x49, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0x4f, 0x2c, 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0xea, - 0x50, 0x6a, 0x62, 0xe4, 0xe2, 0x0e, 0x06, 0x2b, 0x76, 0x2d, 0x2a, 0xca, 0x2f, 0x12, 0x92, 0xe6, - 0xe2, 0x04, 0xa9, 0x8b, 0x4f, 0xce, 0x4f, 0x49, 0x95, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x0d, 0xe2, - 0x00, 0x09, 0x38, 0x03, 0xf9, 0x20, 0xc9, 0x8c, 0x92, 0x92, 0x02, 0x88, 0x24, 0x13, 0x44, 0x12, - 0x24, 0x00, 0x96, 0x94, 0xe0, 0x62, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x95, 0x60, 0x06, - 0x4a, 0x71, 0x06, 0xc1, 0xb8, 0x42, 0xf2, 0x5c, 0xdc, 0x60, 0x6d, 0xc5, 0x25, 0x89, 0x25, 0xa5, - 0xc5, 0x12, 0x2c, 0x60, 0x59, 0x2e, 0x90, 0x50, 0x30, 0x58, 0xc4, 0x89, 0x2b, 0x8a, 0x03, 0xe6, - 0xf2, 0x24, 0x36, 0xb0, 0x6b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x07, 0x92, 0xb6, - 0xd4, 0x00, 0x00, 0x00, + // 181 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0x8e, 0xbf, 0xee, 0x82, 0x30, + 0x14, 0x85, 0xd3, 0xdf, 0x1f, 0x85, 0xcb, 0x46, 0x1c, 0x9a, 0x38, 0x48, 0x74, 0x61, 0x82, 0xc1, + 0x37, 0xd0, 0xf8, 0x02, 0xb0, 0xb9, 0x90, 0x0a, 0x37, 0x40, 0x94, 0x96, 0xdc, 0x5e, 0x62, 0x5c, + 0x7d, 0x72, 0xd3, 0x22, 0xe3, 0xf9, 0xbe, 0x73, 0x92, 0x03, 0x07, 0x9a, 0x34, 0xf7, 0x03, 0xe6, + 0xbd, 0x66, 0x24, 0xad, 0x1e, 0xb9, 0x65, 0x42, 0x35, 0x54, 0x75, 0x37, 0xe9, 0x7b, 0x36, 0x92, + 0x61, 0x13, 0x6f, 0x5a, 0x1a, 0xeb, 0xac, 0x55, 0x8c, 0x4f, 0xf5, 0xca, 0xbe, 0x8b, 0xfd, 0x5b, + 0x40, 0x54, 0xfa, 0xf2, 0x85, 0xc8, 0x50, 0xbc, 0x85, 0xd0, 0xf5, 0xaa, 0xda, 0x34, 0x28, 0x45, + 0x22, 0xd2, 0xff, 0x22, 0x70, 0xe0, 0x6c, 0x1a, 0x74, 0xb2, 0x63, 0x1e, 0x67, 0xf9, 0x33, 0x4b, + 0x07, 0xbc, 0x94, 0xb0, 0x1e, 0xd0, 0x5a, 0xd5, 0xa2, 0xfc, 0x4d, 0x44, 0x1a, 0x16, 0x4b, 0x8c, + 0x77, 0x10, 0xf9, 0x99, 0x65, 0xc5, 0x93, 0x95, 0x7f, 0xde, 0x82, 0x43, 0xa5, 0x27, 0x27, 0xb8, + 0x06, 0xcb, 0xf3, 0xdb, 0xca, 0xbf, 0x3d, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x07, 0x92, + 0xb6, 0xd4, 0x00, 0x00, 0x00, } diff --git a/third_party/googleapis/google/api/annotations.pb.go b/third_party/googleapis/google/api/annotations.pb.go index f051b70b873..2409a86c4bf 100644 --- a/third_party/googleapis/google/api/annotations.pb.go +++ b/third_party/googleapis/google/api/annotations.pb.go @@ -46,16 +46,16 @@ func init() { func init() { proto.RegisterFile("google/api/annotations.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 167 bytes of a gzipped FileDescriptorProto + // 169 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, - 0xcf, 0x2b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0xc8, 0xea, 0x01, 0x65, 0xa5, - 0x44, 0x91, 0x54, 0x66, 0x94, 0x94, 0x14, 0x40, 0x94, 0x48, 0x29, 0x40, 0x85, 0xc1, 0xbc, 0xa4, - 0xd2, 0x34, 0xfd, 0x94, 0xd4, 0xe2, 0xe4, 0xa2, 0xcc, 0x82, 0x92, 0xfc, 0x22, 0x88, 0x0a, 0x2b, - 0x6f, 0x2e, 0x16, 0x90, 0x7a, 0x21, 0x39, 0x3d, 0xa8, 0x69, 0x30, 0xa5, 0x7a, 0xbe, 0xa9, 0x25, - 0x19, 0xf9, 0x29, 0xfe, 0x05, 0x60, 0x2b, 0x25, 0x36, 0x9c, 0xda, 0xa3, 0xa4, 0xc0, 0xa8, 0xc1, - 0x6d, 0x24, 0xa2, 0x87, 0xb0, 0x56, 0xcf, 0x03, 0xa8, 0x35, 0xa8, 0x34, 0x27, 0x35, 0x08, 0x6c, - 0x88, 0x93, 0x0a, 0x17, 0x5f, 0x72, 0x7e, 0x2e, 0x92, 0x02, 0x27, 0x01, 0x47, 0x84, 0xb3, 0x03, - 0x40, 0x26, 0x07, 0x30, 0x26, 0xb1, 0x81, 0xad, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x4f, - 0xd1, 0x89, 0x83, 0xde, 0x00, 0x00, 0x00, + 0xcf, 0x2b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0xc8, 0xea, 0x25, 0x16, 0x64, + 0x4a, 0x89, 0x22, 0xa9, 0xcc, 0x28, 0x29, 0x29, 0x80, 0x28, 0x91, 0x52, 0x80, 0x0a, 0x83, 0x79, + 0x49, 0xa5, 0x69, 0xfa, 0x29, 0xa9, 0xc5, 0xc9, 0x45, 0x99, 0x05, 0x25, 0xf9, 0x45, 0x10, 0x15, + 0x56, 0xde, 0x5c, 0x2c, 0x20, 0xf5, 0x42, 0x72, 0x7a, 0x50, 0xd3, 0x60, 0x4a, 0xf5, 0x7c, 0x53, + 0x4b, 0x32, 0xf2, 0x53, 0xfc, 0x0b, 0xc0, 0x56, 0x4a, 0x6c, 0x38, 0xb5, 0x47, 0x49, 0x81, 0x51, + 0x83, 0xdb, 0x48, 0x44, 0x0f, 0x61, 0xad, 0x9e, 0x47, 0x49, 0x49, 0x41, 0x50, 0x69, 0x4e, 0x6a, + 0x10, 0xd8, 0x10, 0x27, 0x15, 0x2e, 0xbe, 0xe4, 0xfc, 0x5c, 0x24, 0x05, 0x4e, 0x02, 0x8e, 0x08, + 0x67, 0x07, 0x80, 0x4c, 0x0e, 0x60, 0x4c, 0x62, 0x03, 0x5b, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, + 0xff, 0x4f, 0xd1, 0x89, 0x83, 0xde, 0x00, 0x00, 0x00, } diff --git a/third_party/googleapis/google/api/http.pb.go b/third_party/googleapis/google/api/http.pb.go index d340935a293..c572235923c 100644 --- a/third_party/googleapis/google/api/http.pb.go +++ b/third_party/googleapis/google/api/http.pb.go @@ -338,23 +338,23 @@ func init() { func init() { proto.RegisterFile("google/api/http.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 277 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x51, 0xbd, 0x6a, 0xf3, 0x40, - 0x10, 0xfc, 0x64, 0xc9, 0xb2, 0xb5, 0x86, 0x0f, 0x72, 0x71, 0xc2, 0x36, 0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, 0x7b, 0x4b, 0x76, 0x7d, 0x50, 0x84, 0xfd, 0x22, 0x83, 0x85, 0xf6, 0x79, 0xbb, 0x37, - 0xb8, 0xfb, 0x53, 0xc2, 0x46, 0x7f, 0x99, 0x5d, 0x8c, 0x7c, 0xb4, 0x9d, 0x2d, 0x67, 0xde, 0x74, - 0xfe, 0xc7, 0x95, 0x6e, 0x2e, 0x36, 0xf0, 0xbf, 0x51, 0xa7, 0x9b, 0xd8, 0x22, 0x73, 0x36, 0xf6, - 0x02, 0xc7, 0xa8, 0x4e, 0xdd, 0x29, 0x5e, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x89, 0x57, - 0x7f, 0xa3, 0x01, 0x00, 0x00, + // 280 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x6a, 0xbb, 0x40, + 0x10, 0xc6, 0xff, 0x46, 0x63, 0xe2, 0x08, 0x7f, 0xe8, 0x36, 0x2d, 0x7b, 0x09, 0x48, 0x4e, 0x9e, + 0x0c, 0xa4, 0x87, 0x1e, 0x7a, 0xb3, 0x14, 0x72, 0x0c, 0xbe, 0x40, 0x59, 0xdd, 0x45, 0x97, 0x1a, + 0x77, 0x88, 0xe3, 0xa1, 0x8f, 0xd2, 0xb7, 0x2d, 0xbb, 0x6b, 0x48, 0xa0, 0xb7, 0xf9, 0x7e, 0x33, + 0x7e, 0xdf, 0xb8, 0x03, 0x4f, 0xad, 0x31, 0x6d, 0xaf, 0xf6, 0x02, 0xf5, 0xbe, 0x23, 0xc2, 0x02, + 0x2f, 0x86, 0x0c, 0x03, 0x8f, 0x0b, 0x81, 0x7a, 0xf7, 0xb3, 0x80, 0xf5, 0x91, 0x08, 0xab, 0xa9, + 0x57, 0x8c, 0x41, 0xd8, 0x2a, 0xe2, 0x8b, 0x2c, 0xc8, 0x93, 0xe3, 0xbf, 0xca, 0x0a, 0xcb, 0x70, + 0x22, 0x1e, 0x5e, 0x19, 0x4e, 0xc4, 0x36, 0x10, 0xa1, 0x19, 0x89, 0x47, 0x33, 0x74, 0x8a, 0x71, + 0x88, 0xa5, 0xea, 0x15, 0x29, 0xbe, 0x9c, 0xf9, 0xac, 0xd9, 0x33, 0x2c, 0x51, 0x50, 0xd3, 0xf1, + 0x78, 0x6e, 0x78, 0xc9, 0x5e, 0x21, 0x6e, 0xa6, 0x91, 0xcc, 0x99, 0xaf, 0xb3, 0x20, 0x4f, 0x0f, + 0xdb, 0xe2, 0xb6, 0x59, 0xf1, 0xee, 0x3a, 0x76, 0xb7, 0x93, 0x20, 0x52, 0x97, 0xc1, 0x1a, 0xfa, + 0x71, 0xc6, 0x20, 0xaa, 0x8d, 0xfc, 0xe6, 0x2b, 0xeb, 0x57, 0xb9, 0x9a, 0x7d, 0xc0, 0xa3, 0x90, + 0x52, 0x93, 0x36, 0x83, 0xe8, 0x3f, 0x6b, 0x3d, 0x48, 0x3d, 0xb4, 0x23, 0x4f, 0xb3, 0x30, 0x4f, + 0x0f, 0x9b, 0x7b, 0xe7, 0xeb, 0xff, 0x56, 0xec, 0xf6, 0x41, 0x39, 0xcf, 0x97, 0x09, 0xac, 0xd0, + 0xe7, 0xed, 0xde, 0xe0, 0xe1, 0xcf, 0x12, 0x36, 0xfa, 0x4b, 0x0f, 0x92, 0x07, 0x3e, 0xda, 0xd6, + 0x96, 0xa1, 0xa0, 0xce, 0x3f, 0x5c, 0xe5, 0xea, 0x72, 0x0b, 0xff, 0x1b, 0x73, 0xbe, 0x8b, 0x2d, + 0x13, 0x67, 0x63, 0x2f, 0x70, 0x0a, 0xea, 0xd8, 0x9d, 0xe2, 0xe5, 0x37, 0x00, 0x00, 0xff, 0xff, + 0x2f, 0x89, 0x57, 0x7f, 0xa3, 0x01, 0x00, 0x00, } From 10f6983ee6fc929beefb6b480470251dc563d5c0 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Thu, 3 Nov 2016 18:36:15 -0700 Subject: [PATCH 082/552] remove branch name build constraint --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 33032f1292b..307dc10b1e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,3 @@ -branches: - only: - - master language: go sudo: false go: From 5fbceac0ca7544124165e3d03caa5fd78621300b Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Thu, 3 Nov 2016 20:46:15 -0700 Subject: [PATCH 083/552] bump primary go version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 307dc10b1e9..3cc0ec7825b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go sudo: false go: -- 1.6.2 +- 1.7.3 - tip cache: directories: From bf884f262458291b7b627ca7468c2d4676a6e7ca Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Fri, 4 Nov 2016 07:10:26 -0700 Subject: [PATCH 084/552] reorganize example server a bit to fit go1.8 test import changes --- examples/browser/gulpfile.js | 2 +- examples/server/a_bit_of_everything.go | 2 +- examples/server/cmd/example-server/main.go | 17 +++++++++++++++++ examples/server/echo.go | 2 +- examples/server/flow_combination.go | 2 +- examples/server/main.go | 13 +------------ 6 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 examples/server/cmd/example-server/main.go diff --git a/examples/browser/gulpfile.js b/examples/browser/gulpfile.js index 0d8e15864de..3964888c949 100644 --- a/examples/browser/gulpfile.js +++ b/examples/browser/gulpfile.js @@ -16,7 +16,7 @@ gulp.task('bower', function(){ }); gulp.task('server', shell.task([ - 'go build -o bin/example-server github.com/grpc-ecosystem/grpc-gateway/examples/server', + 'go build -o bin/example-server github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server', ])); gulp.task('gateway', shell.task([ diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 37001d69dfe..8c1badd95ee 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -1,4 +1,4 @@ -package main +package server import ( "fmt" diff --git a/examples/server/cmd/example-server/main.go b/examples/server/cmd/example-server/main.go new file mode 100644 index 00000000000..34b319ab4ed --- /dev/null +++ b/examples/server/cmd/example-server/main.go @@ -0,0 +1,17 @@ +package main + +import ( + "flag" + + "github.com/golang/glog" + "github.com/grpc-ecosystem/grpc-gateway/examples/server" +) + +func main() { + flag.Parse() + defer glog.Flush() + + if err := server.Run(); err != nil { + glog.Fatal(err) + } +} diff --git a/examples/server/echo.go b/examples/server/echo.go index 92ac950a2c7..e87db2d510b 100644 --- a/examples/server/echo.go +++ b/examples/server/echo.go @@ -1,4 +1,4 @@ -package main +package server import ( "github.com/golang/glog" diff --git a/examples/server/flow_combination.go b/examples/server/flow_combination.go index 2c9fcd99e68..f1a90fa2b85 100644 --- a/examples/server/flow_combination.go +++ b/examples/server/flow_combination.go @@ -1,4 +1,4 @@ -package main +package server import ( "io" diff --git a/examples/server/main.go b/examples/server/main.go index 136034ad83b..c5e6cb6f97f 100644 --- a/examples/server/main.go +++ b/examples/server/main.go @@ -1,10 +1,8 @@ -package main +package server import ( - "flag" "net" - "github.com/golang/glog" examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "google.golang.org/grpc" ) @@ -25,12 +23,3 @@ func Run() error { s.Serve(l) return nil } - -func main() { - flag.Parse() - defer glog.Flush() - - if err := Run(); err != nil { - glog.Fatal(err) - } -} From 072ceb5b793167681aa42e32636066711a68eafa Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Fri, 4 Nov 2016 07:15:43 -0700 Subject: [PATCH 085/552] specify go_import_path for building from forks --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 3cc0ec7825b..61ec5207f5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ sudo: false go: - 1.7.3 - tip +go_import_path: github.com/grpc-ecosystem/grpc-gateway cache: directories: - $HOME/local From 1656cdff9e0d3ccfe84e5454dada3627b49ca69a Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 3 Nov 2016 10:33:52 -0400 Subject: [PATCH 086/552] Render the swagger request body properly --- protoc-gen-swagger/genswagger/template.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index d33aba5de98..a8431d29e1c 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -377,6 +377,19 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } // Now check if there is a body parameter if b.Body != nil { + var schema swaggerSchemaObject + + if len(b.Body.FieldPath) == 0 { + schema = swaggerSchemaObject{ + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)), + }, + } + } else { + lastField := b.Body.FieldPath[len(b.Body.FieldPath) - 1] + schema = schemaOfField(lastField.Target, reg) + } + desc := "" if meth.GetClientStreaming() { desc = "(streaming inputs)" @@ -386,11 +399,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re Description: desc, In: "body", Required: true, - Schema: &swaggerSchemaObject{ - schemaCore: schemaCore{ - Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)), - }, - }, + Schema: &schema, }) } From fcd254ca7cddec844e872bb820436b0e998a88d7 Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 3 Nov 2016 13:38:50 -0400 Subject: [PATCH 087/552] Fix examples --- examples/clients/abe/ABitOfEverythingServiceApi.go | 4 ++-- examples/examplepb/a_bit_of_everything.swagger.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/clients/abe/ABitOfEverythingServiceApi.go b/examples/clients/abe/ABitOfEverythingServiceApi.go index 855d2755155..eb470763999 100644 --- a/examples/clients/abe/ABitOfEverythingServiceApi.go +++ b/examples/clients/abe/ABitOfEverythingServiceApi.go @@ -414,8 +414,8 @@ func (a ABitOfEverythingServiceApi) Echo_1 () (SubStringMessage, error) { * @param body * @return SubStringMessage */ -//func (a ABitOfEverythingServiceApi) Echo_2 (body SubStringMessage) (SubStringMessage, error) { -func (a ABitOfEverythingServiceApi) Echo_2 (body SubStringMessage) (SubStringMessage, error) { +//func (a ABitOfEverythingServiceApi) Echo_2 (body string) (SubStringMessage, error) { +func (a ABitOfEverythingServiceApi) Echo_2 (body string) (SubStringMessage, error) { _sling := sling.New().Post(a.basePath) diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 840c0ddde03..e8ad64f11d2 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -332,7 +332,8 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/subStringMessage" + "type": "string", + "format": "string" } } ], From 9e271f806757c8f11f1623282f3ef84a898d4cc2 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Mon, 7 Nov 2016 18:25:27 -0800 Subject: [PATCH 088/552] Correct protobuf field tag --- runtime/errors.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/errors.go b/runtime/errors.go index 0d3cb3bf3ca..5a51d02c0a9 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -64,7 +64,7 @@ var ( type errorBody struct { Error string `protobuf:"bytes,1,name=error" json:"error"` - Code int `protobuf:"bytes,2,name=code" json:"code"` + Code int32 `protobuf:"varint,2,name=code" json:"code"` } //Make this also conform to proto.Message for builtin JSONPb Marshaler @@ -85,7 +85,7 @@ func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseW w.Header().Set("Content-Type", marshaler.ContentType()) body := &errorBody{ Error: grpc.ErrorDesc(err), - Code: int(grpc.Code(err)), + Code: int32(grpc.Code(err)), } buf, merr := marshaler.Marshal(body) From 078c7b04b4d9bbd00aa4b3921ad440fb08c13878 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Fri, 18 Nov 2016 16:46:32 -0800 Subject: [PATCH 089/552] regenerate examples --- examples/examplepb/a_bit_of_everything.pb.go | 147 ++++++++++++++++++ examples/examplepb/echo_service.pb.go | 7 + examples/examplepb/flow_combination.pb.go | 42 +++++ examples/sub2/message.pb.go | 7 + runtime/internal/stream_chunk.pb.go | 28 ++++ .../googleapis/google/api/annotations.pb.go | 1 + third_party/googleapis/google/api/http.pb.go | 21 +++ 7 files changed, 253 insertions(+) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 4a3548496ee..d8e32353aec 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -140,6 +140,13 @@ func (m *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested { return nil } +func (m *ABitOfEverything) GetUuid() string { + if m != nil { + return m.Uuid + } + return "" +} + func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { if m != nil { return m.Nested @@ -147,6 +154,118 @@ func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { return nil } +func (m *ABitOfEverything) GetFloatValue() float32 { + if m != nil { + return m.FloatValue + } + return 0 +} + +func (m *ABitOfEverything) GetDoubleValue() float64 { + if m != nil { + return m.DoubleValue + } + return 0 +} + +func (m *ABitOfEverything) GetInt64Value() int64 { + if m != nil { + return m.Int64Value + } + return 0 +} + +func (m *ABitOfEverything) GetUint64Value() uint64 { + if m != nil { + return m.Uint64Value + } + return 0 +} + +func (m *ABitOfEverything) GetInt32Value() int32 { + if m != nil { + return m.Int32Value + } + return 0 +} + +func (m *ABitOfEverything) GetFixed64Value() uint64 { + if m != nil { + return m.Fixed64Value + } + return 0 +} + +func (m *ABitOfEverything) GetFixed32Value() uint32 { + if m != nil { + return m.Fixed32Value + } + return 0 +} + +func (m *ABitOfEverything) GetBoolValue() bool { + if m != nil { + return m.BoolValue + } + return false +} + +func (m *ABitOfEverything) GetStringValue() string { + if m != nil { + return m.StringValue + } + return "" +} + +func (m *ABitOfEverything) GetUint32Value() uint32 { + if m != nil { + return m.Uint32Value + } + return 0 +} + +func (m *ABitOfEverything) GetEnumValue() NumericEnum { + if m != nil { + return m.EnumValue + } + return NumericEnum_ZERO +} + +func (m *ABitOfEverything) GetSfixed32Value() int32 { + if m != nil { + return m.Sfixed32Value + } + return 0 +} + +func (m *ABitOfEverything) GetSfixed64Value() int64 { + if m != nil { + return m.Sfixed64Value + } + return 0 +} + +func (m *ABitOfEverything) GetSint32Value() int32 { + if m != nil { + return m.Sint32Value + } + return 0 +} + +func (m *ABitOfEverything) GetSint64Value() int64 { + if m != nil { + return m.Sint64Value + } + return 0 +} + +func (m *ABitOfEverything) GetRepeatedStringValue() []string { + if m != nil { + return m.RepeatedStringValue + } + return nil +} + func (m *ABitOfEverything) GetOneofEmpty() *google_protobuf1.Empty { if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok { return x.OneofEmpty @@ -182,6 +301,13 @@ func (m *ABitOfEverything) GetMappedNestedValue() map[string]*ABitOfEverything_N return nil } +func (m *ABitOfEverything) GetNonConventionalNameValue() string { + if m != nil { + return m.NonConventionalNameValue + } + return "" +} + func (m *ABitOfEverything) GetTimestampValue() *google_protobuf2.Timestamp { if m != nil { return m.TimestampValue @@ -272,6 +398,27 @@ func (m *ABitOfEverything_Nested) String() string { return proto.Comp func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0, 0} } +func (m *ABitOfEverything_Nested) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ABitOfEverything_Nested) GetAmount() uint32 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *ABitOfEverything_Nested) GetOk() ABitOfEverything_Nested_DeepEnum { + if m != nil { + return m.Ok + } + return ABitOfEverything_Nested_FALSE +} + func init() { proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything") proto.RegisterType((*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.Nested") diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 756fe4c8d98..a7e19fdd932 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -59,6 +59,13 @@ func (m *SimpleMessage) String() string { return proto.CompactTextStr func (*SimpleMessage) ProtoMessage() {} func (*SimpleMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *SimpleMessage) GetId() string { + if m != nil { + return m.Id + } + return "" +} + func init() { proto.RegisterType((*SimpleMessage)(nil), "grpc.gateway.examples.examplepb.SimpleMessage") } diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index f6620070863..bd6dde41f4f 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -38,6 +38,27 @@ func (m *NonEmptyProto) String() string { return proto.CompactTextStr func (*NonEmptyProto) ProtoMessage() {} func (*NonEmptyProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} } +func (m *NonEmptyProto) GetA() string { + if m != nil { + return m.A + } + return "" +} + +func (m *NonEmptyProto) GetB() string { + if m != nil { + return m.B + } + return "" +} + +func (m *NonEmptyProto) GetC() string { + if m != nil { + return m.C + } + return "" +} + type UnaryProto struct { Str string `protobuf:"bytes,1,opt,name=str" json:"str,omitempty"` } @@ -47,6 +68,13 @@ func (m *UnaryProto) String() string { return proto.CompactTextString func (*UnaryProto) ProtoMessage() {} func (*UnaryProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{2} } +func (m *UnaryProto) GetStr() string { + if m != nil { + return m.Str + } + return "" +} + type NestedProto struct { A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"` @@ -65,6 +93,20 @@ func (m *NestedProto) GetA() *UnaryProto { return nil } +func (m *NestedProto) GetB() string { + if m != nil { + return m.B + } + return "" +} + +func (m *NestedProto) GetC() string { + if m != nil { + return m.C + } + return "" +} + type SingleNestedProto struct { A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` } diff --git a/examples/sub2/message.pb.go b/examples/sub2/message.pb.go index 37d6ee759fb..dada72d4557 100644 --- a/examples/sub2/message.pb.go +++ b/examples/sub2/message.pb.go @@ -37,6 +37,13 @@ func (m *IdMessage) String() string { return proto.CompactTextString( func (*IdMessage) ProtoMessage() {} func (*IdMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *IdMessage) GetUuid() string { + if m != nil { + return m.Uuid + } + return "" +} + func init() { proto.RegisterType((*IdMessage)(nil), "sub2.IdMessage") } diff --git a/runtime/internal/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go index 6f837cfd5d9..e2486eb8eec 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -42,6 +42,34 @@ func (m *StreamError) String() string { return proto.CompactTextStrin func (*StreamError) ProtoMessage() {} func (*StreamError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *StreamError) GetGrpcCode() int32 { + if m != nil { + return m.GrpcCode + } + return 0 +} + +func (m *StreamError) GetHttpCode() int32 { + if m != nil { + return m.HttpCode + } + return 0 +} + +func (m *StreamError) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func (m *StreamError) GetHttpStatus() string { + if m != nil { + return m.HttpStatus + } + return "" +} + func init() { proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError") } diff --git a/third_party/googleapis/google/api/annotations.pb.go b/third_party/googleapis/google/api/annotations.pb.go index 2409a86c4bf..98366b55059 100644 --- a/third_party/googleapis/google/api/annotations.pb.go +++ b/third_party/googleapis/google/api/annotations.pb.go @@ -37,6 +37,7 @@ var E_Http = &proto.ExtensionDesc{ Field: 72295728, Name: "google.api.http", Tag: "bytes,72295728,opt,name=http", + Filename: "google/api/annotations.proto", } func init() { diff --git a/third_party/googleapis/google/api/http.pb.go b/third_party/googleapis/google/api/http.pb.go index c572235923c..82e742cf031 100644 --- a/third_party/googleapis/google/api/http.pb.go +++ b/third_party/googleapis/google/api/http.pb.go @@ -180,6 +180,13 @@ func (m *HttpRule) GetCustom() *CustomHttpPattern { return nil } +func (m *HttpRule) GetBody() string { + if m != nil { + return m.Body + } + return "" +} + func (m *HttpRule) GetAdditionalBindings() []*HttpRule { if m != nil { return m.AdditionalBindings @@ -330,6 +337,20 @@ func (m *CustomHttpPattern) String() string { return proto.CompactTex func (*CustomHttpPattern) ProtoMessage() {} func (*CustomHttpPattern) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } +func (m *CustomHttpPattern) GetKind() string { + if m != nil { + return m.Kind + } + return "" +} + +func (m *CustomHttpPattern) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + func init() { proto.RegisterType((*HttpRule)(nil), "google.api.HttpRule") proto.RegisterType((*CustomHttpPattern)(nil), "google.api.CustomHttpPattern") From ea1b8cc45f98eb7016005e1579f791dcb8805487 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Fri, 18 Nov 2016 16:53:01 -0800 Subject: [PATCH 090/552] make lint happy --- protoc-gen-swagger/genswagger/template.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index a8431d29e1c..b81c4c05635 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -386,7 +386,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re }, } } else { - lastField := b.Body.FieldPath[len(b.Body.FieldPath) - 1] + lastField := b.Body.FieldPath[len(b.Body.FieldPath)-1] schema = schemaOfField(lastField.Target, reg) } @@ -399,7 +399,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re Description: desc, In: "body", Required: true, - Schema: &schema, + Schema: &schema, }) } @@ -565,7 +565,7 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er return nil } - return fmt.Errorf("No description nor summary property.") + return fmt.Errorf("no description nor summary property") } func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []string, typeName string, typeIndex int32, fieldPaths ...int32) string { @@ -693,15 +693,15 @@ func isProtoPathMatches(paths []int32, outerPaths []int32, typeName string, type func protoPathIndex(descriptorType reflect.Type, what string) int32 { field, ok := descriptorType.Elem().FieldByName(what) if !ok { - panic(fmt.Errorf("Could not find protobuf descriptor type id for %s.", what)) + panic(fmt.Errorf("could not find protobuf descriptor type id for %s", what)) } pbtag := field.Tag.Get("protobuf") if pbtag == "" { - panic(fmt.Errorf("No Go tag 'protobuf' on protobuf descriptor for %s.", what)) + panic(fmt.Errorf("no Go tag 'protobuf' on protobuf descriptor for %s", what)) } path, err := strconv.Atoi(strings.Split(pbtag, ",")[1]) if err != nil { - panic(fmt.Errorf("Protobuf descriptor id for %s cannot be converted to a number: %s", what, err.Error())) + panic(fmt.Errorf("protobuf descriptor id for %s cannot be converted to a number: %s", what, err.Error())) } return int32(path) From 338f22e78597140ee9d622c595943ee43a7d3605 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 22 Nov 2016 20:14:10 -0800 Subject: [PATCH 091/552] preserve field order in swagger spec --- .../clients/abe/ABitOfEverythingNested.go | 2 +- .../clients/abe/ExamplepbABitOfEverything.go | 38 ++--- .../a_bit_of_everything.swagger.json | 140 +++++++++--------- protoc-gen-swagger/genswagger/template.go | 4 +- protoc-gen-swagger/genswagger/types.go | 40 ++++- 5 files changed, 129 insertions(+), 95 deletions(-) diff --git a/examples/clients/abe/ABitOfEverythingNested.go b/examples/clients/abe/ABitOfEverythingNested.go index ab15b89cfbd..7e5488e37a7 100644 --- a/examples/clients/abe/ABitOfEverythingNested.go +++ b/examples/clients/abe/ABitOfEverythingNested.go @@ -4,8 +4,8 @@ import ( ) type ABitOfEverythingNested struct { - Amount int64 `json:"amount,omitempty"` Name string `json:"name,omitempty"` + Amount int64 `json:"amount,omitempty"` Ok NestedDeepEnum `json:"ok,omitempty"` } diff --git a/examples/clients/abe/ExamplepbABitOfEverything.go b/examples/clients/abe/ExamplepbABitOfEverything.go index 2ca345dcc08..3440ace1888 100644 --- a/examples/clients/abe/ExamplepbABitOfEverything.go +++ b/examples/clients/abe/ExamplepbABitOfEverything.go @@ -5,31 +5,31 @@ import ( ) type ExamplepbABitOfEverything struct { - BoolValue bool `json:"bool_value,omitempty"` - DoubleValue float64 `json:"double_value,omitempty"` - EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"` - Fixed32Value int64 `json:"fixed32_value,omitempty"` - Fixed64Value string `json:"fixed64_value,omitempty"` + SingleNested ABitOfEverythingNested `json:"single_nested,omitempty"` + Uuid string `json:"uuid,omitempty"` + Nested []ABitOfEverythingNested `json:"nested,omitempty"` FloatValue float32 `json:"float_value,omitempty"` - Int32Value int32 `json:"int32_value,omitempty"` + DoubleValue float64 `json:"double_value,omitempty"` Int64Value string `json:"int64_value,omitempty"` - MapValue map[string]ExamplepbNumericEnum `json:"map_value,omitempty"` - MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"` - MappedStringValue map[string]string `json:"mapped_string_value,omitempty"` - Nested []ABitOfEverythingNested `json:"nested,omitempty"` - NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` - OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"` - OneofString string `json:"oneof_string,omitempty"` - RepeatedStringValue []string `json:"repeated_string_value,omitempty"` + Uint64Value string `json:"uint64_value,omitempty"` + Int32Value int32 `json:"int32_value,omitempty"` + Fixed64Value string `json:"fixed64_value,omitempty"` + Fixed32Value int64 `json:"fixed32_value,omitempty"` + BoolValue bool `json:"bool_value,omitempty"` + StringValue string `json:"string_value,omitempty"` + Uint32Value int64 `json:"uint32_value,omitempty"` + EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"` Sfixed32Value int32 `json:"sfixed32_value,omitempty"` Sfixed64Value string `json:"sfixed64_value,omitempty"` - SingleNested ABitOfEverythingNested `json:"single_nested,omitempty"` Sint32Value int32 `json:"sint32_value,omitempty"` Sint64Value string `json:"sint64_value,omitempty"` - StringValue string `json:"string_value,omitempty"` + RepeatedStringValue []string `json:"repeated_string_value,omitempty"` + OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"` + OneofString string `json:"oneof_string,omitempty"` + MapValue map[string]ExamplepbNumericEnum `json:"map_value,omitempty"` + MappedStringValue map[string]string `json:"mapped_string_value,omitempty"` + MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"` + NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestamp_value,omitempty"` - Uint32Value int64 `json:"uint32_value,omitempty"` - Uint64Value string `json:"uint64_value,omitempty"` - Uuid string `json:"uuid,omitempty"` } diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index e8ad64f11d2..0d9366f7ad9 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -363,15 +363,15 @@ "ABitOfEverythingNested": { "type": "object", "properties": { - "amount": { - "type": "integer", - "format": "int64" - }, "name": { "type": "string", "format": "string", "description": "name is nested field." }, + "amount": { + "type": "integer", + "format": "int64" + }, "ok": { "$ref": "#/definitions/NestedDeepEnum" } @@ -390,79 +390,62 @@ "examplepbABitOfEverything": { "type": "object", "properties": { - "bool_value": { - "type": "boolean", - "format": "boolean" + "single_nested": { + "$ref": "#/definitions/ABitOfEverythingNested" + }, + "uuid": { + "type": "string", + "format": "string" + }, + "nested": { + "type": "array", + "items": { + "$ref": "#/definitions/ABitOfEverythingNested" + } + }, + "float_value": { + "type": "number", + "format": "float" }, "double_value": { "type": "number", "format": "double" }, - "enum_value": { - "$ref": "#/definitions/examplepbNumericEnum" - }, - "fixed32_value": { - "type": "integer", + "int64_value": { + "type": "string", "format": "int64" }, - "fixed64_value": { + "uint64_value": { "type": "string", "format": "uint64" }, - "float_value": { - "type": "number", - "format": "float" - }, "int32_value": { "type": "integer", "format": "int32" }, - "int64_value": { + "fixed64_value": { "type": "string", - "format": "int64" - }, - "map_value": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/examplepbNumericEnum" - } - }, - "mapped_nested_value": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/ABitOfEverythingNested" - } + "format": "uint64" }, - "mapped_string_value": { - "type": "object", - "additionalProperties": { - "type": "string", - "format": "string" - } + "fixed32_value": { + "type": "integer", + "format": "int64" }, - "nested": { - "type": "array", - "items": { - "$ref": "#/definitions/ABitOfEverythingNested" - } + "bool_value": { + "type": "boolean", + "format": "boolean" }, - "nonConventionalNameValue": { + "string_value": { "type": "string", "format": "string" }, - "oneof_empty": { - "$ref": "#/definitions/protobufEmpty" - }, - "oneof_string": { - "type": "string", - "format": "string" + "uint32_value": { + "type": "integer", + "format": "int64", + "title": "TODO(yugui) add bytes_value" }, - "repeated_string_value": { - "type": "array", - "items": { - "type": "string", - "format": "string" - } + "enum_value": { + "$ref": "#/definitions/examplepbNumericEnum" }, "sfixed32_value": { "type": "integer", @@ -472,9 +455,6 @@ "type": "string", "format": "int64" }, - "single_nested": { - "$ref": "#/definitions/ABitOfEverythingNested" - }, "sint32_value": { "type": "integer", "format": "int32" @@ -483,26 +463,46 @@ "type": "string", "format": "int64" }, - "string_value": { + "repeated_string_value": { + "type": "array", + "items": { + "type": "string", + "format": "string" + } + }, + "oneof_empty": { + "$ref": "#/definitions/protobufEmpty" + }, + "oneof_string": { "type": "string", "format": "string" }, - "timestamp_value": { - "type": "string", - "format": "date-time" + "map_value": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/examplepbNumericEnum" + } }, - "uint32_value": { - "type": "integer", - "format": "int64", - "title": "TODO(yugui) add bytes_value" + "mapped_string_value": { + "type": "object", + "additionalProperties": { + "type": "string", + "format": "string" + } }, - "uint64_value": { - "type": "string", - "format": "uint64" + "mapped_nested_value": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ABitOfEverythingNested" + } }, - "uuid": { + "nonConventionalNameValue": { "type": "string", "format": "string" + }, + "timestamp_value": { + "type": "string", + "format": "date-time" } }, "title": "Intentionaly complicated message type to cover much features of Protobuf.\nNEXT ID: 27" diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index b81c4c05635..d2a4cb7b398 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -62,7 +62,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, schemaCore: schemaCore{ Type: "object", }, - Properties: make(map[string]swaggerSchemaObject), + Properties: make(swaggerSchemaObjectProperties, 0), } msgComments := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index)) if err := updateSwaggerDataFromComments(&schema, msgComments); err != nil { @@ -78,7 +78,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, panic(err) } - schema.Properties[f.GetName()] = fieldValue + schema.Properties = append(schema.Properties, keyVal{f.GetName(), fieldValue}) } d[fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)] = schema } diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index b91e457c006..662c7ab3b86 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -1,6 +1,9 @@ package genswagger import ( + "bytes" + "encoding/json" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) @@ -116,13 +119,44 @@ type swaggerResponseObject struct { Schema swaggerSchemaObject `json:"schema"` } +type keyVal struct { + Key string + Value interface{} +} + +type swaggerSchemaObjectProperties []keyVal + +func (op swaggerSchemaObjectProperties) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + buf.WriteString("{") + for i, kv := range op { + if i != 0 { + buf.WriteString(",") + } + key, err := json.Marshal(kv.Key) + if err != nil { + return nil, err + } + buf.Write(key) + buf.WriteString(":") + val, err := json.Marshal(kv.Value) + if err != nil { + return nil, err + } + buf.Write(val) + } + + buf.WriteString("}") + return buf.Bytes(), nil +} + // http://swagger.io/specification/#schemaObject type swaggerSchemaObject struct { schemaCore // Properties can be recursively defined - Properties map[string]swaggerSchemaObject `json:"properties,omitempty"` - AdditionalProperties *swaggerSchemaObject `json:"additionalProperties,omitempty"` - Items *swaggerItemsObject `json:"items,omitempty"` + Properties swaggerSchemaObjectProperties `json:"properties,omitempty"` + AdditionalProperties *swaggerSchemaObject `json:"additionalProperties,omitempty"` + Items *swaggerItemsObject `json:"items,omitempty"` // If the item is an enumeration include a list of all the *NAMES* of the // enum values. I'm not sure how well this will work but assuming all enums From 230fb06088bc9673266970d011d5d132f6899a15 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 22 Nov 2016 20:24:55 -0800 Subject: [PATCH 092/552] remove unnecessary make() --- protoc-gen-swagger/genswagger/template.go | 1 - 1 file changed, 1 deletion(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index d2a4cb7b398..72c87330a98 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -62,7 +62,6 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, schemaCore: schemaCore{ Type: "object", }, - Properties: make(swaggerSchemaObjectProperties, 0), } msgComments := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index)) if err := updateSwaggerDataFromComments(&schema, msgComments); err != nil { From 8884ef958456136696cf2c1c0488d84d5509d478 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 27 Nov 2016 16:16:40 -0800 Subject: [PATCH 093/552] protoc-gen-swagger/genswagger: add PATCH support (#228, #268) Fixes: #211 --- protoc-gen-swagger/genswagger/template.go | 3 +++ protoc-gen-swagger/genswagger/types.go | 1 + 2 files changed, 4 insertions(+) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 72c87330a98..d360dff63ba 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -445,6 +445,9 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re case "PUT": pathItemObject.Put = operationObject break + case "PATCH": + pathItemObject.Patch = operationObject + break } paths[templateToSwaggerPath(b.PathTmpl.Template)] = pathItemObject } diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 662c7ab3b86..80b684475cc 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -69,6 +69,7 @@ type swaggerPathItemObject struct { Delete *swaggerOperationObject `json:"delete,omitempty"` Post *swaggerOperationObject `json:"post,omitempty"` Put *swaggerOperationObject `json:"put,omitempty"` + Patch *swaggerOperationObject `json:"patch,omitempty"` } // http://swagger.io/specification/#operationObject From 506f75f7fd3ff47c9c4ce745c181e164bc039246 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 27 Nov 2016 16:18:23 -0800 Subject: [PATCH 094/552] describe default marshaler in README.md (#266) * add note about default marshaler * note the default marshaler/unmarhsaler --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 718047f3234..f5629b1f341 100644 --- a/README.md +++ b/README.md @@ -204,7 +204,7 @@ To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRP * Method parameters in request body * Method parameters in request path * Method parameters in query string -* Mapping streaming APIs to JSON streams +* Mapping streaming APIs to newline-delimited JSON streams * Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata * Optionally emitting API definition for [Swagger](http://swagger.io). * Setting [gRPC timeouts](http://www.grpc.io/docs/guides/wire.html) through inbound HTTP `Grpc-Timeout` header. @@ -229,6 +229,7 @@ But patch is welcome. * HTTP request host is added as `X-Forwarded-Host` gRPC request header * HTTP `Authorization` header is added as `authorization` gRPC request header * Remaining HTTP header keys are prefixed with `Grpc-Metadata-` and added with their values to gRPC request header +* While configurable, the default {un,}marshaling uses [jsonpb](https://godoc.org/github.com/golang/protobuf/jsonpb) with `OrigName: true`. # Contribution See [CONTRIBUTING.md](http://github.com/grpc-ecosystem/grpc-gateway/blob/master/CONTRIBUTING.md). From 4ec43642da561e0565df260ca84c57b995ef3271 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 27 Nov 2016 16:20:07 -0800 Subject: [PATCH 095/552] Allow methods with no bindings. Fixes #263 (#267) --- examples/examplepb/a_bit_of_everything.pb.go | 186 +++++++++++------- examples/examplepb/a_bit_of_everything.proto | 1 + examples/server/a_bit_of_everything.go | 4 + .../descriptor/services.go | 11 +- 4 files changed, 121 insertions(+), 81 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index d8e32353aec..b95a833e486 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -444,6 +444,7 @@ type ABitOfEverythingServiceClient interface { Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) + NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } @@ -518,6 +519,15 @@ func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *AB return out, nil } +func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", in, out, c.cc, opts...) @@ -537,6 +547,7 @@ type ABitOfEverythingServiceServer interface { Delete(context.Context, *sub2.IdMessage) (*google_protobuf1.Empty, error) Echo(context.Context, *grpc_gateway_examples_sub.StringMessage) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) + NoBindings(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) Timeout(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) } @@ -670,6 +681,24 @@ func _ABitOfEverythingService_DeepPathEcho_Handler(srv interface{}, ctx context. return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_NoBindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf1.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, req.(*google_protobuf1.Empty)) + } + return interceptor(ctx, in, info, handler) +} + func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(google_protobuf1.Empty) if err := dec(in); err != nil { @@ -720,6 +749,10 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "DeepPathEcho", Handler: _ABitOfEverythingService_DeepPathEcho_Handler, }, + { + MethodName: "NoBindings", + Handler: _ABitOfEverythingService_NoBindings_Handler, + }, { MethodName: "Timeout", Handler: _ABitOfEverythingService_Timeout_Handler, @@ -732,80 +765,81 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1198 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0xcb, 0x6e, 0xdb, 0x46, - 0x17, 0xf6, 0x48, 0xb6, 0x6c, 0x1d, 0x5a, 0xb2, 0x3c, 0x8e, 0x1d, 0x45, 0xfe, 0x7f, 0x88, 0x55, - 0xda, 0x82, 0x70, 0x0d, 0x12, 0x96, 0x83, 0x22, 0x31, 0x50, 0x04, 0xbe, 0xa8, 0x70, 0xd1, 0xc4, - 0x4e, 0xe9, 0x24, 0x0b, 0xa3, 0x81, 0x40, 0x49, 0x23, 0x99, 0xb0, 0xc8, 0x21, 0xc8, 0xa1, 0x6a, - 0x41, 0x55, 0x17, 0x5d, 0xf4, 0x05, 0xba, 0xe8, 0x2e, 0x9b, 0x02, 0x45, 0x37, 0x5d, 0x76, 0xdd, - 0x87, 0xe8, 0x1b, 0x14, 0x7d, 0x90, 0x82, 0x33, 0x24, 0x4d, 0xc9, 0x16, 0xe4, 0x0b, 0x90, 0x9d, - 0x66, 0xe6, 0x3b, 0xdf, 0x77, 0x2e, 0x73, 0xce, 0x50, 0xb0, 0x49, 0x2e, 0x0c, 0xcb, 0xe9, 0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, 0xeb, 0x93, 0x62, 0x5a, 0x46, 0x4a, 0x4a, 0x07, 0xbe, - 0xf5, 0x36, 0xd8, 0xc1, 0x1f, 0xc1, 0x62, 0x8b, 0xfa, 0x8d, 0x2e, 0x09, 0x11, 0xb3, 0x32, 0x52, - 0x90, 0x2e, 0x89, 0x3d, 0x01, 0x29, 0x83, 0x64, 0xda, 0xec, 0xf3, 0x27, 0x21, 0x62, 0x4e, 0x46, - 0x4a, 0x5a, 0x07, 0xbe, 0x15, 0x73, 0xf8, 0x49, 0x44, 0x46, 0x46, 0xca, 0xac, 0x2e, 0xf9, 0x09, - 0x88, 0xe0, 0xd8, 0xae, 0x86, 0x88, 0x79, 0x19, 0x29, 0x73, 0x9c, 0x63, 0xbb, 0x2a, 0x00, 0x8f, - 0x21, 0xd7, 0x36, 0x2f, 0x48, 0x2b, 0x26, 0x59, 0x90, 0x91, 0x92, 0xd1, 0x17, 0xc3, 0xcd, 0x51, - 0x50, 0xcc, 0x93, 0x95, 0x91, 0x32, 0x1f, 0x82, 0x22, 0xa6, 0xff, 0x03, 0x34, 0x28, 0xed, 0x86, - 0x08, 0x90, 0x91, 0xb2, 0xa0, 0x67, 0x83, 0x9d, 0xd8, 0x59, 0x8f, 0xb9, 0xa6, 0xdd, 0x09, 0x01, - 0x12, 0xcf, 0xbf, 0x24, 0xf6, 0x46, 0xe2, 0x89, 0x55, 0x72, 0x32, 0x52, 0x72, 0x22, 0x9e, 0x48, - 0xe4, 0x6b, 0x00, 0x62, 0xfb, 0x56, 0x08, 0xc8, 0xcb, 0x48, 0xc9, 0x57, 0x37, 0xa7, 0x56, 0xeb, - 0xc8, 0xb7, 0x88, 0x6b, 0x36, 0x6b, 0xb6, 0x6f, 0xe9, 0xd9, 0xc0, 0x5e, 0x90, 0x7d, 0x02, 0x79, - 0x6f, 0x34, 0xae, 0x25, 0x19, 0x29, 0x4b, 0x7a, 0xce, 0x1b, 0x09, 0x2c, 0x86, 0xc5, 0x39, 0x2a, - 0xc8, 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x6e, 0x88, 0x7f, 0x42, 0x90, 0x79, 0xe3, 0xb4, 0xee, 0x78, 0x7f, 0x27, 0x3c, 0xa2, 0x95, - 0x2d, 0xee, 0xc5, 0x67, 0xa5, 0x1b, 0x7a, 0x11, 0xa4, 0xc1, 0x80, 0xcc, 0x01, 0xe9, 0x12, 0x46, - 0xae, 0xa6, 0x61, 0x92, 0x4a, 0x18, 0xeb, 0xc6, 0x4d, 0x63, 0xfd, 0x0b, 0xc1, 0x6c, 0xad, 0x79, - 0x46, 0xb1, 0x32, 0x21, 0x52, 0xcf, 0x6f, 0xa8, 0x62, 0xb4, 0x45, 0xd2, 0x37, 0x46, 0x56, 0x9a, - 0xdc, 0x99, 0x77, 0x78, 0x73, 0x9a, 0x33, 0xa4, 0x79, 0x46, 0xb5, 0x81, 0xb8, 0xb8, 0xa7, 0x8f, - 0x2a, 0x05, 0xad, 0x57, 0x8d, 0xf1, 0xc1, 0xd9, 0x8e, 0x18, 0x55, 0xa7, 0x18, 0x5f, 0x39, 0xc2, - 0x7f, 0x22, 0x58, 0x0c, 0x5e, 0x83, 0x57, 0x06, 0x3b, 0xe3, 0x91, 0x7c, 0x98, 0xeb, 0xfc, 0x9c, - 0xc7, 0xf6, 0xac, 0xf2, 0x64, 0x6a, 0xa2, 0x47, 0xfe, 0x99, 0xa8, 0xc1, 0x5b, 0xc9, 0x8b, 0xfb, - 0x16, 0xe6, 0x83, 0xb7, 0x96, 0xfa, 0x0c, 0x4f, 0x28, 0xe6, 0xc4, 0x22, 0xaf, 0x73, 0xed, 0x55, - 0xbc, 0x92, 0x4c, 0x06, 0x13, 0x64, 0x7b, 0xd2, 0x69, 0x36, 0x76, 0xbb, 0x91, 0xe1, 0x96, 0xdb, - 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xf3, 0x9f, 0xf3, 0x1a, 0x0e, 0x00, 0x00, + // 1211 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x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0x82, 0x0e, 0x1c, 0xcc, 0x57, 0xf8, + 0x01, 0xac, 0x0a, 0x53, 0xa1, 0x55, 0xbc, 0x13, 0x54, 0x65, 0x7f, 0x41, 0x17, 0x84, 0x42, 0x04, + 0x7f, 0x07, 0x59, 0xcb, 0x70, 0x42, 0x3f, 0x36, 0x78, 0x87, 0x3c, 0xbb, 0x7a, 0x87, 0xbc, 0x30, + 0x1c, 0xee, 0x6e, 0xdd, 0x66, 0xee, 0x50, 0x5f, 0xb1, 0xc2, 0x25, 0x3e, 0x85, 0x75, 0xcb, 0x70, + 0x9c, 0xe9, 0x78, 0xef, 0x72, 0x9d, 0xfd, 0x6b, 0xe9, 0x38, 0x13, 0xf9, 0x11, 0x82, 0xb7, 0xac, + 0xe9, 0xfd, 0x84, 0xb2, 0xe8, 0xda, 0x50, 0xb9, 0x78, 0x33, 0x65, 0x31, 0x09, 0xce, 0x2b, 0x27, + 0xf6, 0xf1, 0x36, 0x14, 0x6d, 0x6a, 0xef, 0x52, 0x7b, 0x40, 0xec, 0x60, 0x0e, 0x1b, 0xfd, 0x86, + 0x61, 0x89, 0xb6, 0x2f, 0x96, 0x78, 0x63, 0xcc, 0x3c, 0xc7, 0xbb, 0xb0, 0x16, 0xcf, 0xd1, 0xd0, + 0xe3, 0xfb, 0xbc, 0xe2, 0xa5, 0x73, 0x15, 0x7f, 0x15, 0xe1, 0xf4, 0x7c, 0x6c, 0xc2, 0x49, 0x4a, + 0xbf, 0x23, 0xc8, 0x9c, 0x0d, 0x44, 0xdb, 0xb0, 0x48, 0x34, 0x10, 0x83, 0xdf, 0x78, 0x03, 0x32, + 0x86, 0x45, 0x7d, 0x9b, 0x15, 0x53, 0xbc, 0x07, 0xc3, 0x15, 0xfe, 0x16, 0x52, 0xf4, 0x84, 0x4f, + 0xb3, 0x7c, 0x75, 0xe7, 0xba, 0x43, 0x52, 0xdd, 0x23, 0xc4, 0xe1, 0xbd, 0x98, 0xa2, 0x27, 0x95, + 0x32, 0xac, 0x44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, 0x1b, 0x54, 0x63, 0x7c, 0x70, 0xb6, 0x2d, 0x46, 0xd5, 0x11, 0xc6, 0xe7, 0x8e, 0xf0, 0x9f, + 0x08, 0x56, 0x83, 0xd7, 0xe0, 0xa5, 0xc1, 0x8e, 0x79, 0x24, 0xef, 0xe7, 0x3a, 0x3f, 0xe3, 0xb1, + 0x3d, 0xad, 0x3c, 0x9e, 0x9b, 0xe8, 0x89, 0x7f, 0x26, 0x6a, 0xf0, 0x56, 0xf2, 0xe2, 0x7e, 0x09, + 0xd0, 0xa0, 0x35, 0xd3, 0xee, 0x98, 0x76, 0xcf, 0xc3, 0x33, 0xea, 0x39, 0xb3, 0xce, 0x0b, 0xf8, + 0x0d, 0x2c, 0x07, 0x6f, 0x35, 0xf5, 0xd9, 0x95, 0x8d, 0xef, 0x73, 0xdf, 0xef, 0xe0, 0xf5, 0x64, + 0x32, 0x99, 0x20, 0xab, 0x49, 0x47, 0xd9, 0x38, 0xec, 0x56, 0x86, 0x5b, 0x6e, 0xfd, 0x1f, 0x00, + 0x00, 0xff, 0xff, 0xa4, 0x27, 0xe2, 0xd1, 0x5a, 0x0e, 0x00, 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 85b44edfe42..651333549ef 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -115,6 +115,7 @@ service ABitOfEverythingService { body: "*" }; } + rpc NoBindings(google.protobuf.Empty) returns (google.protobuf.Empty) {} rpc Timeout(google.protobuf.Empty) returns (google.protobuf.Empty) { option (google.api.http) = { get: "/v2/example/timeout", diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 8c1badd95ee..88d39bb655c 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -221,6 +221,10 @@ func (s *_ABitOfEverythingServer) DeepPathEcho(ctx context.Context, msg *example return msg, nil } +func (s *_ABitOfEverythingServer) NoBindings(ctx context.Context, msg *empty.Empty) (*empty.Empty, error) { + return nil, nil +} + func (s *_ABitOfEverythingServer) Timeout(ctx context.Context, msg *empty.Empty) (*empty.Empty, error) { select { case <-ctx.Done(): diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index 8f7cb43c669..edf73caf77b 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -31,8 +31,7 @@ func (r *Registry) loadServices(file *File) error { return err } if opts == nil { - glog.V(1).Infof("Skip non-target method: %s.%s", svc.GetName(), md.GetName()) - continue + glog.V(1).Infof("Found non-target method: %s.%s", svc.GetName(), md.GetName()) } meth, err := r.newMethod(svc, md, opts) if err != nil { @@ -104,8 +103,8 @@ func (r *Registry) newMethod(svc *Service, md *descriptor.MethodDescriptorProto, pathTemplate = custom.Path default: - glog.Errorf("No pattern specified in google.api.HttpRule: %s", md.GetName()) - return nil, fmt.Errorf("none of pattern specified") + glog.V(1).Infof("No pattern specified in google.api.HttpRule: %s", md.GetName()) + return nil, nil } parsed, err := httprule.Parse(pathTemplate) @@ -147,7 +146,9 @@ func (r *Registry) newMethod(svc *Service, md *descriptor.MethodDescriptorProto, return nil, err } - meth.Bindings = append(meth.Bindings, b) + if b != nil { + meth.Bindings = append(meth.Bindings, b) + } for i, additional := range opts.GetAdditionalBindings() { if len(additional.AdditionalBindings) > 0 { return nil, fmt.Errorf("additional_binding in additional_binding not allowed: %s.%s", svc.GetName(), meth.GetName()) From bd12fb037544675b560ea44ea55c55ca3da00c59 Mon Sep 17 00:00:00 2001 From: linuxerwang Date: Tue, 29 Nov 2016 16:56:04 -0800 Subject: [PATCH 096/552] Make grpc-gateway support enum fields in path parameter; repeated enum fields are also supported. --- README.md | 3 ++- runtime/query.go | 8 ++++---- runtime/query_test.go | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f5629b1f341..9112eb0eeca 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,7 @@ To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRP * Method parameters in request body * Method parameters in request path * Method parameters in query string +* Enum fields in path parameter (including repeated enum fields). * Mapping streaming APIs to newline-delimited JSON streams * Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata * Optionally emitting API definition for [Swagger](http://swagger.io). @@ -211,7 +212,7 @@ To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRP ### Want to support But not yet. -* bytes and enum fields in path parameter. #5 +* bytes fields in path parameter. #5 * Optionally generating the entrypoint. #8 * `import_path` parameter diff --git a/runtime/query.go b/runtime/query.go index 56a919a52f1..4df7717f2ac 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -62,7 +62,7 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] case reflect.Ptr: if f.IsNil() { m = reflect.New(f.Type().Elem()) - f.Set(m) + f.Set(m.Convert(f.Type())) } m = f.Elem() continue @@ -101,13 +101,13 @@ func populateRepeatedField(f reflect.Value, values []string) error { if !ok { return fmt.Errorf("unsupported field type %s", elemType) } - f.Set(reflect.MakeSlice(f.Type(), len(values), len(values))) + f.Set(reflect.MakeSlice(f.Type(), len(values), len(values)).Convert(f.Type())) for i, v := range values { result := conv.Call([]reflect.Value{reflect.ValueOf(v)}) if err := result[1].Interface(); err != nil { return err.(error) } - f.Index(i).Set(result[0]) + f.Index(i).Set(result[0].Convert(f.Index(i).Type())) } return nil } @@ -121,7 +121,7 @@ func populateField(f reflect.Value, value string) error { if err := result[1].Interface(); err != nil { return err.(error) } - f.Set(result[0]) + f.Set(result[0].Convert(f.Type())) return nil } diff --git a/runtime/query_test.go b/runtime/query_test.go index cf2d4285616..a739b0dda71 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -26,6 +26,8 @@ func TestPopulateParameters(t *testing.T) { "bool_value": {"true"}, "string_value": {"str"}, "repeated_value": {"a", "b", "c"}, + "enum_value": {"1"}, + "repeated_enum": {"1", "2", "0"}, }, filter: utilities.NewDoubleArray(nil), want: &proto3Message{ @@ -38,6 +40,8 @@ func TestPopulateParameters(t *testing.T) { BoolValue: true, StringValue: "str", RepeatedValue: []string{"a", "b", "c"}, + EnumValue: EnumValue_Y, + RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, }, }, { @@ -51,6 +55,8 @@ func TestPopulateParameters(t *testing.T) { "bool_value": {"true"}, "string_value": {"str"}, "repeated_value": {"a", "b", "c"}, + "enum_value": {"1"}, + "repeated_enum": {"1", "2", "0"}, }, filter: utilities.NewDoubleArray(nil), want: &proto2Message{ @@ -63,6 +69,8 @@ func TestPopulateParameters(t *testing.T) { BoolValue: proto.Bool(true), StringValue: proto.String("str"), RepeatedValue: []string{"a", "b", "c"}, + EnumValue: EnumValue_Y, + RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, }, }, { @@ -209,6 +217,8 @@ type proto3Message struct { BoolValue bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` StringValue string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` + EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=api.EnumValue" json:"enum_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=api.EnumValue" json:"repeated_enum,omitempty"` } func (m *proto3Message) Reset() { *m = proto3Message{} } @@ -233,6 +243,8 @@ type proto2Message struct { BoolValue *bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` StringValue *string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` + EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=api.EnumValue" json:"enum_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=api.EnumValue" json:"repeated_enum,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -309,3 +321,11 @@ func (m *proto2Message) GetRepeatedValue() []string { } return nil } + +type EnumValue int32 + +const ( + EnumValue_X EnumValue = 0 + EnumValue_Y EnumValue = 1 + EnumValue_Z EnumValue = 2 +) From ddbe702494bd7d35338022935dfc893712354f4c Mon Sep 17 00:00:00 2001 From: bluehallu Date: Mon, 5 Dec 2016 16:06:11 +0000 Subject: [PATCH 097/552] Fix ruby gen command protoc-gen-grpc-ruby doesn't work in my machine and google points to this readme as the only occurance... --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5629b1f341..c46240b9c2f 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. protoc -I/usr/local/include -I. \ -I$GOPATH/src \ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ - --plugin=protoc-gen-grpc-ruby=grpc_ruby_plugin \ + --plugin=protoc-gen-grpc=grpc_ruby_plugin \ --grpc-ruby_out=. \ path/to/your/service.proto ``` From b29c6fb228f7d6d1586b438b51dfc1272f7dcf05 Mon Sep 17 00:00:00 2001 From: bluehallu Date: Mon, 5 Dec 2016 17:05:22 +0000 Subject: [PATCH 098/552] Mention required dependencies in Readme Importing annotations.proto will produce a dependency in the generated stubs. This requires the relevant import when using the stubs even if the annotations are not actually used at all by anything but the grpc-gateway plugin. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c46240b9c2f..1f194c972f8 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,9 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. --grpc-ruby_out=. \ path/to/your/service.proto ``` - 2. Implement your service + 2. Add the googleapis-common-protos gem (or your language equivalent) as a dependency to your project. + 3. Implement your service + 5. Generate reverse-proxy ```sh From 5c68c138bd7fc5e30904a83065b042c20adaad6e Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Wed, 4 Jan 2017 17:23:20 -0800 Subject: [PATCH 099/552] pin to version before es6ism --- examples/browser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/browser/package.json b/examples/browser/package.json index c78bdcbf0c9..c0f2896d9f8 100644 --- a/examples/browser/package.json +++ b/examples/browser/package.json @@ -17,7 +17,7 @@ "gulp-shell": "^0.5.2", "jasmine": "^2.4.1", "phantomjs": "^2.1.7", - "swagger-client": "^2.1.14", + "swagger-client": "2.1.26", "webpack-stream": "^3.2.0" } } From f205eab1abb6f2c5a257e8d8d10b16f9c2b89875 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Wed, 4 Jan 2017 17:43:18 -0800 Subject: [PATCH 100/552] Bump swagger-client to 2.1.28 for examples/browser --- examples/browser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/browser/package.json b/examples/browser/package.json index c0f2896d9f8..963f4cd6c30 100644 --- a/examples/browser/package.json +++ b/examples/browser/package.json @@ -17,7 +17,7 @@ "gulp-shell": "^0.5.2", "jasmine": "^2.4.1", "phantomjs": "^2.1.7", - "swagger-client": "2.1.26", + "swagger-client": "^2.1.28", "webpack-stream": "^3.2.0" } } From 96d11a4e2455e89b8744cc15177886226a6f9e65 Mon Sep 17 00:00:00 2001 From: Johan Sim Jian An Date: Sat, 7 Jan 2017 13:08:23 +0800 Subject: [PATCH 101/552] Added support for Timestamp in URL. (#281) Add support for google.protobuf.Timestamp in URL --- runtime/query.go | 24 +++++++++++++ runtime/query_test.go | 84 +++++++++++++++++++++++++------------------ 2 files changed, 73 insertions(+), 35 deletions(-) diff --git a/runtime/query.go b/runtime/query.go index 4df7717f2ac..c4b8148967b 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -5,6 +5,7 @@ import ( "net/url" "reflect" "strings" + "time" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/utilities" @@ -113,6 +114,29 @@ func populateRepeatedField(f reflect.Value, values []string) error { } func populateField(f reflect.Value, value string) error { + // Handle well known type + type wkt interface { + XXX_WellKnownType() string + } + if wkt, ok := f.Addr().Interface().(wkt); ok { + switch wkt.XXX_WellKnownType() { + case "Timestamp": + if value == "null" { + f.Field(0).SetInt(0) + f.Field(1).SetInt(0) + return nil + } + + t, err := time.Parse(time.RFC3339Nano, value) + if err != nil { + return fmt.Errorf("bad Timestamp: %v", err) + } + f.Field(0).SetInt(int64(t.Unix())) + f.Field(1).SetInt(int64(t.Nanosecond())) + return nil + } + } + conv, ok := convFromType[f.Kind()] if !ok { return fmt.Errorf("unsupported field type %T", f) diff --git a/runtime/query_test.go b/runtime/query_test.go index a739b0dda71..1fcfef6eef7 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -4,12 +4,23 @@ import ( "net/url" "testing" + "time" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "github.com/golang/protobuf/ptypes/timestamp" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" ) func TestPopulateParameters(t *testing.T) { + timeT := time.Date(2016, time.December, 15, 12, 23, 32, 49, time.UTC) + timeStr := timeT.Format(time.RFC3339Nano) + timePb, err := ptypes.TimestampProto(timeT) + if err != nil { + t.Fatalf("Couldn't setup timestamp in Protobuf format: %v", err) + } + for _, spec := range []struct { values url.Values filter *utilities.DoubleArray @@ -17,31 +28,33 @@ func TestPopulateParameters(t *testing.T) { }{ { values: url.Values{ - "float_value": {"1.5"}, - "double_value": {"2.5"}, - "int64_value": {"-1"}, - "int32_value": {"-2"}, - "uint64_value": {"3"}, - "uint32_value": {"4"}, - "bool_value": {"true"}, - "string_value": {"str"}, - "repeated_value": {"a", "b", "c"}, - "enum_value": {"1"}, - "repeated_enum": {"1", "2", "0"}, + "float_value": {"1.5"}, + "double_value": {"2.5"}, + "int64_value": {"-1"}, + "int32_value": {"-2"}, + "uint64_value": {"3"}, + "uint32_value": {"4"}, + "bool_value": {"true"}, + "string_value": {"str"}, + "repeated_value": {"a", "b", "c"}, + "enum_value": {"1"}, + "repeated_enum": {"1", "2", "0"}, + "timestamp_value": {timeStr}, }, filter: utilities.NewDoubleArray(nil), want: &proto3Message{ - FloatValue: 1.5, - DoubleValue: 2.5, - Int64Value: -1, - Int32Value: -2, - Uint64Value: 3, - Uint32Value: 4, - BoolValue: true, - StringValue: "str", - RepeatedValue: []string{"a", "b", "c"}, - EnumValue: EnumValue_Y, - RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: -1, + Int32Value: -2, + Uint64Value: 3, + Uint32Value: 4, + BoolValue: true, + StringValue: "str", + RepeatedValue: []string{"a", "b", "c"}, + EnumValue: EnumValue_Y, + RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, + TimestampValue: timePb, }, }, { @@ -206,19 +219,20 @@ func TestPopulateParametersWithFilters(t *testing.T) { } type proto3Message struct { - Nested *proto2Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` - NestedNonNull proto2Message `protobuf:"bytes,11,opt,name=nested_non_null" json:"nested_non_null,omitempty"` - FloatValue float32 `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"` - DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value" json:"double_value,omitempty"` - Int64Value int64 `protobuf:"varint,4,opt,name=int64_value" json:"int64_value,omitempty"` - Int32Value int32 `protobuf:"varint,5,opt,name=int32_value" json:"int32_value,omitempty"` - Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value" json:"uint64_value,omitempty"` - Uint32Value uint32 `protobuf:"varint,7,opt,name=uint32_value" json:"uint32_value,omitempty"` - BoolValue bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` - StringValue string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` - RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` - EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=api.EnumValue" json:"enum_value,omitempty"` - RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=api.EnumValue" json:"repeated_enum,omitempty"` + Nested *proto2Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` + NestedNonNull proto2Message `protobuf:"bytes,11,opt,name=nested_non_null" json:"nested_non_null,omitempty"` + FloatValue float32 `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,4,opt,name=int64_value" json:"int64_value,omitempty"` + Int32Value int32 `protobuf:"varint,5,opt,name=int32_value" json:"int32_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value" json:"uint64_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,7,opt,name=uint32_value" json:"uint32_value,omitempty"` + BoolValue bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` + RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` + EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=api.EnumValue" json:"enum_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=api.EnumValue" json:"repeated_enum,omitempty"` + TimestampValue *timestamp.Timestamp `protobuf:"bytes,11,opt,name=timestamp_value" json:"timestamp_value,omitempty"` } func (m *proto3Message) Reset() { *m = proto3Message{} } From 241a93d146bc2b1d1654c6542bd8bae584091234 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sat, 7 Jan 2017 10:28:37 -0800 Subject: [PATCH 102/552] Prevent lack of http bindings from generating non-building output (#286) * Add example service with no bindings to demonstrate bug. * Skip services that have no methods with http bindings --- examples/examplepb/a_bit_of_everything.pb.go | 218 ++++++++++++------ examples/examplepb/a_bit_of_everything.proto | 4 + .../gengateway/template.go | 12 +- 3 files changed, 154 insertions(+), 80 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index b95a833e486..c6cba0d1293 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -762,84 +762,150 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ Metadata: "examples/examplepb/a_bit_of_everything.proto", } +// Client API for AnotherServiceWithNoBindings service + +type AnotherServiceWithNoBindingsClient interface { + NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) +} + +type anotherServiceWithNoBindingsClient struct { + cc *grpc.ClientConn +} + +func NewAnotherServiceWithNoBindingsClient(cc *grpc.ClientConn) AnotherServiceWithNoBindingsClient { + return &anotherServiceWithNoBindingsClient{cc} +} + +func (c *anotherServiceWithNoBindingsClient) NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for AnotherServiceWithNoBindings service + +type AnotherServiceWithNoBindingsServer interface { + NoBindings(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) +} + +func RegisterAnotherServiceWithNoBindingsServer(s *grpc.Server, srv AnotherServiceWithNoBindingsServer) { + s.RegisterService(&_AnotherServiceWithNoBindings_serviceDesc, srv) +} + +func _AnotherServiceWithNoBindings_NoBindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf1.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, req.(*google_protobuf1.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings", + HandlerType: (*AnotherServiceWithNoBindingsServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "NoBindings", + Handler: _AnotherServiceWithNoBindings_NoBindings_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/examplepb/a_bit_of_everything.proto", +} + func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1211 bytes of a gzipped FileDescriptorProto + // 1233 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0xf6, 0x4a, 0xb6, 0x6c, 0x0d, 0x2d, 0x59, 0x59, 0x27, 0x8e, 0xa2, 0xb4, 0x10, 0xab, 0xb4, - 0x05, 0xe1, 0x06, 0x24, 0x22, 0x07, 0x45, 0x62, 0xa0, 0x0d, 0x2c, 0x5b, 0x85, 0x8b, 0x26, 0x72, - 0x4a, 0x27, 0x39, 0x18, 0x0d, 0x04, 0x4a, 0x5a, 0xc9, 0x84, 0x45, 0x2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xc9, 0xc9, 0x48, 0xc9, 0x89, 0x78, 0x22, 0x91, 0x6f, - 0x00, 0x88, 0xed, 0x5b, 0x21, 0x20, 0x2f, 0x23, 0x25, 0x5f, 0x7d, 0x38, 0xb7, 0x5a, 0x0d, 0xdf, - 0x22, 0xae, 0xd9, 0xae, 0xdb, 0xbe, 0xa5, 0x67, 0x03, 0x7b, 0x41, 0xf6, 0x09, 0xe4, 0xbd, 0xc9, - 0xb8, 0xd6, 0x64, 0xa4, 0xac, 0xe9, 0x39, 0x6f, 0x22, 0xb0, 0x18, 0x16, 0xe7, 0xa8, 0x20, 0x23, - 0xa5, 0x10, 0xc1, 0x12, 0xd5, 0xf0, 0x92, 0xde, 0xdf, 0x92, 0x91, 0x72, 0x4b, 0x97, 0xbc, 0x84, - 0xf7, 0x21, 0x24, 0xe6, 0xc1, 0x32, 0x52, 0xb0, 0x80, 0x44, 0x2c, 0x55, 0xb8, 0xe3, 0x12, 0x87, - 0x18, 0x8c, 0x74, 0x9a, 0x13, 0xf9, 0x5a, 0x97, 0xd3, 0x4a, 0x56, 0x5f, 0x8f, 0x0e, 0x0f, 0x13, - 0x79, 0x7b, 0x0a, 0x12, 0xb5, 0x49, 0x30, 0x16, 0x82, 0xae, 0x2d, 0xde, 0xe6, 0xfd, 0xb2, 0xa1, - 0x8a, 0xee, 0x53, 0xa3, 0xee, 0x53, 0xeb, 0xc1, 0xe9, 0xfe, 0x82, 0x0e, 0x1c, 0xcc, 0x57, 0xf8, - 0x01, 0xac, 0x0a, 0x53, 0xa1, 0x55, 0xbc, 0x13, 0x54, 0x65, 0x7f, 0x41, 0x17, 0x84, 0x42, 0x04, - 0x7f, 0x07, 0x59, 0xcb, 0x70, 0x42, 0x3f, 0x36, 0x78, 0x87, 0x3c, 0xbb, 0x7a, 0x87, 0xbc, 0x30, - 0x1c, 0xee, 0x6e, 0xdd, 0x66, 0xee, 0x50, 0x5f, 0xb1, 0xc2, 0x25, 0x3e, 0x85, 0x75, 0xcb, 0x70, - 0x9c, 0xe9, 0x78, 0xef, 0x72, 0x9d, 0xfd, 0x6b, 0xe9, 0x38, 0x13, 0xf9, 0x11, 0x82, 0xb7, 0xac, - 0xe9, 0xfd, 0x84, 0xb2, 0xe8, 0xda, 0x50, 0xb9, 0x78, 0x33, 0x65, 0x31, 0x09, 0xce, 0x2b, 0x27, - 0xf6, 0xf1, 0x36, 0x14, 0x6d, 0x6a, 0xef, 0x52, 0x7b, 0x40, 0xec, 0x60, 0x0e, 0x1b, 0xfd, 0x86, - 0x61, 0x89, 0xb6, 0x2f, 0x96, 0x78, 0x63, 0xcc, 0x3c, 0xc7, 0xbb, 0xb0, 0x16, 0xcf, 0xd1, 0xd0, - 0xe3, 0xfb, 0xbc, 0xe2, 0xa5, 0x73, 0x15, 0x7f, 0x15, 0xe1, 0xf4, 0x7c, 0x6c, 0xc2, 0x49, 0x4a, - 0xbf, 0x23, 0xc8, 0x9c, 0x0d, 0x44, 0xdb, 0xb0, 0x48, 0x34, 0x10, 0x83, 0xdf, 0x78, 0x03, 0x32, - 0x86, 0x45, 0x7d, 0x9b, 0x15, 0x53, 0xbc, 0x07, 0xc3, 0x15, 0xfe, 0x16, 0x52, 0xf4, 0x84, 0x4f, - 0xb3, 0x7c, 0x75, 0xe7, 0xba, 0x43, 0x52, 0xdd, 0x23, 0xc4, 0xe1, 0xbd, 0x98, 0xa2, 0x27, 0x95, - 0x32, 0xac, 0x44, 0x6b, 0x9c, 0x85, 0xa5, 0xaf, 0x76, 0x9e, 0x1f, 0xd6, 0x0b, 0x0b, 0x78, 0x05, - 0x16, 0x5f, 0xe9, 0xaf, 0xeb, 0x05, 0x54, 0x32, 0x21, 0x37, 0x71, 0x75, 0x70, 0x01, 0xd2, 0x27, - 0x64, 0x18, 0xfa, 0x1b, 0xfc, 0xc4, 0x35, 0x58, 0x12, 0x89, 0x48, 0x5d, 0x63, 0x20, 0x08, 0xd3, - 0xed, 0xd4, 0x13, 0x54, 0xda, 0x83, 0x8d, 0x8b, 0x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, 0x77, 0xc6, 0x48, 0x8d, 0x5c, 0xd5, 0xd8, 0xb5, 0x74, 0xa7, 0x47, 0x69, 0x6f, 0x40, 0x34, + 0xc3, 0x31, 0x35, 0xc3, 0xb6, 0x29, 0x33, 0x98, 0x49, 0x6d, 0x4f, 0xb8, 0x97, 0x6e, 0x87, 0x56, + 0xbe, 0x6a, 0xf9, 0x5d, 0x8d, 0x58, 0x0e, 0x1b, 0x85, 0xc6, 0x52, 0x1c, 0x89, 0xe7, 0xb7, 0x34, + 0x8b, 0x78, 0x9e, 0xd1, 0x23, 0x91, 0x63, 0xd2, 0x56, 0x9d, 0x31, 0x96, 0x67, 0x59, 0x99, 0x69, + 0x11, 0x8f, 0x19, 0x96, 0x23, 0x00, 0x95, 0x7f, 0xf2, 0x50, 0xd8, 0xad, 0x99, 0x6c, 0xbf, 0x5b, + 0x8f, 0x13, 0xc2, 0x6f, 0x21, 0xe7, 0x99, 0x76, 0x6f, 0x40, 0x9a, 0x36, 0xf1, 0x18, 0xe9, 0x14, + 0x6f, 0xc9, 0x48, 0x91, 0xaa, 0x8f, 0xd4, 0x05, 0x29, 0xaa, 0xb3, 0x4c, 0x6a, 0x83, 0xfb, 0xeb, + 0xeb, 0x82, 0x4e, 0xac, 0x30, 0x86, 0x65, 0xdf, 0x37, 0x3b, 0x45, 0x24, 0x23, 0x25, 0xab, 0xf3, + 0xdf, 0xf8, 0x25, 0x64, 0x42, 0xad, 0x94, 0x9c, 0xbe, 0x92, 0x56, 0xc8, 0x83, 0xcb, 0x20, 0x75, + 0x07, 0xd4, 0x60, 0xcd, 0xa1, 0x31, 0xf0, 0x49, 0x31, 0x2d, 0x23, 0x25, 0xa5, 0x03, 0xdf, 0x7a, + 0x13, 0xec, 0xe0, 0xff, 0xc3, 0x7a, 0x87, 0xfa, 0xad, 0x01, 0x09, 0x11, 0xcb, 0x32, 0x52, 0x90, + 0x2e, 0x89, 0x3d, 0x01, 0x29, 0x83, 0x64, 0xda, 0xec, 0x93, 0x87, 0x21, 0x62, 0x45, 0x46, 0x4a, + 0x5a, 0x07, 0xbe, 0x15, 0x73, 0xf8, 0x49, 0x44, 0x46, 0x46, 0xca, 0xb2, 0x2e, 0xf9, 0x09, 0x88, + 0xe0, 0x78, 0x50, 0x0d, 0x11, 0xab, 0x32, 0x52, 0x56, 0x38, 0xc7, 0x83, 0xaa, 0x00, 0xdc, 0x85, + 0x5c, 0xd7, 0x3c, 0x26, 0x9d, 0x98, 0x64, 0x4d, 0x46, 0x4a, 0x46, 0x5f, 0x0f, 0x37, 0xa7, 0x41, + 0x31, 0x4f, 0x56, 0x46, 0xca, 0x6a, 0x08, 0x8a, 0x98, 0xfe, 0x07, 0xd0, 0xa2, 0x74, 0x10, 0x22, + 0x40, 0x46, 0xca, 0x9a, 0x9e, 0x0d, 0x76, 0xe2, 0x60, 0x3d, 0xe6, 0x9a, 0x76, 0x2f, 0x04, 0x48, + 0xbc, 0xfe, 0x92, 0xd8, 0x9b, 0xca, 0x27, 0x56, 0xc9, 0xc9, 0x48, 0xc9, 0x89, 0x7c, 0x22, 0x91, + 0x2f, 0x01, 0x88, 0xed, 0x5b, 0x21, 0x20, 0x2f, 0x23, 0x25, 0x5f, 0xbd, 0xb7, 0xb0, 0x5b, 0x0d, + 0xdf, 0x22, 0xae, 0xd9, 0xae, 0xdb, 0xbe, 0xa5, 0x67, 0x03, 0x7f, 0x41, 0xf6, 0x21, 0xe4, 0xbd, + 0xe9, 0xbc, 0x36, 0x64, 0xa4, 0x6c, 0xe8, 0x39, 0x6f, 0x2a, 0xb1, 0x18, 0x16, 0xd7, 0xa8, 0x20, + 0x23, 0xa5, 0x10, 0xc1, 0x12, 0xdd, 0xf0, 0x92, 0xd1, 0x5f, 0x93, 0x91, 0x72, 0x4d, 0x97, 0xbc, + 0x44, 0xf4, 0x21, 0x24, 0xe6, 0xc1, 0x32, 0x52, 0xb0, 0x80, 0x44, 0x2c, 0x55, 0xb8, 0xe1, 0x12, + 0x87, 0x18, 0x8c, 0x74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, 0x2e, 0xc3, 0x3c, 0x95, 0x30, 0xd7, 0xed, 0xf3, 0xe6, 0xfa, 0x27, 0x82, 0xe5, 0x7a, + 0xbb, 0x4f, 0xb1, 0x32, 0x27, 0x53, 0xcf, 0x6f, 0xa9, 0x62, 0xb4, 0x45, 0xd2, 0xe7, 0x46, 0x56, + 0xda, 0x3c, 0x98, 0xb7, 0xf8, 0xde, 0xa2, 0x60, 0x48, 0xbb, 0x4f, 0xb5, 0xb1, 0x38, 0xb8, 0x87, + 0xb7, 0x2a, 0x05, 0x6d, 0x58, 0x8d, 0xf1, 0x81, 0x6d, 0x47, 0x8c, 0xaa, 0x43, 0x8c, 0x4f, 0x99, + 0xf0, 0x1f, 0x08, 0xd6, 0x83, 0xd7, 0xe0, 0xa5, 0xc1, 0xfa, 0x3c, 0x93, 0xf7, 0x73, 0x9c, 0x9f, + 0xf0, 0xdc, 0x1e, 0x57, 0x1e, 0x2e, 0x2c, 0xf4, 0xd4, 0x3f, 0x13, 0x35, 0x78, 0x2b, 0x79, 0x73, + 0x3f, 0x03, 0x68, 0xd0, 0x9a, 0x69, 0x77, 0x4c, 0xbb, 0xe7, 0xe1, 0x39, 0xfd, 0x9c, 0xdb, 0xe7, + 0x25, 0xfc, 0x06, 0x56, 0x83, 0xb7, 0x9a, 0xfa, 0xec, 0xc2, 0xce, 0xb7, 0x79, 0xec, 0x37, 0xf0, + 0x66, 0xb2, 0x98, 0x4c, 0x90, 0x55, 0xbf, 0x85, 0x3b, 0xbb, 0x36, 0x65, 0x7d, 0xe2, 0x86, 0xf3, + 0xfc, 0x6b, 0x93, 0xf5, 0x13, 0x91, 0x5e, 0x31, 0xee, 0x9a, 0x74, 0x98, 0x8d, 0xcb, 0xda, 0xca, + 0x70, 0xf3, 0x83, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x59, 0xdb, 0x5f, 0x3e, 0xba, 0x0e, 0x00, + 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 651333549ef..292803fedd9 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -122,3 +122,7 @@ service ABitOfEverythingService { }; } } + +service AnotherServiceWithNoBindings { + rpc NoBindings(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 3c3da539b95..5a3d914ef16 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -71,22 +71,26 @@ func applyTemplate(p param) (string, error) { if err := headerTemplate.Execute(w, p); err != nil { return "", err } - var methodSeen bool + var targetServices []*descriptor.Service for _, svc := range p.Services { + var methodWithBindingsSeen bool for _, meth := range svc.Methods { glog.V(2).Infof("Processing %s.%s", svc.GetName(), meth.GetName()) - methodSeen = true for _, b := range meth.Bindings { + methodWithBindingsSeen = true if err := handlerTemplate.Execute(w, binding{Binding: b}); err != nil { return "", err } } } + if methodWithBindingsSeen { + targetServices = append(targetServices, svc) + } } - if !methodSeen { + if len(targetServices) == 0 { return "", errNoTargetService } - if err := trailerTemplate.Execute(w, p.Services); err != nil { + if err := trailerTemplate.Execute(w, targetServices); err != nil { return "", err } return w.String(), nil From 6b73ae5898faa4e605bfbbab11222c1c07994e53 Mon Sep 17 00:00:00 2001 From: msample Date: Mon, 9 Jan 2017 14:55:58 -0800 Subject: [PATCH 103/552] add plugin param 'allow_delete_body' (#280) * added plugin parameter 'allow_delete_body' to allow REST mappings for legacy services that inapproriately use HTTP DELETE with body * added comment to pubic registy method so lint doesn't complain * added tests for allow_delete_body both on command line/code-gen-req-param parsing and in registry service generation. Required mild refactoring of protoc-gen-swagger cmd line parsing to make testable * fixed copy paste oops on using param vs global flag.Commandline global * kvvar ignores whitespace & empty string Set() input now * removed protoc-gen-swagger pkg_map cmd line flag and KVVar flag.Value impl from utilities pkg --- .../descriptor/registry.go | 9 ++ .../descriptor/services.go | 2 +- .../descriptor/services_test.go | 101 ++++++++++++++ protoc-gen-swagger/main.go | 67 ++++++--- protoc-gen-swagger/main_test.go | 129 ++++++++++++++++++ 5 files changed, 288 insertions(+), 20 deletions(-) create mode 100644 protoc-gen-swagger/main_test.go diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index f293f555824..123280990d3 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -30,6 +30,9 @@ type Registry struct { // pkgAliases is a mapping from package aliases to package paths in go which are already taken. pkgAliases map[string]string + + // allowDeleteBody permits http delete methods to have a body + allowDeleteBody bool } // NewRegistry returns a new Registry. @@ -260,6 +263,12 @@ func (r *Registry) GetAllFQENs() []string { return keys } +// SetAllowDeleteBody controls whether http delete methods may have a +// body or fail loading if encountered. +func (r *Registry) SetAllowDeleteBody(allow bool) { + r.allowDeleteBody = allow +} + // defaultGoPackageName returns the default go package name to be used for go files generated from "f". // You might need to use an unique alias for the package when you import it. Use ReserveGoPackageAlias to get a unique alias. func defaultGoPackageName(f *descriptor.FileDescriptorProto) string { diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index edf73caf77b..7bd928678f0 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -89,7 +89,7 @@ func (r *Registry) newMethod(svc *Service, md *descriptor.MethodDescriptorProto, case opts.GetDelete() != "": httpMethod = "DELETE" pathTemplate = opts.GetDelete() - if opts.Body != "" { + if opts.Body != "" && !r.allowDeleteBody { return nil, fmt.Errorf("needs request body even though http method is DELETE: %s", md.GetName()) } diff --git a/protoc-gen-grpc-gateway/descriptor/services_test.go b/protoc-gen-grpc-gateway/descriptor/services_test.go index 7b4af4e6898..eda34d4141e 100644 --- a/protoc-gen-grpc-gateway/descriptor/services_test.go +++ b/protoc-gen-grpc-gateway/descriptor/services_test.go @@ -1107,3 +1107,104 @@ func TestResolveFieldPath(t *testing.T) { } } } + +func TestExtractServicesWithDeleteBody(t *testing.T) { + for _, spec := range []struct { + allowDeleteBody bool + expectErr bool + target string + srcs []string + }{ + // body for DELETE, but registry configured to allow it + { + allowDeleteBody: true, + expectErr: false, + target: "path/to/example.proto", + srcs: []string{ + ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "RemoveResource" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + delete: "/v1/example/resource" + body: "string" + > + > + > + > + `, + }, + }, + // body for DELETE, registry configured not to allow it + { + allowDeleteBody: false, + expectErr: true, + target: "path/to/example.proto", + srcs: []string{ + ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "RemoveResource" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + delete: "/v1/example/resource" + body: "string" + > + > + > + > + `, + }, + }, + } { + reg := NewRegistry() + reg.SetAllowDeleteBody(spec.allowDeleteBody) + + var fds []*descriptor.FileDescriptorProto + for _, src := range spec.srcs { + var fd descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &fd); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) + } + reg.loadFile(&fd) + fds = append(fds, &fd) + } + err := reg.loadServices(reg.files[spec.target]) + if spec.expectErr && err == nil { + t.Errorf("loadServices(%q) succeeded; want an error; allowDeleteBody=%v, files=%v", spec.target, spec.allowDeleteBody, spec.srcs) + } + if !spec.expectErr && err != nil { + t.Errorf("loadServices(%q) failed; do not want an error; allowDeleteBody=%v, files=%v", spec.target, spec.allowDeleteBody, spec.srcs) + } + t.Log(err) + } +} diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index fc3a0030a11..db747704e23 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -2,6 +2,7 @@ package main import ( "flag" + "fmt" "io" "io/ioutil" "os" @@ -15,8 +16,9 @@ import ( ) var ( - importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") - file = flag.String("file", "stdin", "where to load data from") + importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") + file = flag.String("file", "stdin", "where to load data from") + allowDeleteBody = flag.Bool("allow_delete_body", false, "unless set, HTTP DELETE methods may not have a body") ) func parseReq(r io.Reader) (*plugin.CodeGeneratorRequest, error) { @@ -50,29 +52,21 @@ func main() { if err != nil { glog.Fatal(err) } + pkgMap := make(map[string]string) if req.Parameter != nil { - for _, p := range strings.Split(req.GetParameter(), ",") { - spec := strings.SplitN(p, "=", 2) - if len(spec) == 1 { - if err := flag.CommandLine.Set(spec[0], ""); err != nil { - glog.Fatalf("Cannot set flag %s", p) - } - continue - } - name, value := spec[0], spec[1] - if strings.HasPrefix(name, "M") { - reg.AddPkgMap(name[1:], value) - continue - } - if err := flag.CommandLine.Set(name, value); err != nil { - glog.Fatalf("Cannot set flag %s", p) - } + err := parseReqParam(req.GetParameter(), flag.CommandLine, pkgMap) + if err != nil { + glog.Fatalf("Error parsing flags: %v", err) } } + reg.SetPrefix(*importPrefix) + reg.SetAllowDeleteBody(*allowDeleteBody) + for k, v := range pkgMap { + reg.AddPkgMap(k, v) + } g := genswagger.New(reg) - reg.SetPrefix(*importPrefix) if err := reg.Load(req); err != nil { emitError(err) return @@ -113,3 +107,38 @@ func emitResp(resp *plugin.CodeGeneratorResponse) { glog.Fatal(err) } } + +// parseReqParam parses a CodeGeneratorRequest parameter and adds the +// extracted values to the given FlagSet and pkgMap. Returns a non-nil +// error if setting a flag failed. +func parseReqParam(param string, f *flag.FlagSet, pkgMap map[string]string) error { + if param == "" { + return nil + } + for _, p := range strings.Split(param, ",") { + spec := strings.SplitN(p, "=", 2) + if len(spec) == 1 { + if spec[0] == "allow_delete_body" { + err := f.Set(spec[0], "true") + if err != nil { + return fmt.Errorf("Cannot set flag %s: %v", p, err) + } + continue + } + err := f.Set(spec[0], "") + if err != nil { + return fmt.Errorf("Cannot set flag %s: %v", p, err) + } + continue + } + name, value := spec[0], spec[1] + if strings.HasPrefix(name, "M") { + pkgMap[name[1:]] = value + continue + } + if err := f.Set(name, value); err != nil { + return fmt.Errorf("Cannot set flag %s: %v", p, err) + } + } + return nil +} diff --git a/protoc-gen-swagger/main_test.go b/protoc-gen-swagger/main_test.go new file mode 100644 index 00000000000..c4d12dd20bd --- /dev/null +++ b/protoc-gen-swagger/main_test.go @@ -0,0 +1,129 @@ +package main + +import ( + "flag" + "reflect" + "testing" +) + +func TestParseReqParam(t *testing.T) { + + f := flag.CommandLine + + // this one must be first - with no leading clearFlags call it + // verifies our expectation of default values as we reset by + // clearFlags + pkgMap := make(map[string]string) + expected := map[string]string{} + err := parseReqParam("", f, pkgMap) + if err != nil { + t.Errorf("Test 0: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 0: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(false, "stdin", "", t, 0) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"} + err = parseReqParam("allow_delete_body,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) + if err != nil { + t.Errorf("Test 1: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 1: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(true, "./foo.pb", "/bar/baz", t, 1) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"} + err = parseReqParam("allow_delete_body=true,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) + if err != nil { + t.Errorf("Test 2: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 2: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(true, "./foo.pb", "/bar/baz", t, 2) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{"a/b/c.proto": "github.com/x/y/z", "f/g/h.proto": "github.com/1/2/3/"} + err = parseReqParam("allow_delete_body=false,Ma/b/c.proto=github.com/x/y/z,Mf/g/h.proto=github.com/1/2/3/", f, pkgMap) + if err != nil { + t.Errorf("Test 3: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 3: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(false, "stdin", "", t, 3) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{} + err = parseReqParam("", f, pkgMap) + if err != nil { + t.Errorf("Test 4: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 4: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(false, "stdin", "", t, 4) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{} + err = parseReqParam("unknown_param=17", f, pkgMap) + if err == nil { + t.Error("Test 5: expected parse error not returned") + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 5: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(false, "stdin", "", t, 5) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{} + err = parseReqParam("Mfoo", f, pkgMap) + if err == nil { + t.Error("Test 6: expected parse error not returned") + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 6: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(false, "stdin", "", t, 6) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{} + err = parseReqParam("allow_delete_body,file,import_prefix", f, pkgMap) + if err != nil { + t.Errorf("Test 7: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 7: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(true, "", "", t, 7) + +} + +func checkFlags(allowDeleteV bool, fileV, importPathV string, t *testing.T, tid int) { + if *importPrefix != importPathV { + t.Errorf("Test %v: import_prefix misparsed, expected '%v', got '%v'", tid, importPathV, *importPrefix) + } + if *file != fileV { + t.Errorf("Test %v: file misparsed, expected '%v', got '%v'", tid, fileV, *file) + } + if *allowDeleteBody != allowDeleteV { + t.Errorf("Test %v: allow_delete_body misparsed, expected '%v', got '%v'", tid, allowDeleteV, *allowDeleteBody) + } +} + +func clearFlags() { + *importPrefix = "" + *file = "stdin" + *allowDeleteBody = false +} From 15d4c6ad446dc6640cca4b105f90041b9399ddb5 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Wed, 11 Jan 2017 07:20:48 -0800 Subject: [PATCH 104/552] Pass permanent HTTP request headers (#252) * Pass Permanent Request Headers * Fix tests and update pr213 --- README.md | 5 ++-- examples/integration_test.go | 8 +++--- runtime/context.go | 50 +++++++++++++++++++++++++++++++++--- runtime/context_test.go | 11 +++++--- 4 files changed, 61 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9112eb0eeca..b303415a1ee 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRP * Method parameters in query string * Enum fields in path parameter (including repeated enum fields). * Mapping streaming APIs to newline-delimited JSON streams -* Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata +* Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata (prefixed with `grpcgateway-`) * Optionally emitting API definition for [Swagger](http://swagger.io). * Setting [gRPC timeouts](http://www.grpc.io/docs/guides/wire.html) through inbound HTTP `Grpc-Timeout` header. @@ -229,7 +229,8 @@ But patch is welcome. * HTTP request source IP is added as `X-Forwarded-For` gRPC request header * HTTP request host is added as `X-Forwarded-Host` gRPC request header * HTTP `Authorization` header is added as `authorization` gRPC request header -* Remaining HTTP header keys are prefixed with `Grpc-Metadata-` and added with their values to gRPC request header +* Remaining Permanent HTTP header keys (as specified by the IANA [here](http://www.iana.org/assignments/message-headers/message-headers.xhtml) are prefixed with `grpcgateway-` and added with their values to gRPC request header +* HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata (prefixed with `grpcgateway-`) * While configurable, the default {un,}marshaling uses [jsonpb](https://godoc.org/github.com/golang/protobuf/jsonpb) with `OrigName: true`. # Contribution diff --git a/examples/integration_test.go b/examples/integration_test.go index ba011497b6a..826fbddc119 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -128,10 +128,10 @@ func testEchoBody(t *testing.T) { } if got, want := resp.Header.Get("Grpc-Metadata-Foo"), "foo1"; got != want { - t.Errorf("Grpc-Header-Foo was %q, wanted %q", got, want) + t.Errorf("Grpc-Metadata-Foo was %q, wanted %q", got, want) } if got, want := resp.Header.Get("Grpc-Metadata-Bar"), "bar1"; got != want { - t.Errorf("Grpc-Header-Bar was %q, wanted %q", got, want) + t.Errorf("Grpc-Metadata-Bar was %q, wanted %q", got, want) } if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want { @@ -369,7 +369,7 @@ func testABEBulkCreate(t *testing.T) { } if got, want := resp.Header.Get("Grpc-Metadata-Count"), fmt.Sprintf("%d", count); got != want { - t.Errorf("Grpc-Header-Count was %q, wanted %q", got, want) + t.Errorf("Grpc-Metadata-Count was %q, wanted %q", got, want) } if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want { @@ -518,7 +518,7 @@ func testABEList(t *testing.T) { value := resp.Header.Get("Grpc-Metadata-Count") if value == "" { - t.Errorf("Grpc-Header-Count should not be empty") + t.Errorf("Grpc-Metadata-Count should not be empty") } count, err := strconv.Atoi(value) diff --git a/runtime/context.go b/runtime/context.go index f248c738b23..98eeb44c9a1 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -15,12 +15,17 @@ import ( "google.golang.org/grpc/metadata" ) -// MetadataHeaderPrefix is prepended to HTTP headers in order to convert them to -// gRPC metadata for incoming requests processed by grpc-gateway +// MetadataHeaderPrefix is the http prefix that represents custom metadata +// parameters to or from a gRPC call. const MetadataHeaderPrefix = "Grpc-Metadata-" + +// MetadataPrefix is the prefix for grpc-gateway supplied custom metadata fields. +const MetadataPrefix = "grpcgateway-" + // MetadataTrailerPrefix is prepended to gRPC metadata as it is converted to // HTTP headers in a response handled by grpc-gateway const MetadataTrailerPrefix = "Grpc-Trailer-" + const metadataGrpcTimeout = "Grpc-Timeout" const xForwardedFor = "X-Forwarded-For" @@ -52,8 +57,12 @@ func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, e for key, vals := range req.Header { for _, val := range vals { - if key == "Authorization" { + // For backwards-compatibility, pass through 'authorization' header with no prefix. + if strings.ToLower(key) == "authorization" { pairs = append(pairs, "authorization", val) + } + if isPermanentHTTPHeader(key) { + pairs = append(pairs, strings.ToLower(fmt.Sprintf("%s%s", MetadataPrefix, key)), val) continue } if strings.HasPrefix(key, MetadataHeaderPrefix) { @@ -141,3 +150,38 @@ func timeoutUnitToDuration(u uint8) (d time.Duration, ok bool) { } return } + +// isPermanentHTTPHeader checks whether hdr belongs to the list of +// permenant request headers maintained by IANA. +// http://www.iana.org/assignments/message-headers/message-headers.xml +func isPermanentHTTPHeader(hdr string) bool { + switch hdr { + case + "Accept", + "Accept-Charset", + "Accept-Language", + "Accept-Ranges", + "Authorization", + "Cache-Control", + "Content-Type", + "Cookie", + "Date", + "Expect", + "From", + "Host", + "If-Match", + "If-Modified-Since", + "If-None-Match", + "If-Schedule-Tag-Match", + "If-Unmodified-Since", + "Max-Forwards", + "Origin", + "Pragma", + "Referer", + "User-Agent", + "Via", + "Warning": + return true + } + return false +} diff --git a/runtime/context_test.go b/runtime/context_test.go index abc1873fad9..2f3b02393db 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -51,14 +51,17 @@ func TestAnnotateContext_ForwardsGrpcMetadata(t *testing.T) { return } md, ok := metadata.FromContext(annotated) - if got, want := len(md), emptyForwardMetaCount+3; !ok || got != want { - t.Errorf("Expected %d metadata items in context; got %d", got, want) + if got, want := len(md), emptyForwardMetaCount+4; !ok || got != want { + t.Errorf("metadata items in context = %d want %d: %v", got, want, md) } if got, want := md["foobar"], []string{"Value1"}; !reflect.DeepEqual(got, want) { - t.Errorf(`md["foobar"] = %q; want %q`, got, want) + t.Errorf(`md["grpcgateway-foobar"] = %q; want %q`, got, want) } if got, want := md["foo-baz"], []string{"Value2", "Value3"}; !reflect.DeepEqual(got, want) { - t.Errorf(`md["foo-baz"] = %q want %q`, got, want) + t.Errorf(`md["grpcgateway-foo-baz"] = %q want %q`, got, want) + } + if got, want := md["grpcgateway-authorization"], []string{"Token 1234567890"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["grpcgateway-authorization"] = %q want %q`, got, want) } if got, want := md["authorization"], []string{"Token 1234567890"}; !reflect.DeepEqual(got, want) { t.Errorf(`md["authorization"] = %q want %q`, got, want) From 08776b5b4d3fadc9dc3467271f83ef584d660052 Mon Sep 17 00:00:00 2001 From: Rafael Garcia Date: Fri, 22 Jul 2016 16:53:45 +0000 Subject: [PATCH 105/552] write query parameters to swagger definition addresses #159 --- protoc-gen-swagger/genswagger/template.go | 50 ++++++++ .../genswagger/template_test.go | 118 ++++++++++++++++++ 2 files changed, 168 insertions(+) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index d360dff63ba..653125ae9d2 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -13,6 +13,49 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) +// messageToQueryParameters converts a message to a list of swagger query parameters. +func messageToQueryParameters(message *descriptor.Message, reg *descriptor.Registry, pathParams []descriptor.Parameter) ([]swaggerParameterObject, error) { + var parameters []swaggerParameterObject + var addParameterWithPrefix func(string, *descriptor.Field) error + addParameterWithPrefix = func(prefix string, field *descriptor.Field) error { + // make sure the parameter is not already listed as a path parameter + for _, pathParam := range pathParams { + if pathParam.Target == field { + return nil + } + } + schema := schemaOfField(field, reg) + if schema.Type != "" { + // basic type, add a basic query parameter + parameters = append(parameters, swaggerParameterObject{ + Name: prefix + field.GetName(), + Description: schema.Description, + In: "query", + Type: schema.Type, + }) + return nil + } + + // nested type, recurse + msg, err := reg.LookupMsg("", field.GetTypeName()) + if err != nil { + return fmt.Errorf("unknown message type %s", field.GetTypeName()) + } + for _, nestedField := range msg.Fields { + if err := addParameterWithPrefix(field.GetName()+".", nestedField); err != nil { + return err + } + } + return nil + } + for _, field := range message.Fields { + if err := addParameterWithPrefix("", field); err != nil { + return parameters, err + } + } + return parameters, nil +} + // findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service. func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, e enumMap) { for _, svc := range s { @@ -400,6 +443,13 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re Required: true, Schema: &schema, }) + } else if b.HTTPMethod == "GET" { + // add the parameters to the query string + queryParams, err := messageToQueryParameters(meth.RequestType, reg, b.PathParams) + if err != nil { + return err + } + parameters = append(parameters, queryParams...) } pathItemObject, ok := paths[templateToSwaggerPath(b.PathTmpl.Template)] diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 1c897be8acd..fb18ca9ab29 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -7,6 +7,7 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) @@ -30,6 +31,123 @@ func crossLinkFixture(f *descriptor.File) *descriptor.File { return f } +func TestMessageToQueryParameters(t *testing.T) { + type test struct { + MsgDescs []*protodescriptor.DescriptorProto + Message string + Params []swaggerParameterObject + } + + tests := []test{ + { + MsgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("a"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("b"), + Type: protodescriptor.FieldDescriptorProto_TYPE_DOUBLE.Enum(), + Number: proto.Int32(2), + }, + }, + }, + }, + Message: "ExampleMessage", + Params: []swaggerParameterObject{ + swaggerParameterObject{ + Name: "a", + In: "query", + Required: false, + Type: "string", + }, + swaggerParameterObject{ + Name: "b", + In: "query", + Required: false, + Type: "number", + }, + }, + }, + { + MsgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("nested"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String(".example.Nested"), + Number: proto.Int32(1), + }, + }, + }, + &protodescriptor.DescriptorProto{ + Name: proto.String("Nested"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("a"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + }, + }, + }, + }, + Message: "ExampleMessage", + Params: []swaggerParameterObject{ + swaggerParameterObject{ + Name: "nested.a", + In: "query", + Required: false, + Type: "string", + }, + }, + }, + } + + for _, test := range tests { + reg := descriptor.NewRegistry() + msgs := []*descriptor.Message{} + for _, msgdesc := range test.MsgDescs { + msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{}, + MessageType: test.MsgDescs, + Service: []*protodescriptor.ServiceDescriptorProto{}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: msgs, + } + reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}, + }) + + message, err := reg.LookupMsg("", ".example."+test.Message) + if err != nil { + t.Fatalf("failed to lookup message: %s", err) + } + params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}) + if err != nil { + t.Fatalf("failed to convert message to query parameters: %s", err) + } + if !reflect.DeepEqual(params, test.Params) { + t.Errorf("expected %v, got %v", test.Params, params) + } + } +} + func TestApplyTemplateSimple(t *testing.T) { msgdesc := &protodescriptor.DescriptorProto{ Name: proto.String("ExampleMessage"), From 908753fd0024d4f5c33618aba6f5b7cae7c02b71 Mon Sep 17 00:00:00 2001 From: Rafael Garcia Date: Mon, 25 Jul 2016 18:34:39 +0000 Subject: [PATCH 106/552] regenerate examples --- examples/clients/abe/ABitOfEverythingServiceApi.go | 10 ++++++++-- examples/examplepb/a_bit_of_everything.swagger.json | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/clients/abe/ABitOfEverythingServiceApi.go b/examples/clients/abe/ABitOfEverythingServiceApi.go index eb470763999..975564f4069 100644 --- a/examples/clients/abe/ABitOfEverythingServiceApi.go +++ b/examples/clients/abe/ABitOfEverythingServiceApi.go @@ -354,10 +354,11 @@ func (a ABitOfEverythingServiceApi) Echo (value string) (SubStringMessage, error /** * * + * @param value * @return SubStringMessage */ -//func (a ABitOfEverythingServiceApi) Echo_1 () (SubStringMessage, error) { -func (a ABitOfEverythingServiceApi) Echo_1 () (SubStringMessage, error) { +//func (a ABitOfEverythingServiceApi) Echo_1 (value string) (SubStringMessage, error) { +func (a ABitOfEverythingServiceApi) Echo_1 (value string) (SubStringMessage, error) { _sling := sling.New().Get(a.basePath) @@ -366,6 +367,11 @@ func (a ABitOfEverythingServiceApi) Echo_1 () (SubStringMessage, error) { _sling = _sling.Path(path) + type QueryParams struct { + value string `url:"value,omitempty"` + +} + _sling = _sling.QueryStruct(&QueryParams{ value: value }) // accept header accepts := []string { "application/json" } for key := range accepts { diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 0d9366f7ad9..f7c7f6c9a59 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -312,6 +312,14 @@ } } }, + "parameters": [ + { + "name": "value", + "in": "query", + "required": false, + "type": "string" + } + ], "tags": [ "ABitOfEverythingService" ] From dcac8451eccf2aeb2220c536e585866c2689cf7e Mon Sep 17 00:00:00 2001 From: lipixun Date: Sun, 15 Jan 2017 19:33:12 +0800 Subject: [PATCH 107/552] Convert the first letter of method name to upper --- protoc-gen-grpc-gateway/gengateway/template.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 5a3d914ef16..5b9b8d5f046 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -76,6 +76,8 @@ func applyTemplate(p param) (string, error) { var methodWithBindingsSeen bool for _, meth := range svc.Methods { glog.V(2).Infof("Processing %s.%s", svc.GetName(), meth.GetName()) + methName := strings.Title(*meth.Name) + meth.Name = &methName for _, b := range meth.Bindings { methodWithBindingsSeen = true if err := handlerTemplate.Execute(w, binding{Binding: b}); err != nil { From 668a47a53fd2daed520f68ec8624752e15250ab2 Mon Sep 17 00:00:00 2001 From: Yukinari Toyota Date: Fri, 13 Jan 2017 01:13:25 +0900 Subject: [PATCH 108/552] swagger support enum in query. fix deep nested type handling. refactor. #199 --- .../clients/abe/ABitOfEverythingServiceApi.go | 110 ++++++++ .../clients/abe/ExamplepbABitOfEverything.go | 1 + examples/examplepb/a_bit_of_everything.pb.go | 202 ++++++++------ .../examplepb/a_bit_of_everything.pb.gw.go | 67 +++++ examples/examplepb/a_bit_of_everything.proto | 8 + .../a_bit_of_everything.swagger.json | 256 +++++++++++++++--- examples/examplepb/echo_service.swagger.json | 4 +- examples/server/a_bit_of_everything.go | 13 + protoc-gen-swagger/genswagger/template.go | 197 +++++++++----- .../genswagger/template_test.go | 46 ++++ protoc-gen-swagger/genswagger/types.go | 17 +- 11 files changed, 739 insertions(+), 182 deletions(-) diff --git a/examples/clients/abe/ABitOfEverythingServiceApi.go b/examples/clients/abe/ABitOfEverythingServiceApi.go index 975564f4069..fcc60763608 100644 --- a/examples/clients/abe/ABitOfEverythingServiceApi.go +++ b/examples/clients/abe/ABitOfEverythingServiceApi.go @@ -6,6 +6,7 @@ import ( "encoding/json" "errors" "github.com/dghubble/sling" + "time" ) type ABitOfEverythingServiceApi struct { @@ -474,6 +475,115 @@ func (a ABitOfEverythingServiceApi) Echo_2 (body string) (SubStringMessage, erro return *successPayload, err } +/** + * + * + * @param uuid + * @param singleNestedName name is nested field. + * @param singleNestedAmount + * @param singleNestedOk - FALSE: FALSE is false.\n - TRUE: TRUE is true. + * @param floatValue + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param uint32Value TODO(yugui) add bytes_value. + * @param enumValue - ZERO: ZERO means 0\n - ONE: ONE means 1 + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param repeatedStringValue + * @param oneofString + * @param nonConventionalNameValue + * @param timestampValue + * @param repeatedEnumValue repeated enum value. it is comma-separated in query.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1 + * @return ProtobufEmpty + */ +//func (a ABitOfEverythingServiceApi) GetQuery (uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (ProtobufEmpty, error) { +func (a ABitOfEverythingServiceApi) GetQuery (uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (ProtobufEmpty, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/query/{uuid}" + path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) + + _sling = _sling.Path(path) + + type QueryParams struct { + singleNestedName string `url:"single_nested.name,omitempty"` + singleNestedAmount int64 `url:"single_nested.amount,omitempty"` + singleNestedOk string `url:"single_nested.ok,omitempty"` + floatValue float32 `url:"float_value,omitempty"` + doubleValue float64 `url:"double_value,omitempty"` + int64Value string `url:"int64_value,omitempty"` + uint64Value string `url:"uint64_value,omitempty"` + int32Value int32 `url:"int32_value,omitempty"` + fixed64Value string `url:"fixed64_value,omitempty"` + fixed32Value int64 `url:"fixed32_value,omitempty"` + boolValue bool `url:"bool_value,omitempty"` + stringValue string `url:"string_value,omitempty"` + uint32Value int64 `url:"uint32_value,omitempty"` + enumValue string `url:"enum_value,omitempty"` + sfixed32Value int32 `url:"sfixed32_value,omitempty"` + sfixed64Value string `url:"sfixed64_value,omitempty"` + sint32Value int32 `url:"sint32_value,omitempty"` + sint64Value string `url:"sint64_value,omitempty"` + repeatedStringValue []string `url:"repeated_string_value,omitempty"` + oneofString string `url:"oneof_string,omitempty"` + nonConventionalNameValue string `url:"nonConventionalNameValue,omitempty"` + timestampValue time.Time `url:"timestamp_value,omitempty"` + repeatedEnumValue []string `url:"repeated_enum_value,omitempty"` + +} + _sling = _sling.QueryStruct(&QueryParams{ singleNestedName: singleNestedName,singleNestedAmount: singleNestedAmount,singleNestedOk: singleNestedOk,floatValue: floatValue,doubleValue: doubleValue,int64Value: int64Value,uint64Value: uint64Value,int32Value: int32Value,fixed64Value: fixed64Value,fixed32Value: fixed32Value,boolValue: boolValue,stringValue: stringValue,uint32Value: uint32Value,enumValue: enumValue,sfixed32Value: sfixed32Value,sfixed64Value: sfixed64Value,sint32Value: sint32Value,sint64Value: sint64Value,repeatedStringValue: repeatedStringValue,oneofString: oneofString,nonConventionalNameValue: nonConventionalNameValue,timestampValue: timestampValue,repeatedEnumValue: repeatedEnumValue }) + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ProtobufEmpty) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} /** * * diff --git a/examples/clients/abe/ExamplepbABitOfEverything.go b/examples/clients/abe/ExamplepbABitOfEverything.go index 3440ace1888..2892eb624d9 100644 --- a/examples/clients/abe/ExamplepbABitOfEverything.go +++ b/examples/clients/abe/ExamplepbABitOfEverything.go @@ -31,5 +31,6 @@ type ExamplepbABitOfEverything struct { MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestamp_value,omitempty"` + RepeatedEnumValue []ExamplepbNumericEnum `json:"repeated_enum_value,omitempty"` } diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index c6cba0d1293..964d9ca7d39 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -105,6 +105,8 @@ type ABitOfEverything struct { MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue" json:"nonConventionalNameValue,omitempty"` TimestampValue *google_protobuf2.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` + // repeated enum value. it is comma-separated in query + RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` } func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } @@ -315,6 +317,13 @@ func (m *ABitOfEverything) GetTimestampValue() *google_protobuf2.Timestamp { return nil } +func (m *ABitOfEverything) GetRepeatedEnumValue() []NumericEnum { + if m != nil { + return m.RepeatedEnumValue + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*ABitOfEverything) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _ABitOfEverything_OneofMarshaler, _ABitOfEverything_OneofUnmarshaler, _ABitOfEverything_OneofSizer, []interface{}{ @@ -442,6 +451,7 @@ type ABitOfEverythingServiceClient interface { Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, 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) + GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) @@ -501,6 +511,15 @@ func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdM return out, nil } +func (c *aBitOfEverythingServiceClient) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) { out := new(grpc_gateway_examples_sub.StringMessage) err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", in, out, c.cc, opts...) @@ -545,6 +564,7 @@ type ABitOfEverythingServiceServer interface { Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, error) Update(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error) Delete(context.Context, *sub2.IdMessage) (*google_protobuf1.Empty, error) + GetQuery(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error) Echo(context.Context, *grpc_gateway_examples_sub.StringMessage) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) NoBindings(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) @@ -645,6 +665,24 @@ func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_GetQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverything) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).GetQuery(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).GetQuery(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) +} + func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(grpc_gateway_examples_sub.StringMessage) if err := dec(in); err != nil { @@ -741,6 +779,10 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "Delete", Handler: _ABitOfEverythingService_Delete_Handler, }, + { + MethodName: "GetQuery", + Handler: _ABitOfEverythingService_GetQuery_Handler, + }, { MethodName: "Echo", Handler: _ABitOfEverythingService_Echo_Handler, @@ -829,83 +871,85 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1233 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0xcd, 0x6e, 0xdb, 0x46, - 0x17, 0xf5, 0x48, 0xb6, 0x6c, 0x5d, 0x5a, 0xb2, 0x32, 0x4e, 0x1c, 0x45, 0xc9, 0x07, 0xf1, 0x53, - 0xda, 0x82, 0x70, 0x03, 0x12, 0x51, 0x82, 0x22, 0x31, 0xd0, 0x06, 0x56, 0xa2, 0xc2, 0x45, 0x13, - 0x39, 0xa5, 0x93, 0x14, 0x30, 0x9a, 0x0a, 0x94, 0x34, 0x92, 0x08, 0x8b, 0x1c, 0x82, 0x1c, 0xaa, - 0x16, 0x54, 0x75, 0xd1, 0x45, 0x5f, 0xa0, 0xfb, 0x6c, 0x0a, 0x14, 0xdd, 0x74, 0xd9, 0x75, 0x1f, - 0xa2, 0x8b, 0xee, 0x8b, 0x3e, 0x48, 0xc1, 0x19, 0x92, 0xa6, 0x64, 0x0b, 0xf2, 0x0f, 0x90, 0x9d, - 0x66, 0xee, 0xb9, 0xe7, 0xdc, 0x9f, 0x99, 0x3b, 0x14, 0xdc, 0x23, 0xc7, 0x86, 0xe5, 0x0c, 0x88, - 0xa7, 0x85, 0x3f, 0x9c, 0x96, 0x66, 0x34, 0x5b, 0x26, 0x6b, 0xd2, 0x6e, 0x93, 0x0c, 0x89, 0x3b, - 0x62, 0x7d, 0xd3, 0xee, 0xa9, 0x8e, 0x4b, 0x19, 0xc5, 0xe5, 0x9e, 0xeb, 0xb4, 0xd5, 0x9e, 0xc1, - 0xc8, 0x77, 0xc6, 0x48, 0x8d, 0x5c, 0xd5, 0xd8, 0xb5, 0x74, 0xa7, 0x47, 0x69, 0x6f, 0x40, 0x34, - 0xc3, 0x31, 0x35, 0xc3, 0xb6, 0x29, 0x33, 0x98, 0x49, 0x6d, 0x4f, 0xb8, 0x97, 0x6e, 0x87, 0x56, - 0xbe, 0x6a, 0xf9, 0x5d, 0x8d, 0x58, 0x0e, 0x1b, 0x85, 0xc6, 0x52, 0x1c, 0x89, 0xe7, 0xb7, 0x34, - 0x8b, 0x78, 0x9e, 0xd1, 0x23, 0x91, 0x63, 0xd2, 0x56, 0x9d, 0x31, 0x96, 0x67, 0x59, 0x99, 0x69, - 0x11, 0x8f, 0x19, 0x96, 0x23, 0x00, 0x95, 0x7f, 0xf2, 0x50, 0xd8, 0xad, 0x99, 0x6c, 0xbf, 0x5b, - 0x8f, 0x13, 0xc2, 0x6f, 0x21, 0xe7, 0x99, 0x76, 0x6f, 0x40, 0x9a, 0x36, 0xf1, 0x18, 0xe9, 0x14, - 0x6f, 0xc9, 0x48, 0x91, 0xaa, 0x8f, 0xd4, 0x05, 0x29, 0xaa, 0xb3, 0x4c, 0x6a, 0x83, 0xfb, 0xeb, - 0xeb, 0x82, 0x4e, 0xac, 0x30, 0x86, 0x65, 0xdf, 0x37, 0x3b, 0x45, 0x24, 0x23, 0x25, 0xab, 0xf3, - 0xdf, 0xf8, 0x25, 0x64, 0x42, 0xad, 0x94, 0x9c, 0xbe, 0x92, 0x56, 0xc8, 0x83, 0xcb, 0x20, 0x75, - 0x07, 0xd4, 0x60, 0xcd, 0xa1, 0x31, 0xf0, 0x49, 0x31, 0x2d, 0x23, 0x25, 0xa5, 0x03, 0xdf, 0x7a, - 0x13, 0xec, 0xe0, 0xff, 0xc3, 0x7a, 0x87, 0xfa, 0xad, 0x01, 0x09, 0x11, 0xcb, 0x32, 0x52, 0x90, - 0x2e, 0x89, 0x3d, 0x01, 0x29, 0x83, 0x64, 0xda, 0xec, 0x93, 0x87, 0x21, 0x62, 0x45, 0x46, 0x4a, - 0x5a, 0x07, 0xbe, 0x15, 0x73, 0xf8, 0x49, 0x44, 0x46, 0x46, 0xca, 0xb2, 0x2e, 0xf9, 0x09, 0x88, - 0xe0, 0x78, 0x50, 0x0d, 0x11, 0xab, 0x32, 0x52, 0x56, 0x38, 0xc7, 0x83, 0xaa, 0x00, 0xdc, 0x85, - 0x5c, 0xd7, 0x3c, 0x26, 0x9d, 0x98, 0x64, 0x4d, 0x46, 0x4a, 0x46, 0x5f, 0x0f, 0x37, 0xa7, 0x41, - 0x31, 0x4f, 0x56, 0x46, 0xca, 0x6a, 0x08, 0x8a, 0x98, 0xfe, 0x07, 0xd0, 0xa2, 0x74, 0x10, 0x22, - 0x40, 0x46, 0xca, 0x9a, 0x9e, 0x0d, 0x76, 0xe2, 0x60, 0x3d, 0xe6, 0x9a, 0x76, 0x2f, 0x04, 0x48, - 0xbc, 0xfe, 0x92, 0xd8, 0x9b, 0xca, 0x27, 0x56, 0xc9, 0xc9, 0x48, 0xc9, 0x89, 0x7c, 0x22, 0x91, - 0x2f, 0x01, 0x88, 0xed, 0x5b, 0x21, 0x20, 0x2f, 0x23, 0x25, 0x5f, 0xbd, 0xb7, 0xb0, 0x5b, 0x0d, - 0xdf, 0x22, 0xae, 0xd9, 0xae, 0xdb, 0xbe, 0xa5, 0x67, 0x03, 0x7f, 0x41, 0xf6, 0x21, 0xe4, 0xbd, - 0xe9, 0xbc, 0x36, 0x64, 0xa4, 0x6c, 0xe8, 0x39, 0x6f, 0x2a, 0xb1, 0x18, 0x16, 0xd7, 0xa8, 0x20, - 0x23, 0xa5, 0x10, 0xc1, 0x12, 0xdd, 0xf0, 0x92, 0xd1, 0x5f, 0x93, 0x91, 0x72, 0x4d, 0x97, 0xbc, - 0x44, 0xf4, 0x21, 0x24, 0xe6, 0xc1, 0x32, 0x52, 0xb0, 0x80, 0x44, 0x2c, 0x55, 0xb8, 0x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c, 0x33, 0x32, 0x20, - 0x8c, 0x9c, 0x2e, 0xc3, 0x3c, 0x95, 0x30, 0xd7, 0xed, 0xf3, 0xe6, 0xfa, 0x27, 0x82, 0xe5, 0x7a, - 0xbb, 0x4f, 0xb1, 0x32, 0x27, 0x53, 0xcf, 0x6f, 0xa9, 0x62, 0xb4, 0x45, 0xd2, 0xe7, 0x46, 0x56, - 0xda, 0x3c, 0x98, 0xb7, 0xf8, 0xde, 0xa2, 0x60, 0x48, 0xbb, 0x4f, 0xb5, 0xb1, 0x38, 0xb8, 0x87, - 0xb7, 0x2a, 0x05, 0x6d, 0x58, 0x8d, 0xf1, 0x81, 0x6d, 0x47, 0x8c, 0xaa, 0x43, 0x8c, 0x4f, 0x99, - 0xf0, 0x1f, 0x08, 0xd6, 0x83, 0xd7, 0xe0, 0xa5, 0xc1, 0xfa, 0x3c, 0x93, 0xf7, 0x73, 0x9c, 0x9f, - 0xf0, 0xdc, 0x1e, 0x57, 0x1e, 0x2e, 0x2c, 0xf4, 0xd4, 0x3f, 0x13, 0x35, 0x78, 0x2b, 0x79, 0x73, - 0x3f, 0x03, 0x68, 0xd0, 0x9a, 0x69, 0x77, 0x4c, 0xbb, 0xe7, 0xe1, 0x39, 0xfd, 0x9c, 0xdb, 0xe7, - 0x25, 0xfc, 0x06, 0x56, 0x83, 0xb7, 0x9a, 0xfa, 0xec, 0xc2, 0xce, 0xb7, 0x79, 0xec, 0x37, 0xf0, - 0x66, 0xb2, 0x98, 0x4c, 0x90, 0x55, 0xbf, 0x85, 0x3b, 0xbb, 0x36, 0x65, 0x7d, 0xe2, 0x86, 0xf3, - 0xfc, 0x6b, 0x93, 0xf5, 0x13, 0x91, 0x5e, 0x31, 0xee, 0x9a, 0x74, 0x98, 0x8d, 0xcb, 0xda, 0xca, - 0x70, 0xf3, 0x83, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x59, 0xdb, 0x5f, 0x3e, 0xba, 0x0e, 0x00, - 0x00, + // 1278 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6e, 0xdb, 0x46, + 0x13, 0xf7, 0x4a, 0xb6, 0x2c, 0x8d, 0x24, 0x5b, 0x5e, 0x27, 0x8e, 0xa2, 0xe4, 0x83, 0xf8, 0x29, + 0x6d, 0x41, 0xb8, 0x01, 0x89, 0x28, 0x41, 0x91, 0x18, 0x68, 0x03, 0x2b, 0x51, 0x9b, 0xa2, 0x89, + 0x92, 0xd0, 0x49, 0x0a, 0x18, 0x49, 0x05, 0x4a, 0x5a, 0x49, 0x84, 0x45, 0x2e, 0x4b, 0x2e, 0x55, + 0x0b, 0xaa, 0x7a, 0xe8, 0xa1, 0x97, 0x1e, 0x7b, 0xcf, 0xa5, 0x40, 0xd1, 0x4b, 0x8f, 0x3d, 0xb7, + 0xef, 0xd0, 0x57, 0x68, 0xdf, 0xa3, 0xe0, 0x2e, 0x49, 0x53, 0xb2, 0x05, 0xf9, 0x4f, 0x91, 0x1b, + 0x77, 0x67, 0xe6, 0x37, 0xbf, 0x99, 0xd9, 0x99, 0x5d, 0xc2, 0x4d, 0x72, 0xa8, 0x9b, 0xf6, 0x80, + 0xb8, 0x6a, 0xf0, 0x61, 0xb7, 0x54, 0xbd, 0xd9, 0x32, 0x58, 0x93, 0x76, 0x9b, 0x64, 0x48, 0x9c, + 0x11, 0xeb, 0x1b, 0x56, 0x4f, 0xb1, 0x1d, 0xca, 0x28, 0x2e, 0xf7, 0x1c, 0xbb, 0xad, 0xf4, 0x74, + 0x46, 0xbe, 0xd1, 0x47, 0x4a, 0x68, 0xaa, 0x44, 0xa6, 0xa5, 0xeb, 0x3d, 0x4a, 0x7b, 0x03, 0xa2, + 0xea, 0xb6, 0xa1, 0xea, 0x96, 0x45, 0x99, 0xce, 0x0c, 0x6a, 0xb9, 0xc2, 0xbc, 0x74, 0x2d, 0x90, + 0xf2, 0x55, 0xcb, 0x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0x1c, 0xe3, 0x76, 0x55, 0x28, + 0xdc, 0x80, 0x7c, 0xd7, 0x38, 0x24, 0x9d, 0x08, 0x24, 0x2d, 0x21, 0x39, 0xa5, 0xe5, 0x82, 0xcd, + 0x69, 0xa5, 0x08, 0x27, 0x23, 0x21, 0x79, 0x35, 0x50, 0x0a, 0x91, 0xfe, 0x07, 0xd0, 0xa2, 0x74, + 0x10, 0x68, 0x80, 0x84, 0xe4, 0xb4, 0x96, 0xf1, 0x77, 0x22, 0xb2, 0x2e, 0x73, 0x0c, 0xab, 0x17, + 0x28, 0x64, 0x79, 0xfe, 0xb3, 0x62, 0x6f, 0x2a, 0x9e, 0xc8, 0x4b, 0x5e, 0x42, 0x72, 0x5e, 0xc4, + 0x13, 0x3a, 0xf9, 0x02, 0x80, 0x58, 0x9e, 0x19, 0x28, 0xac, 0x49, 0x48, 0x5e, 0xab, 0xde, 0x5c, + 0x58, 0xad, 0x86, 0x67, 0x12, 0xc7, 0x68, 0xd7, 0x2d, 0xcf, 0xd4, 0x32, 0xbe, 0xbd, 0x00, 0x7b, + 0x1f, 0xd6, 0xdc, 0xe9, 0xb8, 0xd6, 0x25, 0x24, 0xaf, 0x6b, 0x79, 0x77, 0x2a, 0xb0, 0x48, 0x2d, + 0xca, 0x51, 0x41, 0x42, 0x72, 0x21, 0x54, 0x8b, 0x55, 0xc3, 0x8d, 0xb3, 0xdf, 0x90, 0x90, 0xbc, + 0xa1, 0x65, 0xdd, 0x18, 0xfb, 0x40, 0x25, 0xc2, 0xc1, 0x12, 0x92, 0xb1, 0x50, 0x09, 0x51, 0xaa, + 0x70, 0xd9, 0x21, 0x36, 0xd1, 0x19, 0xe9, 0x34, 0xa7, 0xf2, 0xb5, 0x29, 0x25, 0xe5, 0x8c, 0xb6, + 0x19, 0x0a, 0xf7, 0x62, 0x79, 0xbb, 0x07, 0x59, 0x6a, 0x11, 0x7f, 0x2c, 0xf8, 0x5d, 0x5b, 0xbc, + 0xc4, 0xfb, 0x65, 0x4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00, } diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 213f5415fcd..f8f3eabd0fc 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -317,6 +317,41 @@ func request_ABitOfEverythingService_Delete_0(ctx context.Context, marshaler run } +var ( + filter_ABitOfEverythingService_GetQuery_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_ABitOfEverythingService_GetQuery_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 + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uuid"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + } + + protoReq.Uuid, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_GetQuery_0); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + func request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub.StringMessage var metadata runtime.ServerMetadata @@ -584,6 +619,34 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }) + mux.Handle("GET", pattern_ABitOfEverythingService_GetQuery_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_GetQuery_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_GetQuery_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_ABitOfEverythingService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -738,6 +801,8 @@ var ( 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"}, "")) + pattern_ABitOfEverythingService_GetQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "query", "uuid"}, "")) + pattern_ABitOfEverythingService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "echo", "value"}, "")) pattern_ABitOfEverythingService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, "")) @@ -760,6 +825,8 @@ var ( forward_ABitOfEverythingService_Delete_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_GetQuery_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_Echo_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Echo_1 = runtime.ForwardResponseMessage diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 292803fedd9..7ff55a4a0c6 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -58,6 +58,9 @@ message ABitOfEverything { string nonConventionalNameValue = 26; google.protobuf.Timestamp timestamp_value = 27; + + // repeated enum value. it is comma-separated in query + repeated NumericEnum repeated_enum_value = 28; } // NumericEnum is one or zero. @@ -97,6 +100,11 @@ service ABitOfEverythingService { delete: "/v1/example/a_bit_of_everything/{uuid}" }; } + rpc GetQuery(ABitOfEverything) returns (google.protobuf.Empty) { + option (google.api.http) = { + get: "/v1/example/a_bit_of_everything/query/{uuid}" + }; + } rpc Echo(grpc.gateway.examples.sub.StringMessage) returns (grpc.gateway.examples.sub.StringMessage) { option (google.api.http) = { get: "/v1/example/a_bit_of_everything/echo/{value}" diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index f7c7f6c9a59..7f73c164dec 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -57,8 +57,209 @@ "name": "value", "in": "path", "required": true, + "type": "string" + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v1/example/a_bit_of_everything/query/{uuid}": { + "get": { + "operationId": "GetQuery", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + } + }, + "parameters": [ + { + "name": "uuid", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "single_nested.name", + "description": "name is nested field.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "single_nested.amount", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "single_nested.ok", + "description": " - FALSE: FALSE is false.\n - TRUE: TRUE is true.", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "FALSE", + "TRUE" + ], + "default": "FALSE" + }, + { + "name": "float_value", + "in": "query", + "required": false, + "type": "number", + "format": "float" + }, + { + "name": "double_value", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "int64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "uint64_value", + "in": "query", + "required": false, + "type": "string", + "format": "uint64" + }, + { + "name": "int32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "fixed64_value", + "in": "query", + "required": false, + "type": "string", + "format": "uint64" + }, + { + "name": "fixed32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "bool_value", + "in": "query", + "required": false, + "type": "boolean", + "format": "boolean" + }, + { + "name": "string_value", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "uint32_value", + "description": "TODO(yugui) add bytes_value.", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "enum_value", + "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "ZERO", + "ONE" + ], + "default": "ZERO" + }, + { + "name": "sfixed32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "sfixed64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "sint32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "sint64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "repeated_string_value", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + } + }, + { + "name": "oneof_string", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "nonConventionalNameValue", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "timestamp_value", + "in": "query", + "required": false, "type": "string", - "format": "string" + "format": "date-time" + }, + { + "name": "repeated_enum_value", + "description": "repeated enum value. it is comma-separated in query.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + } } ], "tags": [ @@ -138,8 +339,7 @@ "name": "string_value", "in": "path", "required": true, - "type": "string", - "format": "string" + "type": "string" }, { "name": "uint32_value", @@ -180,8 +380,7 @@ "name": "nonConventionalNameValue", "in": "path", "required": true, - "type": "string", - "format": "string" + "type": "string" } ], "tags": [ @@ -205,8 +404,7 @@ "name": "single_nested.name", "in": "path", "required": true, - "type": "string", - "format": "string" + "type": "string" }, { "name": "body", @@ -238,8 +436,7 @@ "name": "uuid", "in": "path", "required": true, - "type": "string", - "format": "string" + "type": "string" } ], "tags": [ @@ -261,8 +458,7 @@ "name": "uuid", "in": "path", "required": true, - "type": "string", - "format": "string" + "type": "string" } ], "tags": [ @@ -284,8 +480,7 @@ "name": "uuid", "in": "path", "required": true, - "type": "string", - "format": "string" + "type": "string" }, { "name": "body", @@ -340,8 +535,7 @@ "in": "body", "required": true, "schema": { - "type": "string", - "format": "string" + "type": "string" } } ], @@ -373,7 +567,6 @@ "properties": { "name": { "type": "string", - "format": "string", "description": "name is nested field." }, "amount": { @@ -402,8 +595,7 @@ "$ref": "#/definitions/ABitOfEverythingNested" }, "uuid": { - "type": "string", - "format": "string" + "type": "string" }, "nested": { "type": "array", @@ -444,8 +636,7 @@ "format": "boolean" }, "string_value": { - "type": "string", - "format": "string" + "type": "string" }, "uint32_value": { "type": "integer", @@ -474,16 +665,14 @@ "repeated_string_value": { "type": "array", "items": { - "type": "string", - "format": "string" + "type": "string" } }, "oneof_empty": { "$ref": "#/definitions/protobufEmpty" }, "oneof_string": { - "type": "string", - "format": "string" + "type": "string" }, "map_value": { "type": "object", @@ -494,8 +683,7 @@ "mapped_string_value": { "type": "object", "additionalProperties": { - "type": "string", - "format": "string" + "type": "string" } }, "mapped_nested_value": { @@ -505,12 +693,18 @@ } }, "nonConventionalNameValue": { - "type": "string", - "format": "string" + "type": "string" }, "timestamp_value": { "type": "string", "format": "date-time" + }, + "repeated_enum_value": { + "type": "array", + "items": { + "$ref": "#/definitions/examplepbNumericEnum" + }, + "title": "repeated enum value. it is comma-separated in query" } }, "title": "Intentionaly complicated message type to cover much features of Protobuf.\nNEXT ID: 27" @@ -533,8 +727,7 @@ "type": "object", "properties": { "uuid": { - "type": "string", - "format": "string" + "type": "string" } } }, @@ -542,8 +735,7 @@ "type": "object", "properties": { "value": { - "type": "string", - "format": "string" + "type": "string" } } } diff --git a/examples/examplepb/echo_service.swagger.json b/examples/examplepb/echo_service.swagger.json index f6c6d8b9814..9380472a3f9 100644 --- a/examples/examplepb/echo_service.swagger.json +++ b/examples/examplepb/echo_service.swagger.json @@ -34,8 +34,7 @@ "name": "id", "in": "path", "required": true, - "type": "string", - "format": "string" + "type": "string" } ], "tags": [ @@ -77,7 +76,6 @@ "properties": { "id": { "type": "string", - "format": "string", "description": "Id represents the message identifier." } }, diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 88d39bb655c..5f48e797419 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -170,6 +170,19 @@ func (s *_ABitOfEverythingServer) Delete(ctx context.Context, msg *sub2.IdMessag return new(empty.Empty), nil } +func (s *_ABitOfEverythingServer) GetQuery(ctx context.Context, msg *examples.ABitOfEverything) (*empty.Empty, error) { + s.m.Lock() + defer s.m.Unlock() + + glog.Info(msg) + if _, ok := s.v[msg.Uuid]; ok { + s.v[msg.Uuid] = msg + } else { + return nil, grpc.Errorf(codes.NotFound, "not found") + } + return new(empty.Empty), nil +} + func (s *_ABitOfEverythingServer) Echo(ctx context.Context, msg *sub.StringMessage) (*sub.StringMessage, error) { s.m.Lock() defer s.m.Unlock() diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 653125ae9d2..022b649fb9b 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -13,47 +13,108 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) +func listEnumNames(enum *descriptor.Enum) (names []string) { + for _, value := range enum.GetValue() { + names = append(names, value.GetName()) + } + return names +} + +func getEnumDefault(enum *descriptor.Enum) string { + for _, value := range enum.GetValue() { + if value.GetNumber() == 0 { + return value.GetName() + } + } + return "" +} + // messageToQueryParameters converts a message to a list of swagger query parameters. -func messageToQueryParameters(message *descriptor.Message, reg *descriptor.Registry, pathParams []descriptor.Parameter) ([]swaggerParameterObject, error) { - var parameters []swaggerParameterObject - var addParameterWithPrefix func(string, *descriptor.Field) error - addParameterWithPrefix = func(prefix string, field *descriptor.Field) error { - // make sure the parameter is not already listed as a path parameter - for _, pathParam := range pathParams { - if pathParam.Target == field { - return nil - } +func messageToQueryParameters(message *descriptor.Message, reg *descriptor.Registry, pathParams []descriptor.Parameter) (params []swaggerParameterObject, err error) { + for _, field := range message.Fields { + p, err := queryParams(message, field, "", reg, pathParams) + if err != nil { + return nil, err } - schema := schemaOfField(field, reg) - if schema.Type != "" { - // basic type, add a basic query parameter - parameters = append(parameters, swaggerParameterObject{ - Name: prefix + field.GetName(), - Description: schema.Description, - In: "query", - Type: schema.Type, - }) - return nil + params = append(params, p...) + } + return params, nil +} + +// queryParams converts a field to a list of swagger query parameters recuresively. +func queryParams(message *descriptor.Message, field *descriptor.Field, prefix string, reg *descriptor.Registry, pathParams []descriptor.Parameter) (params []swaggerParameterObject, err error) { + // make sure the parameter is not already listed as a path parameter + for _, pathParam := range pathParams { + if pathParam.Target == field { + return nil, nil + } + } + schema := schemaOfField(field, reg) + fieldType := field.GetTypeName() + if message.File != nil { + comments := fieldProtoComments(reg, message, field) + if err := updateSwaggerDataFromComments(&schema, comments); err != nil { + return nil, err } + } - // nested type, recurse - msg, err := reg.LookupMsg("", field.GetTypeName()) - if err != nil { - return fmt.Errorf("unknown message type %s", field.GetTypeName()) + isEnum := field.GetType() == pbdescriptor.FieldDescriptorProto_TYPE_ENUM + items := schema.Items + if schema.Type != "" || isEnum { + if schema.Type == "object" { + return nil, nil // TODO: currently, mapping object in query parameter is not supported } - for _, nestedField := range msg.Fields { - if err := addParameterWithPrefix(field.GetName()+".", nestedField); err != nil { - return err + if items != nil && (items.Type == "" || items.Type == "object") && !isEnum { + return nil, nil // TODO: currently, mapping object in query parameter is not supported + } + desc := schema.Description + if schema.Title != "" { // merge title because title of parameter object will be ignored + desc = strings.TrimSpace(schema.Title + ". " + schema.Description) + } + param := swaggerParameterObject{ + Name: prefix + field.GetName(), + Description: desc, + In: "query", + Type: schema.Type, + Items: schema.Items, + Format: schema.Format, + } + if isEnum { + enum, err := reg.LookupEnum("", fieldType) + if err != nil { + return nil, fmt.Errorf("unknown enum type %s", fieldType) + } + if items != nil { // array + param.Items = &swaggerItemsObject{ + Type: "string", + Enum: listEnumNames(enum), + } + } else { + param.Type = "string" + param.Enum = listEnumNames(enum) + param.Default = getEnumDefault(enum) + } + valueComments := enumValueProtoComments(reg, enum) + if valueComments != "" { + param.Description = strings.TrimLeft(param.Description+"\n\n "+valueComments, "\n") } } - return nil + return []swaggerParameterObject{param}, nil } - for _, field := range message.Fields { - if err := addParameterWithPrefix("", field); err != nil { - return parameters, err + + // nested type, recurse + msg, err := reg.LookupMsg("", fieldType) + if err != nil { + return nil, fmt.Errorf("unknown message type %s", fieldType) + } + for _, nestedField := range msg.Fields { + p, err := queryParams(msg, nestedField, prefix+field.GetName()+".", reg, pathParams) + if err != nil { + return nil, err } + params = append(params, p...) } - return parameters, nil + return params, nil } // findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service. @@ -111,12 +172,10 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, panic(err) } - for i, f := range msg.Fields { + for _, f := range msg.Fields { fieldValue := schemaOfField(f, reg) - - fieldProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "Field") - fieldProtoComments := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index), fieldProtoPath, int32(i)) - if err := updateSwaggerDataFromComments(&fieldValue, fieldProtoComments); err != nil { + comments := fieldProtoComments(reg, msg, f) + if err := updateSwaggerDataFromComments(&fieldValue, comments); err != nil { panic(err) } @@ -173,9 +232,9 @@ func schemaOfField(f *descriptor.Field, reg *descriptor.Registry) swaggerSchemaO case array: return swaggerSchemaObject{ schemaCore: schemaCore{ - Type: "array", + Type: "array", + Items: (*swaggerItemsObject)(&core), }, - Items: (*swaggerItemsObject)(&core), } case object: return swaggerSchemaObject{ @@ -218,7 +277,8 @@ func primitiveSchema(t pbdescriptor.FieldDescriptorProto_Type) (ftype, format st case pbdescriptor.FieldDescriptorProto_TYPE_BOOL: return "boolean", "boolean", true case pbdescriptor.FieldDescriptorProto_TYPE_STRING: - return "string", "string", true + // NOTE: in swagger specifition, format should be empty on string type + return "string", "", true case pbdescriptor.FieldDescriptorProto_TYPE_BYTES: return "string", "byte", true case pbdescriptor.FieldDescriptorProto_TYPE_UINT32: @@ -239,35 +299,22 @@ func primitiveSchema(t pbdescriptor.FieldDescriptorProto_Type) (ftype, format st // renderEnumerationsAsDefinition inserts enums into the definitions object. func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { - valueProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.EnumDescriptorProto)(nil)), "Value") for _, enum := range enums { enumComments := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index)) - var enumNames []string // it may be necessary to sort the result of the GetValue function. - var defaultValue string - var valueDescriptions []string - for valueIdx, value := range enum.GetValue() { - enumNames = append(enumNames, value.GetName()) - if defaultValue == "" && value.GetNumber() == 0 { - defaultValue = value.GetName() - } - - valueDescription := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index), valueProtoPath, int32(valueIdx)) - if valueDescription != "" { - valueDescriptions = append(valueDescriptions, value.GetName()+": "+valueDescription) - } - } - - if len(valueDescriptions) > 0 { - enumComments += "\n\n - " + strings.Join(valueDescriptions, "\n - ") + enumNames := listEnumNames(enum) + defaultValue := getEnumDefault(enum) + valueComments := enumValueProtoComments(reg, enum) + if valueComments != "" { + enumComments = strings.TrimLeft(enumComments+"\n\n "+valueComments, "\n") } enumSchemaObject := swaggerSchemaObject{ schemaCore: schemaCore{ - Type: "string", + Type: "string", + Enum: enumNames, + Default: defaultValue, }, - Enum: enumNames, - Default: defaultValue, } if err := updateSwaggerDataFromComments(&enumSchemaObject, enumComments); err != nil { panic(err) @@ -528,7 +575,9 @@ func applyTemplate(p param) (string, error) { // Loops through all the services and their exposed GET/POST/PUT/DELETE definitions // and create entries for all of them. - renderServices(p.Services, s.Paths, p.reg) + if err := renderServices(p.Services, s.Paths, p.reg); err != nil { + panic(err) + } // Find all the service's messages and enumerations that are defined (recursively) and then // write their request and response types out as definition objects. @@ -620,6 +669,32 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er return fmt.Errorf("no description nor summary property") } +func fieldProtoComments(reg *descriptor.Registry, msg *descriptor.Message, field *descriptor.Field) string { + protoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "Field") + for i, f := range msg.Fields { + if f == field { + return protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index), protoPath, int32(i)) + } + } + return "" +} + +func enumValueProtoComments(reg *descriptor.Registry, enum *descriptor.Enum) string { + protoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.EnumDescriptorProto)(nil)), "Value") + var comments []string + for idx, value := range enum.GetValue() { + name := value.GetName() + str := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index), protoPath, int32(idx)) + if str != "" { + comments = append(comments, name+": "+str) + } + } + if len(comments) > 0 { + return "- " + strings.Join(comments, "\n - ") + } + return "" +} + func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []string, typeName string, typeIndex int32, fieldPaths ...int32) string { if file.SourceCodeInfo == nil { // Curious! A file without any source code info. diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index fb18ca9ab29..e0b25c16716 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -70,6 +70,7 @@ func TestMessageToQueryParameters(t *testing.T) { In: "query", Required: false, Type: "number", + Format: "double", }, }, }, @@ -94,7 +95,38 @@ func TestMessageToQueryParameters(t *testing.T) { Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), Number: proto.Int32(1), }, + { + Name: proto.String("deep"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String(".example.Nested.DeepNested"), + Number: proto.Int32(2), + }, }, + NestedType: []*protodescriptor.DescriptorProto{{ + Name: proto.String("DeepNested"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("b"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("c"), + Type: protodescriptor.FieldDescriptorProto_TYPE_ENUM.Enum(), + TypeName: proto.String(".example.Nested.DeepNested.DeepEnum"), + Number: proto.Int32(2), + }, + }, + EnumType: []*protodescriptor.EnumDescriptorProto{ + { + Name: proto.String("DeepEnum"), + Value: []*protodescriptor.EnumValueDescriptorProto{ + {Name: proto.String("FALSE"), Number: proto.Int32(0)}, + {Name: proto.String("TRUE"), Number: proto.Int32(1)}, + }, + }, + }, + }}, }, }, Message: "ExampleMessage", @@ -105,6 +137,20 @@ func TestMessageToQueryParameters(t *testing.T) { Required: false, Type: "string", }, + swaggerParameterObject{ + Name: "nested.deep.b", + In: "query", + Required: false, + Type: "string", + }, + swaggerParameterObject{ + Name: "nested.deep.c", + In: "query", + Required: false, + Type: "string", + Enum: []string{"FALSE", "TRUE"}, + Default: "FALSE", + }, }, }, } diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 80b684475cc..3c6a5c9f0de 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -95,6 +95,8 @@ type swaggerParameterObject struct { Type string `json:"type,omitempty"` Format string `json:"format,omitempty"` Items *swaggerItemsObject `json:"items,omitempty"` + Enum []string `json:"enum,omitempty"` + Default string `json:"default,omitempty"` // Or you can explicitly refer to another type. If this is defined all // other fields should be empty @@ -107,6 +109,14 @@ type schemaCore struct { Type string `json:"type,omitempty"` Format string `json:"format,omitempty"` Ref string `json:"$ref,omitempty"` + + Items *swaggerItemsObject `json:"items,omitempty"` + + // If the item is an enumeration include a list of all the *NAMES* of the + // enum values. I'm not sure how well this will work but assuming all enums + // start from 0 index it will be great. I don't think that is a good assumption. + Enum []string `json:"enum,omitempty"` + Default string `json:"default,omitempty"` } type swaggerItemsObject schemaCore @@ -157,13 +167,6 @@ type swaggerSchemaObject struct { // Properties can be recursively defined Properties swaggerSchemaObjectProperties `json:"properties,omitempty"` AdditionalProperties *swaggerSchemaObject `json:"additionalProperties,omitempty"` - Items *swaggerItemsObject `json:"items,omitempty"` - - // If the item is an enumeration include a list of all the *NAMES* of the - // enum values. I'm not sure how well this will work but assuming all enums - // start from 0 index it will be great. I don't think that is a good assumption. - Enum []string `json:"enum,omitempty"` - Default string `json:"default,omitempty"` Description string `json:"description,omitempty"` Title string `json:"title,omitempty"` From 7db1668df04382ebeaedfe113f199253a80628f4 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Wed, 25 Jan 2017 01:58:37 -0800 Subject: [PATCH 109/552] Add request_context flag to utilize (*http.Request).Context() in handlers (#265) * Add usage of http.Request's Context * add request_context flag Contribution by @kokaz, @tmc and @yugui --- .travis.yml | 5 ++++- Makefile | 7 +++++- README.md | 3 +++ .../gengateway/generator.go | 11 +++++----- .../gengateway/template.go | 22 ++++++++++++++++--- protoc-gen-grpc-gateway/main.go | 5 +++-- 6 files changed, 41 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 61ec5207f5d..daf891232c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,10 +23,13 @@ before_script: - sh -c 'cd examples/browser && npm install' script: - make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" -- if ! go version | grep devel; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi +- if (go version | grep -qv devel) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi - env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... - make lint - sh -c 'cd examples/browser && gulp' env: global: - "PATH=$PATH:$HOME/local/bin" + matrix: + - GATEWAY_PLUGIN_FLAGS= + - GATEWAY_PLUGIN_FLAGS=request_context=true diff --git a/Makefile b/Makefile index 756f678aeaa..01a05855453 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ GATEWAY_PLUGIN_SRC= utilities/doc.go \ protoc-gen-grpc-gateway/httprule/parse.go \ protoc-gen-grpc-gateway/httprule/types.go \ protoc-gen-grpc-gateway/main.go +GATEWAY_PLUGIN_FLAGS?= GOOGLEAPIS_DIR=third_party/googleapis OPTIONS_PROTO=$(GOOGLEAPIS_DIR)/google/api/annotations.proto $(GOOGLEAPIS_DIR)/google/api/http.proto @@ -45,6 +46,10 @@ RUNTIME_PROTO=runtime/internal/stream_chunk.proto 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 +ADDITIONAL_FLAGS= +ifneq "$(GATEWAY_PLUGIN_FLAGS)" "" + ADDITIONAL_FLAGS=,$(GATEWAY_PLUGIN_FLAGS) +endif SWAGGER_EXAMPLES=examples/examplepb/echo_service.proto \ examples/examplepb/a_bit_of_everything.proto EXAMPLES=examples/examplepb/echo_service.proto \ @@ -102,7 +107,7 @@ $(EXAMPLE_DEPSRCS): $(GO_PLUGIN) $(EXAMPLE_DEPS) protoc -I $(PROTOC_INC_PATH) -I. --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP),plugins=grpc:$(OUTPUT_DIR) $(@:.pb.go=.proto) cp $(OUTPUT_DIR)/$(PKG)/$@ $@ || cp $(OUTPUT_DIR)/$@ $@ $(EXAMPLE_GWSRCS): $(GATEWAY_PLUGIN) $(EXAMPLES) - protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GATEWAY_PLUGIN) --grpc-gateway_out=logtostderr=true,$(PKGMAP):. $(EXAMPLES) + protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GATEWAY_PLUGIN) --grpc-gateway_out=logtostderr=true,$(PKGMAP)$(ADDITIONAL_FLAGS):. $(EXAMPLES) $(EXAMPLE_SWAGGERSRCS): $(SWAGGER_PLUGIN) $(SWAGGER_EXAMPLES) protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(SWAGGER_PLUGIN) --swagger_out=logtostderr=true,$(PKGMAP):. $(SWAGGER_EXAMPLES) diff --git a/README.md b/README.md index b303415a1ee..f26381fe543 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,9 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. `protoc-gen-grpc-gateway` supports custom mapping from Protobuf `import` to Golang import path. They are compatible to [the parameters with same names in `protoc-gen-go`](https://github.com/golang/protobuf#parameters). +In addition we also support the `request_context` parameter in order to use the `http.Request`'s Context (only for Go 1.7 and above). +This parameter can be useful to pass request scoped context between the gateway and the gRPC service. + `protoc-gen-grpc-gateway` also supports some more command line flags to control logging. You can give these flags together with parameters above. Run `protoc-gen-grpc-gateway --help` for more details about the flags. ## More Examples diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index b4cce8695eb..44d01187207 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -20,12 +20,13 @@ var ( ) type generator struct { - reg *descriptor.Registry - baseImports []descriptor.GoPackage + reg *descriptor.Registry + baseImports []descriptor.GoPackage + useRequestContext bool } // New returns a new generator which generates grpc gateway files. -func New(reg *descriptor.Registry) gen.Generator { +func New(reg *descriptor.Registry, useRequestContext bool) gen.Generator { var imports []descriptor.GoPackage for _, pkgpath := range []string{ "io", @@ -54,7 +55,7 @@ func New(reg *descriptor.Registry) gen.Generator { } imports = append(imports, pkg) } - return &generator{reg: reg, baseImports: imports} + return &generator{reg: reg, baseImports: imports, useRequestContext: useRequestContext} } func (g *generator) Generate(targets []*descriptor.File) ([]*plugin.CodeGeneratorResponse_File, error) { @@ -107,5 +108,5 @@ func (g *generator) generate(file *descriptor.File) (string, error) { imports = append(imports, pkg) } } - return applyTemplate(param{File: file, Imports: imports}) + return applyTemplate(param{File: file, Imports: imports, UseRequestContext: g.useRequestContext}) } diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 5a3d914ef16..fbd88f6e80d 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -13,7 +13,8 @@ import ( type param struct { *descriptor.File - Imports []descriptor.GoPackage + Imports []descriptor.GoPackage + UseRequestContext bool } type binding struct { @@ -66,6 +67,11 @@ func (f queryParamFilter) String() string { return fmt.Sprintf("&utilities.DoubleArray{Encoding: map[string]int{%s}, Base: %#v, Check: %#v}", e, f.Base, f.Check) } +type trailerParams struct { + Services []*descriptor.Service + UseRequestContext bool +} + func applyTemplate(p param) (string, error) { w := bytes.NewBuffer(nil) if err := headerTemplate.Execute(w, p); err != nil { @@ -90,7 +96,12 @@ func applyTemplate(p param) (string, error) { if len(targetServices) == 0 { return "", errNoTargetService } - if err := trailerTemplate.Execute(w, targetServices); err != nil { + + tp := trailerParams{ + Services: targetServices, + UseRequestContext: p.UseRequestContext, + } + if err := trailerTemplate.Execute(w, tp); err != nil { return "", err } return w.String(), nil @@ -295,7 +306,8 @@ var ( `)) trailerTemplate = template.Must(template.New("trailer").Parse(` -{{range $svc := .}} +{{$UseRequestContext := .UseRequestContext}} +{{range $svc := .Services}} // Register{{$svc.GetName}}HandlerFromEndpoint is same as Register{{$svc.GetName}}Handler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func Register{{$svc.GetName}}HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { @@ -328,7 +340,11 @@ func Register{{$svc.GetName}}Handler(ctx context.Context, mux *runtime.ServeMux, {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + {{- if $UseRequestContext }} + ctx, cancel := context.WithCancel(req.Context()) + {{- else -}} ctx, cancel := context.WithCancel(ctx) + {{- end }} defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 1c01d8756ce..0e2c54f8b26 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -23,7 +23,8 @@ import ( ) var ( - importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") + importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") + useRequestContext = flag.Bool("request_context", false, "determine whether to use http.Request's context or not") ) func parseReq(r io.Reader) (*plugin.CodeGeneratorRequest, error) { @@ -73,7 +74,7 @@ func main() { } } - g := gengateway.New(reg) + g := gengateway.New(reg, *useRequestContext) reg.SetPrefix(*importPrefix) if err := reg.Load(req); err != nil { From 932cfd6f306871d7fa529aa1a688171ca15d81ef Mon Sep 17 00:00:00 2001 From: Maxime Fischer Date: Sat, 11 Feb 2017 15:59:00 +0000 Subject: [PATCH 110/552] Do not add imports for a method when this latter is not exposed by the gateway. --- protoc-gen-grpc-gateway/gengateway/generator.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index 44d01187207..d2218c004bc 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -13,6 +13,7 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" + options "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" ) var ( @@ -98,10 +99,8 @@ func (g *generator) generate(file *descriptor.File) (string, error) { for _, svc := range file.Services { for _, m := range svc.Methods { pkg := m.RequestType.File.GoPkg - if pkg == file.GoPkg { - continue - } - if pkgSeen[pkg.Path] { + if m.Options == nil || !proto.HasExtension(m.Options, options.E_Http) || + pkg == file.GoPkg || pkgSeen[pkg.Path] { continue } pkgSeen[pkg.Path] = true From 2f7bc124a637ea065e6830846b05bbdee1a8addb Mon Sep 17 00:00:00 2001 From: Todd Neal Date: Fri, 17 Feb 2017 12:15:30 -0600 Subject: [PATCH 111/552] enable parsing enums from query parameters - parses enumeration strings and integer values - range checks both the string and integer form Fixes #166 --- runtime/query.go | 53 +++++++++++++++++++++++++++++++++++++++++++ runtime/query_test.go | 26 +++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/runtime/query.go b/runtime/query.go index c4b8148967b..fea54a1d5e2 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -4,6 +4,7 @@ import ( "fmt" "net/url" "reflect" + "strconv" "strings" "time" @@ -98,6 +99,12 @@ func fieldByProtoName(m reflect.Value, name string) reflect.Value { func populateRepeatedField(f reflect.Value, values []string) error { elemType := f.Type().Elem() + + // is the destination field a slice of an enumeration type? + if enumValMap := proto.EnumValueMap(elemType.String()); enumValMap != nil { + return populateFieldEnumRepeated(f, values, enumValMap) + } + conv, ok := convFromType[elemType.Kind()] if !ok { return fmt.Errorf("unsupported field type %s", elemType) @@ -137,6 +144,11 @@ func populateField(f reflect.Value, value string) error { } } + // is the destination field an enumeration type? + if enumValMap := proto.EnumValueMap(f.Type().String()); enumValMap != nil { + return populateFieldEnum(f, value, enumValMap) + } + conv, ok := convFromType[f.Kind()] if !ok { return fmt.Errorf("unsupported field type %T", f) @@ -149,6 +161,47 @@ func populateField(f reflect.Value, value string) error { return nil } +func convertEnum(value string, t reflect.Type, enumValMap map[string]int32) (reflect.Value, error) { + // see if it's an enumeration string + if enumVal, ok := enumValMap[value]; ok { + return reflect.ValueOf(enumVal).Convert(t), nil + } + + // check for an integer that matches an enumeration value + eVal, err := strconv.Atoi(value) + if err != nil { + return reflect.Value{}, fmt.Errorf("%s is not a valid %s", value, t) + } + for _, v := range enumValMap { + if v == int32(eVal) { + return reflect.ValueOf(eVal).Convert(t), nil + } + } + return reflect.Value{}, fmt.Errorf("%s is not a valid %s", value, t) +} + +func populateFieldEnum(f reflect.Value, value string, enumValMap map[string]int32) error { + cval, err := convertEnum(value, f.Type(), enumValMap) + if err != nil { + return err + } + f.Set(cval) + return nil +} + +func populateFieldEnumRepeated(f reflect.Value, values []string, enumValMap map[string]int32) error { + elemType := f.Type().Elem() + f.Set(reflect.MakeSlice(f.Type(), len(values), len(values)).Convert(f.Type())) + for i, v := range values { + result, err := convertEnum(v, elemType, enumValMap) + if err != nil { + return err + } + f.Index(i).Set(result) + } + return nil +} + var ( convFromType = map[reflect.Kind]reflect.Value{ reflect.String: reflect.ValueOf(String), diff --git a/runtime/query_test.go b/runtime/query_test.go index 1fcfef6eef7..ce08976037b 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -57,6 +57,17 @@ func TestPopulateParameters(t *testing.T) { TimestampValue: timePb, }, }, + { + values: url.Values{ + "enum_value": {"EnumValue_Z"}, + "repeated_enum": {"EnumValue_X", "2", "0"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + EnumValue: EnumValue_Z, + RepeatedEnum: []EnumValue{EnumValue_X, EnumValue_Z, EnumValue_X}, + }, + }, { values: url.Values{ "float_value": {"1.5"}, @@ -343,3 +354,18 @@ const ( EnumValue_Y EnumValue = 1 EnumValue_Z EnumValue = 2 ) + +var EnumValue_name = map[int32]string{ + 0: "EnumValue_X", + 1: "EnumValue_Y", + 2: "EnumValue_Z", +} +var EnumValue_value = map[string]int32{ + "EnumValue_X": 0, + "EnumValue_Y": 1, + "EnumValue_Z": 2, +} + +func init() { + proto.RegisterEnum("runtime_test.EnumValue", EnumValue_name, EnumValue_value) +} From 8bbc88c42424aa4619a090a5383b2ae79666d359 Mon Sep 17 00:00:00 2001 From: Maxime Fischer Date: Sat, 18 Feb 2017 14:35:43 +0000 Subject: [PATCH 112/552] Define the version of swagger-codegen to use to make `make test` pass. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dbf0132094b..94983bc97e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ Here's the recommended process of contribution. 4. Make sure that your change follows best practices in Go * [Effective Go](https://golang.org/doc/effective_go.html) * [Go Code Review Comments](https://golang.org/wiki/CodeReviewComments) -5. Make sure that `make test` passes. +5. Make sure that `make test` passes. (use swagger-codegen 2.1.6, not newer versions) 6. Sign [a Contributor License Agreement](https://cla.developers.google.com/clas) 7. Open a pull request in Github From c99b7d63dd7d50e37424057c4605f79cfc10bbe4 Mon Sep 17 00:00:00 2001 From: Maxime Fischer Date: Sat, 18 Feb 2017 14:40:32 +0000 Subject: [PATCH 113/552] Update ABE example to include a method with no bindings that uses an imported package which is not used by any other method. --- examples/clients/abe/ProtobufDuration.go | 10 + examples/examplepb/a_bit_of_everything.pb.go | 181 +++++++++--------- .../examplepb/a_bit_of_everything.pb.gw.go | 1 + examples/examplepb/a_bit_of_everything.proto | 3 +- .../a_bit_of_everything.swagger.json | 16 ++ examples/server/a_bit_of_everything.go | 3 +- 6 files changed, 123 insertions(+), 91 deletions(-) create mode 100644 examples/clients/abe/ProtobufDuration.go diff --git a/examples/clients/abe/ProtobufDuration.go b/examples/clients/abe/ProtobufDuration.go new file mode 100644 index 00000000000..837f298bd91 --- /dev/null +++ b/examples/clients/abe/ProtobufDuration.go @@ -0,0 +1,10 @@ +package abe + +import ( +) + +type ProtobufDuration struct { + Seconds string `json:"seconds,omitempty"` + Nanos int32 `json:"nanos,omitempty"` + +} diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 964d9ca7d39..79af189db91 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -9,9 +9,10 @@ import fmt "fmt" import math "math" import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf2 "github.com/golang/protobuf/ptypes/duration" import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" import sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" -import google_protobuf2 "github.com/golang/protobuf/ptypes/timestamp" +import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp" import ( context "golang.org/x/net/context" @@ -104,7 +105,7 @@ type ABitOfEverything struct { MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue" json:"nonConventionalNameValue,omitempty"` - TimestampValue *google_protobuf2.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` + TimestampValue *google_protobuf3.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` // repeated enum value. it is comma-separated in query RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` } @@ -310,7 +311,7 @@ func (m *ABitOfEverything) GetNonConventionalNameValue() string { return "" } -func (m *ABitOfEverything) GetTimestampValue() *google_protobuf2.Timestamp { +func (m *ABitOfEverything) GetTimestampValue() *google_protobuf3.Timestamp { if m != nil { return m.TimestampValue } @@ -454,7 +455,7 @@ type ABitOfEverythingServiceClient interface { GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) - NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + NoBindings(ctx context.Context, in *google_protobuf2.Duration, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } @@ -538,7 +539,7 @@ func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *AB return out, nil } -func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { +func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *google_protobuf2.Duration, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", in, out, c.cc, opts...) if err != nil { @@ -567,7 +568,7 @@ type ABitOfEverythingServiceServer interface { GetQuery(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error) Echo(context.Context, *grpc_gateway_examples_sub.StringMessage) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) - NoBindings(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) + NoBindings(context.Context, *google_protobuf2.Duration) (*google_protobuf1.Empty, error) Timeout(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) } @@ -720,7 +721,7 @@ func _ABitOfEverythingService_DeepPathEcho_Handler(srv interface{}, ctx context. } func _ABitOfEverythingService_NoBindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(google_protobuf1.Empty) + in := new(google_protobuf2.Duration) if err := dec(in); err != nil { return nil, err } @@ -732,7 +733,7 @@ func _ABitOfEverythingService_NoBindings_Handler(srv interface{}, ctx context.Co FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, req.(*google_protobuf1.Empty)) + return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, req.(*google_protobuf2.Duration)) } return interceptor(ctx, in, info, handler) } @@ -871,85 +872,87 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1278 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6e, 0xdb, 0x46, - 0x13, 0xf7, 0x4a, 0xb6, 0x2c, 0x8d, 0x24, 0x5b, 0x5e, 0x27, 0x8e, 0xa2, 0xe4, 0x83, 0xf8, 0x29, - 0x6d, 0x41, 0xb8, 0x01, 0x89, 0x28, 0x41, 0x91, 0x18, 0x68, 0x03, 0x2b, 0x51, 0x9b, 0xa2, 0x89, - 0x92, 0xd0, 0x49, 0x0a, 0x18, 0x49, 0x05, 0x4a, 0x5a, 0x49, 0x84, 0x45, 0x2e, 0x4b, 0x2e, 0x55, - 0x0b, 0xaa, 0x7a, 0xe8, 0xa1, 0x97, 0x1e, 0x7b, 0xcf, 0xa5, 0x40, 0xd1, 0x4b, 0x8f, 0x3d, 0xb7, - 0xef, 0xd0, 0x57, 0x68, 0xdf, 0xa3, 0xe0, 0x2e, 0x49, 0x53, 0xb2, 0x05, 0xf9, 0x4f, 0x91, 0x1b, - 0x77, 0x67, 0xe6, 0x37, 0xbf, 0x99, 0xd9, 0x99, 0x5d, 0xc2, 0x4d, 0x72, 0xa8, 0x9b, 0xf6, 0x80, - 0xb8, 0x6a, 0xf0, 0x61, 0xb7, 0x54, 0xbd, 0xd9, 0x32, 0x58, 0x93, 0x76, 0x9b, 0x64, 0x48, 0x9c, - 0x11, 0xeb, 0x1b, 0x56, 0x4f, 0xb1, 0x1d, 0xca, 0x28, 0x2e, 0xf7, 0x1c, 0xbb, 0xad, 0xf4, 0x74, - 0x46, 0xbe, 0xd1, 0x47, 0x4a, 0x68, 0xaa, 0x44, 0xa6, 0xa5, 0xeb, 0x3d, 0x4a, 0x7b, 0x03, 0xa2, - 0xea, 0xb6, 0xa1, 0xea, 0x96, 0x45, 0x99, 0xce, 0x0c, 0x6a, 0xb9, 0xc2, 0xbc, 0x74, 0x2d, 0x90, - 0xf2, 0x55, 0xcb,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b, 0x1c, 0xe3, 0x76, 0x55, 0x28, - 0xdc, 0x80, 0x7c, 0xd7, 0x38, 0x24, 0x9d, 0x08, 0x24, 0x2d, 0x21, 0x39, 0xa5, 0xe5, 0x82, 0xcd, - 0x69, 0xa5, 0x08, 0x27, 0x23, 0x21, 0x79, 0x35, 0x50, 0x0a, 0x91, 0xfe, 0x07, 0xd0, 0xa2, 0x74, - 0x10, 0x68, 0x80, 0x84, 0xe4, 0xb4, 0x96, 0xf1, 0x77, 0x22, 0xb2, 0x2e, 0x73, 0x0c, 0xab, 0x17, - 0x28, 0x64, 0x79, 0xfe, 0xb3, 0x62, 0x6f, 0x2a, 0x9e, 0xc8, 0x4b, 0x5e, 0x42, 0x72, 0x5e, 0xc4, - 0x13, 0x3a, 0xf9, 0x02, 0x80, 0x58, 0x9e, 0x19, 0x28, 0xac, 0x49, 0x48, 0x5e, 0xab, 0xde, 0x5c, - 0x58, 0xad, 0x86, 0x67, 0x12, 0xc7, 0x68, 0xd7, 0x2d, 0xcf, 0xd4, 0x32, 0xbe, 0xbd, 0x00, 0x7b, - 0x1f, 0xd6, 0xdc, 0xe9, 0xb8, 0xd6, 0x25, 0x24, 0xaf, 0x6b, 0x79, 0x77, 0x2a, 0xb0, 0x48, 0x2d, - 0xca, 0x51, 0x41, 0x42, 0x72, 0x21, 0x54, 0x8b, 0x55, 0xc3, 0x8d, 0xb3, 0xdf, 0x90, 0x90, 0xbc, - 0xa1, 0x65, 0xdd, 0x18, 0xfb, 0x40, 0x25, 0xc2, 0xc1, 0x12, 0x92, 0xb1, 0x50, 0x09, 0x51, 0xaa, - 0x70, 0xd9, 0x21, 0x36, 0xd1, 0x19, 0xe9, 0x34, 0xa7, 0xf2, 0xb5, 0x29, 0x25, 0xe5, 0x8c, 0xb6, - 0x19, 0x0a, 0xf7, 0x62, 0x79, 0xbb, 0x07, 0x59, 0x6a, 0x11, 0x7f, 0x2c, 0xf8, 0x5d, 0x5b, 0xbc, - 0xc4, 0xfb, 0x65, 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 0x00, + // 1297 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xd8, 0x89, 0x13, 0x3f, 0xc7, 0x89, 0x33, 0x69, 0x53, 0xd7, 0x2d, 0x64, 0x71, 0x01, + 0xad, 0x42, 0xb5, 0xab, 0xba, 0x15, 0x6a, 0x23, 0x41, 0x95, 0x34, 0x86, 0x22, 0xda, 0xb4, 0xdd, + 0xfe, 0x41, 0x8a, 0x5a, 0xac, 0xb5, 0x3d, 0xb6, 0x57, 0xf1, 0xee, 0x2c, 0xbb, 0xb3, 0x26, 0x96, + 0x31, 0x07, 0x0e, 0x5c, 0x38, 0x72, 0xef, 0x05, 0x09, 0x71, 0xe1, 0xc8, 0x19, 0xbe, 0x03, 0x5f, + 0x81, 0x03, 0x1f, 0x03, 0xed, 0xcc, 0xec, 0x76, 0xd7, 0x89, 0xe5, 0x26, 0x45, 0xbd, 0xed, 0xcc, + 0x7b, 0xef, 0xf7, 0x7b, 0x7f, 0xe6, 0xbd, 0x99, 0x85, 0xab, 0xe4, 0xc8, 0xb4, 0xdd, 0x3e, 0xf1, + 0x75, 0xf9, 0xe1, 0x36, 0x75, 0xb3, 0xd1, 0xb4, 0x58, 0x83, 0x76, 0x1a, 0x64, 0x40, 0xbc, 0x21, + 0xeb, 0x59, 0x4e, 0x57, 0x73, 0x3d, 0xca, 0x28, 0xde, 0xec, 0x7a, 0x6e, 0x4b, 0xeb, 0x9a, 0x8c, + 0x7c, 0x6b, 0x0e, 0xb5, 0xc8, 0x54, 0x8b, 0x4d, 0x2b, 0x97, 0xbb, 0x94, 0x76, 0xfb, 0x44, 0x37, + 0x5d, 0x4b, 0x37, 0x1d, 0x87, 0x32, 0x93, 0x59, 0xd4, 0xf1, 0x85, 0x79, 0xe5, 0x92, 0x94, 0xf2, + 0x55, 0x33, 0xe8, 0xe8, 0xc4, 0x76, 0xd9, 0x50, 0x0a, 0xdf, 0x9d, 0x14, 0xb6, 0x03, 0x8f, 0x5b, + 0x4b, 0x79, 0x25, 0xf6, 0xd4, 0x0f, 0x9a, 0xba, 0x4d, 0x7c, 0xdf, 0xec, 0x92, 0x08, 0x38, 0x29, + 0xab, 0x4d, 0x08, 0x37, 0x27, 0x81, 0x99, 0x65, 0x13, 0x9f, 0x99, 0xb6, 0x2b, 0x14, 0xaa, 0x7f, + 0xad, 0x42, 0x69, 0x67, 0xd7, 0x62, 0x0f, 0x3a, 0xf5, 0x38, 0x60, 0xfc, 0x02, 0x8a, 0xbe, 0xe5, + 0x74, 0xfb, 0xa4, 0xe1, 0x10, 0x9f, 0x91, 0x76, 0xf9, 0xa2, 0x82, 0xd4, 0x42, 0xed, 0xa6, 0x36, + 0x23, 0x05, 0xda, 0x24, 0x92, 0xb6, 0xcf, 0xed, 0x8d, 0x65, 0x01, 0x27, 0x56, 0x18, 0xc3, 0x7c, + 0x10, 0x58, 0xed, 0x32, 0x52, 0x90, 0x9a, 0x37, 0xf8, 0x37, 0x7e, 0x08, 0x39, 0xc9, 0x95, 0x51, + 0xb2, 0x6f, 0xc4, 0x25, 0x71, 0xf0, 0x26, 0x14, 0x3a, 0x7d, 0x6a, 0xb2, 0xc6, 0xc0, 0xec, 0x07, + 0xa4, 0x9c, 0x55, 0x90, 0x9a, 0x31, 0x80, 0x6f, 0x3d, 0x0b, 0x77, 0xf0, 0x7b, 0xb0, 0xdc, 0xa6, + 0x41, 0xb3, 0x4f, 0xa4, 0xc6, 0xbc, 0x82, 0x54, 0x64, 0x14, 0xc4, 0x9e, 0x50, 0xd9, 0x84, 0x82, + 0xe5, 0xb0, 0x8f, 0x6f, 0x48, 0x8d, 0x05, 0x05, 0xa9, 0x59, 0x03, 0xf8, 0x56, 0x8c, 0x11, 0x24, + 0x35, 0x72, 0x0a, 0x52, 0xe7, 0x8d, 0x42, 0x90, 0x50, 0x11, 0x18, 0xd7, 0x6b, 0x52, 0x63, 0x51, + 0x41, 0xea, 0x02, 0xc7, 0xb8, 0x5e, 0x13, 0x0a, 0x57, 0xa0, 0xd8, 0xb1, 0x8e, 0x48, 0x3b, 0x06, + 0x59, 0x52, 0x90, 0x9a, 0x33, 0x96, 0xe5, 0x66, 0x5a, 0x29, 0xc6, 0xc9, 0x2b, 0x48, 0x5d, 0x94, + 0x4a, 0x11, 0xd2, 0x3b, 0x00, 0x4d, 0x4a, 0xfb, 0x52, 0x03, 0x14, 0xa4, 0x2e, 0x19, 0xf9, 0x70, + 0x27, 0x76, 0xd6, 0x67, 0x9e, 0xe5, 0x74, 0xa5, 0x42, 0x81, 0xe7, 0xbf, 0x20, 0xf6, 0x52, 0xf1, + 0xc4, 0x2c, 0x45, 0x05, 0xa9, 0x45, 0x11, 0x4f, 0x44, 0xf2, 0x25, 0x00, 0x71, 0x02, 0x5b, 0x2a, + 0xac, 0x28, 0x48, 0x5d, 0xa9, 0x5d, 0x9d, 0x59, 0xad, 0xfd, 0xc0, 0x26, 0x9e, 0xd5, 0xaa, 0x3b, + 0x81, 0x6d, 0xe4, 0x43, 0x7b, 0x01, 0xf6, 0x01, 0xac, 0xf8, 0xe9, 0xb8, 0x56, 0x15, 0xa4, 0xae, + 0x1a, 0x45, 0x3f, 0x15, 0x58, 0xac, 0x16, 0xe7, 0xa8, 0xa4, 0x20, 0xb5, 0x14, 0xa9, 0x25, 0xaa, + 0xe1, 0x27, 0xbd, 0x5f, 0x53, 0x90, 0xba, 0x66, 0x14, 0xfc, 0x84, 0xf7, 0x52, 0x25, 0xc6, 0xc1, + 0x0a, 0x52, 0xb1, 0x50, 0x89, 0x50, 0x6a, 0x70, 0xde, 0x23, 0x2e, 0x31, 0x19, 0x69, 0x37, 0x52, + 0xf9, 0x5a, 0x57, 0xb2, 0x6a, 0xde, 0x58, 0x8f, 0x84, 0x8f, 0x13, 0x79, 0xbb, 0x05, 0x05, 0xea, + 0x90, 0x70, 0x6c, 0x84, 0x5d, 0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0x76, 0x0b, 0x07, 0xf9, 0x38, 0xb3, 0xcd, + 0x1c, 0x17, 0x5f, 0xff, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xab, 0xe5, 0x92, 0x0d, 0xc9, 0x0f, 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 f8f3eabd0fc..7cef435ca11 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -14,6 +14,7 @@ import ( "net/http" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/empty" "github.com/grpc-ecosystem/grpc-gateway/examples/sub" "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 7ff55a4a0c6..91e561e06a8 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -4,6 +4,7 @@ package grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; +import "google/protobuf/duration.proto"; import "examples/sub/message.proto"; import "examples/sub2/message.proto"; import "google/protobuf/timestamp.proto"; @@ -123,7 +124,7 @@ service ABitOfEverythingService { body: "*" }; } - rpc NoBindings(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc NoBindings(google.protobuf.Duration) returns (google.protobuf.Empty) {} rpc Timeout(google.protobuf.Empty) returns (google.protobuf.Empty) { option (google.api.http) = { get: "/v2/example/timeout", diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 7f73c164dec..780d0d9c426 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -718,6 +718,22 @@ "default": "ZERO", "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" }, + "protobufDuration": { + "type": "object", + "properties": { + "seconds": { + "type": "string", + "format": "int64", + "description": "Signed seconds of the span of time. Must be from -315,576,000,000\nto +315,576,000,000 inclusive." + }, + "nanos": { + "type": "integer", + "format": "int32", + "description": "Signed fractions of a second at nanosecond resolution of the span\nof time. Durations less than one second are represented with a 0\n`seconds` field and a positive or negative `nanos` field. For durations\nof one second or more, a non-zero value for the `nanos` field must be\nof the same sign as the `seconds` field. Must be from -999,999,999\nto +999,999,999 inclusive." + } + }, + "description": "A Duration represents a signed, fixed-length span of time represented\nas a count of seconds and fractions of seconds at nanosecond\nresolution. It is independent of any calendar and concepts like \"day\"\nor \"month\". It is related to Timestamp in that the difference between\ntwo Timestamp values is a Duration and it can be added or subtracted\nfrom a Timestamp. Range is approximately +-10,000 years.\n\nExample 1: Compute Duration from two Timestamps in pseudo code.\n\n Timestamp start = ...;\n Timestamp end = ...;\n Duration duration = ...;\n\n duration.seconds = end.seconds - start.seconds;\n duration.nanos = end.nanos - start.nanos;\n\n if (duration.seconds \u003c 0 \u0026\u0026 duration.nanos \u003e 0) {\n duration.seconds += 1;\n duration.nanos -= 1000000000;\n } else if (durations.seconds \u003e 0 \u0026\u0026 duration.nanos \u003c 0) {\n duration.seconds -= 1;\n duration.nanos += 1000000000;\n }\n\nExample 2: Compute Timestamp from Timestamp + Duration in pseudo code.\n\n Timestamp start = ...;\n Duration duration = ...;\n Timestamp end = ...;\n\n end.seconds = start.seconds + duration.seconds;\n end.nanos = start.nanos + duration.nanos;\n\n if (end.nanos \u003c 0) {\n end.seconds -= 1;\n end.nanos += 1000000000;\n } else if (end.nanos \u003e= 1000000000) {\n end.seconds += 1;\n end.nanos -= 1000000000;\n }\n\nExample 3: Compute Duration from datetime.timedelta in Python.\n\n td = datetime.timedelta(days=3, minutes=10)\n duration = Duration()\n duration.FromTimedelta(td)" + }, "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 `{}`.", diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 5f48e797419..07bdcce8ea9 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -6,6 +6,7 @@ import ( "sync" "github.com/golang/glog" + "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/empty" examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" @@ -234,7 +235,7 @@ func (s *_ABitOfEverythingServer) DeepPathEcho(ctx context.Context, msg *example return msg, nil } -func (s *_ABitOfEverythingServer) NoBindings(ctx context.Context, msg *empty.Empty) (*empty.Empty, error) { +func (s *_ABitOfEverythingServer) NoBindings(ctx context.Context, msg *duration.Duration) (*empty.Empty, error) { return nil, nil } From 0588498030bacbf37ec9193b3704c93cfb1e8d3c Mon Sep 17 00:00:00 2001 From: Maxime Fischer Date: Sat, 18 Feb 2017 14:55:40 +0000 Subject: [PATCH 114/552] Change imports so that it uses the right packages. --- .travis.yml | 12 ++++++------ Makefile | 4 ++-- examples/browser/bower.json | 2 +- examples/browser/gulpfile.js | 4 ++-- examples/client_test.go | 4 ++-- examples/examplepb/a_bit_of_everything.pb.go | 6 +++--- examples/examplepb/a_bit_of_everything.pb.gw.go | 9 ++++----- examples/examplepb/echo_service.pb.go | 2 +- examples/examplepb/echo_service.pb.gw.go | 4 ++-- examples/examplepb/flow_combination.pb.go | 2 +- examples/examplepb/flow_combination.pb.gw.go | 4 ++-- examples/examplepb/stream.pb.go | 4 ++-- examples/examplepb/stream.pb.gw.go | 6 +++--- examples/integration_test.go | 6 +++--- examples/main.go | 4 ++-- examples/main_test.go | 2 +- examples/server/a_bit_of_everything.go | 6 +++--- examples/server/cmd/example-server/main.go | 2 +- examples/server/echo.go | 2 +- examples/server/flow_combination.go | 2 +- examples/server/main.go | 2 +- examples/sub2/message.pb.go | 10 +++++----- examples/sub2/message.proto | 2 +- protoc-gen-grpc-gateway/descriptor/services.go | 4 ++-- protoc-gen-grpc-gateway/descriptor/services_test.go | 2 +- protoc-gen-grpc-gateway/descriptor/types.go | 2 +- protoc-gen-grpc-gateway/descriptor/types_test.go | 6 +++--- protoc-gen-grpc-gateway/generator/generator.go | 2 +- protoc-gen-grpc-gateway/gengateway/generator.go | 10 +++++----- protoc-gen-grpc-gateway/gengateway/template.go | 4 ++-- protoc-gen-grpc-gateway/gengateway/template_test.go | 4 ++-- protoc-gen-grpc-gateway/httprule/compile.go | 2 +- protoc-gen-grpc-gateway/httprule/compile_test.go | 2 +- protoc-gen-grpc-gateway/main.go | 4 ++-- protoc-gen-swagger/genswagger/generator.go | 4 ++-- protoc-gen-swagger/genswagger/template.go | 2 +- protoc-gen-swagger/genswagger/template_test.go | 4 ++-- protoc-gen-swagger/genswagger/types.go | 2 +- protoc-gen-swagger/main.go | 4 ++-- protoc-gen-swagger/main_test.go | 8 ++++---- runtime/context_test.go | 2 +- runtime/errors_test.go | 2 +- runtime/handler.go | 2 +- runtime/marshal_json_test.go | 4 ++-- runtime/marshal_jsonpb_test.go | 4 ++-- runtime/marshaler_registry_test.go | 2 +- runtime/mux_test.go | 4 ++-- runtime/pattern.go | 2 +- runtime/pattern_test.go | 2 +- runtime/query.go | 2 +- runtime/query_test.go | 4 ++-- utilities/trie_test.go | 2 +- 52 files changed, 99 insertions(+), 100 deletions(-) diff --git a/.travis.yml b/.travis.yml index daf891232c1..810404a7610 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false go: - 1.7.3 - tip -go_import_path: github.com/grpc-ecosystem/grpc-gateway +go_import_path: github.com/fische/grpc-gateway cache: directories: - $HOME/local @@ -15,16 +15,16 @@ before_install: - go get github.com/golang/lint/golint - go get github.com/dghubble/sling install: -- go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway -- go get github.com/grpc-ecosystem/grpc-gateway/runtime -- go get github.com/grpc-ecosystem/grpc-gateway/examples -- go get github.com/grpc-ecosystem/grpc-gateway/examples/server +- go get github.com/fische/grpc-gateway/protoc-gen-grpc-gateway +- go get github.com/fische/grpc-gateway/runtime +- go get github.com/fische/grpc-gateway/examples +- go get github.com/fische/grpc-gateway/examples/server before_script: - sh -c 'cd examples/browser && npm install' script: - make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" - if (go version | grep -qv devel) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi -- env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... +- env GLOG_logtostderr=1 go test -race -v github.com/fische/grpc-gateway/... - make lint - sh -c 'cd examples/browser && gulp' env: diff --git a/Makefile b/Makefile index 01a05855453..83459bf33a8 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # You don't have to rebuild these targets by yourself unless you develop # grpc-gateway itself. -PKG=github.com/grpc-ecosystem/grpc-gateway +PKG=github.com/fische/grpc-gateway GO_PLUGIN=bin/protoc-gen-go GO_PLUGIN_PKG=github.com/golang/protobuf/protoc-gen-go SWAGGER_PLUGIN=bin/protoc-gen-swagger @@ -85,7 +85,7 @@ generate: $(OPTIONS_GO) $(RUNTIME_GO) .SUFFIXES: .go .proto -$(GO_PLUGIN): +$(GO_PLUGIN): go get $(GO_PLUGIN_PKG) go build -o $@ $(GO_PLUGIN_PKG) diff --git a/examples/browser/bower.json b/examples/browser/bower.json index 2454691ae08..24b145e4e8a 100644 --- a/examples/browser/bower.json +++ b/examples/browser/bower.json @@ -6,7 +6,7 @@ "Yuki Yugui Sonoda " ], "license": "SEE LICENSE IN LICENSE file", - "homepage": "https://github.com/grpc-ecosystem/grpc-gateway", + "homepage": "https://github.com/fische/grpc-gateway", "private": true, "dependencies": { "swagger-js": "~> 2.1" diff --git a/examples/browser/gulpfile.js b/examples/browser/gulpfile.js index 3964888c949..cee30e396c9 100644 --- a/examples/browser/gulpfile.js +++ b/examples/browser/gulpfile.js @@ -16,11 +16,11 @@ gulp.task('bower', function(){ }); gulp.task('server', shell.task([ - 'go build -o bin/example-server github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server', + 'go build -o bin/example-server github.com/fische/grpc-gateway/examples/server/cmd/example-server', ])); gulp.task('gateway', shell.task([ - 'go build -o bin/example-gw github.com/grpc-ecosystem/grpc-gateway/examples', + 'go build -o bin/example-gw github.com/fische/grpc-gateway/examples', ])); gulp.task('serve-server', ['server'], function(){ diff --git a/examples/client_test.go b/examples/client_test.go index 0574d9fbb0c..396c6f68f9b 100644 --- a/examples/client_test.go +++ b/examples/client_test.go @@ -4,8 +4,8 @@ import ( "reflect" "testing" - "github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe" - "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo" + "github.com/fische/grpc-gateway/examples/clients/abe" + "github.com/fische/grpc-gateway/examples/clients/echo" ) func TestClientIntegration(t *testing.T) { diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 79af189db91..83adb0a52c4 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -7,11 +7,11 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" +import _ "github.com/fische/grpc-gateway/third_party/googleapis/google/api" import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" import google_protobuf2 "github.com/golang/protobuf/ptypes/duration" -import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" -import sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" +import grpc_gateway_examples_sub "github.com/fische/grpc-gateway/examples/sub" +import sub2 "github.com/fische/grpc-gateway/examples/sub2" import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp" import ( diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 7cef435ca11..6b3f6b1e72f 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -13,13 +13,12 @@ import ( "io" "net/http" + "github.com/fische/grpc-gateway/examples/sub" + "github.com/fische/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/utilities" "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/empty" - "github.com/grpc-ecosystem/grpc-gateway/examples/sub" - "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/fische/grpc-gateway/examples/sub2" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index a7e19fdd932..3a90bfa77aa 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -30,7 +30,7 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" +import _ "github.com/fische/grpc-gateway/third_party/googleapis/google/api" import ( context "golang.org/x/net/context" diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 19130064d5c..76a82c580bf 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -13,9 +13,9 @@ import ( "io" "net/http" + "github.com/fische/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/utilities" "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index bd6dde41f4f..fdc22e0ad79 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -7,7 +7,7 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" +import _ "github.com/fische/grpc-gateway/third_party/googleapis/google/api" import ( context "golang.org/x/net/context" diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index af9da8d5f95..edf463b2d41 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -13,9 +13,9 @@ import ( "io" "net/http" + "github.com/fische/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/utilities" "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index 9bc4de296f1..ff47124d5d0 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -7,9 +7,9 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" +import _ "github.com/fische/grpc-gateway/third_party/googleapis/google/api" import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" -import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" +import grpc_gateway_examples_sub "github.com/fische/grpc-gateway/examples/sub" import ( context "golang.org/x/net/context" diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index f256228759a..8b9d93696d7 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -13,11 +13,11 @@ import ( "io" "net/http" + "github.com/fische/grpc-gateway/examples/sub" + "github.com/fische/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/utilities" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" - "github.com/grpc-ecosystem/grpc-gateway/examples/sub" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/integration_test.go b/examples/integration_test.go index 826fbddc119..8c07db20d2d 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -17,9 +17,9 @@ import ( "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" - gw "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" - sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" - "github.com/grpc-ecosystem/grpc-gateway/runtime" + gw "github.com/fische/grpc-gateway/examples/examplepb" + sub "github.com/fische/grpc-gateway/examples/sub" + "github.com/fische/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc/codes" ) diff --git a/examples/main.go b/examples/main.go index 748ab36186b..909bb31b051 100644 --- a/examples/main.go +++ b/examples/main.go @@ -7,8 +7,8 @@ import ( "strings" "github.com/golang/glog" - "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" - "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/examples/examplepb" + "github.com/fische/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/examples/main_test.go b/examples/main_test.go index 2742c385bb2..b61de7ab105 100644 --- a/examples/main_test.go +++ b/examples/main_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - server "github.com/grpc-ecosystem/grpc-gateway/examples/server" + server "github.com/fische/grpc-gateway/examples/server" ) func runServers() <-chan error { diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 07bdcce8ea9..469acf4cb9b 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -5,12 +5,12 @@ import ( "io" "sync" + examples "github.com/fische/grpc-gateway/examples/examplepb" + sub "github.com/fische/grpc-gateway/examples/sub" + sub2 "github.com/fische/grpc-gateway/examples/sub2" "github.com/golang/glog" "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/empty" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" - sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" - sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" "github.com/rogpeppe/fastuuid" "golang.org/x/net/context" "google.golang.org/grpc" diff --git a/examples/server/cmd/example-server/main.go b/examples/server/cmd/example-server/main.go index 34b319ab4ed..0dbc27a1690 100644 --- a/examples/server/cmd/example-server/main.go +++ b/examples/server/cmd/example-server/main.go @@ -4,7 +4,7 @@ import ( "flag" "github.com/golang/glog" - "github.com/grpc-ecosystem/grpc-gateway/examples/server" + "github.com/fische/grpc-gateway/examples/server" ) func main() { diff --git a/examples/server/echo.go b/examples/server/echo.go index e87db2d510b..f69ecbfa558 100644 --- a/examples/server/echo.go +++ b/examples/server/echo.go @@ -2,7 +2,7 @@ package server import ( "github.com/golang/glog" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + examples "github.com/fische/grpc-gateway/examples/examplepb" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/metadata" diff --git a/examples/server/flow_combination.go b/examples/server/flow_combination.go index f1a90fa2b85..2ae59f57a55 100644 --- a/examples/server/flow_combination.go +++ b/examples/server/flow_combination.go @@ -3,7 +3,7 @@ package server import ( "io" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + examples "github.com/fische/grpc-gateway/examples/examplepb" "golang.org/x/net/context" ) diff --git a/examples/server/main.go b/examples/server/main.go index c5e6cb6f97f..9675ac23dc5 100644 --- a/examples/server/main.go +++ b/examples/server/main.go @@ -3,7 +3,7 @@ package server import ( "net" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + examples "github.com/fische/grpc-gateway/examples/examplepb" "google.golang.org/grpc" ) diff --git a/examples/sub2/message.pb.go b/examples/sub2/message.pb.go index dada72d4557..3bc61eebf01 100644 --- a/examples/sub2/message.pb.go +++ b/examples/sub2/message.pb.go @@ -51,13 +51,13 @@ func init() { func init() { proto.RegisterFile("examples/sub2/message.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 128 bytes of a gzipped FileDescriptorProto + // 125 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x29, 0xc9, 0x73, 0x71, 0x7a, 0xa6, 0xf8, 0x42, 0x24, 0x84, 0x84, 0xb8, 0x58, 0x4a, 0x4b, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18, - 0x35, 0x38, 0x83, 0xc0, 0x6c, 0x27, 0xb3, 0x28, 0x93, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, - 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xa2, 0x82, 0x64, 0xdd, 0xd4, 0xe4, 0xfc, 0xe2, 0xca, 0xe2, 0x92, - 0x54, 0x28, 0x37, 0x3d, 0xb1, 0x24, 0xb5, 0x3c, 0xb1, 0x52, 0x1f, 0xc5, 0xb2, 0x24, 0x36, 0xb0, - 0x2d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53, 0x75, 0xef, 0xe0, 0x84, 0x00, 0x00, 0x00, + 0x35, 0x38, 0x83, 0xc0, 0x6c, 0x27, 0xbd, 0x28, 0x9d, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, + 0xe4, 0xfc, 0x5c, 0xfd, 0xb4, 0xcc, 0xe2, 0xe4, 0x8c, 0x54, 0xfd, 0xf4, 0xa2, 0x82, 0x64, 0xdd, + 0xf4, 0xc4, 0x92, 0xd4, 0xf2, 0xc4, 0x4a, 0x7d, 0x14, 0x4b, 0x92, 0xd8, 0xc0, 0xa6, 0x1b, 0x03, + 0x02, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xdc, 0x1a, 0x2b, 0x7c, 0x00, 0x00, 0x00, } diff --git a/examples/sub2/message.proto b/examples/sub2/message.proto index 9c266430958..c4c0c37aad1 100644 --- a/examples/sub2/message.proto +++ b/examples/sub2/message.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/grpc-ecosystem/grpc-gateway/examples/sub2"; +option go_package = "github.com/fische/grpc-gateway/examples/sub2"; package sub2; message IdMessage { diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index 7bd928678f0..40f2de0af45 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -7,8 +7,8 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" - options "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/httprule" + options "github.com/fische/grpc-gateway/third_party/googleapis/google/api" ) // loadServices registers services and their methods from "targetFile" to "r". diff --git a/protoc-gen-grpc-gateway/descriptor/services_test.go b/protoc-gen-grpc-gateway/descriptor/services_test.go index eda34d4141e..97cf0fbcf4e 100644 --- a/protoc-gen-grpc-gateway/descriptor/services_test.go +++ b/protoc-gen-grpc-gateway/descriptor/services_test.go @@ -6,7 +6,7 @@ import ( "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func compilePath(t *testing.T, path string) httprule.Template { diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index 248538e7bad..363c54e9941 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -6,7 +6,7 @@ import ( descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) // GoPackage represents a golang package diff --git a/protoc-gen-grpc-gateway/descriptor/types_test.go b/protoc-gen-grpc-gateway/descriptor/types_test.go index ef2162a61fb..66a8b12546c 100644 --- a/protoc-gen-grpc-gateway/descriptor/types_test.go +++ b/protoc-gen-grpc-gateway/descriptor/types_test.go @@ -29,7 +29,7 @@ func TestGoPackageStandard(t *testing.T) { want: false, }, { - pkg: GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"}, + pkg: GoPackage{Path: "github.com/fische/grpc-gateway", Name: "main"}, want: false, }, { @@ -65,8 +65,8 @@ func TestGoPackageString(t *testing.T) { want: `"golang.org/x/net/context"`, }, { - pkg: GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"}, - want: `"github.com/grpc-ecosystem/grpc-gateway"`, + pkg: GoPackage{Path: "github.com/fische/grpc-gateway", Name: "main"}, + want: `"github.com/fische/grpc-gateway"`, }, { pkg: GoPackage{Path: "github.com/google/googleapis/google/api/http.pb", Name: "http_pb", Alias: "htpb"}, diff --git a/protoc-gen-grpc-gateway/generator/generator.go b/protoc-gen-grpc-gateway/generator/generator.go index df55da44445..f8fd35c08d3 100644 --- a/protoc-gen-grpc-gateway/generator/generator.go +++ b/protoc-gen-grpc-gateway/generator/generator.go @@ -3,7 +3,7 @@ package generator import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) // Generator is an abstraction of code generators. diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index d2218c004bc..73976944620 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -11,9 +11,9 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" - options "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/generator" + options "github.com/fische/grpc-gateway/third_party/googleapis/google/api" ) var ( @@ -32,8 +32,8 @@ func New(reg *descriptor.Registry, useRequestContext bool) gen.Generator { for _, pkgpath := range []string{ "io", "net/http", - "github.com/grpc-ecosystem/grpc-gateway/runtime", - "github.com/grpc-ecosystem/grpc-gateway/utilities", + "github.com/fische/grpc-gateway/runtime", + "github.com/fische/grpc-gateway/utilities", "github.com/golang/protobuf/proto", "golang.org/x/net/context", "google.golang.org/grpc", diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index e43904a8498..f7c43ff85a1 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -7,8 +7,8 @@ import ( "text/template" "github.com/golang/glog" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/fische/grpc-gateway/utilities" ) type param struct { diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index c5fb2f93e39..28a325f6abb 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -6,8 +6,8 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { diff --git a/protoc-gen-grpc-gateway/httprule/compile.go b/protoc-gen-grpc-gateway/httprule/compile.go index 437039a3dae..26f559c6a14 100644 --- a/protoc-gen-grpc-gateway/httprule/compile.go +++ b/protoc-gen-grpc-gateway/httprule/compile.go @@ -1,7 +1,7 @@ package httprule import ( - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/fische/grpc-gateway/utilities" ) const ( diff --git a/protoc-gen-grpc-gateway/httprule/compile_test.go b/protoc-gen-grpc-gateway/httprule/compile_test.go index 9ef297573f8..9b558481a4e 100644 --- a/protoc-gen-grpc-gateway/httprule/compile_test.go +++ b/protoc-gen-grpc-gateway/httprule/compile_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/fische/grpc-gateway/utilities" ) const ( diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 0e2c54f8b26..751d967dcf8 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -15,11 +15,11 @@ import ( "os" "strings" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/gengateway" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway" ) var ( diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go index 697e540b4ae..fa79d7b7be8 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/genswagger/generator.go @@ -11,8 +11,8 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/generator" ) var ( diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 022b649fb9b..d0f219897eb 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -10,7 +10,7 @@ import ( "strings" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) func listEnumNames(enum *descriptor.Enum) (names []string) { diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index e0b25c16716..1b7cdab7d64 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -8,8 +8,8 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 3c6a5c9f0de..481ea73298b 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) type param struct { diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index db747704e23..ef1c11222ad 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -11,8 +11,8 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger" + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/fische/grpc-gateway/protoc-gen-swagger/genswagger" ) var ( diff --git a/protoc-gen-swagger/main_test.go b/protoc-gen-swagger/main_test.go index c4d12dd20bd..60d2adc6353 100644 --- a/protoc-gen-swagger/main_test.go +++ b/protoc-gen-swagger/main_test.go @@ -26,8 +26,8 @@ func TestParseReqParam(t *testing.T) { clearFlags() pkgMap = make(map[string]string) - expected = map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"} - err = parseReqParam("allow_delete_body,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) + expected = map[string]string{"google/api/annotations.proto": "github.com/fische/grpc-gateway/third_party/googleapis/google/api"} + err = parseReqParam("allow_delete_body,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/fische/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) if err != nil { t.Errorf("Test 1: unexpected parse error '%v'", err) } @@ -38,8 +38,8 @@ func TestParseReqParam(t *testing.T) { clearFlags() pkgMap = make(map[string]string) - expected = map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"} - err = parseReqParam("allow_delete_body=true,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) + expected = map[string]string{"google/api/annotations.proto": "github.com/fische/grpc-gateway/third_party/googleapis/google/api"} + err = parseReqParam("allow_delete_body=true,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/fische/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) if err != nil { t.Errorf("Test 2: unexpected parse error '%v'", err) } diff --git a/runtime/context_test.go b/runtime/context_test.go index 2f3b02393db..4950aa4cb15 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc/metadata" ) diff --git a/runtime/errors_test.go b/runtime/errors_test.go index 2bdfca637c1..56ee358dcc2 100644 --- a/runtime/errors_test.go +++ b/runtime/errors_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/runtime/handler.go b/runtime/handler.go index d7040851ae9..ec314c1408b 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -7,7 +7,7 @@ import ( "net/textproto" "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" + "github.com/fische/grpc-gateway/runtime/internal" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" diff --git a/runtime/marshal_json_test.go b/runtime/marshal_json_test.go index e6efa291072..48d6e724aef 100644 --- a/runtime/marshal_json_test.go +++ b/runtime/marshal_json_test.go @@ -12,8 +12,8 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "github.com/golang/protobuf/ptypes/timestamp" "github.com/golang/protobuf/ptypes/wrappers" - "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" - "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/examples/examplepb" + "github.com/fische/grpc-gateway/runtime" ) func TestJSONBuiltinMarshal(t *testing.T) { diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index 01e7ce87251..d8f53b1dfaf 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -13,8 +13,8 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "github.com/golang/protobuf/ptypes/timestamp" "github.com/golang/protobuf/ptypes/wrappers" - "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" - "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/examples/examplepb" + "github.com/fische/grpc-gateway/runtime" ) func TestJSONPbMarshal(t *testing.T) { diff --git a/runtime/marshaler_registry_test.go b/runtime/marshaler_registry_test.go index 194de6fee11..9190c8dabb4 100644 --- a/runtime/marshaler_registry_test.go +++ b/runtime/marshaler_registry_test.go @@ -6,7 +6,7 @@ import ( "net/http" "testing" - "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/runtime" ) func TestMarshalerForRequest(t *testing.T) { diff --git a/runtime/mux_test.go b/runtime/mux_test.go index bb90a7306a1..64e2ad183a7 100644 --- a/runtime/mux_test.go +++ b/runtime/mux_test.go @@ -7,8 +7,8 @@ import ( "net/http/httptest" "testing" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/fische/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/utilities" ) func TestMuxServeHTTP(t *testing.T) { diff --git a/runtime/pattern.go b/runtime/pattern.go index 3947dbea023..17edebd9b7b 100644 --- a/runtime/pattern.go +++ b/runtime/pattern.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/fische/grpc-gateway/utilities" "google.golang.org/grpc/grpclog" ) diff --git a/runtime/pattern_test.go b/runtime/pattern_test.go index 8f5a664aba5..bdd53968641 100644 --- a/runtime/pattern_test.go +++ b/runtime/pattern_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/fische/grpc-gateway/utilities" ) const ( diff --git a/runtime/query.go b/runtime/query.go index c4b8148967b..951258c8373 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -8,7 +8,7 @@ import ( "time" "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/fische/grpc-gateway/utilities" "google.golang.org/grpc/grpclog" ) diff --git a/runtime/query_test.go b/runtime/query_test.go index 1fcfef6eef7..81def11c143 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -9,8 +9,8 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/timestamp" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/fische/grpc-gateway/runtime" + "github.com/fische/grpc-gateway/utilities" ) func TestPopulateParameters(t *testing.T) { diff --git a/utilities/trie_test.go b/utilities/trie_test.go index 0178aa827a0..289fd56a945 100644 --- a/utilities/trie_test.go +++ b/utilities/trie_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/fische/grpc-gateway/utilities" ) func TestMaxCommonPrefix(t *testing.T) { From 3577c5117ea06c7fabf370af84569057165083d7 Mon Sep 17 00:00:00 2001 From: Maxime Fischer Date: Sat, 18 Feb 2017 14:59:23 +0000 Subject: [PATCH 115/552] Add a test for methods with no bindings. --- .../gengateway/generator_test.go | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 protoc-gen-grpc-gateway/gengateway/generator_test.go diff --git a/protoc-gen-grpc-gateway/gengateway/generator_test.go b/protoc-gen-grpc-gateway/gengateway/generator_test.go new file mode 100644 index 00000000000..89a21a3b19a --- /dev/null +++ b/protoc-gen-grpc-gateway/gengateway/generator_test.go @@ -0,0 +1,88 @@ +package gengateway + +import ( + "strings" + "testing" + + "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/golang/protobuf/proto" + protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +) + +func TestGenerateServiceWithoutBindings(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + } + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + msg1 := &descriptor.Message{ + DescriptorProto: msgdesc, + File: &descriptor.File{ + GoPkg: descriptor.GoPackage{ + Path: "github.com/golang/protobuf/ptypes/empty", + Name: "empty", + }, + }, + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Example"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + } + meth1 := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("ExampleWithoutBindings"), + InputType: proto.String("empty.Empty"), + OutputType: proto.String("empty.Empty"), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth, meth1}, + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, + MessageType: []*protodescriptor.DescriptorProto{msgdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + Body: &descriptor.Body{FieldPath: nil}, + }, + }, + }, + { + MethodDescriptorProto: meth1, + RequestType: msg1, + ResponseType: msg1, + }, + }, + }, + }, + } + g := &generator{} + got, err := g.generate(crossLinkFixture(&file)) + if err != nil { + t.Errorf("generate(%#v) failed with %v; want success", file, err) + return + } + if notwanted := `"github.com/golang/protobuf/ptypes/empty"`; strings.Contains(got, notwanted) { + t.Errorf("generate(%#v) = %s; does not want to contain %s", file, got, notwanted) + } +} From 98153c05cf231bcfe03ed188f1205370d6a175f2 Mon Sep 17 00:00:00 2001 From: Maxime Fischer Date: Sat, 18 Feb 2017 15:02:51 +0000 Subject: [PATCH 116/552] Regenerate all .pb.go and .pb.gw.go --- examples/examplepb/a_bit_of_everything.pb.go | 2 +- examples/examplepb/a_bit_of_everything.pb.gw.go | 2 +- examples/examplepb/echo_service.pb.go | 2 +- examples/examplepb/flow_combination.pb.go | 2 +- examples/examplepb/stream.pb.go | 2 +- examples/sub/message.pb.go | 2 +- examples/sub2/message.pb.go | 2 +- runtime/internal/stream_chunk.pb.go | 2 +- third_party/googleapis/google/api/annotations.pb.go | 2 +- third_party/googleapis/google/api/http.pb.go | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 83adb0a52c4..5d2fb202fb8 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -873,7 +873,7 @@ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", var fileDescriptor1 = []byte{ // 1297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, 0x14, 0xcf, 0xd8, 0x89, 0x13, 0x3f, 0xc7, 0x89, 0x33, 0x69, 0x53, 0xd7, 0x2d, 0x64, 0x71, 0x01, 0xad, 0x42, 0xb5, 0xab, 0xba, 0x15, 0x6a, 0x23, 0x41, 0x95, 0x34, 0x86, 0x22, 0xda, 0xb4, 0xdd, 0xfe, 0x41, 0x8a, 0x5a, 0xac, 0xb5, 0x3d, 0xb6, 0x57, 0xf1, 0xee, 0x2c, 0xbb, 0xb3, 0x26, 0x96, diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 6b3f6b1e72f..5f8068b8bae 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -14,11 +14,11 @@ import ( "net/http" "github.com/fische/grpc-gateway/examples/sub" + "github.com/fische/grpc-gateway/examples/sub2" "github.com/fische/grpc-gateway/runtime" "github.com/fische/grpc-gateway/utilities" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" - "github.com/fische/grpc-gateway/examples/sub2" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 3a90bfa77aa..885077cd3eb 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -189,7 +189,7 @@ func init() { proto.RegisterFile("examples/examplepb/echo_service.proto", fileDe var fileDescriptor0 = []byte{ // 229 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x87, 0x32, 0x0a, 0x92, 0xf4, 0x53, 0x93, 0x33, 0xf2, 0xe3, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xe4, 0xd3, 0x8b, 0x0a, 0x92, 0xf5, 0xd2, 0x13, 0x4b, 0x52, 0xcb, 0x13, 0x2b, 0xf5, 0x60, 0x7a, 0xf4, 0xe0, 0x7a, diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index fdc22e0ad79..925e0037ca5 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -679,7 +679,7 @@ func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fi var fileDescriptor3 = []byte{ // 656 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x8f, 0x12, 0x4f, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x8f, 0x12, 0x4f, 0x18, 0xc7, 0xf3, 0x70, 0xc9, 0x2f, 0xb9, 0xe1, 0xfe, 0x70, 0xcb, 0x2f, 0x08, 0x1c, 0x1e, 0x77, 0xe3, 0x25, 0xe2, 0xbf, 0x5d, 0x82, 0xd5, 0x51, 0x9e, 0xd1, 0x92, 0x5c, 0xb8, 0xd8, 0x6c, 0x63, 0x66, 0x87, 0x15, 0x48, 0x60, 0x67, 0x6e, 0x77, 0x0d, 0x5e, 0x08, 0x31, 0xb1, 0xb1, 0xb4, 0xf0, diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index ff47124d5d0..a7813bfef22 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -256,7 +256,7 @@ func init() { proto.RegisterFile("examples/examplepb/stream.proto", fileDescript var fileDescriptor2 = []byte{ // 314 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x90, 0xbf, 0x4a, 0x43, 0x31, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xbf, 0x4a, 0x43, 0x31, 0x14, 0xc6, 0xb9, 0x2a, 0xa2, 0x11, 0x97, 0x0c, 0x0e, 0x51, 0x28, 0x16, 0xc1, 0x2a, 0x92, 0xb4, 0xba, 0xb9, 0x59, 0xe9, 0xa6, 0x38, 0x74, 0x73, 0x29, 0xc9, 0xe5, 0x34, 0x0d, 0xbd, 0xf7, 0x26, 0x24, 0xe7, 0x56, 0x0b, 0x4e, 0x8e, 0xae, 0x7d, 0x11, 0xdf, 0xc5, 0x57, 0xf0, 0x41, 0xa4, 0xf7, diff --git a/examples/sub/message.pb.go b/examples/sub/message.pb.go index 58a9be92c13..57c4ecd8e6e 100644 --- a/examples/sub/message.pb.go +++ b/examples/sub/message.pb.go @@ -53,7 +53,7 @@ func init() { proto.RegisterFile("examples/sub/message.proto", fileDescriptor0) var fileDescriptor0 = []byte{ // 111 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0x48, 0xcc, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4c, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0x4f, 0x2c, 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0x29, 0xd4, 0x2b, 0x2e, 0x4d, 0x52, 0x52, 0xe5, 0xe2, 0x0d, diff --git a/examples/sub2/message.pb.go b/examples/sub2/message.pb.go index 3bc61eebf01..099699c9302 100644 --- a/examples/sub2/message.pb.go +++ b/examples/sub2/message.pb.go @@ -52,7 +52,7 @@ func init() { proto.RegisterFile("examples/sub2/message.proto", fileDescriptor0) var fileDescriptor0 = []byte{ // 125 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x29, 0xc9, 0x73, 0x71, 0x7a, 0xa6, 0xf8, 0x42, 0x24, 0x84, 0x84, 0xb8, 0x58, 0x4a, 0x4b, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18, diff --git a/runtime/internal/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go index e2486eb8eec..9a140556495 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -78,7 +78,7 @@ func init() { proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDesc var fileDescriptor0 = []byte{ // 181 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0x8e, 0xbf, 0xee, 0x82, 0x30, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x8e, 0xbf, 0xee, 0x82, 0x30, 0x14, 0x85, 0xd3, 0xdf, 0x1f, 0x85, 0xcb, 0x46, 0x1c, 0x9a, 0x38, 0x48, 0x74, 0x61, 0x82, 0xc1, 0x37, 0xd0, 0xf8, 0x02, 0xb0, 0xb9, 0x90, 0x0a, 0x37, 0x40, 0x94, 0x96, 0xdc, 0x5e, 0x62, 0x5c, 0x7d, 0x72, 0xd3, 0x22, 0xe3, 0xf9, 0xbe, 0x73, 0x92, 0x03, 0x07, 0x9a, 0x34, 0xf7, 0x03, 0xe6, diff --git a/third_party/googleapis/google/api/annotations.pb.go b/third_party/googleapis/google/api/annotations.pb.go index 98366b55059..f029a774980 100644 --- a/third_party/googleapis/google/api/annotations.pb.go +++ b/third_party/googleapis/google/api/annotations.pb.go @@ -48,7 +48,7 @@ func init() { proto.RegisterFile("google/api/annotations.proto", fileDescriptor0 var fileDescriptor0 = []byte{ // 169 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0xc8, 0xea, 0x25, 0x16, 0x64, 0x4a, 0x89, 0x22, 0xa9, 0xcc, 0x28, 0x29, 0x29, 0x80, 0x28, 0x91, 0x52, 0x80, 0x0a, 0x83, 0x79, diff --git a/third_party/googleapis/google/api/http.pb.go b/third_party/googleapis/google/api/http.pb.go index 82e742cf031..62a35e399d7 100644 --- a/third_party/googleapis/google/api/http.pb.go +++ b/third_party/googleapis/google/api/http.pb.go @@ -360,7 +360,7 @@ func init() { proto.RegisterFile("google/api/http.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ // 280 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x6a, 0xbb, 0x40, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x6a, 0xbb, 0x40, 0x10, 0xc6, 0xff, 0x46, 0x63, 0xe2, 0x08, 0x7f, 0xe8, 0x36, 0x2d, 0x7b, 0x09, 0x48, 0x4e, 0x9e, 0x0c, 0xa4, 0x87, 0x1e, 0x7a, 0xb3, 0x14, 0x72, 0x0c, 0xbe, 0x40, 0x59, 0xdd, 0x45, 0x97, 0x1a, 0x77, 0x88, 0xe3, 0xa1, 0x8f, 0xd2, 0xb7, 0x2d, 0xbb, 0x6b, 0x48, 0xa0, 0xb7, 0xf9, 0x7e, 0x33, From bd9999b3089ea94d71a51221c92ffb32adbf2cad Mon Sep 17 00:00:00 2001 From: Maxime Fischer Date: Sat, 18 Feb 2017 15:17:44 +0000 Subject: [PATCH 117/552] Fix travis tests. --- examples/examplepb/a_bit_of_everything.pb.go | 2 +- examples/examplepb/echo_service.pb.go | 2 +- examples/examplepb/flow_combination.pb.go | 2 +- examples/examplepb/stream.pb.go | 2 +- examples/sub/message.pb.go | 2 +- examples/sub2/message.pb.go | 2 +- runtime/internal/stream_chunk.pb.go | 2 +- third_party/googleapis/google/api/annotations.pb.go | 2 +- third_party/googleapis/google/api/http.pb.go | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 5d2fb202fb8..83adb0a52c4 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -873,7 +873,7 @@ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", var fileDescriptor1 = []byte{ // 1297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, 0x14, 0xcf, 0xd8, 0x89, 0x13, 0x3f, 0xc7, 0x89, 0x33, 0x69, 0x53, 0xd7, 0x2d, 0x64, 0x71, 0x01, 0xad, 0x42, 0xb5, 0xab, 0xba, 0x15, 0x6a, 0x23, 0x41, 0x95, 0x34, 0x86, 0x22, 0xda, 0xb4, 0xdd, 0xfe, 0x41, 0x8a, 0x5a, 0xac, 0xb5, 0x3d, 0xb6, 0x57, 0xf1, 0xee, 0x2c, 0xbb, 0xb3, 0x26, 0x96, diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 885077cd3eb..3a90bfa77aa 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -189,7 +189,7 @@ func init() { proto.RegisterFile("examples/examplepb/echo_service.proto", fileDe var fileDescriptor0 = []byte{ // 229 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x87, 0x32, 0x0a, 0x92, 0xf4, 0x53, 0x93, 0x33, 0xf2, 0xe3, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xe4, 0xd3, 0x8b, 0x0a, 0x92, 0xf5, 0xd2, 0x13, 0x4b, 0x52, 0xcb, 0x13, 0x2b, 0xf5, 0x60, 0x7a, 0xf4, 0xe0, 0x7a, diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 925e0037ca5..fdc22e0ad79 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -679,7 +679,7 @@ func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fi var fileDescriptor3 = []byte{ // 656 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x8f, 0x12, 0x4f, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x8f, 0x12, 0x4f, 0x18, 0xc7, 0xf3, 0x70, 0xc9, 0x2f, 0xb9, 0xe1, 0xfe, 0x70, 0xcb, 0x2f, 0x08, 0x1c, 0x1e, 0x77, 0xe3, 0x25, 0xe2, 0xbf, 0x5d, 0x82, 0xd5, 0x51, 0x9e, 0xd1, 0x92, 0x5c, 0xb8, 0xd8, 0x6c, 0x63, 0x66, 0x87, 0x15, 0x48, 0x60, 0x67, 0x6e, 0x77, 0x0d, 0x5e, 0x08, 0x31, 0xb1, 0xb1, 0xb4, 0xf0, diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index a7813bfef22..ff47124d5d0 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -256,7 +256,7 @@ func init() { proto.RegisterFile("examples/examplepb/stream.proto", fileDescript var fileDescriptor2 = []byte{ // 314 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xbf, 0x4a, 0x43, 0x31, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x90, 0xbf, 0x4a, 0x43, 0x31, 0x14, 0xc6, 0xb9, 0x2a, 0xa2, 0x11, 0x97, 0x0c, 0x0e, 0x51, 0x28, 0x16, 0xc1, 0x2a, 0x92, 0xb4, 0xba, 0xb9, 0x59, 0xe9, 0xa6, 0x38, 0x74, 0x73, 0x29, 0xc9, 0xe5, 0x34, 0x0d, 0xbd, 0xf7, 0x26, 0x24, 0xe7, 0x56, 0x0b, 0x4e, 0x8e, 0xae, 0x7d, 0x11, 0xdf, 0xc5, 0x57, 0xf0, 0x41, 0xa4, 0xf7, diff --git a/examples/sub/message.pb.go b/examples/sub/message.pb.go index 57c4ecd8e6e..58a9be92c13 100644 --- a/examples/sub/message.pb.go +++ b/examples/sub/message.pb.go @@ -53,7 +53,7 @@ func init() { proto.RegisterFile("examples/sub/message.proto", fileDescriptor0) var fileDescriptor0 = []byte{ // 111 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0x48, 0xcc, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4c, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0x4f, 0x2c, 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0x29, 0xd4, 0x2b, 0x2e, 0x4d, 0x52, 0x52, 0xe5, 0xe2, 0x0d, diff --git a/examples/sub2/message.pb.go b/examples/sub2/message.pb.go index 099699c9302..3bc61eebf01 100644 --- a/examples/sub2/message.pb.go +++ b/examples/sub2/message.pb.go @@ -52,7 +52,7 @@ func init() { proto.RegisterFile("examples/sub2/message.proto", fileDescriptor0) var fileDescriptor0 = []byte{ // 125 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x29, 0xc9, 0x73, 0x71, 0x7a, 0xa6, 0xf8, 0x42, 0x24, 0x84, 0x84, 0xb8, 0x58, 0x4a, 0x4b, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18, diff --git a/runtime/internal/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go index 9a140556495..e2486eb8eec 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -78,7 +78,7 @@ func init() { proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDesc var fileDescriptor0 = []byte{ // 181 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x8e, 0xbf, 0xee, 0x82, 0x30, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0x8e, 0xbf, 0xee, 0x82, 0x30, 0x14, 0x85, 0xd3, 0xdf, 0x1f, 0x85, 0xcb, 0x46, 0x1c, 0x9a, 0x38, 0x48, 0x74, 0x61, 0x82, 0xc1, 0x37, 0xd0, 0xf8, 0x02, 0xb0, 0xb9, 0x90, 0x0a, 0x37, 0x40, 0x94, 0x96, 0xdc, 0x5e, 0x62, 0x5c, 0x7d, 0x72, 0xd3, 0x22, 0xe3, 0xf9, 0xbe, 0x73, 0x92, 0x03, 0x07, 0x9a, 0x34, 0xf7, 0x03, 0xe6, diff --git a/third_party/googleapis/google/api/annotations.pb.go b/third_party/googleapis/google/api/annotations.pb.go index f029a774980..98366b55059 100644 --- a/third_party/googleapis/google/api/annotations.pb.go +++ b/third_party/googleapis/google/api/annotations.pb.go @@ -48,7 +48,7 @@ func init() { proto.RegisterFile("google/api/annotations.proto", fileDescriptor0 var fileDescriptor0 = []byte{ // 169 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0xc8, 0xea, 0x25, 0x16, 0x64, 0x4a, 0x89, 0x22, 0xa9, 0xcc, 0x28, 0x29, 0x29, 0x80, 0x28, 0x91, 0x52, 0x80, 0x0a, 0x83, 0x79, diff --git a/third_party/googleapis/google/api/http.pb.go b/third_party/googleapis/google/api/http.pb.go index 62a35e399d7..82e742cf031 100644 --- a/third_party/googleapis/google/api/http.pb.go +++ b/third_party/googleapis/google/api/http.pb.go @@ -360,7 +360,7 @@ func init() { proto.RegisterFile("google/api/http.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ // 280 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x6a, 0xbb, 0x40, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x6a, 0xbb, 0x40, 0x10, 0xc6, 0xff, 0x46, 0x63, 0xe2, 0x08, 0x7f, 0xe8, 0x36, 0x2d, 0x7b, 0x09, 0x48, 0x4e, 0x9e, 0x0c, 0xa4, 0x87, 0x1e, 0x7a, 0xb3, 0x14, 0x72, 0x0c, 0xbe, 0x40, 0x59, 0xdd, 0x45, 0x97, 0x1a, 0x77, 0x88, 0xe3, 0xa1, 0x8f, 0xd2, 0xb7, 0x2d, 0xbb, 0x6b, 0x48, 0xa0, 0xb7, 0xf9, 0x7e, 0x33, From df1d364cd3be92aae7ee92aff8c6b637202b22b4 Mon Sep 17 00:00:00 2001 From: Maxime Fischer Date: Sat, 18 Feb 2017 15:48:24 +0000 Subject: [PATCH 118/552] Revert "Change imports so that it uses the right packages." This reverts commit f36044845bfb08e9cbd439fb5766f88c92abd990. --- .travis.yml | 12 ++++++------ Makefile | 4 ++-- examples/browser/bower.json | 2 +- examples/browser/gulpfile.js | 4 ++-- examples/client_test.go | 4 ++-- examples/examplepb/a_bit_of_everything.pb.go | 6 +++--- examples/examplepb/a_bit_of_everything.pb.gw.go | 8 ++++---- examples/examplepb/echo_service.pb.go | 2 +- examples/examplepb/echo_service.pb.gw.go | 4 ++-- examples/examplepb/flow_combination.pb.go | 2 +- examples/examplepb/flow_combination.pb.gw.go | 4 ++-- examples/examplepb/stream.pb.go | 4 ++-- examples/examplepb/stream.pb.gw.go | 6 +++--- examples/integration_test.go | 6 +++--- examples/main.go | 4 ++-- examples/main_test.go | 2 +- examples/server/a_bit_of_everything.go | 6 +++--- examples/server/cmd/example-server/main.go | 2 +- examples/server/echo.go | 2 +- examples/server/flow_combination.go | 2 +- examples/server/main.go | 2 +- examples/sub2/message.pb.go | 10 +++++----- examples/sub2/message.proto | 2 +- protoc-gen-grpc-gateway/descriptor/services.go | 4 ++-- protoc-gen-grpc-gateway/descriptor/services_test.go | 2 +- protoc-gen-grpc-gateway/descriptor/types.go | 2 +- protoc-gen-grpc-gateway/descriptor/types_test.go | 6 +++--- protoc-gen-grpc-gateway/generator/generator.go | 2 +- protoc-gen-grpc-gateway/gengateway/generator.go | 10 +++++----- protoc-gen-grpc-gateway/gengateway/generator_test.go | 2 +- protoc-gen-grpc-gateway/gengateway/template.go | 4 ++-- protoc-gen-grpc-gateway/gengateway/template_test.go | 4 ++-- protoc-gen-grpc-gateway/httprule/compile.go | 2 +- protoc-gen-grpc-gateway/httprule/compile_test.go | 2 +- protoc-gen-grpc-gateway/main.go | 4 ++-- protoc-gen-swagger/genswagger/generator.go | 4 ++-- protoc-gen-swagger/genswagger/template.go | 2 +- protoc-gen-swagger/genswagger/template_test.go | 4 ++-- protoc-gen-swagger/genswagger/types.go | 2 +- protoc-gen-swagger/main.go | 4 ++-- protoc-gen-swagger/main_test.go | 8 ++++---- runtime/context_test.go | 2 +- runtime/errors_test.go | 2 +- runtime/handler.go | 2 +- runtime/marshal_json_test.go | 4 ++-- runtime/marshal_jsonpb_test.go | 4 ++-- runtime/marshaler_registry_test.go | 2 +- runtime/mux_test.go | 4 ++-- runtime/pattern.go | 2 +- runtime/pattern_test.go | 2 +- runtime/query.go | 2 +- runtime/query_test.go | 4 ++-- utilities/trie_test.go | 2 +- 53 files changed, 100 insertions(+), 100 deletions(-) diff --git a/.travis.yml b/.travis.yml index 810404a7610..daf891232c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false go: - 1.7.3 - tip -go_import_path: github.com/fische/grpc-gateway +go_import_path: github.com/grpc-ecosystem/grpc-gateway cache: directories: - $HOME/local @@ -15,16 +15,16 @@ before_install: - go get github.com/golang/lint/golint - go get github.com/dghubble/sling install: -- go get github.com/fische/grpc-gateway/protoc-gen-grpc-gateway -- go get github.com/fische/grpc-gateway/runtime -- go get github.com/fische/grpc-gateway/examples -- go get github.com/fische/grpc-gateway/examples/server +- go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway +- go get github.com/grpc-ecosystem/grpc-gateway/runtime +- go get github.com/grpc-ecosystem/grpc-gateway/examples +- go get github.com/grpc-ecosystem/grpc-gateway/examples/server before_script: - sh -c 'cd examples/browser && npm install' script: - make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" - if (go version | grep -qv devel) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi -- env GLOG_logtostderr=1 go test -race -v github.com/fische/grpc-gateway/... +- env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... - make lint - sh -c 'cd examples/browser && gulp' env: diff --git a/Makefile b/Makefile index 83459bf33a8..01a05855453 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # You don't have to rebuild these targets by yourself unless you develop # grpc-gateway itself. -PKG=github.com/fische/grpc-gateway +PKG=github.com/grpc-ecosystem/grpc-gateway GO_PLUGIN=bin/protoc-gen-go GO_PLUGIN_PKG=github.com/golang/protobuf/protoc-gen-go SWAGGER_PLUGIN=bin/protoc-gen-swagger @@ -85,7 +85,7 @@ generate: $(OPTIONS_GO) $(RUNTIME_GO) .SUFFIXES: .go .proto -$(GO_PLUGIN): +$(GO_PLUGIN): go get $(GO_PLUGIN_PKG) go build -o $@ $(GO_PLUGIN_PKG) diff --git a/examples/browser/bower.json b/examples/browser/bower.json index 24b145e4e8a..2454691ae08 100644 --- a/examples/browser/bower.json +++ b/examples/browser/bower.json @@ -6,7 +6,7 @@ "Yuki Yugui Sonoda " ], "license": "SEE LICENSE IN LICENSE file", - "homepage": "https://github.com/fische/grpc-gateway", + "homepage": "https://github.com/grpc-ecosystem/grpc-gateway", "private": true, "dependencies": { "swagger-js": "~> 2.1" diff --git a/examples/browser/gulpfile.js b/examples/browser/gulpfile.js index cee30e396c9..3964888c949 100644 --- a/examples/browser/gulpfile.js +++ b/examples/browser/gulpfile.js @@ -16,11 +16,11 @@ gulp.task('bower', function(){ }); gulp.task('server', shell.task([ - 'go build -o bin/example-server github.com/fische/grpc-gateway/examples/server/cmd/example-server', + 'go build -o bin/example-server github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server', ])); gulp.task('gateway', shell.task([ - 'go build -o bin/example-gw github.com/fische/grpc-gateway/examples', + 'go build -o bin/example-gw github.com/grpc-ecosystem/grpc-gateway/examples', ])); gulp.task('serve-server', ['server'], function(){ diff --git a/examples/client_test.go b/examples/client_test.go index 396c6f68f9b..0574d9fbb0c 100644 --- a/examples/client_test.go +++ b/examples/client_test.go @@ -4,8 +4,8 @@ import ( "reflect" "testing" - "github.com/fische/grpc-gateway/examples/clients/abe" - "github.com/fische/grpc-gateway/examples/clients/echo" + "github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe" + "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo" ) func TestClientIntegration(t *testing.T) { diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 83adb0a52c4..79af189db91 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -7,11 +7,11 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/fische/grpc-gateway/third_party/googleapis/google/api" +import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" import google_protobuf2 "github.com/golang/protobuf/ptypes/duration" -import grpc_gateway_examples_sub "github.com/fische/grpc-gateway/examples/sub" -import sub2 "github.com/fische/grpc-gateway/examples/sub2" +import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" +import sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp" import ( diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 5f8068b8bae..f8f3eabd0fc 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -13,12 +13,12 @@ import ( "io" "net/http" - "github.com/fische/grpc-gateway/examples/sub" - "github.com/fische/grpc-gateway/examples/sub2" - "github.com/fische/grpc-gateway/runtime" - "github.com/fische/grpc-gateway/utilities" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" + "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 3a90bfa77aa..a7e19fdd932 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -30,7 +30,7 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/fische/grpc-gateway/third_party/googleapis/google/api" +import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" import ( context "golang.org/x/net/context" diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 76a82c580bf..19130064d5c 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -13,9 +13,9 @@ import ( "io" "net/http" - "github.com/fische/grpc-gateway/runtime" - "github.com/fische/grpc-gateway/utilities" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index fdc22e0ad79..bd6dde41f4f 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -7,7 +7,7 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/fische/grpc-gateway/third_party/googleapis/google/api" +import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" import ( context "golang.org/x/net/context" diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index edf463b2d41..af9da8d5f95 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -13,9 +13,9 @@ import ( "io" "net/http" - "github.com/fische/grpc-gateway/runtime" - "github.com/fische/grpc-gateway/utilities" "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index ff47124d5d0..9bc4de296f1 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -7,9 +7,9 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/fische/grpc-gateway/third_party/googleapis/google/api" +import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" -import grpc_gateway_examples_sub "github.com/fische/grpc-gateway/examples/sub" +import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" import ( context "golang.org/x/net/context" diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index 8b9d93696d7..f256228759a 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -13,11 +13,11 @@ import ( "io" "net/http" - "github.com/fische/grpc-gateway/examples/sub" - "github.com/fische/grpc-gateway/runtime" - "github.com/fische/grpc-gateway/utilities" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" + "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/integration_test.go b/examples/integration_test.go index 8c07db20d2d..826fbddc119 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -17,9 +17,9 @@ import ( "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" - gw "github.com/fische/grpc-gateway/examples/examplepb" - sub "github.com/fische/grpc-gateway/examples/sub" - "github.com/fische/grpc-gateway/runtime" + gw "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc/codes" ) diff --git a/examples/main.go b/examples/main.go index 909bb31b051..748ab36186b 100644 --- a/examples/main.go +++ b/examples/main.go @@ -7,8 +7,8 @@ import ( "strings" "github.com/golang/glog" - "github.com/fische/grpc-gateway/examples/examplepb" - "github.com/fische/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/examples/main_test.go b/examples/main_test.go index b61de7ab105..2742c385bb2 100644 --- a/examples/main_test.go +++ b/examples/main_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - server "github.com/fische/grpc-gateway/examples/server" + server "github.com/grpc-ecosystem/grpc-gateway/examples/server" ) func runServers() <-chan error { diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 469acf4cb9b..07bdcce8ea9 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -5,12 +5,12 @@ import ( "io" "sync" - examples "github.com/fische/grpc-gateway/examples/examplepb" - sub "github.com/fische/grpc-gateway/examples/sub" - sub2 "github.com/fische/grpc-gateway/examples/sub2" "github.com/golang/glog" "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/empty" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" "github.com/rogpeppe/fastuuid" "golang.org/x/net/context" "google.golang.org/grpc" diff --git a/examples/server/cmd/example-server/main.go b/examples/server/cmd/example-server/main.go index 0dbc27a1690..34b319ab4ed 100644 --- a/examples/server/cmd/example-server/main.go +++ b/examples/server/cmd/example-server/main.go @@ -4,7 +4,7 @@ import ( "flag" "github.com/golang/glog" - "github.com/fische/grpc-gateway/examples/server" + "github.com/grpc-ecosystem/grpc-gateway/examples/server" ) func main() { diff --git a/examples/server/echo.go b/examples/server/echo.go index f69ecbfa558..e87db2d510b 100644 --- a/examples/server/echo.go +++ b/examples/server/echo.go @@ -2,7 +2,7 @@ package server import ( "github.com/golang/glog" - examples "github.com/fische/grpc-gateway/examples/examplepb" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/metadata" diff --git a/examples/server/flow_combination.go b/examples/server/flow_combination.go index 2ae59f57a55..f1a90fa2b85 100644 --- a/examples/server/flow_combination.go +++ b/examples/server/flow_combination.go @@ -3,7 +3,7 @@ package server import ( "io" - examples "github.com/fische/grpc-gateway/examples/examplepb" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "golang.org/x/net/context" ) diff --git a/examples/server/main.go b/examples/server/main.go index 9675ac23dc5..c5e6cb6f97f 100644 --- a/examples/server/main.go +++ b/examples/server/main.go @@ -3,7 +3,7 @@ package server import ( "net" - examples "github.com/fische/grpc-gateway/examples/examplepb" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "google.golang.org/grpc" ) diff --git a/examples/sub2/message.pb.go b/examples/sub2/message.pb.go index 3bc61eebf01..dada72d4557 100644 --- a/examples/sub2/message.pb.go +++ b/examples/sub2/message.pb.go @@ -51,13 +51,13 @@ func init() { func init() { proto.RegisterFile("examples/sub2/message.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 125 bytes of a gzipped FileDescriptorProto + // 128 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x29, 0xc9, 0x73, 0x71, 0x7a, 0xa6, 0xf8, 0x42, 0x24, 0x84, 0x84, 0xb8, 0x58, 0x4a, 0x4b, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18, - 0x35, 0x38, 0x83, 0xc0, 0x6c, 0x27, 0xbd, 0x28, 0x9d, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, - 0xe4, 0xfc, 0x5c, 0xfd, 0xb4, 0xcc, 0xe2, 0xe4, 0x8c, 0x54, 0xfd, 0xf4, 0xa2, 0x82, 0x64, 0xdd, - 0xf4, 0xc4, 0x92, 0xd4, 0xf2, 0xc4, 0x4a, 0x7d, 0x14, 0x4b, 0x92, 0xd8, 0xc0, 0xa6, 0x1b, 0x03, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xdc, 0x1a, 0x2b, 0x7c, 0x00, 0x00, 0x00, + 0x35, 0x38, 0x83, 0xc0, 0x6c, 0x27, 0xb3, 0x28, 0x93, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, + 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xa2, 0x82, 0x64, 0xdd, 0xd4, 0xe4, 0xfc, 0xe2, 0xca, 0xe2, 0x92, + 0x54, 0x28, 0x37, 0x3d, 0xb1, 0x24, 0xb5, 0x3c, 0xb1, 0x52, 0x1f, 0xc5, 0xb2, 0x24, 0x36, 0xb0, + 0x2d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53, 0x75, 0xef, 0xe0, 0x84, 0x00, 0x00, 0x00, } diff --git a/examples/sub2/message.proto b/examples/sub2/message.proto index c4c0c37aad1..9c266430958 100644 --- a/examples/sub2/message.proto +++ b/examples/sub2/message.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/fische/grpc-gateway/examples/sub2"; +option go_package = "github.com/grpc-ecosystem/grpc-gateway/examples/sub2"; package sub2; message IdMessage { diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index 40f2de0af45..7bd928678f0 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -7,8 +7,8 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/httprule" - options "github.com/fische/grpc-gateway/third_party/googleapis/google/api" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + options "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" ) // loadServices registers services and their methods from "targetFile" to "r". diff --git a/protoc-gen-grpc-gateway/descriptor/services_test.go b/protoc-gen-grpc-gateway/descriptor/services_test.go index 97cf0fbcf4e..eda34d4141e 100644 --- a/protoc-gen-grpc-gateway/descriptor/services_test.go +++ b/protoc-gen-grpc-gateway/descriptor/services_test.go @@ -6,7 +6,7 @@ import ( "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func compilePath(t *testing.T, path string) httprule.Template { diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index 363c54e9941..248538e7bad 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -6,7 +6,7 @@ import ( descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) // GoPackage represents a golang package diff --git a/protoc-gen-grpc-gateway/descriptor/types_test.go b/protoc-gen-grpc-gateway/descriptor/types_test.go index 66a8b12546c..ef2162a61fb 100644 --- a/protoc-gen-grpc-gateway/descriptor/types_test.go +++ b/protoc-gen-grpc-gateway/descriptor/types_test.go @@ -29,7 +29,7 @@ func TestGoPackageStandard(t *testing.T) { want: false, }, { - pkg: GoPackage{Path: "github.com/fische/grpc-gateway", Name: "main"}, + pkg: GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"}, want: false, }, { @@ -65,8 +65,8 @@ func TestGoPackageString(t *testing.T) { want: `"golang.org/x/net/context"`, }, { - pkg: GoPackage{Path: "github.com/fische/grpc-gateway", Name: "main"}, - want: `"github.com/fische/grpc-gateway"`, + pkg: GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"}, + want: `"github.com/grpc-ecosystem/grpc-gateway"`, }, { pkg: GoPackage{Path: "github.com/google/googleapis/google/api/http.pb", Name: "http_pb", Alias: "htpb"}, diff --git a/protoc-gen-grpc-gateway/generator/generator.go b/protoc-gen-grpc-gateway/generator/generator.go index f8fd35c08d3..df55da44445 100644 --- a/protoc-gen-grpc-gateway/generator/generator.go +++ b/protoc-gen-grpc-gateway/generator/generator.go @@ -3,7 +3,7 @@ package generator import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) // Generator is an abstraction of code generators. diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index 73976944620..d2218c004bc 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -11,9 +11,9 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - gen "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/generator" - options "github.com/fische/grpc-gateway/third_party/googleapis/google/api" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" + options "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" ) var ( @@ -32,8 +32,8 @@ func New(reg *descriptor.Registry, useRequestContext bool) gen.Generator { for _, pkgpath := range []string{ "io", "net/http", - "github.com/fische/grpc-gateway/runtime", - "github.com/fische/grpc-gateway/utilities", + "github.com/grpc-ecosystem/grpc-gateway/runtime", + "github.com/grpc-ecosystem/grpc-gateway/utilities", "github.com/golang/protobuf/proto", "golang.org/x/net/context", "google.golang.org/grpc", diff --git a/protoc-gen-grpc-gateway/gengateway/generator_test.go b/protoc-gen-grpc-gateway/gengateway/generator_test.go index 89a21a3b19a..755a09236e2 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator_test.go +++ b/protoc-gen-grpc-gateway/gengateway/generator_test.go @@ -4,9 +4,9 @@ import ( "strings" "testing" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) func TestGenerateServiceWithoutBindings(t *testing.T) { diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index f7c43ff85a1..e43904a8498 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -7,8 +7,8 @@ import ( "text/template" "github.com/golang/glog" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/fische/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) type param struct { diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index 28a325f6abb..c5fb2f93e39 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -6,8 +6,8 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { diff --git a/protoc-gen-grpc-gateway/httprule/compile.go b/protoc-gen-grpc-gateway/httprule/compile.go index 26f559c6a14..437039a3dae 100644 --- a/protoc-gen-grpc-gateway/httprule/compile.go +++ b/protoc-gen-grpc-gateway/httprule/compile.go @@ -1,7 +1,7 @@ package httprule import ( - "github.com/fische/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) const ( diff --git a/protoc-gen-grpc-gateway/httprule/compile_test.go b/protoc-gen-grpc-gateway/httprule/compile_test.go index 9b558481a4e..9ef297573f8 100644 --- a/protoc-gen-grpc-gateway/httprule/compile_test.go +++ b/protoc-gen-grpc-gateway/httprule/compile_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/fische/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) const ( diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 751d967dcf8..0e2c54f8b26 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -15,11 +15,11 @@ import ( "os" "strings" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/gengateway" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway" ) var ( diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go index fa79d7b7be8..697e540b4ae 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/genswagger/generator.go @@ -11,8 +11,8 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - gen "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/generator" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" ) var ( diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index d0f219897eb..022b649fb9b 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -10,7 +10,7 @@ import ( "strings" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) func listEnumNames(enum *descriptor.Enum) (names []string) { diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 1b7cdab7d64..e0b25c16716 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -8,8 +8,8 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 481ea73298b..3c6a5c9f0de 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) type param struct { diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index ef1c11222ad..db747704e23 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -11,8 +11,8 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/fische/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/fische/grpc-gateway/protoc-gen-swagger/genswagger" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger" ) var ( diff --git a/protoc-gen-swagger/main_test.go b/protoc-gen-swagger/main_test.go index 60d2adc6353..c4d12dd20bd 100644 --- a/protoc-gen-swagger/main_test.go +++ b/protoc-gen-swagger/main_test.go @@ -26,8 +26,8 @@ func TestParseReqParam(t *testing.T) { clearFlags() pkgMap = make(map[string]string) - expected = map[string]string{"google/api/annotations.proto": "github.com/fische/grpc-gateway/third_party/googleapis/google/api"} - err = parseReqParam("allow_delete_body,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/fische/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) + expected = map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"} + err = parseReqParam("allow_delete_body,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) if err != nil { t.Errorf("Test 1: unexpected parse error '%v'", err) } @@ -38,8 +38,8 @@ func TestParseReqParam(t *testing.T) { clearFlags() pkgMap = make(map[string]string) - expected = map[string]string{"google/api/annotations.proto": "github.com/fische/grpc-gateway/third_party/googleapis/google/api"} - err = parseReqParam("allow_delete_body=true,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/fische/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) + expected = map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"} + err = parseReqParam("allow_delete_body=true,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) if err != nil { t.Errorf("Test 2: unexpected parse error '%v'", err) } diff --git a/runtime/context_test.go b/runtime/context_test.go index 4950aa4cb15..2f3b02393db 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/fische/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc/metadata" ) diff --git a/runtime/errors_test.go b/runtime/errors_test.go index 56ee358dcc2..2bdfca637c1 100644 --- a/runtime/errors_test.go +++ b/runtime/errors_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/fische/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/runtime/handler.go b/runtime/handler.go index ec314c1408b..d7040851ae9 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -7,7 +7,7 @@ import ( "net/textproto" "github.com/golang/protobuf/proto" - "github.com/fische/grpc-gateway/runtime/internal" + "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" diff --git a/runtime/marshal_json_test.go b/runtime/marshal_json_test.go index 48d6e724aef..e6efa291072 100644 --- a/runtime/marshal_json_test.go +++ b/runtime/marshal_json_test.go @@ -12,8 +12,8 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "github.com/golang/protobuf/ptypes/timestamp" "github.com/golang/protobuf/ptypes/wrappers" - "github.com/fische/grpc-gateway/examples/examplepb" - "github.com/fische/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" ) func TestJSONBuiltinMarshal(t *testing.T) { diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index d8f53b1dfaf..01e7ce87251 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -13,8 +13,8 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "github.com/golang/protobuf/ptypes/timestamp" "github.com/golang/protobuf/ptypes/wrappers" - "github.com/fische/grpc-gateway/examples/examplepb" - "github.com/fische/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" ) func TestJSONPbMarshal(t *testing.T) { diff --git a/runtime/marshaler_registry_test.go b/runtime/marshaler_registry_test.go index 9190c8dabb4..194de6fee11 100644 --- a/runtime/marshaler_registry_test.go +++ b/runtime/marshaler_registry_test.go @@ -6,7 +6,7 @@ import ( "net/http" "testing" - "github.com/fische/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime" ) func TestMarshalerForRequest(t *testing.T) { diff --git a/runtime/mux_test.go b/runtime/mux_test.go index 64e2ad183a7..bb90a7306a1 100644 --- a/runtime/mux_test.go +++ b/runtime/mux_test.go @@ -7,8 +7,8 @@ import ( "net/http/httptest" "testing" - "github.com/fische/grpc-gateway/runtime" - "github.com/fische/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) func TestMuxServeHTTP(t *testing.T) { diff --git a/runtime/pattern.go b/runtime/pattern.go index 17edebd9b7b..3947dbea023 100644 --- a/runtime/pattern.go +++ b/runtime/pattern.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/fische/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "google.golang.org/grpc/grpclog" ) diff --git a/runtime/pattern_test.go b/runtime/pattern_test.go index bdd53968641..8f5a664aba5 100644 --- a/runtime/pattern_test.go +++ b/runtime/pattern_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/fische/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) const ( diff --git a/runtime/query.go b/runtime/query.go index 951258c8373..c4b8148967b 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -8,7 +8,7 @@ import ( "time" "github.com/golang/protobuf/proto" - "github.com/fische/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" "google.golang.org/grpc/grpclog" ) diff --git a/runtime/query_test.go b/runtime/query_test.go index 81def11c143..1fcfef6eef7 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -9,8 +9,8 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/timestamp" - "github.com/fische/grpc-gateway/runtime" - "github.com/fische/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) func TestPopulateParameters(t *testing.T) { diff --git a/utilities/trie_test.go b/utilities/trie_test.go index 289fd56a945..0178aa827a0 100644 --- a/utilities/trie_test.go +++ b/utilities/trie_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/fische/grpc-gateway/utilities" + "github.com/grpc-ecosystem/grpc-gateway/utilities" ) func TestMaxCommonPrefix(t *testing.T) { From 0bc2ad625833158bd7d5f510a9a4280cc94bd15b Mon Sep 17 00:00:00 2001 From: Noel Cower Date: Thu, 23 Feb 2017 12:41:34 -0800 Subject: [PATCH 119/552] runtime: Fix typo in Error call --- runtime/query_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/query_test.go b/runtime/query_test.go index ce08976037b..1da5d215b57 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -136,7 +136,7 @@ func TestPopulateParameters(t *testing.T) { msg.Reset() err := runtime.PopulateQueryParameters(msg, spec.values, spec.filter) if err != nil { - t.Errorf("runtime.PoplateQueryParameters(msg, %v, %v) failed with %v; want success", spec.values, spec.filter, err) + t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v) failed with %v; want success", spec.values, spec.filter, err) continue } if got, want := msg, spec.want; !proto.Equal(got, want) { From 8303460eb0348f71e52d53d682001cb377f91fc1 Mon Sep 17 00:00:00 2001 From: Noel Cower Date: Thu, 23 Feb 2017 12:41:59 -0800 Subject: [PATCH 120/552] runtime: Make enum type distinct for query test This also means that the reflect-based name tests will now fail. This is intentional, we want to use the protobuf enum's name to look it up via proto.EnumValueMap, not the reflect-based type name, since that can vary. --- runtime/query_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runtime/query_test.go b/runtime/query_test.go index 1da5d215b57..58cc3c5b669 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -241,8 +241,8 @@ type proto3Message struct { BoolValue bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` StringValue string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` - EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=api.EnumValue" json:"enum_value,omitempty"` - RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=api.EnumValue" json:"repeated_enum,omitempty"` + EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` TimestampValue *timestamp.Timestamp `protobuf:"bytes,11,opt,name=timestamp_value" json:"timestamp_value,omitempty"` } @@ -268,8 +268,8 @@ type proto2Message struct { BoolValue *bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` StringValue *string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` - EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=api.EnumValue" json:"enum_value,omitempty"` - RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=api.EnumValue" json:"repeated_enum,omitempty"` + EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -367,5 +367,5 @@ var EnumValue_value = map[string]int32{ } func init() { - proto.RegisterEnum("runtime_test.EnumValue", EnumValue_name, EnumValue_value) + proto.RegisterEnum("runtime_test_api.EnumValue", EnumValue_name, EnumValue_value) } From 4d319d24ccbd8cda16a389eb0140de84664cc052 Mon Sep 17 00:00:00 2001 From: Noel Cower Date: Thu, 23 Feb 2017 12:48:00 -0800 Subject: [PATCH 121/552] runtime: Use protobuf enum name instead of (reflect.Type).String This adds pass-through of the *proto.Properties for fields so that the fields being populated can be addressed by their enum name when the type is an enum (i.e., (*proto.Properties).Enum is set). As a result of this, the tests now pass, using the protobuf enum name as registered (i.e., fully qualified package name) instead of the Go package name derived by calling (reflect.Type).String. This should have no real impact on existing use, but it may be justified to re-add a fallback case for that reflect.Type name for hand-written protobuf types. Even then, however, it seems unlikely that it should be expected for enums-by-name to work when registering the enum map under a name other than the one it's referred to in protobuf. --- runtime/query.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/runtime/query.go b/runtime/query.go index fea54a1d5e2..85d0e23612a 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -40,13 +40,15 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] if m.Kind() != reflect.Ptr { return fmt.Errorf("unexpected type %T: %v", msg, msg) } + var props *proto.Properties m = m.Elem() for i, fieldName := range fieldPath { isLast := i == len(fieldPath)-1 if !isLast && m.Kind() != reflect.Struct { return fmt.Errorf("non-aggregate type in the mid of path: %s", strings.Join(fieldPath, ".")) } - f := fieldByProtoName(m, fieldName) + var f reflect.Value + f, props = fieldByProtoName(m, fieldName) if !f.IsValid() { grpclog.Printf("field not found in %T: %s", msg, strings.Join(fieldPath, ".")) return nil @@ -60,7 +62,7 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] if !isLast { return fmt.Errorf("unexpected repeated field in %s", strings.Join(fieldPath, ".")) } - return populateRepeatedField(f, values) + return populateRepeatedField(f, values, props) case reflect.Ptr: if f.IsNil() { m = reflect.New(f.Type().Elem()) @@ -82,26 +84,26 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] default: grpclog.Printf("too many field values: %s", strings.Join(fieldPath, ".")) } - return populateField(m, values[0]) + return populateField(m, values[0], props) } // fieldByProtoName looks up a field whose corresponding protobuf field name is "name". // "m" must be a struct value. It returns zero reflect.Value if no such field found. -func fieldByProtoName(m reflect.Value, name string) reflect.Value { +func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Properties) { props := proto.GetProperties(m.Type()) for _, p := range props.Prop { if p.OrigName == name { - return m.FieldByName(p.Name) + return m.FieldByName(p.Name), p } } - return reflect.Value{} + return reflect.Value{}, nil } -func populateRepeatedField(f reflect.Value, values []string) error { +func populateRepeatedField(f reflect.Value, values []string, props *proto.Properties) error { elemType := f.Type().Elem() // is the destination field a slice of an enumeration type? - if enumValMap := proto.EnumValueMap(elemType.String()); enumValMap != nil { + if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil { return populateFieldEnumRepeated(f, values, enumValMap) } @@ -120,7 +122,7 @@ func populateRepeatedField(f reflect.Value, values []string) error { return nil } -func populateField(f reflect.Value, value string) error { +func populateField(f reflect.Value, value string, props *proto.Properties) error { // Handle well known type type wkt interface { XXX_WellKnownType() string @@ -145,7 +147,7 @@ func populateField(f reflect.Value, value string) error { } // is the destination field an enumeration type? - if enumValMap := proto.EnumValueMap(f.Type().String()); enumValMap != nil { + if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil { return populateFieldEnum(f, value, enumValMap) } From be77ba52d148373ab76834a4930d008e749ae99c Mon Sep 17 00:00:00 2001 From: Francesc Campoy Date: Tue, 28 Feb 2017 16:14:35 +0530 Subject: [PATCH 122/552] Do not ignore the error coming from http.ListenAndServe in examples --- README.md | 4 ++-- examples/main.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f26381fe543..a139a519930 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. Now you need to write an entrypoint of the proxy server. ```go package main + import ( "flag" "net/http" @@ -158,8 +159,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. return err } - http.ListenAndServe(":8080", mux) - return nil + return http.ListenAndServe(":8080", mux) } func main() { diff --git a/examples/main.go b/examples/main.go index 748ab36186b..f6a16a808ce 100644 --- a/examples/main.go +++ b/examples/main.go @@ -96,8 +96,7 @@ func Run(address string, opts ...runtime.ServeMuxOption) error { } mux.Handle("/", gw) - http.ListenAndServe(address, allowCORS(mux)) - return nil + return http.ListenAndServe(address, allowCORS(mux)) } func main() { From 0e1ea0fcaef930cecf7f8add2d0d67df856785c0 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 14 Mar 2017 13:22:58 -0700 Subject: [PATCH 123/552] Update upstream proto files and add google.golang.org/genproto support. (#325) * revendor proto files, point to genproto for go files * test 1.8 first --- .travis.yml | 5 +- Makefile | 13 +- README.md | 4 +- examples/examplepb/a_bit_of_everything.pb.go | 4 +- examples/examplepb/echo_service.pb.go | 4 +- examples/examplepb/flow_combination.pb.go | 4 +- examples/examplepb/stream.pb.go | 4 +- examples/sub/message.pb.go | 2 +- examples/sub2/message.pb.go | 2 +- .../descriptor/services.go | 2 +- .../gengateway/generator.go | 2 +- protoc-gen-grpc-gateway/httprule/parse.go | 2 +- runtime/internal/stream_chunk.pb.go | 2 +- runtime/pattern.go | 2 +- ...EADME.grcp-gateway => README.grpc-gateway} | 0 .../googleapis/google/api/annotations.pb.go | 62 --- .../googleapis/google/api/annotations.proto | 2 + third_party/googleapis/google/api/http.pb.go | 381 ------------------ third_party/googleapis/google/api/http.proto | 228 +++++++++-- 19 files changed, 222 insertions(+), 503 deletions(-) rename third_party/googleapis/{README.grcp-gateway => README.grpc-gateway} (100%) delete mode 100644 third_party/googleapis/google/api/annotations.pb.go delete mode 100644 third_party/googleapis/google/api/http.pb.go diff --git a/.travis.yml b/.travis.yml index daf891232c1..c1113a5c282 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ language: go sudo: false go: -- 1.7.3 +- 1.8.x +- 1.7.x - tip go_import_path: github.com/grpc-ecosystem/grpc-gateway cache: @@ -23,7 +24,7 @@ before_script: - sh -c 'cd examples/browser && npm install' script: - make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" -- if (go version | grep -qv devel) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi +- if (go version | grep -q 1.8) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi - env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... - make lint - sh -c 'cd examples/browser && gulp' diff --git a/Makefile b/Makefile index 01a05855453..accde9800fe 100644 --- a/Makefile +++ b/Makefile @@ -38,14 +38,12 @@ GATEWAY_PLUGIN_SRC= utilities/doc.go \ GATEWAY_PLUGIN_FLAGS?= GOOGLEAPIS_DIR=third_party/googleapis -OPTIONS_PROTO=$(GOOGLEAPIS_DIR)/google/api/annotations.proto $(GOOGLEAPIS_DIR)/google/api/http.proto -OPTIONS_GO=$(OPTIONS_PROTO:.proto=.pb.go) OUTPUT_DIR=_output RUNTIME_PROTO=runtime/internal/stream_chunk.proto 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 +PKGMAP=Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mexamples/sub/message.proto=$(PKG)/examples/sub ADDITIONAL_FLAGS= ifneq "$(GATEWAY_PLUGIN_FLAGS)" "" ADDITIONAL_FLAGS=,$(GATEWAY_PLUGIN_FLAGS) @@ -81,7 +79,7 @@ SWAGGER_CODEGEN=swagger-codegen PROTOC_INC_PATH=$(dir $(shell which protoc))/../include -generate: $(OPTIONS_GO) $(RUNTIME_GO) +generate: $(RUNTIME_GO) .SUFFIXES: .go .proto @@ -89,15 +87,13 @@ $(GO_PLUGIN): go get $(GO_PLUGIN_PKG) go build -o $@ $(GO_PLUGIN_PKG) -$(OPTIONS_GO): $(OPTIONS_PROTO) $(GO_PLUGIN) - protoc -I $(PROTOC_INC_PATH) -I$(GOOGLEAPIS_DIR) --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP):$(GOOGLEAPIS_DIR) $(OPTIONS_PROTO) $(RUNTIME_GO): $(RUNTIME_PROTO) $(GO_PLUGIN) protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP):. $(RUNTIME_PROTO) -$(GATEWAY_PLUGIN): $(OPTIONS_GO) $(RUNTIME_GO) $(GATEWAY_PLUGIN_SRC) +$(GATEWAY_PLUGIN): $(RUNTIME_GO) $(GATEWAY_PLUGIN_SRC) go build -o $@ $(GATEWAY_PLUGIN_PKG) -$(SWAGGER_PLUGIN): $(OPTIONS_GO) $(SWAGGER_PLUGIN_SRC) +$(SWAGGER_PLUGIN): $(SWAGGER_PLUGIN_SRC) go build -o $@ $(SWAGGER_PLUGIN_PKG) $(EXAMPLE_SVCSRCS): $(GO_PLUGIN) $(EXAMPLES) @@ -137,7 +133,6 @@ lint: clean distclean: rm -f $(GATEWAY_PLUGIN) realclean: distclean - rm -f $(OPTIONS_GO) rm -f $(EXAMPLE_SVCSRCS) $(EXAMPLE_DEPSRCS) rm -f $(EXAMPLE_GWSRCS) rm -f $(EXAMPLE_SWAGGERSRCS) diff --git a/README.md b/README.md index 507da0380d4..69e3d39411e 100644 --- a/README.md +++ b/README.md @@ -89,8 +89,8 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. ```sh protoc -I/usr/local/include -I. \ -I$GOPATH/src \ - -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ - --go_out=Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \ + -I$GOPATH/src/github.com/googleapis/googleapis/ \ + --go_out=,plugins=grpc:. \ path/to/your_service.proto ``` diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 79af189db91..0d8f3208cc6 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -7,7 +7,7 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" +import _ "google.golang.org/genproto/googleapis/api/annotations" import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" import google_protobuf2 "github.com/golang/protobuf/ptypes/duration" import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" @@ -873,7 +873,7 @@ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", var fileDescriptor1 = []byte{ // 1297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, 0x14, 0xcf, 0xd8, 0x89, 0x13, 0x3f, 0xc7, 0x89, 0x33, 0x69, 0x53, 0xd7, 0x2d, 0x64, 0x71, 0x01, 0xad, 0x42, 0xb5, 0xab, 0xba, 0x15, 0x6a, 0x23, 0x41, 0x95, 0x34, 0x86, 0x22, 0xda, 0xb4, 0xdd, 0xfe, 0x41, 0x8a, 0x5a, 0xac, 0xb5, 0x3d, 0xb6, 0x57, 0xf1, 0xee, 0x2c, 0xbb, 0xb3, 0x26, 0x96, diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index a7e19fdd932..8edcf616813 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -30,7 +30,7 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" +import _ "google.golang.org/genproto/googleapis/api/annotations" import ( context "golang.org/x/net/context" @@ -189,7 +189,7 @@ func init() { proto.RegisterFile("examples/examplepb/echo_service.proto", fileDe var fileDescriptor0 = []byte{ // 229 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x87, 0x32, 0x0a, 0x92, 0xf4, 0x53, 0x93, 0x33, 0xf2, 0xe3, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xe4, 0xd3, 0x8b, 0x0a, 0x92, 0xf5, 0xd2, 0x13, 0x4b, 0x52, 0xcb, 0x13, 0x2b, 0xf5, 0x60, 0x7a, 0xf4, 0xe0, 0x7a, diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index bd6dde41f4f..486b7c60682 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -7,7 +7,7 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" +import _ "google.golang.org/genproto/googleapis/api/annotations" import ( context "golang.org/x/net/context" @@ -679,7 +679,7 @@ func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fi var fileDescriptor3 = []byte{ // 656 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x8f, 0x12, 0x4f, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x8f, 0x12, 0x4f, 0x18, 0xc7, 0xf3, 0x70, 0xc9, 0x2f, 0xb9, 0xe1, 0xfe, 0x70, 0xcb, 0x2f, 0x08, 0x1c, 0x1e, 0x77, 0xe3, 0x25, 0xe2, 0xbf, 0x5d, 0x82, 0xd5, 0x51, 0x9e, 0xd1, 0x92, 0x5c, 0xb8, 0xd8, 0x6c, 0x63, 0x66, 0x87, 0x15, 0x48, 0x60, 0x67, 0x6e, 0x77, 0x0d, 0x5e, 0x08, 0x31, 0xb1, 0xb1, 0xb4, 0xf0, diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index 9bc4de296f1..2411be64e9f 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -7,7 +7,7 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" +import _ "google.golang.org/genproto/googleapis/api/annotations" import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" @@ -256,7 +256,7 @@ func init() { proto.RegisterFile("examples/examplepb/stream.proto", fileDescript var fileDescriptor2 = []byte{ // 314 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x90, 0xbf, 0x4a, 0x43, 0x31, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xbf, 0x4a, 0x43, 0x31, 0x14, 0xc6, 0xb9, 0x2a, 0xa2, 0x11, 0x97, 0x0c, 0x0e, 0x51, 0x28, 0x16, 0xc1, 0x2a, 0x92, 0xb4, 0xba, 0xb9, 0x59, 0xe9, 0xa6, 0x38, 0x74, 0x73, 0x29, 0xc9, 0xe5, 0x34, 0x0d, 0xbd, 0xf7, 0x26, 0x24, 0xe7, 0x56, 0x0b, 0x4e, 0x8e, 0xae, 0x7d, 0x11, 0xdf, 0xc5, 0x57, 0xf0, 0x41, 0xa4, 0xf7, diff --git a/examples/sub/message.pb.go b/examples/sub/message.pb.go index 58a9be92c13..57c4ecd8e6e 100644 --- a/examples/sub/message.pb.go +++ b/examples/sub/message.pb.go @@ -53,7 +53,7 @@ func init() { proto.RegisterFile("examples/sub/message.proto", fileDescriptor0) var fileDescriptor0 = []byte{ // 111 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0x48, 0xcc, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4c, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0x4f, 0x2c, 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0x29, 0xd4, 0x2b, 0x2e, 0x4d, 0x52, 0x52, 0xe5, 0xe2, 0x0d, diff --git a/examples/sub2/message.pb.go b/examples/sub2/message.pb.go index dada72d4557..18569d9427e 100644 --- a/examples/sub2/message.pb.go +++ b/examples/sub2/message.pb.go @@ -52,7 +52,7 @@ func init() { proto.RegisterFile("examples/sub2/message.proto", fileDescriptor0) var fileDescriptor0 = []byte{ // 128 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x29, 0xc9, 0x73, 0x71, 0x7a, 0xa6, 0xf8, 0x42, 0x24, 0x84, 0x84, 0xb8, 0x58, 0x4a, 0x4b, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18, diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index 7bd928678f0..c9dfec8e040 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -8,7 +8,7 @@ import ( "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" - options "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" + options "google.golang.org/genproto/googleapis/api/annotations" ) // loadServices registers services and their methods from "targetFile" to "r". diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index d2218c004bc..a2aecd00ae0 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -13,7 +13,7 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" - options "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api" + options "google.golang.org/genproto/googleapis/api/annotations" ) var ( diff --git a/protoc-gen-grpc-gateway/httprule/parse.go b/protoc-gen-grpc-gateway/httprule/parse.go index 97122f20451..3be742685c6 100644 --- a/protoc-gen-grpc-gateway/httprule/parse.go +++ b/protoc-gen-grpc-gateway/httprule/parse.go @@ -92,7 +92,7 @@ func tokenize(path string) (tokens []string, verb string) { return tokens, verb } -// parser is a parser of the template syntax defined in third_party/googleapis/google/api/httprule.proto. +// parser is a parser of the template syntax defined in github.com/googleapis/googleapis/google/api/http.proto. type parser struct { tokens []string accepted []string diff --git a/runtime/internal/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go index e2486eb8eec..9a140556495 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -78,7 +78,7 @@ func init() { proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDesc var fileDescriptor0 = []byte{ // 181 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0x8e, 0xbf, 0xee, 0x82, 0x30, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x8e, 0xbf, 0xee, 0x82, 0x30, 0x14, 0x85, 0xd3, 0xdf, 0x1f, 0x85, 0xcb, 0x46, 0x1c, 0x9a, 0x38, 0x48, 0x74, 0x61, 0x82, 0xc1, 0x37, 0xd0, 0xf8, 0x02, 0xb0, 0xb9, 0x90, 0x0a, 0x37, 0x40, 0x94, 0x96, 0xdc, 0x5e, 0x62, 0x5c, 0x7d, 0x72, 0xd3, 0x22, 0xe3, 0xf9, 0xbe, 0x73, 0x92, 0x03, 0x07, 0x9a, 0x34, 0xf7, 0x03, 0xe6, diff --git a/runtime/pattern.go b/runtime/pattern.go index 3947dbea023..8a9ec2cdae4 100644 --- a/runtime/pattern.go +++ b/runtime/pattern.go @@ -21,7 +21,7 @@ type op struct { operand int } -// Pattern is a template pattern of http request paths defined in third_party/googleapis/google/api/http.proto. +// Pattern is a template pattern of http request paths defined in github.com/googleapis/googleapis/google/api/http.proto. type Pattern struct { // ops is a list of operations ops []op diff --git a/third_party/googleapis/README.grcp-gateway b/third_party/googleapis/README.grpc-gateway similarity index 100% rename from third_party/googleapis/README.grcp-gateway rename to third_party/googleapis/README.grpc-gateway diff --git a/third_party/googleapis/google/api/annotations.pb.go b/third_party/googleapis/google/api/annotations.pb.go deleted file mode 100644 index 98366b55059..00000000000 --- a/third_party/googleapis/google/api/annotations.pb.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by protoc-gen-go. -// source: google/api/annotations.proto -// DO NOT EDIT! - -/* -Package google_api is a generated protocol buffer package. - -It is generated from these files: - google/api/annotations.proto - google/api/http.proto - -It has these top-level messages: - HttpRule - CustomHttpPattern -*/ -package google_api - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import google_protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -var E_Http = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MethodOptions)(nil), - ExtensionType: (*HttpRule)(nil), - Field: 72295728, - Name: "google.api.http", - Tag: "bytes,72295728,opt,name=http", - Filename: "google/api/annotations.proto", -} - -func init() { - proto.RegisterExtension(E_Http) -} - -func init() { proto.RegisterFile("google/api/annotations.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 169 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, - 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, - 0xcf, 0x2b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0xc8, 0xea, 0x25, 0x16, 0x64, - 0x4a, 0x89, 0x22, 0xa9, 0xcc, 0x28, 0x29, 0x29, 0x80, 0x28, 0x91, 0x52, 0x80, 0x0a, 0x83, 0x79, - 0x49, 0xa5, 0x69, 0xfa, 0x29, 0xa9, 0xc5, 0xc9, 0x45, 0x99, 0x05, 0x25, 0xf9, 0x45, 0x10, 0x15, - 0x56, 0xde, 0x5c, 0x2c, 0x20, 0xf5, 0x42, 0x72, 0x7a, 0x50, 0xd3, 0x60, 0x4a, 0xf5, 0x7c, 0x53, - 0x4b, 0x32, 0xf2, 0x53, 0xfc, 0x0b, 0xc0, 0x56, 0x4a, 0x6c, 0x38, 0xb5, 0x47, 0x49, 0x81, 0x51, - 0x83, 0xdb, 0x48, 0x44, 0x0f, 0x61, 0xad, 0x9e, 0x47, 0x49, 0x49, 0x41, 0x50, 0x69, 0x4e, 0x6a, - 0x10, 0xd8, 0x10, 0x27, 0x15, 0x2e, 0xbe, 0xe4, 0xfc, 0x5c, 0x24, 0x05, 0x4e, 0x02, 0x8e, 0x08, - 0x67, 0x07, 0x80, 0x4c, 0x0e, 0x60, 0x4c, 0x62, 0x03, 0x5b, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, - 0xff, 0x4f, 0xd1, 0x89, 0x83, 0xde, 0x00, 0x00, 0x00, -} diff --git a/third_party/googleapis/google/api/annotations.proto b/third_party/googleapis/google/api/annotations.proto index cbd18b847f3..85c361b47fe 100644 --- a/third_party/googleapis/google/api/annotations.proto +++ b/third_party/googleapis/google/api/annotations.proto @@ -19,9 +19,11 @@ package google.api; import "google/api/http.proto"; import "google/protobuf/descriptor.proto"; +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; option java_multiple_files = true; option java_outer_classname = "AnnotationsProto"; option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; extend google.protobuf.MethodOptions { // See `HttpRule`. diff --git a/third_party/googleapis/google/api/http.pb.go b/third_party/googleapis/google/api/http.pb.go deleted file mode 100644 index 82e742cf031..00000000000 --- a/third_party/googleapis/google/api/http.pb.go +++ /dev/null @@ -1,381 +0,0 @@ -// Code generated by protoc-gen-go. -// source: google/api/http.proto -// DO NOT EDIT! - -package google_api - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// `HttpRule` defines the mapping of an RPC method to one or more HTTP REST API -// methods. The mapping determines what portions of the request message are -// populated from the path, query parameters, or body of the HTTP request. The -// mapping is typically specified as an `google.api.http` annotation, see -// "google/api/annotations.proto" for details. -// -// The mapping consists of a mandatory field specifying a path template and an -// optional `body` field specifying what data is represented in the HTTP request -// body. The field name for the path indicates the HTTP method. Example: -// -// ``` -// package google.storage.v2; -// -// import "google/api/annotations.proto"; -// -// service Storage { -// rpc CreateObject(CreateObjectRequest) returns (Object) { -// option (google.api.http) { -// post: "/v2/{bucket_name=buckets/*}/objects" -// body: "object" -// }; -// }; -// } -// ``` -// -// Here `bucket_name` and `object` bind to fields of the request message -// `CreateObjectRequest`. -// -// The rules for mapping HTTP path, query parameters, and body fields -// to the request message are as follows: -// -// 1. The `body` field specifies either `*` or a field path, or is -// omitted. If omitted, it assumes there is no HTTP body. -// 2. Leaf fields (recursive expansion of nested messages in the -// request) can be classified into three types: -// (a) Matched in the URL template. -// (b) Covered by body (if body is `*`, everything except (a) fields; -// else everything under the body field) -// (c) All other fields. -// 3. URL query parameters found in the HTTP request are mapped to (c) fields. -// 4. Any body sent with an HTTP request can contain only (b) fields. -// -// The syntax of the path template is as follows: -// -// Template = "/" Segments [ Verb ] ; -// Segments = Segment { "/" Segment } ; -// Segment = "*" | "**" | LITERAL | Variable ; -// Variable = "{" FieldPath [ "=" Segments ] "}" ; -// FieldPath = IDENT { "." IDENT } ; -// Verb = ":" LITERAL ; -// -// `*` matches a single path component, `**` zero or more path components, and -// `LITERAL` a constant. A `Variable` can match an entire path as specified -// again by a template; this nested template must not contain further variables. -// If no template is given with a variable, it matches a single path component. -// The notation `{var}` is henceforth equivalent to `{var=*}`. -// -// Use CustomHttpPattern to specify any HTTP method that is not included in the -// pattern field, such as HEAD, or "*" to leave the HTTP method unspecified for -// a given URL path rule. The wild-card rule is useful for services that provide -// content to Web (HTML) clients. -type HttpRule struct { - // Determines the URL pattern is matched by this rules. This pattern can be - // used with any of the {get|put|post|delete|patch} methods. A custom method - // can be defined using the 'custom' field. - // - // Types that are valid to be assigned to Pattern: - // *HttpRule_Get - // *HttpRule_Put - // *HttpRule_Post - // *HttpRule_Delete - // *HttpRule_Patch - // *HttpRule_Custom - Pattern isHttpRule_Pattern `protobuf_oneof:"pattern"` - // The name of the request field whose value is mapped to the HTTP body, or - // `*` for mapping all fields not captured by the path pattern to the HTTP - // body. - Body string `protobuf:"bytes,7,opt,name=body" json:"body,omitempty"` - // Additional HTTP bindings for the selector. Nested bindings must not - // specify a selector and must not contain additional bindings. - AdditionalBindings []*HttpRule `protobuf:"bytes,11,rep,name=additional_bindings,json=additionalBindings" json:"additional_bindings,omitempty"` -} - -func (m *HttpRule) Reset() { *m = HttpRule{} } -func (m *HttpRule) String() string { return proto.CompactTextString(m) } -func (*HttpRule) ProtoMessage() {} -func (*HttpRule) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } - -type isHttpRule_Pattern interface { - isHttpRule_Pattern() -} - -type HttpRule_Get struct { - Get string `protobuf:"bytes,2,opt,name=get,oneof"` -} -type HttpRule_Put struct { - Put string `protobuf:"bytes,3,opt,name=put,oneof"` -} -type HttpRule_Post struct { - Post string `protobuf:"bytes,4,opt,name=post,oneof"` -} -type HttpRule_Delete struct { - Delete string `protobuf:"bytes,5,opt,name=delete,oneof"` -} -type HttpRule_Patch struct { - Patch string `protobuf:"bytes,6,opt,name=patch,oneof"` -} -type HttpRule_Custom struct { - Custom *CustomHttpPattern `protobuf:"bytes,8,opt,name=custom,oneof"` -} - -func (*HttpRule_Get) isHttpRule_Pattern() {} -func (*HttpRule_Put) isHttpRule_Pattern() {} -func (*HttpRule_Post) isHttpRule_Pattern() {} -func (*HttpRule_Delete) isHttpRule_Pattern() {} -func (*HttpRule_Patch) isHttpRule_Pattern() {} -func (*HttpRule_Custom) isHttpRule_Pattern() {} - -func (m *HttpRule) GetPattern() isHttpRule_Pattern { - if m != nil { - return m.Pattern - } - return nil -} - -func (m *HttpRule) GetGet() string { - if x, ok := m.GetPattern().(*HttpRule_Get); ok { - return x.Get - } - return "" -} - -func (m *HttpRule) GetPut() string { - if x, ok := m.GetPattern().(*HttpRule_Put); ok { - return x.Put - } - return "" -} - -func (m *HttpRule) GetPost() string { - if x, ok := m.GetPattern().(*HttpRule_Post); ok { - return x.Post - } - return "" -} - -func (m *HttpRule) GetDelete() string { - if x, ok := m.GetPattern().(*HttpRule_Delete); ok { - return x.Delete - } - return "" -} - -func (m *HttpRule) GetPatch() string { - if x, ok := m.GetPattern().(*HttpRule_Patch); ok { - return x.Patch - } - return "" -} - -func (m *HttpRule) GetCustom() *CustomHttpPattern { - if x, ok := m.GetPattern().(*HttpRule_Custom); ok { - return x.Custom - } - return nil -} - -func (m *HttpRule) GetBody() string { - if m != nil { - return m.Body - } - return "" -} - -func (m *HttpRule) GetAdditionalBindings() []*HttpRule { - if m != nil { - return m.AdditionalBindings - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*HttpRule) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _HttpRule_OneofMarshaler, _HttpRule_OneofUnmarshaler, _HttpRule_OneofSizer, []interface{}{ - (*HttpRule_Get)(nil), - (*HttpRule_Put)(nil), - (*HttpRule_Post)(nil), - (*HttpRule_Delete)(nil), - (*HttpRule_Patch)(nil), - (*HttpRule_Custom)(nil), - } -} - -func _HttpRule_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*HttpRule) - // pattern - switch x := m.Pattern.(type) { - case *HttpRule_Get: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Get) - case *HttpRule_Put: - b.EncodeVarint(3<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Put) - case *HttpRule_Post: - b.EncodeVarint(4<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Post) - case *HttpRule_Delete: - b.EncodeVarint(5<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Delete) - case *HttpRule_Patch: - b.EncodeVarint(6<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Patch) - case *HttpRule_Custom: - b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Custom); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("HttpRule.Pattern has unexpected type %T", x) - } - return nil -} - -func _HttpRule_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*HttpRule) - switch tag { - case 2: // pattern.get - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Pattern = &HttpRule_Get{x} - return true, err - case 3: // pattern.put - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Pattern = &HttpRule_Put{x} - return true, err - case 4: // pattern.post - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Pattern = &HttpRule_Post{x} - return true, err - case 5: // pattern.delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Pattern = &HttpRule_Delete{x} - return true, err - case 6: // pattern.patch - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Pattern = &HttpRule_Patch{x} - return true, err - case 8: // pattern.custom - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(CustomHttpPattern) - err := b.DecodeMessage(msg) - m.Pattern = &HttpRule_Custom{msg} - return true, err - default: - return false, nil - } -} - -func _HttpRule_OneofSizer(msg proto.Message) (n int) { - m := msg.(*HttpRule) - // pattern - switch x := m.Pattern.(type) { - case *HttpRule_Get: - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Get))) - n += len(x.Get) - case *HttpRule_Put: - n += proto.SizeVarint(3<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Put))) - n += len(x.Put) - case *HttpRule_Post: - n += proto.SizeVarint(4<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Post))) - n += len(x.Post) - case *HttpRule_Delete: - n += proto.SizeVarint(5<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Delete))) - n += len(x.Delete) - case *HttpRule_Patch: - n += proto.SizeVarint(6<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Patch))) - n += len(x.Patch) - case *HttpRule_Custom: - s := proto.Size(x.Custom) - n += proto.SizeVarint(8<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// A custom pattern is used for defining custom HTTP verb. -type CustomHttpPattern struct { - // The name of this custom HTTP verb. - Kind string `protobuf:"bytes,1,opt,name=kind" json:"kind,omitempty"` - // The path matched by this custom verb. - Path string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` -} - -func (m *CustomHttpPattern) Reset() { *m = CustomHttpPattern{} } -func (m *CustomHttpPattern) String() string { return proto.CompactTextString(m) } -func (*CustomHttpPattern) ProtoMessage() {} -func (*CustomHttpPattern) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } - -func (m *CustomHttpPattern) GetKind() string { - if m != nil { - return m.Kind - } - return "" -} - -func (m *CustomHttpPattern) GetPath() string { - if m != nil { - return m.Path - } - return "" -} - -func init() { - proto.RegisterType((*HttpRule)(nil), "google.api.HttpRule") - proto.RegisterType((*CustomHttpPattern)(nil), "google.api.CustomHttpPattern") -} - -func init() { proto.RegisterFile("google/api/http.proto", fileDescriptor1) } - -var fileDescriptor1 = []byte{ - // 280 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x6a, 0xbb, 0x40, - 0x10, 0xc6, 0xff, 0x46, 0x63, 0xe2, 0x08, 0x7f, 0xe8, 0x36, 0x2d, 0x7b, 0x09, 0x48, 0x4e, 0x9e, - 0x0c, 0xa4, 0x87, 0x1e, 0x7a, 0xb3, 0x14, 0x72, 0x0c, 0xbe, 0x40, 0x59, 0xdd, 0x45, 0x97, 0x1a, - 0x77, 0x88, 0xe3, 0xa1, 0x8f, 0xd2, 0xb7, 0x2d, 0xbb, 0x6b, 0x48, 0xa0, 0xb7, 0xf9, 0x7e, 0x33, - 0x7e, 0xdf, 0xb8, 0x03, 0x4f, 0xad, 0x31, 0x6d, 0xaf, 0xf6, 0x02, 0xf5, 0xbe, 0x23, 0xc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70, 0x0a, 0xea, 0xd8, 0x9d, 0xe2, 0xe5, 0x37, 0x00, 0x00, 0xff, 0xff, - 0x2f, 0x89, 0x57, 0x7f, 0xa3, 0x01, 0x00, 0x00, -} diff --git a/third_party/googleapis/google/api/http.proto b/third_party/googleapis/google/api/http.proto index ce07aa14f54..5f8538a0164 100644 --- a/third_party/googleapis/google/api/http.proto +++ b/third_party/googleapis/google/api/http.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2015, Google Inc. +// Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,38 +16,184 @@ syntax = "proto3"; package google.api; +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; option java_multiple_files = true; option java_outer_classname = "HttpProto"; option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; -// `HttpRule` defines the mapping of an RPC method to one or more HTTP REST API -// methods. The mapping determines what portions of the request message are -// populated from the path, query parameters, or body of the HTTP request. The -// mapping is typically specified as an `google.api.http` annotation, see -// "google/api/annotations.proto" for details. +// Defines the HTTP configuration for a service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +message Http { + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated HttpRule rules = 1; +} + +// `HttpRule` defines the mapping of an RPC method to one or more HTTP +// REST APIs. The mapping determines what portions of the request +// message are populated from the path, query parameters, or body of +// the HTTP request. The mapping is typically specified as an +// `google.api.http` annotation, see "google/api/annotations.proto" +// for details. +// +// The mapping consists of a field specifying the path template and +// method kind. The path template can refer to fields in the request +// message, as in the example below which describes a REST GET +// operation on a resource collection of messages: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// SubMessage sub = 2; // `sub.subfield` is url-mapped +// } +// message Message { +// string text = 1; // content of the resource +// } +// +// The same http annotation can alternatively be expressed inside the +// `GRPC API Configuration` YAML file. +// +// http: +// rules: +// - selector: .Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// This definition enables an automatic, bidrectional mapping of HTTP +// JSON to RPC. Example: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` +// +// In general, not only fields but also field paths can be referenced +// from a path pattern. Fields mapped to the path pattern cannot be +// repeated and must have a primitive (non-message) type. +// +// Any fields in the request message which are not bound by the path +// pattern automatically become (optional) HTTP query +// parameters. Assume the following definition of the request message: +// +// +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// int64 revision = 2; // becomes a parameter +// SubMessage sub = 3; // `sub.subfield` becomes a parameter +// } +// +// +// This enables a HTTP JSON to RPC mapping as below: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` +// +// Note that fields which are mapped to HTTP parameters must have a +// primitive type or a repeated primitive type. Message types are not +// allowed. In the case of a repeated type, the parameter can be +// repeated in the URL, as in `...?param=A¶m=B`. // -// The mapping consists of a mandatory field specifying a path template and an -// optional `body` field specifying what data is represented in the HTTP request -// body. The field name for the path indicates the HTTP method. Example: +// For HTTP method kinds which allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: // -// ``` -// package google.storage.v2; // -// import "google/api/annotations.proto"; +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } // -// service Storage { -// rpc CreateObject(CreateObjectRequest) returns (Object) { -// option (google.api.http) { -// post: "/v2/{bucket_name=buckets/*}/objects" -// body: "object" -// }; -// }; -// } -// ``` // -// Here `bucket_name` and `object` bind to fields of the request message -// `CreateObjectRequest`. +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// +// The following HTTP JSON to RPC mapping is enabled: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice of +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// +// This enables the following two alternative HTTP JSON to RPC +// mappings: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` +// +// # Rules for HTTP mapping // // The rules for mapping HTTP path, query parameters, and body fields // to the request message are as follows: @@ -72,17 +218,33 @@ option java_package = "com.google.api"; // FieldPath = IDENT { "." IDENT } ; // Verb = ":" LITERAL ; // -// `*` matches a single path component, `**` zero or more path components, and -// `LITERAL` a constant. A `Variable` can match an entire path as specified -// again by a template; this nested template must not contain further variables. -// If no template is given with a variable, it matches a single path component. -// The notation `{var}` is henceforth equivalent to `{var=*}`. +// The syntax `*` matches a single path segment. It follows the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String +// Expansion. +// +// The syntax `**` matches zero or more path segments. It follows the semantics +// of [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.3 Reserved +// Expansion. NOTE: it must be the last segment in the path except the Verb. +// +// The syntax `LITERAL` matches literal text in the URL path. +// +// The syntax `Variable` matches the entire path as specified by its template; +// this nested template must not contain further variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// NOTE: the field paths in variables and in the `body` must not refer to +// repeated fields or map fields. // // Use CustomHttpPattern to specify any HTTP method that is not included in the -// pattern field, such as HEAD, or "*" to leave the HTTP method unspecified for +// `pattern` field, such as HEAD, or "*" to leave the HTTP method unspecified for // a given URL path rule. The wild-card rule is useful for services that provide // content to Web (HTML) clients. message HttpRule { + // Selects methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; // Determines the URL pattern is matched by this rules. This pattern can be // used with any of the {get|put|post|delete|patch} methods. A custom method @@ -109,11 +271,13 @@ message HttpRule { // The name of the request field whose value is mapped to the HTTP body, or // `*` for mapping all fields not captured by the path pattern to the HTTP - // body. + // body. NOTE: the referred field must not be a repeated field and must be + // present at the top-level of request message type. string body = 7; - // Additional HTTP bindings for the selector. Nested bindings must not - // specify a selector and must not contain additional bindings. + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). repeated HttpRule additional_bindings = 11; } From 5336e1edafc314ae123754dec01970e73f64199c Mon Sep 17 00:00:00 2001 From: Maxime Fischer Date: Wed, 15 Mar 2017 21:35:39 +0000 Subject: [PATCH 124/552] Return an error on invalid nested query parameters. (#329) * Add some tests with invalid nested query paramters. * Return an error when an invalid nested field is passed in query parameters. --- runtime/query.go | 3 ++ runtime/query_test.go | 99 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/runtime/query.go b/runtime/query.go index 85d0e23612a..69f0ba1d6a7 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -56,6 +56,9 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] switch f.Kind() { case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, reflect.String, reflect.Uint32, reflect.Uint64: + if !isLast { + return fmt.Errorf("unexpected nested field %s in %s", fieldPath[i+1], strings.Join(fieldPath[:i+1], ".")) + } m = f case reflect.Slice: // TODO(yugui) Support []byte diff --git a/runtime/query_test.go b/runtime/query_test.go index 58cc3c5b669..2670966caa0 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -229,6 +229,105 @@ func TestPopulateParametersWithFilters(t *testing.T) { } } +func TestPopulateQueryParametersWithInvalidNestedParameters(t *testing.T) { + for _, spec := range []struct { + msg proto.Message + values url.Values + filter *utilities.DoubleArray + }{ + { + msg: &proto3Message{}, + values: url.Values{ + "float_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "double_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "int64_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "int32_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "uint64_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "uint32_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "bool_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "string_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "repeated_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "enum_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "enum_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "repeated_enum.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + } { + spec.msg.Reset() + err := runtime.PopulateQueryParameters(spec.msg, spec.values, spec.filter) + if err == nil { + t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v) did not fail; want error", spec.values, spec.filter) + } + } +} + type proto3Message struct { Nested *proto2Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` NestedNonNull proto2Message `protobuf:"bytes,11,opt,name=nested_non_null" json:"nested_non_null,omitempty"` From 17af8472529038b54ce5d9657fd65dd305652d96 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 21 Mar 2017 13:09:37 -0700 Subject: [PATCH 125/552] Update stale path in README (#332) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 69e3d39411e..2ce299f2a72 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. ```sh protoc -I/usr/local/include -I. \ -I$GOPATH/src \ - -I$GOPATH/src/github.com/googleapis/googleapis/ \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --go_out=,plugins=grpc:. \ path/to/your_service.proto ``` From d9687264d75dd4d093ad5766295a0814b3b1bd8e Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 21 Mar 2017 13:21:02 -0700 Subject: [PATCH 126/552] Update go_out parameter to remove comma (#333) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ce299f2a72..72126610633 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. protoc -I/usr/local/include -I. \ -I$GOPATH/src \ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ - --go_out=,plugins=grpc:. \ + --go_out=plugins=grpc:. \ path/to/your_service.proto ``` From 71901e81470ae00ea7204a5682b92d5c8934d6ce Mon Sep 17 00:00:00 2001 From: "Patrick M. Galbraith" Date: Fri, 24 Mar 2017 09:56:43 -0400 Subject: [PATCH 127/552] Various updates, corrected include path to README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 72126610633..b8a7b8af192 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ make check sudo make install ``` -Then, `go get -u` as usual. +Then, `go get -u` as usual the following packages: ```sh go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway @@ -127,6 +127,9 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. ``` It will generate a reverse proxy `path/to/your_service.pb.gw.go`. + + Note: After generating the code for each of the stubs, in order to build the code, you will want to run ```go get .``` from the directory containing the stubs. + 6. Write an entrypoint Now you need to write an entrypoint of the proxy server. From a89656b6b1755b838aca408cb4ead6728c8d8db2 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Thu, 30 Mar 2017 19:13:50 -0700 Subject: [PATCH 128/552] Add changelog for 1.2.0 generated with github_changelog_generator author=false compare-link=false issues=false exclude-tags=v1.2.0.rc1 future-release=v1.2.0 --- CHANGELOG.md | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000000..94c0426105e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,152 @@ +# Change Log + +## [v1.2.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.0) (2017-03-30) +**Merged pull requests:** + +- Update go\_out parameter to remove comma [\#333](https://github.com/grpc-ecosystem/grpc-gateway/pull/333) +- Update stale path in README [\#332](https://github.com/grpc-ecosystem/grpc-gateway/pull/332) +- improve documentation regarding external dependencies [\#330](https://github.com/grpc-ecosystem/grpc-gateway/pull/330) +- Return an error on invalid nested query parameters. [\#329](https://github.com/grpc-ecosystem/grpc-gateway/pull/329) +- Update upstream proto files and add google.golang.org/genproto support. [\#325](https://github.com/grpc-ecosystem/grpc-gateway/pull/325) +- Do not ignore the error coming from http.ListenAndServe in examples [\#319](https://github.com/grpc-ecosystem/grpc-gateway/pull/319) +- Look up enum value maps by their proto name [\#315](https://github.com/grpc-ecosystem/grpc-gateway/pull/315) +- enable parsing enums from query parameters [\#314](https://github.com/grpc-ecosystem/grpc-gateway/pull/314) +- Do not add imports from methods with no bindings. [\#312](https://github.com/grpc-ecosystem/grpc-gateway/pull/312) +- Convert the first letter of method name to upper [\#300](https://github.com/grpc-ecosystem/grpc-gateway/pull/300) +- write query parameters to swagger definition [\#297](https://github.com/grpc-ecosystem/grpc-gateway/pull/297) +- Bump swagger-client to 2.1.28 for examples/browser [\#290](https://github.com/grpc-ecosystem/grpc-gateway/pull/290) +- pin to version before es6ism [\#289](https://github.com/grpc-ecosystem/grpc-gateway/pull/289) +- Prevent lack of http bindings from generating non-building output [\#286](https://github.com/grpc-ecosystem/grpc-gateway/pull/286) +- Added support for Timestamp in URL. [\#281](https://github.com/grpc-ecosystem/grpc-gateway/pull/281) +- add plugin param 'allow\_delete\_body' [\#280](https://github.com/grpc-ecosystem/grpc-gateway/pull/280) +- Fix ruby gen command [\#275](https://github.com/grpc-ecosystem/grpc-gateway/pull/275) +- Make grpc-gateway support enum fields in path parameter [\#273](https://github.com/grpc-ecosystem/grpc-gateway/pull/273) +- remove unnecessary make\(\) [\#271](https://github.com/grpc-ecosystem/grpc-gateway/pull/271) +- preserve field order in swagger spec [\#270](https://github.com/grpc-ecosystem/grpc-gateway/pull/270) +- Merge \#228 [\#268](https://github.com/grpc-ecosystem/grpc-gateway/pull/268) +- Handle methods with no bindings more carefully [\#267](https://github.com/grpc-ecosystem/grpc-gateway/pull/267) +- describe default marshaler in README.md [\#266](https://github.com/grpc-ecosystem/grpc-gateway/pull/266) +- Add request\_context flag to utilize \(\*http.Request\).Context\(\) in handlers [\#265](https://github.com/grpc-ecosystem/grpc-gateway/pull/265) +- Regenerate examples [\#264](https://github.com/grpc-ecosystem/grpc-gateway/pull/264) +- Correct runtime.errorBody protobuf field tag [\#256](https://github.com/grpc-ecosystem/grpc-gateway/pull/256) +- Pass permanent HTTP request headers [\#252](https://github.com/grpc-ecosystem/grpc-gateway/pull/252) +- regenerate examples, fix tests for go tip [\#248](https://github.com/grpc-ecosystem/grpc-gateway/pull/248) +- Render the swagger request body properly [\#247](https://github.com/grpc-ecosystem/grpc-gateway/pull/247) +- Error output should have lowercase attribute names [\#244](https://github.com/grpc-ecosystem/grpc-gateway/pull/244) +- runtime - export prefix constants [\#236](https://github.com/grpc-ecosystem/grpc-gateway/pull/236) +- README - Add CoreOS example [\#231](https://github.com/grpc-ecosystem/grpc-gateway/pull/231) +- Docs - Add section about how HTTP maps to gRPC [\#227](https://github.com/grpc-ecosystem/grpc-gateway/pull/227) +- readme: added links to additional documentation [\#222](https://github.com/grpc-ecosystem/grpc-gateway/pull/222) +- Use a released version of protoc [\#216](https://github.com/grpc-ecosystem/grpc-gateway/pull/216) +- Add contribution guideline [\#210](https://github.com/grpc-ecosystem/grpc-gateway/pull/210) +- improve\(genswagger:template\):added support for google.protobuf.Timestamp [\#209](https://github.com/grpc-ecosystem/grpc-gateway/pull/209) +- Allowing unknown fields to be dropped instead of returning error from… [\#208](https://github.com/grpc-ecosystem/grpc-gateway/pull/208) +- Avoid Internal Server Error on zero-length input for bidi streaming [\#200](https://github.com/grpc-ecosystem/grpc-gateway/pull/200) + +## [v1.1.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.1.0) (2016-07-23) +**Merged pull requests:** + +- Rename packages to follow the repository transfer [\#192](https://github.com/grpc-ecosystem/grpc-gateway/pull/192) +- return err early if EOF to prevent logging in normal conditions [\#191](https://github.com/grpc-ecosystem/grpc-gateway/pull/191) +- send Trailer header on error [\#188](https://github.com/grpc-ecosystem/grpc-gateway/pull/188) +- generate swagger output for streaming endpoints with a basic note [\#183](https://github.com/grpc-ecosystem/grpc-gateway/pull/183) + +## [v1.0.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.0.0) (2016-06-15) +**Merged pull requests:** + +- Regenerate files with the latest protoc-gen-go [\#185](https://github.com/grpc-ecosystem/grpc-gateway/pull/185) +- Add browser examples [\#184](https://github.com/grpc-ecosystem/grpc-gateway/pull/184) +- Fix golint and go vet errors [\#182](https://github.com/grpc-ecosystem/grpc-gateway/pull/182) +- Add integration with clients generated by swagger-codegen [\#181](https://github.com/grpc-ecosystem/grpc-gateway/pull/181) +- Simplify example services [\#180](https://github.com/grpc-ecosystem/grpc-gateway/pull/180) +- Avoid errors when req.RemoteAddr is empty [\#178](https://github.com/grpc-ecosystem/grpc-gateway/pull/178) +- Feature/headers [\#176](https://github.com/grpc-ecosystem/grpc-gateway/pull/176) +- Include HTTP req.remoteAddr in gRPC ctx [\#174](https://github.com/grpc-ecosystem/grpc-gateway/pull/174) +- Update dependencies [\#171](https://github.com/grpc-ecosystem/grpc-gateway/pull/171) +- Add bidirectional streaming support by running Send\(\) and Recv\(\) concurrently [\#170](https://github.com/grpc-ecosystem/grpc-gateway/pull/170) +- make Authorization header check case-insensitive to comply with RFC 2616 4.2 [\#164](https://github.com/grpc-ecosystem/grpc-gateway/pull/164) +- jsonpb: avoid duplicating upstream's struct [\#158](https://github.com/grpc-ecosystem/grpc-gateway/pull/158) +- Generate Swagger description for service methods using proto comments. [\#156](https://github.com/grpc-ecosystem/grpc-gateway/pull/156) +- Implement gRPC timeout support for inbound HTTP headers [\#155](https://github.com/grpc-ecosystem/grpc-gateway/pull/155) +- Add more examples to marshalers [\#154](https://github.com/grpc-ecosystem/grpc-gateway/pull/154) +- custom marshaler: handle `Accept` headers correctly [\#152](https://github.com/grpc-ecosystem/grpc-gateway/pull/152) +- Simplify custom marshaler API [\#151](https://github.com/grpc-ecosystem/grpc-gateway/pull/151) +- Fix camel case path parameter handling in swagger [\#149](https://github.com/grpc-ecosystem/grpc-gateway/pull/149) +- Swagger dot in path template [\#148](https://github.com/grpc-ecosystem/grpc-gateway/pull/148) +- Support map types in swagger generator [\#147](https://github.com/grpc-ecosystem/grpc-gateway/pull/147) +- Cleanup custom marshaler [\#146](https://github.com/grpc-ecosystem/grpc-gateway/pull/146) +- Implement custom Marshaler support, add jsonpb implemention. [\#144](https://github.com/grpc-ecosystem/grpc-gateway/pull/144) +- Allow period in path URL templates when generating Swagger templates. [\#143](https://github.com/grpc-ecosystem/grpc-gateway/pull/143) +- Link to LICENSE.txt [\#142](https://github.com/grpc-ecosystem/grpc-gateway/pull/142) +- Support map types in swagger generator [\#141](https://github.com/grpc-ecosystem/grpc-gateway/pull/141) +- Conditionally stops checking if generated file are up-to-date [\#136](https://github.com/grpc-ecosystem/grpc-gateway/pull/136) +- Generate Swagger description for service methods using proto comments. [\#134](https://github.com/grpc-ecosystem/grpc-gateway/pull/134) +- Swagger definitions now have `type` set to `object`. [\#133](https://github.com/grpc-ecosystem/grpc-gateway/pull/133) +- go\_package option as go import path [\#129](https://github.com/grpc-ecosystem/grpc-gateway/pull/129) +- Fix govet errors [\#126](https://github.com/grpc-ecosystem/grpc-gateway/pull/126) +- Fix data-race in generated codes [\#125](https://github.com/grpc-ecosystem/grpc-gateway/pull/125) +- Fix \#119 - CloseNotify race with ServeHTTP [\#120](https://github.com/grpc-ecosystem/grpc-gateway/pull/120) +- Replace glog with grpclog [\#118](https://github.com/grpc-ecosystem/grpc-gateway/pull/118) +- Fix a goroutine-leak in HTTP keep-alive [\#116](https://github.com/grpc-ecosystem/grpc-gateway/pull/116) +- Fix camel case path parameter handling in swagger [\#114](https://github.com/grpc-ecosystem/grpc-gateway/pull/114) +- gofmt -s [\#112](https://github.com/grpc-ecosystem/grpc-gateway/pull/112) +- fix typo [\#111](https://github.com/grpc-ecosystem/grpc-gateway/pull/111) +- fix typo [\#110](https://github.com/grpc-ecosystem/grpc-gateway/pull/110) +- fixes missing swagger operation objects [\#109](https://github.com/grpc-ecosystem/grpc-gateway/pull/109) +- Add parser and swagger support for enum, no gengateway yet [\#108](https://github.com/grpc-ecosystem/grpc-gateway/pull/108) +- README: add protoc-gen-swagger too [\#105](https://github.com/grpc-ecosystem/grpc-gateway/pull/105) +- README: Suggest go get -u by default. [\#104](https://github.com/grpc-ecosystem/grpc-gateway/pull/104) +- Cancel context when HTTP connection is closed [\#102](https://github.com/grpc-ecosystem/grpc-gateway/pull/102) +- wait test server up [\#100](https://github.com/grpc-ecosystem/grpc-gateway/pull/100) +- Fix the swagger section of the README.md [\#98](https://github.com/grpc-ecosystem/grpc-gateway/pull/98) +- Add documentation for using Swagger [\#97](https://github.com/grpc-ecosystem/grpc-gateway/pull/97) +- Better compatibility to field names generated by protoc-gen-go [\#96](https://github.com/grpc-ecosystem/grpc-gateway/pull/96) +- Update protoc from 3.0.0-beta1 to 3.0.0-beta2 [\#95](https://github.com/grpc-ecosystem/grpc-gateway/pull/95) +- Better grpc error strings [\#94](https://github.com/grpc-ecosystem/grpc-gateway/pull/94) +- make available header and trailer metadata [\#93](https://github.com/grpc-ecosystem/grpc-gateway/pull/93) +- make grpc.DialOption configurable [\#89](https://github.com/grpc-ecosystem/grpc-gateway/pull/89) +- Add request in error handlers [\#88](https://github.com/grpc-ecosystem/grpc-gateway/pull/88) +- Improve PascalFromSnake behavior [\#85](https://github.com/grpc-ecosystem/grpc-gateway/pull/85) +- Typo grcp -\> grpc [\#81](https://github.com/grpc-ecosystem/grpc-gateway/pull/81) +- Add abstraction of code generator implementation [\#78](https://github.com/grpc-ecosystem/grpc-gateway/pull/78) +- Support multivalue of metadata [\#77](https://github.com/grpc-ecosystem/grpc-gateway/pull/77) +- Fix broken test [\#76](https://github.com/grpc-ecosystem/grpc-gateway/pull/76) +- Added missing instruction line in README [\#75](https://github.com/grpc-ecosystem/grpc-gateway/pull/75) +- Fix a complie error in generated go files [\#71](https://github.com/grpc-ecosystem/grpc-gateway/pull/71) +- Update generated .pb.go files in third\_party [\#69](https://github.com/grpc-ecosystem/grpc-gateway/pull/69) +- Add swagger support [\#68](https://github.com/grpc-ecosystem/grpc-gateway/pull/68) +- Bugfix/handling headers for `Authorization` and `Host` [\#65](https://github.com/grpc-ecosystem/grpc-gateway/pull/65) +- Fix `error` field always in chunk response [\#64](https://github.com/grpc-ecosystem/grpc-gateway/pull/64) +- Update .pb.go to latest version. [\#63](https://github.com/grpc-ecosystem/grpc-gateway/pull/63) +- Run more tests in Travis CI [\#60](https://github.com/grpc-ecosystem/grpc-gateway/pull/60) +- Added http error code and error status for responseStreamChunk error [\#59](https://github.com/grpc-ecosystem/grpc-gateway/pull/59) +- Fix parsing of verb and final path component. [\#55](https://github.com/grpc-ecosystem/grpc-gateway/pull/55) +- Add runtime.WithForwardResponseOption [\#53](https://github.com/grpc-ecosystem/grpc-gateway/pull/53) +- add grpc.WithInsecure\(\) as option for grpc.Dial call in template [\#52](https://github.com/grpc-ecosystem/grpc-gateway/pull/52) +- update .pb.go files for latest golang proto generation [\#51](https://github.com/grpc-ecosystem/grpc-gateway/pull/51) +- Fix a build error with the latest protoc-gen-go [\#50](https://github.com/grpc-ecosystem/grpc-gateway/pull/50) +- Configure Travis CI [\#49](https://github.com/grpc-ecosystem/grpc-gateway/pull/49) +- Follow a change of go package name convention in protoc-gen-go [\#48](https://github.com/grpc-ecosystem/grpc-gateway/pull/48) +- Consider tail segments after deep wildcard [\#47](https://github.com/grpc-ecosystem/grpc-gateway/pull/47) +- Fix typo in README [\#45](https://github.com/grpc-ecosystem/grpc-gateway/pull/45) +- Fix undefined variable error in generated codes [\#42](https://github.com/grpc-ecosystem/grpc-gateway/pull/42) +- Follow changes in protoc-gen-go and grpc-go [\#41](https://github.com/grpc-ecosystem/grpc-gateway/pull/41) +- Fixes \#4 [\#40](https://github.com/grpc-ecosystem/grpc-gateway/pull/40) +- fix examples to work with go1.5 [\#39](https://github.com/grpc-ecosystem/grpc-gateway/pull/39) +- rename internal to utilties for 1.5 compatibility [\#38](https://github.com/grpc-ecosystem/grpc-gateway/pull/38) +- Reflection fix of proto3 nested messages. [\#34](https://github.com/grpc-ecosystem/grpc-gateway/pull/34) +- \[Experimental\] Make the response forwarder function customizable [\#31](https://github.com/grpc-ecosystem/grpc-gateway/pull/31) +- Add f.Flush\(\) to runtime.ForwardResponseStream [\#30](https://github.com/grpc-ecosystem/grpc-gateway/pull/30) +- Format error message in JSON [\#29](https://github.com/grpc-ecosystem/grpc-gateway/pull/29) +- Update examples with HTTP header context annotation [\#28](https://github.com/grpc-ecosystem/grpc-gateway/pull/28) +- Report semantic errors in the source to protoc [\#27](https://github.com/grpc-ecosystem/grpc-gateway/pull/27) +- Add support for non-nullable nested messages. [\#21](https://github.com/grpc-ecosystem/grpc-gateway/pull/21) +- Receive GRPC metadata from HTTP headers. [\#18](https://github.com/grpc-ecosystem/grpc-gateway/pull/18) +- Implement detailed specs of google.api.http [\#14](https://github.com/grpc-ecosystem/grpc-gateway/pull/14) +- Configure travis CI [\#13](https://github.com/grpc-ecosystem/grpc-gateway/pull/13) +- Replace our own custom option with the one defined by Google [\#12](https://github.com/grpc-ecosystem/grpc-gateway/pull/12) +- Remove useless context setup [\#11](https://github.com/grpc-ecosystem/grpc-gateway/pull/11) +- Fix typo, path, missing semicolon. [\#10](https://github.com/grpc-ecosystem/grpc-gateway/pull/10) +- Use a globally unique id for the custom option [\#3](https://github.com/grpc-ecosystem/grpc-gateway/pull/3) +- implement ABitOfEverythingService [\#2](https://github.com/grpc-ecosystem/grpc-gateway/pull/2) +- support streaming API calls [\#1](https://github.com/grpc-ecosystem/grpc-gateway/pull/1) From 69af4f49b7c5ddd35462b04c043af82a5522a8b3 Mon Sep 17 00:00:00 2001 From: Noel Cower Date: Thu, 2 Mar 2017 16:58:06 -0800 Subject: [PATCH 129/552] runtime: Add tests for oneof query values This adds tests, which fail, to read values for oneof fields from the query string. The assumption for the change right now is that the query string should only contain one use of a oneof group's fields -- e.g., in the test, only one of oneof_string_value or oneof_bool_value, or neither, may be specified. Passing both is an error. This also adds a wanterr field to the test spec for parameters, simply to detect that case. --- runtime/query_test.go | 178 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 161 insertions(+), 17 deletions(-) diff --git a/runtime/query_test.go b/runtime/query_test.go index 2670966caa0..05166ef0e2f 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -1,7 +1,10 @@ package runtime_test import ( + "errors" + "fmt" "net/url" + "reflect" "testing" "time" @@ -22,9 +25,10 @@ func TestPopulateParameters(t *testing.T) { } for _, spec := range []struct { - values url.Values - filter *utilities.DoubleArray - want proto.Message + values url.Values + filter *utilities.DoubleArray + want proto.Message + wanterr error }{ { values: url.Values{ @@ -131,10 +135,45 @@ func TestPopulateParameters(t *testing.T) { Uint64Value: 1, }, }, + { + values: url.Values{ + "oneof_string_value": {"foobar"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + OneofValue: &proto3Message_OneofStringValue{"foobar"}, + }, + }, + { + values: url.Values{ + "oneof_bool_value": {"true"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + OneofValue: &proto3Message_OneofBoolValue{true}, + }, + }, + { + // Don't allow setting a oneof more than once + values: url.Values{ + "oneof_bool_value": {"true"}, + "oneof_string_value": {"foobar"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{}, + wanterr: errors.New("field already set for oneof"), + }, } { msg := proto.Clone(spec.want) msg.Reset() err := runtime.PopulateQueryParameters(msg, spec.values, spec.filter) + if spec.wanterr != nil { + if !reflect.DeepEqual(err, spec.wanterr) { + t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v) failed with %v; want error %v", spec.values, spec.filter, err, spec.wanterr) + } + continue + } + if err != nil { t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v) failed with %v; want success", spec.values, spec.filter, err) continue @@ -329,20 +368,21 @@ func TestPopulateQueryParametersWithInvalidNestedParameters(t *testing.T) { } type proto3Message struct { - Nested *proto2Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` - NestedNonNull proto2Message `protobuf:"bytes,11,opt,name=nested_non_null" json:"nested_non_null,omitempty"` - FloatValue float32 `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"` - DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value" json:"double_value,omitempty"` - Int64Value int64 `protobuf:"varint,4,opt,name=int64_value" json:"int64_value,omitempty"` - Int32Value int32 `protobuf:"varint,5,opt,name=int32_value" json:"int32_value,omitempty"` - Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value" json:"uint64_value,omitempty"` - Uint32Value uint32 `protobuf:"varint,7,opt,name=uint32_value" json:"uint32_value,omitempty"` - BoolValue bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` - StringValue string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` - RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` - EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` - RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` - TimestampValue *timestamp.Timestamp `protobuf:"bytes,11,opt,name=timestamp_value" json:"timestamp_value,omitempty"` + Nested *proto2Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` + NestedNonNull proto2Message `protobuf:"bytes,11,opt,name=nested_non_null" json:"nested_non_null,omitempty"` + FloatValue float32 `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,4,opt,name=int64_value" json:"int64_value,omitempty"` + Int32Value int32 `protobuf:"varint,5,opt,name=int32_value" json:"int32_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value" json:"uint64_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,7,opt,name=uint32_value" json:"uint32_value,omitempty"` + BoolValue bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` + RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` + EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` + TimestampValue *timestamp.Timestamp `protobuf:"bytes,11,opt,name=timestamp_value" json:"timestamp_value,omitempty"` + OneofValue proto3Message_OneofValue `protobuf_oneof:"oneof_value"` } func (m *proto3Message) Reset() { *m = proto3Message{} } @@ -356,6 +396,110 @@ func (m *proto3Message) GetNested() *proto2Message { return nil } +type proto3Message_OneofValue interface { + proto3Message_OneofValue() +} + +type proto3Message_OneofBoolValue struct { + OneofBoolValue bool `protobuf:"varint,13,opt,name=oneof_bool_value,json=oneofBoolValue,oneof"` +} +type proto3Message_OneofStringValue struct { + OneofStringValue string `protobuf:"bytes,14,opt,name=oneof_string_value,json=oneofStringValue,oneof"` +} + +func (*proto3Message_OneofBoolValue) proto3Message_OneofValue() {} +func (*proto3Message_OneofStringValue) proto3Message_OneofValue() {} + +func (m *proto3Message) GetOneofValue() proto3Message_OneofValue { + if m != nil { + return m.OneofValue + } + return nil +} + +func (m *proto3Message) GetOneofBoolValue() bool { + if x, ok := m.GetOneofValue().(*proto3Message_OneofBoolValue); ok { + return x.OneofBoolValue + } + return false +} + +func (m *proto3Message) GetOneofStringValue() string { + if x, ok := m.GetOneofValue().(*proto3Message_OneofStringValue); ok { + return x.OneofStringValue + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*proto3Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _proto3Message_OneofMarshaler, _proto3Message_OneofUnmarshaler, _proto3Message_OneofSizer, []interface{}{ + (*proto3Message_OneofBoolValue)(nil), + (*proto3Message_OneofStringValue)(nil), + } +} + +func _proto3Message_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*proto3Message) + // oneof_value + switch x := m.OneofValue.(type) { + case *proto3Message_OneofBoolValue: + t := uint64(0) + if x.OneofBoolValue { + t = 1 + } + b.EncodeVarint(13<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *proto3Message_OneofStringValue: + b.EncodeVarint(14<<3 | proto.WireBytes) + b.EncodeStringBytes(x.OneofStringValue) + case nil: + default: + return fmt.Errorf("proto3Message.OneofValue has unexpected type %T", x) + } + return nil +} + +func _proto3Message_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*proto3Message) + switch tag { + case 14: // oneof_value.oneof_bool_value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.OneofValue = &proto3Message_OneofBoolValue{x != 0} + return true, err + case 15: // oneof_value.oneof_string_value + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.OneofValue = &proto3Message_OneofStringValue{x} + return true, err + default: + return false, nil + } +} + +func _proto3Message_OneofSizer(msg proto.Message) (n int) { + m := msg.(*proto3Message) + // oneof_value + switch x := m.OneofValue.(type) { + case *proto3Message_OneofBoolValue: + n += proto.SizeVarint(14<<3 | proto.WireVarint) + n += 1 + case *proto3Message_OneofStringValue: + n += proto.SizeVarint(15<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.OneofStringValue))) + n += len(x.OneofStringValue) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + type proto2Message struct { Nested *proto3Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` FloatValue *float32 `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"` From d7e1e2d62a483d4ce45eee3a0deed46270efa1aa Mon Sep 17 00:00:00 2001 From: Noel Cower Date: Thu, 2 Mar 2017 17:06:36 -0800 Subject: [PATCH 130/552] runtime: Fix tags in proto3Message This is only for testing. Has no effect on tests passing (the tag is unused in runtime), but fixed for the sake of correctness. --- runtime/query_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/query_test.go b/runtime/query_test.go index 05166ef0e2f..82026a8ed84 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -369,7 +369,7 @@ func TestPopulateQueryParametersWithInvalidNestedParameters(t *testing.T) { type proto3Message struct { Nested *proto2Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` - NestedNonNull proto2Message `protobuf:"bytes,11,opt,name=nested_non_null" json:"nested_non_null,omitempty"` + NestedNonNull proto2Message `protobuf:"bytes,15,opt,name=nested_non_null" json:"nested_non_null,omitempty"` FloatValue float32 `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"` DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value" json:"double_value,omitempty"` Int64Value int64 `protobuf:"varint,4,opt,name=int64_value" json:"int64_value,omitempty"` @@ -381,7 +381,7 @@ type proto3Message struct { RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` - TimestampValue *timestamp.Timestamp `protobuf:"bytes,11,opt,name=timestamp_value" json:"timestamp_value,omitempty"` + TimestampValue *timestamp.Timestamp `protobuf:"bytes,16,opt,name=timestamp_value" json:"timestamp_value,omitempty"` OneofValue proto3Message_OneofValue `protobuf_oneof:"oneof_value"` } From e2d19ba0ffec4f3434aa0f57b0b6d6b164f300da Mon Sep 17 00:00:00 2001 From: Noel Cower Date: Thu, 2 Mar 2017 17:07:01 -0800 Subject: [PATCH 131/552] runtime: Add oneof lookup for fields This modifies fieldByProtoName to do two things: 1. It may now return an error. It only does this for the oneof case right now, as the not-found case only causes the field to be skipped. 2. It will first look for the field name in the message's OneofTypes map. If the field matches a OneOf type, it will check first that the field is nil -- if it isn't, the field is already set and it returns an error. If nil, it allocates a new oneof type for the field and returns the first field of the oneof type. The reason for rejecting multiple oneof fields is that the runtime iterates over url.Values and gets pseudo-random key order, meaning that one field is selected out of several. We could address this by sorting the url.Values and picking the last seen, in which case the code is far simpler but involves allocating and sorting an array of field names before walking them (only to get predictable field selection). This change amends the error result tested for in TestPopulateParameters to include the name of oneof_value. Related to issue #82. Change-Id: I7a5ecc9ce397bd71156cd4ac8690bae782ecc55e --- runtime/query.go | 25 ++++++++++++++++++++----- runtime/query_test.go | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/runtime/query.go b/runtime/query.go index 69f0ba1d6a7..4b031219c1f 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -48,8 +48,11 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] return fmt.Errorf("non-aggregate type in the mid of path: %s", strings.Join(fieldPath, ".")) } var f reflect.Value - f, props = fieldByProtoName(m, fieldName) - if !f.IsValid() { + var err error + f, props, err = fieldByProtoName(m, fieldName) + if err != nil { + return err + } else if !f.IsValid() { grpclog.Printf("field not found in %T: %s", msg, strings.Join(fieldPath, ".")) return nil } @@ -92,14 +95,26 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] // fieldByProtoName looks up a field whose corresponding protobuf field name is "name". // "m" must be a struct value. It returns zero reflect.Value if no such field found. -func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Properties) { +func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Properties, error) { props := proto.GetProperties(m.Type()) + + // look up field name in oneof map + if op, ok := props.OneofTypes[name]; ok { + v := reflect.New(op.Type.Elem()) + field := m.Field(op.Field) + if !field.IsNil() { + return reflect.Value{}, nil, fmt.Errorf("field already set for %s oneof", props.Prop[op.Field].OrigName) + } + field.Set(v) + return v.Elem().Field(0), op.Prop, nil + } + for _, p := range props.Prop { if p.OrigName == name { - return m.FieldByName(p.Name), p + return m.FieldByName(p.Name), p, nil } } - return reflect.Value{}, nil + return reflect.Value{}, nil, nil } func populateRepeatedField(f reflect.Value, values []string, props *proto.Properties) error { diff --git a/runtime/query_test.go b/runtime/query_test.go index 82026a8ed84..07262fad67f 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -161,7 +161,7 @@ func TestPopulateParameters(t *testing.T) { }, filter: utilities.NewDoubleArray(nil), want: &proto3Message{}, - wanterr: errors.New("field already set for oneof"), + wanterr: errors.New("field already set for oneof_value oneof"), }, } { msg := proto.Clone(spec.want) From 89c106ad5de2c827655259aff7d6462f449cfa21 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 4 Apr 2017 16:42:07 -0700 Subject: [PATCH 132/552] Update README.md Improve copy in readme. --- README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b8a7b8af192..c7396cc154b 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,10 @@ It helps you to provide your APIs in both gRPC and RESTful style at the same tim ![architecture introduction diagram](https://docs.google.com/drawings/d/12hp4CPqrNPFhattL_cIoJptFvlAqm5wLQ0ggqI5mkCg/pub?w=749&h=370) ## Background -gRPC is great -- it generates API clients and server stubs in many programming languages, -it is fast, easy-to-use, bandwidth-efficient and its design is combat-proven by Google. -However, you might still want to provide classic RESTful APIs too for some reasons -- -compatibility with languages not supported by gRPC, API backward-compatibility or aesthetics -of RESTful architecture. - -That's what grpc-gateway helps you to do. You just need to implement your gRPC service with a small amount of custom options. -Then the reverse-proxy generated by grpc-gateway serves RESTful API on top of the gRPC service. +gRPC is great -- it generates API clients and server stubs in many programming languages, it is fast, easy-to-use, bandwidth-efficient and its design is combat-proven by Google. +However, you might still want to provide a traditional RESTful API as well. Reasons can range from maintaining backwards-compatibility, supporting languages or clients not well supported by gRPC to simply maintaining the aesthetics and tooling involved with a RESTful architecture. + +This project aims to provide that HTTP+JSON interface to your gRPC service. A small amount of configuration in your service to attach HTTP semantics is all that's needed to generate a reverse-proxy with this library. ## Installation First you need to install ProtocolBuffers 3.0.0-beta-3 or later. From 6528226567c655c515f679bbaae15ba323d36e1c Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 16 Apr 2017 22:38:43 -0700 Subject: [PATCH 133/552] bugfix: reflect upstream api change. (#359) metadata.NewContext now is a synonym for metadata.NewOutgoingContext. Call NewIncomingContext instead. --- runtime/context.go | 2 +- runtime/context_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/context.go b/runtime/context.go index 98eeb44c9a1..2eb5c5e69ab 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -94,7 +94,7 @@ func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, e if len(pairs) == 0 { return ctx, nil } - return metadata.NewContext(ctx, metadata.Pairs(pairs...)), nil + return metadata.NewIncomingContext(ctx, metadata.Pairs(pairs...)), nil } // ServerMetadata consists of metadata sent from gRPC server. diff --git a/runtime/context_test.go b/runtime/context_test.go index 2f3b02393db..334bbc3214a 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -28,7 +28,7 @@ func TestAnnotateContext_WorksWithEmpty(t *testing.T) { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } - md, ok := metadata.FromContext(annotated) + md, ok := metadata.FromIncomingContext(annotated) if !ok || len(md) != emptyForwardMetaCount { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount, md) } @@ -50,7 +50,7 @@ func TestAnnotateContext_ForwardsGrpcMetadata(t *testing.T) { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } - md, ok := metadata.FromContext(annotated) + md, ok := metadata.FromIncomingContext(annotated) if got, want := len(md), emptyForwardMetaCount+4; !ok || got != want { t.Errorf("metadata items in context = %d want %d: %v", got, want, md) } @@ -82,7 +82,7 @@ func TestAnnotateContext_XForwardedFor(t *testing.T) { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } - md, ok := metadata.FromContext(annotated) + md, ok := metadata.FromIncomingContext(annotated) if !ok || len(md) != emptyForwardMetaCount+1 { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) } From 541f893aa5a8377ee1200efe94c30bf759295166 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 16 Apr 2017 22:44:32 -0700 Subject: [PATCH 134/552] Add changelog for 1.2.1 generated with github_changelog_generator author=false compare-link=false issues=false future-release=v1.2.1 --- CHANGELOG.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c0426105e..14d3d0f15ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Change Log -## [v1.2.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.0) (2017-03-30) +## [v1.2.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.1) (2017-04-16) +**Merged pull requests:** + +- bugfix: reflect upstream api change. [\#359](https://github.com/grpc-ecosystem/grpc-gateway/pull/359) + +## [v1.2.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.0) (2017-03-31) +**Merged pull requests:** + +- Add changelog for 1.2.0 [\#342](https://github.com/grpc-ecosystem/grpc-gateway/pull/342) + +## [v1.2.0.rc1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.0.rc1) (2017-03-24) **Merged pull requests:** - Update go\_out parameter to remove comma [\#333](https://github.com/grpc-ecosystem/grpc-gateway/pull/333) @@ -8,6 +18,7 @@ - improve documentation regarding external dependencies [\#330](https://github.com/grpc-ecosystem/grpc-gateway/pull/330) - Return an error on invalid nested query parameters. [\#329](https://github.com/grpc-ecosystem/grpc-gateway/pull/329) - Update upstream proto files and add google.golang.org/genproto support. [\#325](https://github.com/grpc-ecosystem/grpc-gateway/pull/325) +- Support oneof fields in query params [\#321](https://github.com/grpc-ecosystem/grpc-gateway/pull/321) - Do not ignore the error coming from http.ListenAndServe in examples [\#319](https://github.com/grpc-ecosystem/grpc-gateway/pull/319) - Look up enum value maps by their proto name [\#315](https://github.com/grpc-ecosystem/grpc-gateway/pull/315) - enable parsing enums from query parameters [\#314](https://github.com/grpc-ecosystem/grpc-gateway/pull/314) From dc52ebca06d41f4948a2845537e3461fa6ded226 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Mon, 17 Apr 2017 01:01:58 -0700 Subject: [PATCH 135/552] metadata: fix properly and change to Outgoing --- runtime/context.go | 2 +- runtime/context_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/context.go b/runtime/context.go index 2eb5c5e69ab..ded3b2e6182 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -94,7 +94,7 @@ func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, e if len(pairs) == 0 { return ctx, nil } - return metadata.NewIncomingContext(ctx, metadata.Pairs(pairs...)), nil + return metadata.NewOutgoingContext(ctx, metadata.Pairs(pairs...)), nil } // ServerMetadata consists of metadata sent from gRPC server. diff --git a/runtime/context_test.go b/runtime/context_test.go index 334bbc3214a..a479b5a2dde 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -28,7 +28,7 @@ func TestAnnotateContext_WorksWithEmpty(t *testing.T) { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } - md, ok := metadata.FromIncomingContext(annotated) + md, ok := metadata.FromOutgoingContext(annotated) if !ok || len(md) != emptyForwardMetaCount { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount, md) } @@ -50,7 +50,7 @@ func TestAnnotateContext_ForwardsGrpcMetadata(t *testing.T) { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } - md, ok := metadata.FromIncomingContext(annotated) + md, ok := metadata.FromOutgoingContext(annotated) if got, want := len(md), emptyForwardMetaCount+4; !ok || got != want { t.Errorf("metadata items in context = %d want %d: %v", got, want, md) } @@ -82,7 +82,7 @@ func TestAnnotateContext_XForwardedFor(t *testing.T) { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return } - md, ok := metadata.FromIncomingContext(annotated) + md, ok := metadata.FromOutgoingContext(annotated) if !ok || len(md) != emptyForwardMetaCount+1 { t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) } From 283f7ca581ff2683f0c85df2fd215d4494438ecd Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Mon, 17 Apr 2017 09:01:37 -0700 Subject: [PATCH 136/552] Add changelog for 1.2.2 generated with github_changelog_generator author=false compare-link=false issues=false future-release=v1.2.2 --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14d3d0f15ae..3d613fec084 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ # Change Log -## [v1.2.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.1) (2017-04-16) +## [v1.2.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.2) (2017-04-17) **Merged pull requests:** +- metadata: fix properly and change to Outgoing [\#361](https://github.com/grpc-ecosystem/grpc-gateway/pull/361) + +## [v1.2.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.1) (2017-04-17) +**Merged pull requests:** + +- Add changelog for 1.2.1 [\#360](https://github.com/grpc-ecosystem/grpc-gateway/pull/360) - bugfix: reflect upstream api change. [\#359](https://github.com/grpc-ecosystem/grpc-gateway/pull/359) ## [v1.2.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.0) (2017-03-31) From a03a04a49093cf7542bac2ba7889e905bad9f68d Mon Sep 17 00:00:00 2001 From: tamal Date: Thu, 23 Mar 2017 17:58:46 -0700 Subject: [PATCH 137/552] Extend ServeMux to allow user configurable header forwarding. --- .../examplepb/a_bit_of_everything.pb.gw.go | 88 ++++---- examples/examplepb/echo_service.pb.gw.go | 16 +- examples/examplepb/flow_combination.pb.gw.go | 208 +++++++++--------- examples/examplepb/stream.pb.gw.go | 24 +- .../gengateway/template.go | 10 +- runtime/context.go | 18 +- runtime/context_test.go | 12 +- runtime/errors.go | 4 +- runtime/errors_test.go | 2 +- runtime/handler.go | 20 +- runtime/mux.go | 52 +++++ 11 files changed, 257 insertions(+), 197 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index f8f3eabd0fc..10d95b52b14 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -492,18 +492,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_Create_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Create_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Create_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -520,18 +520,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_CreateBody_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_CreateBody_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_CreateBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -548,18 +548,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_Lookup_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Lookup_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Lookup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -576,18 +576,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_Update_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Update_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Update_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -604,18 +604,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_Delete_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Delete_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Delete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -632,18 +632,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_GetQuery_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_GetQuery_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_GetQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -660,18 +660,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_Echo_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Echo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Echo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -688,18 +688,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_Echo_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Echo_1(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Echo_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -716,18 +716,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_Echo_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Echo_2(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Echo_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -744,18 +744,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_DeepPathEcho_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_DeepPathEcho_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_DeepPathEcho_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -772,18 +772,18 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_ABitOfEverythingService_Timeout_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_Timeout_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_Timeout_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 19130064d5c..6d223733647 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -110,18 +110,18 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_EchoService_Echo_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_EchoService_Echo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_EchoService_Echo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -138,18 +138,18 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_EchoService_EchoBody_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_EchoService_EchoBody_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_EchoService_EchoBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index af9da8d5f95..9a2fdd861e5 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -1027,18 +1027,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcEmptyRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcEmptyRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcEmptyRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1055,18 +1055,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcEmptyStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcEmptyStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcEmptyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1083,18 +1083,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_StreamEmptyRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_StreamEmptyRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_StreamEmptyRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1111,18 +1111,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_StreamEmptyStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_StreamEmptyStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_StreamEmptyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1139,18 +1139,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1167,18 +1167,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyRpc_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_1(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1195,18 +1195,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyRpc_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_2(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1223,18 +1223,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyRpc_3(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_3(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_3(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1251,18 +1251,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyRpc_4(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_4(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_4(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1279,18 +1279,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyRpc_5(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_5(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_5(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1307,18 +1307,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyRpc_6(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyRpc_6(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyRpc_6(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1335,18 +1335,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcPathSingleNestedRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathSingleNestedRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathSingleNestedRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1363,18 +1363,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcPathNestedRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1391,18 +1391,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcPathNestedRpc_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedRpc_1(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedRpc_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1419,18 +1419,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcPathNestedRpc_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedRpc_2(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedRpc_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1447,18 +1447,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1475,18 +1475,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyStream_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_1(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_1(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1503,18 +1503,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyStream_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_2(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_2(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1531,18 +1531,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyStream_3(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_3(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_3(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1559,18 +1559,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyStream_4(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_4(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_4(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1587,18 +1587,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyStream_5(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_5(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_5(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1615,18 +1615,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcBodyStream_6(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcBodyStream_6(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcBodyStream_6(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1643,18 +1643,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcPathSingleNestedStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathSingleNestedStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathSingleNestedStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1671,18 +1671,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcPathNestedStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1699,18 +1699,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcPathNestedStream_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedStream_1(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedStream_1(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1727,18 +1727,18 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_FlowCombination_RpcPathNestedStream_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_FlowCombination_RpcPathNestedStream_2(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_FlowCombination_RpcPathNestedStream_2(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index f256228759a..42e7a7a7a4a 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -182,18 +182,18 @@ func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, co }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, 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) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_StreamService_BulkCreate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_StreamService_BulkCreate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -210,18 +210,18 @@ func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, co }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, 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) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_StreamService_List_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_StreamService_List_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -238,18 +238,18 @@ func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, co }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, 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) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_StreamService_BulkEcho_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_StreamService_BulkEcho_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index e43904a8498..b743be404db 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -358,20 +358,20 @@ func Register{{$svc.GetName}}Handler(ctx context.Context, mux *runtime.ServeMux, }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) } resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } {{if $m.GetServerStreaming}} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) {{else}} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) {{end}} }) {{end}} diff --git a/runtime/context.go b/runtime/context.go index ded3b2e6182..dc5d98bbb64 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -44,7 +44,7 @@ At a minimum, the RemoteAddr is included in the fashion of "X-Forwarded-For", except that the forwarded destination is not another HTTP service but rather a gRPC service. */ -func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, error) { +func AnnotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (context.Context, error) { var pairs []string timeout := DefaultContextTimeout if tm := req.Header.Get(metadataGrpcTimeout); tm != "" { @@ -61,12 +61,10 @@ func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, e if strings.ToLower(key) == "authorization" { pairs = append(pairs, "authorization", val) } - if isPermanentHTTPHeader(key) { - pairs = append(pairs, strings.ToLower(fmt.Sprintf("%s%s", MetadataPrefix, key)), val) - continue - } - if strings.HasPrefix(key, MetadataHeaderPrefix) { - pairs = append(pairs, key[len(MetadataHeaderPrefix):], val) + if mux.incomingHeaderMatcher != nil { + if h, ok := mux.incomingHeaderMatcher(key); ok { + pairs = append(pairs, h, val) + } } } } @@ -94,7 +92,11 @@ func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, e if len(pairs) == 0 { return ctx, nil } - return metadata.NewOutgoingContext(ctx, metadata.Pairs(pairs...)), nil + md := metadata.Pairs(pairs...) + if mux.metadataAnnotator != nil { + md = metadata.Join(md, mux.metadataAnnotator(ctx, req)) + } + return metadata.NewOutgoingContext(ctx, md), nil } // ServerMetadata consists of metadata sent from gRPC server. diff --git a/runtime/context_test.go b/runtime/context_test.go index a479b5a2dde..955d6f13578 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -23,7 +23,7 @@ func TestAnnotateContext_WorksWithEmpty(t *testing.T) { t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) } request.Header.Add("Some-Irrelevant-Header", "some value") - annotated, err := runtime.AnnotateContext(ctx, request) + annotated, err := runtime.AnnotateContext(ctx, runtime.NewServeMux(), request) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return @@ -45,7 +45,7 @@ func TestAnnotateContext_ForwardsGrpcMetadata(t *testing.T) { request.Header.Add("Grpc-Metadata-Foo-BAZ", "Value2") request.Header.Add("Grpc-Metadata-foo-bAz", "Value3") request.Header.Add("Authorization", "Token 1234567890") - annotated, err := runtime.AnnotateContext(ctx, request) + annotated, err := runtime.AnnotateContext(ctx, runtime.NewServeMux(), request) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return @@ -77,7 +77,7 @@ func TestAnnotateContext_XForwardedFor(t *testing.T) { request.Header.Add("X-Forwarded-For", "192.0.2.100") // client request.RemoteAddr = "192.0.2.200:12345" // proxy - annotated, err := runtime.AnnotateContext(ctx, request) + annotated, err := runtime.AnnotateContext(ctx, runtime.NewServeMux(), request) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return @@ -101,7 +101,7 @@ func TestAnnotateContext_SupportsTimeouts(t *testing.T) { if err != nil { t.Fatalf(`http.NewRequest("GET", "http://example.com", nil failed with %v; want success`, err) } - annotated, err := runtime.AnnotateContext(ctx, request) + annotated, err := runtime.AnnotateContext(ctx, runtime.NewServeMux(), request) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return @@ -113,7 +113,7 @@ func TestAnnotateContext_SupportsTimeouts(t *testing.T) { const acceptableError = 50 * time.Millisecond runtime.DefaultContextTimeout = 10 * time.Second - annotated, err = runtime.AnnotateContext(ctx, request) + annotated, err = runtime.AnnotateContext(ctx, runtime.NewServeMux(), request) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return @@ -156,7 +156,7 @@ func TestAnnotateContext_SupportsTimeouts(t *testing.T) { }, } { request.Header.Set("Grpc-Timeout", spec.timeout) - annotated, err = runtime.AnnotateContext(ctx, request) + annotated, err = runtime.AnnotateContext(ctx, runtime.NewServeMux(), request) if err != nil { t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) return diff --git a/runtime/errors.go b/runtime/errors.go index 5a51d02c0a9..0b67fd9870e 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -78,7 +78,7 @@ func (*errorBody) ProtoMessage() {} // // The response body returned by this function is a JSON object, // which contains a member whose key is "error" and whose value is err.Error(). -func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) { +func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) { const fallback = `{"error": "failed to marshal error message"}` w.Header().Del("Trailer") @@ -103,7 +103,7 @@ func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseW grpclog.Printf("Failed to extract ServerMetadata from context") } - handleForwardResponseServerMetadata(w, md) + handleForwardResponseServerMetadata(w, mux, md) handleForwardResponseTrailerHeader(w, md) st := HTTPStatusFromCode(grpc.Code(err)) w.WriteHeader(st) diff --git a/runtime/errors_test.go b/runtime/errors_test.go index 2bdfca637c1..c5f2c530390 100644 --- a/runtime/errors_test.go +++ b/runtime/errors_test.go @@ -35,7 +35,7 @@ func TestDefaultHTTPError(t *testing.T) { } { w := httptest.NewRecorder() req, _ := http.NewRequest("", "", nil) // Pass in an empty request to match the signature - runtime.DefaultHTTPError(ctx, &runtime.JSONBuiltin{}, w, req, spec.err) + runtime.DefaultHTTPError(ctx, &runtime.ServeMux{}, &runtime.JSONBuiltin{}, w, req, spec.err) if got, want := w.Header().Get("Content-Type"), "application/json"; got != want { t.Errorf(`w.Header().Get("Content-Type") = %q; want %q; on spec.err=%v`, got, want, spec.err) diff --git a/runtime/handler.go b/runtime/handler.go index d7040851ae9..a249b3f25a6 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -14,7 +14,7 @@ import ( ) // ForwardResponseStream forwards the stream from gRPC server to REST client. -func ForwardResponseStream(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { +func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { f, ok := w.(http.Flusher) if !ok { grpclog.Printf("Flush not supported in %T", w) @@ -28,7 +28,7 @@ func ForwardResponseStream(ctx context.Context, marshaler Marshaler, w http.Resp http.Error(w, "unexpected error", http.StatusInternalServerError) return } - handleForwardResponseServerMetadata(w, md) + handleForwardResponseServerMetadata(w, mux, md) w.Header().Set("Transfer-Encoding", "chunked") w.Header().Set("Content-Type", marshaler.ContentType()) @@ -65,9 +65,15 @@ func ForwardResponseStream(ctx context.Context, marshaler Marshaler, w http.Resp } } -func handleForwardResponseServerMetadata(w http.ResponseWriter, md ServerMetadata) { +func handleForwardResponseServerMetadata(w http.ResponseWriter, mux *ServeMux, md ServerMetadata) { for k, vs := range md.HeaderMD { hKey := fmt.Sprintf("%s%s", MetadataHeaderPrefix, k) + if mux.outgoingHeaderMatcher != nil { + if h, ok := mux.outgoingHeaderMatcher(k); ok { + hKey = h + break + } + } for i := range vs { w.Header().Add(hKey, vs[i]) } @@ -91,24 +97,24 @@ func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) { } // ForwardResponseMessage forwards the message "resp" from gRPC server to REST client. -func ForwardResponseMessage(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { +func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { md, ok := ServerMetadataFromContext(ctx) if !ok { grpclog.Printf("Failed to extract ServerMetadata from context") } - handleForwardResponseServerMetadata(w, md) + handleForwardResponseServerMetadata(w, mux, md) handleForwardResponseTrailerHeader(w, md) w.Header().Set("Content-Type", marshaler.ContentType()) if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { - HTTPError(ctx, marshaler, w, req, err) + HTTPError(ctx, mux, marshaler, w, req, err) return } buf, err := marshaler.Marshal(resp) if err != nil { grpclog.Printf("Marshal error: %v", err) - HTTPError(ctx, marshaler, w, req, err) + HTTPError(ctx, mux, marshaler, w, req, err) return } diff --git a/runtime/mux.go b/runtime/mux.go index 2e6c5621302..85f53d3f513 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -1,12 +1,14 @@ package runtime import ( + "fmt" "net/http" "strings" "golang.org/x/net/context" "github.com/golang/protobuf/proto" + "google.golang.org/grpc/metadata" ) // A HandlerFunc handles a specific pair of path pattern and HTTP method. @@ -19,6 +21,9 @@ type ServeMux struct { handlers map[string][]handler forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error marshalers marshalerRegistry + incomingHeaderMatcher HeaderMatcherFunc + outgoingHeaderMatcher HeaderMatcherFunc + metadataAnnotator func(context.Context, *http.Request) metadata.MD } // ServeMuxOption is an option that can be given to a ServeMux on construction. @@ -36,12 +41,59 @@ func WithForwardResponseOption(forwardResponseOption func(context.Context, http. } } +// HeaderMatcherFunc checks whether a header key should be forwarded to/from gRPC context. +type HeaderMatcherFunc func(string) (string, bool) + +// DefaultHeaderMatcher is used to pass http request headers to/from gRPC context. This adds permanent HTTP header +// keys (as specified by the IANA) to gRPC context with grpcgateway- prefix. HTTP headers that start with +// 'Grpc-Metadata-' are mapped to gRPC metadata after removing prefix 'Grpc-Metadata-'. +func DefaultHeaderMatcher(key string) (string, bool) { + if isPermanentHTTPHeader(key) { + return strings.ToLower(fmt.Sprintf("%s%s", MetadataPrefix, key)), true + } else if strings.HasPrefix(key, MetadataHeaderPrefix) { + return key[len(MetadataHeaderPrefix):], true + } + return "", false +} + +// WithIncomingHeaderMatcher returns a ServeMuxOption representing a headerMatcher for incoming request to gateway. +// +// This matcher will be called with each header in http.Request. If matcher returns true, that header will be +// passed to gRPC context. To transform the header before passing to gRPC context, matcher should return modified header. +func WithIncomingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption { + return func(mux *ServeMux) { + mux.incomingHeaderMatcher = fn + } +} + +// WithOutgoingHeaderMatcher returns a ServeMuxOption representing a headerMatcher for outgoing response from gateway. +// +// This matcher will be called with each header in response header metadata. If matcher returns true, that header will be +// passed to http response returned from gateway. To transform the header before passing to response, +// matcher should return modified header. +func WithOutgoingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption { + return func(mux *ServeMux) { + mux.outgoingHeaderMatcher = fn + } +} + +// WithMetadata returns a ServeMuxOption for passing metadata to a gRPC context. +// +// This can be used by services that need to read from http.Request and modify gRPC context. A common use case +// is reading token from cookie and adding it in gRPC context. +func WithMetadata(annotator func(context.Context, *http.Request) metadata.MD) ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.metadataAnnotator = annotator + } +} + // NewServeMux returns a new ServeMux whose internal mapping is empty. func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ handlers: make(map[string][]handler), forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), marshalers: makeMarshalerMIMERegistry(), + incomingHeaderMatcher: DefaultHeaderMatcher, } for _, opt := range opts { From bb772e561c4f298af0dbaf6a07dbdceafe03b115 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Tue, 18 Apr 2017 23:35:19 -0700 Subject: [PATCH 138/552] Use canonical header form in default header matcher. (#369) --- runtime/mux.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/mux.go b/runtime/mux.go index 85f53d3f513..88521c69c8b 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -1,13 +1,12 @@ package runtime import ( - "fmt" "net/http" + "net/textproto" "strings" - "golang.org/x/net/context" - "github.com/golang/protobuf/proto" + "golang.org/x/net/context" "google.golang.org/grpc/metadata" ) @@ -48,8 +47,9 @@ type HeaderMatcherFunc func(string) (string, bool) // keys (as specified by the IANA) to gRPC context with grpcgateway- prefix. HTTP headers that start with // 'Grpc-Metadata-' are mapped to gRPC metadata after removing prefix 'Grpc-Metadata-'. func DefaultHeaderMatcher(key string) (string, bool) { + key = textproto.CanonicalMIMEHeaderKey(key) if isPermanentHTTPHeader(key) { - return strings.ToLower(fmt.Sprintf("%s%s", MetadataPrefix, key)), true + return MetadataPrefix + key, true } else if strings.HasPrefix(key, MetadataHeaderPrefix) { return key[len(MetadataHeaderPrefix):], true } From 1035c3810b8c3a2478cdd5657f6c5be3264da16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E5=90=89=E5=B3=B0?= Date: Tue, 25 Apr 2017 19:02:39 +0800 Subject: [PATCH 139/552] support allow_delete_body for protoc-gen-grpc-gateway (#318) this fixes up #280 --- protoc-gen-grpc-gateway/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 0e2c54f8b26..cf365f249e1 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -25,6 +25,7 @@ import ( var ( importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") useRequestContext = flag.Bool("request_context", false, "determine whether to use http.Request's context or not") + allowDeleteBody = flag.Bool("allow_delete_body", false, "unless set, HTTP DELETE methods may not have a body") ) func parseReq(r io.Reader) (*plugin.CodeGeneratorRequest, error) { @@ -77,6 +78,7 @@ func main() { g := gengateway.New(reg, *useRequestContext) reg.SetPrefix(*importPrefix) + reg.SetAllowDeleteBody(*allowDeleteBody) if err := reg.Load(req); err != nil { emitError(err) return From a55fd0f65f460c90b5f39eced72ca14623c04c77 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Sun, 30 Apr 2017 22:22:36 -0700 Subject: [PATCH 140/552] Add response headers from grpc server (#374) --- runtime/handler.go | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/handler.go b/runtime/handler.go index a249b3f25a6..43f8a56e8b7 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -71,7 +71,6 @@ func handleForwardResponseServerMetadata(w http.ResponseWriter, mux *ServeMux, m if mux.outgoingHeaderMatcher != nil { if h, ok := mux.outgoingHeaderMatcher(k); ok { hKey = h - break } } for i := range vs { From c7c54cbcc5e01212be0c4af889330ed67377dd31 Mon Sep 17 00:00:00 2001 From: Masahiro Sano Date: Sat, 13 May 2017 01:41:52 +0900 Subject: [PATCH 141/552] Use status package for error and introduce WithProtoErrorHandler option (#378) * use status package instead of depreated method * use status package for genereated files * use status package instead of depreated method * add custome error handler to handle error as status proto * pass port number explicitly * add OtherErrorHandler tests * add ProtoErrorHandler test * regenerate go files --- .../examplepb/a_bit_of_everything.pb.gw.go | 57 +++--- examples/examplepb/echo_service.pb.gw.go | 5 +- examples/examplepb/flow_combination.pb.gw.go | 107 +++++------ examples/examplepb/stream.pb.gw.go | 3 +- examples/integration_test.go | 109 +++++++---- examples/proto_error_test.go | 170 ++++++++++++++++++ examples/server/a_bit_of_everything.go | 11 +- .../gengateway/generator.go | 1 + .../gengateway/template.go | 8 +- runtime/context.go | 4 +- runtime/errors.go | 14 +- runtime/errors_test.go | 5 +- runtime/handler.go | 8 +- runtime/mux.go | 79 +++++++- runtime/proto_errors.go | 61 +++++++ 15 files changed, 501 insertions(+), 141 deletions(-) create mode 100644 examples/proto_error_test.go create mode 100644 runtime/proto_errors.go diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 10d95b52b14..e1640d388d1 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -23,6 +23,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" ) var _ codes.Code @@ -47,7 +48,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["float_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "float_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "float_value") } protoReq.FloatValue, err = runtime.Float32(val) @@ -58,7 +59,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["double_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "double_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "double_value") } protoReq.DoubleValue, err = runtime.Float64(val) @@ -69,7 +70,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["int64_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "int64_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int64_value") } protoReq.Int64Value, err = runtime.Int64(val) @@ -80,7 +81,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["uint64_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64_value") } protoReq.Uint64Value, err = runtime.Uint64(val) @@ -91,7 +92,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["int32_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "int32_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int32_value") } protoReq.Int32Value, err = runtime.Int32(val) @@ -102,7 +103,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["fixed64_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed64_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed64_value") } protoReq.Fixed64Value, err = runtime.Uint64(val) @@ -113,7 +114,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["fixed32_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed32_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed32_value") } protoReq.Fixed32Value, err = runtime.Uint32(val) @@ -124,7 +125,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["bool_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "bool_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bool_value") } protoReq.BoolValue, err = runtime.Bool(val) @@ -135,7 +136,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["string_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") } protoReq.StringValue, err = runtime.String(val) @@ -146,7 +147,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["uint32_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32_value") } protoReq.Uint32Value, err = runtime.Uint32(val) @@ -157,7 +158,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["sfixed32_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed32_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed32_value") } protoReq.Sfixed32Value, err = runtime.Int32(val) @@ -168,7 +169,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["sfixed64_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed64_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed64_value") } protoReq.Sfixed64Value, err = runtime.Int64(val) @@ -179,7 +180,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["sint32_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sint32_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sint32_value") } protoReq.Sint32Value, err = runtime.Int32(val) @@ -190,7 +191,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["sint64_value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sint64_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sint64_value") } protoReq.Sint64Value, err = runtime.Int64(val) @@ -201,7 +202,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run val, ok = pathParams["nonConventionalNameValue"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "nonConventionalNameValue") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonConventionalNameValue") } protoReq.NonConventionalNameValue, err = runtime.String(val) @@ -211,7 +212,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Create_0); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -224,7 +225,7 @@ func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -245,7 +246,7 @@ func request_ABitOfEverythingService_Lookup_0(ctx context.Context, marshaler run val, ok = pathParams["uuid"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) @@ -264,7 +265,7 @@ func request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler run var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( @@ -276,7 +277,7 @@ func request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler run val, ok = pathParams["uuid"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) @@ -303,7 +304,7 @@ func request_ABitOfEverythingService_Delete_0(ctx context.Context, marshaler run val, ok = pathParams["uuid"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) @@ -334,7 +335,7 @@ func request_ABitOfEverythingService_GetQuery_0(ctx context.Context, marshaler r val, ok = pathParams["uuid"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } protoReq.Uuid, err = runtime.String(val) @@ -344,7 +345,7 @@ func request_ABitOfEverythingService_GetQuery_0(ctx context.Context, marshaler r } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_GetQuery_0); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.GetQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -365,7 +366,7 @@ func request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runti val, ok = pathParams["value"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value") } protoReq.Value, err = runtime.StringP(val) @@ -384,7 +385,7 @@ func request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runti var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Value); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -401,7 +402,7 @@ func request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runti var metadata runtime.ServerMetadata if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Echo_2); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -414,7 +415,7 @@ func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshal var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( @@ -426,7 +427,7 @@ func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshal val, ok = pathParams["single_nested.name"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") } err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 6d223733647..d89d2c69caf 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" ) var _ codes.Code @@ -40,7 +41,7 @@ func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler val, ok = pathParams["id"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } protoReq.Id, err = runtime.String(val) @@ -59,7 +60,7 @@ func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marsh var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 9a2fdd861e5..1bdfd091f5f 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" ) var _ codes.Code @@ -69,7 +70,7 @@ func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler run } if err != nil { grpclog.Printf("Failed to decode request: %v", err) - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err = stream.Send(&protoReq); err != nil { grpclog.Printf("Failed to send request: %v", err) @@ -151,7 +152,7 @@ func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -172,7 +173,7 @@ func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime val, ok = pathParams["a"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) @@ -183,7 +184,7 @@ func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime val, ok = pathParams["b"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) @@ -194,7 +195,7 @@ func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime val, ok = pathParams["c"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "c") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "c") } protoReq.C, err = runtime.String(val) @@ -217,7 +218,7 @@ func request_FlowCombination_RpcBodyRpc_2(ctx context.Context, marshaler runtime var metadata runtime.ServerMetadata if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_2); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -230,7 +231,7 @@ func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( @@ -242,7 +243,7 @@ func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime val, ok = pathParams["a"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) @@ -253,7 +254,7 @@ func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime val, ok = pathParams["b"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) @@ -276,11 +277,11 @@ func request_FlowCombination_RpcBodyRpc_4(ctx context.Context, marshaler runtime var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_4); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -297,7 +298,7 @@ func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( @@ -309,7 +310,7 @@ func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime val, ok = pathParams["a"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) @@ -319,7 +320,7 @@ func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_5); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -344,7 +345,7 @@ func request_FlowCombination_RpcBodyRpc_6(ctx context.Context, marshaler runtime val, ok = pathParams["a"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) @@ -354,7 +355,7 @@ func request_FlowCombination_RpcBodyRpc_6(ctx context.Context, marshaler runtime } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_6); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -379,7 +380,7 @@ func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marsh val, ok = pathParams["a.str"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) @@ -389,7 +390,7 @@ func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marsh } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcPathSingleNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -406,7 +407,7 @@ func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler r var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( @@ -418,7 +419,7 @@ func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler r val, ok = pathParams["a.str"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) @@ -429,7 +430,7 @@ func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler r val, ok = pathParams["b"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) @@ -439,7 +440,7 @@ func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler r } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_0); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -464,7 +465,7 @@ func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler r val, ok = pathParams["a.str"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) @@ -474,7 +475,7 @@ func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler r } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_1); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -491,7 +492,7 @@ func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler r var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( @@ -503,7 +504,7 @@ func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler r val, ok = pathParams["a.str"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) @@ -513,7 +514,7 @@ func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler r } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_2); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -526,7 +527,7 @@ func request_FlowCombination_RpcBodyStream_0(ctx context.Context, marshaler runt var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) @@ -555,7 +556,7 @@ func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runt val, ok = pathParams["a"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) @@ -566,7 +567,7 @@ func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runt val, ok = pathParams["b"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) @@ -577,7 +578,7 @@ func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runt val, ok = pathParams["c"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "c") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "c") } protoReq.C, err = runtime.String(val) @@ -608,7 +609,7 @@ func request_FlowCombination_RpcBodyStream_2(ctx context.Context, marshaler runt var metadata runtime.ServerMetadata if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_2); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) @@ -629,7 +630,7 @@ func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runt var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( @@ -641,7 +642,7 @@ func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runt val, ok = pathParams["a"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) @@ -652,7 +653,7 @@ func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runt val, ok = pathParams["b"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) @@ -683,11 +684,11 @@ func request_FlowCombination_RpcBodyStream_4(ctx context.Context, marshaler runt var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_4); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) @@ -712,7 +713,7 @@ func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runt var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( @@ -724,7 +725,7 @@ func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runt val, ok = pathParams["a"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) @@ -734,7 +735,7 @@ func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runt } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_5); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) @@ -767,7 +768,7 @@ func request_FlowCombination_RpcBodyStream_6(ctx context.Context, marshaler runt val, ok = pathParams["a"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } protoReq.A, err = runtime.String(val) @@ -777,7 +778,7 @@ func request_FlowCombination_RpcBodyStream_6(ctx context.Context, marshaler runt } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_6); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) @@ -810,7 +811,7 @@ func request_FlowCombination_RpcPathSingleNestedStream_0(ctx context.Context, ma val, ok = pathParams["a.str"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) @@ -820,7 +821,7 @@ func request_FlowCombination_RpcPathSingleNestedStream_0(ctx context.Context, ma } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathSingleNestedStream_0); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcPathSingleNestedStream(ctx, &protoReq) @@ -845,7 +846,7 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( @@ -857,7 +858,7 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale val, ok = pathParams["a.str"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) @@ -868,7 +869,7 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale val, ok = pathParams["b"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } protoReq.B, err = runtime.String(val) @@ -878,7 +879,7 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_0); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcPathNestedStream(ctx, &protoReq) @@ -911,7 +912,7 @@ func request_FlowCombination_RpcPathNestedStream_1(ctx context.Context, marshale val, ok = pathParams["a.str"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) @@ -921,7 +922,7 @@ func request_FlowCombination_RpcPathNestedStream_1(ctx context.Context, marshale } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_1); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcPathNestedStream(ctx, &protoReq) @@ -946,7 +947,7 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } var ( @@ -958,7 +959,7 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale val, ok = pathParams["a.str"] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") } err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) @@ -968,7 +969,7 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_2); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } stream, err := client.RpcPathNestedStream(ctx, &protoReq) diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index 42e7a7a7a4a..67799b9ffb8 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -22,6 +22,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" ) var _ codes.Code @@ -45,7 +46,7 @@ func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.M } if err != nil { grpclog.Printf("Failed to decode request: %v", err) - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err = stream.Send(&protoReq); err != nil { grpclog.Printf("Failed to send request: %v", err) diff --git a/examples/integration_test.go b/examples/integration_test.go index 826fbddc119..710b8249623 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -36,7 +36,7 @@ func TestEcho(t *testing.T) { } testEcho(t, 8080, "application/json") - testEchoBody(t) + testEchoBody(t, 8080) } func TestForwardResponseOption(t *testing.T) { @@ -92,7 +92,7 @@ func testEcho(t *testing.T, port int, contentType string) { } } -func testEchoBody(t *testing.T) { +func testEchoBody(t *testing.T, port int) { sent := gw.SimpleMessage{Id: "example"} var m jsonpb.Marshaler payload, err := m.MarshalToString(&sent) @@ -100,7 +100,7 @@ func testEchoBody(t *testing.T) { t.Fatalf("m.MarshalToString(%#v) failed with %v; want success", payload, err) } - url := "http://localhost:8080/v1/example/echo_body" + url := fmt.Sprintf("http://localhost:%d/v1/example/echo_body", port) resp, err := http.Post(url, "", strings.NewReader(payload)) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", url, err) @@ -148,18 +148,18 @@ func TestABE(t *testing.T) { return } - testABECreate(t) - testABECreateBody(t) - testABEBulkCreate(t) - testABELookup(t) - testABELookupNotFound(t) - testABEList(t) - testABEBulkEcho(t) - testABEBulkEchoZeroLength(t) - testAdditionalBindings(t) + testABECreate(t, 8080) + testABECreateBody(t, 8080) + testABEBulkCreate(t, 8080) + testABELookup(t, 8080) + testABELookupNotFound(t, 8080) + testABEList(t, 8080) + testABEBulkEcho(t, 8080) + testABEBulkEchoZeroLength(t, 8080) + testAdditionalBindings(t, 8080) } -func testABECreate(t *testing.T) { +func testABECreate(t *testing.T, port int) { want := gw.ABitOfEverything{ FloatValue: 1.5, DoubleValue: 2.5, @@ -177,7 +177,7 @@ func testABECreate(t *testing.T) { Sint64Value: 4611686018427387903, NonConventionalNameValue: "camelCase", } - url := fmt.Sprintf("http://localhost:8080/v1/example/a_bit_of_everything/%f/%f/%d/separator/%d/%d/%d/%d/%v/%s/%d/%d/%d/%d/%d/%s", want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue) + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/%f/%f/%d/separator/%d/%d/%d/%d/%v/%s/%d/%d/%d/%d/%d/%s", port, want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue) resp, err := http.Post(url, "application/json", strings.NewReader("{}")) if err != nil { @@ -210,7 +210,7 @@ func testABECreate(t *testing.T) { } } -func testABECreateBody(t *testing.T) { +func testABECreateBody(t *testing.T, port int) { want := gw.ABitOfEverything{ FloatValue: 1.5, DoubleValue: 2.5, @@ -255,7 +255,7 @@ func testABECreateBody(t *testing.T) { "b": {Name: "y", Amount: 2}, }, } - url := "http://localhost:8080/v1/example/a_bit_of_everything" + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) var m jsonpb.Marshaler payload, err := m.MarshalToString(&want) if err != nil { @@ -293,7 +293,7 @@ func testABECreateBody(t *testing.T) { } } -func testABEBulkCreate(t *testing.T) { +func testABEBulkCreate(t *testing.T, port int) { count := 0 r, w := io.Pipe() go func(w io.WriteCloser) { @@ -344,7 +344,7 @@ func testABEBulkCreate(t *testing.T) { count++ } }(w) - url := "http://localhost:8080/v1/example/a_bit_of_everything/bulk" + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/bulk", port) resp, err := http.Post(url, "application/json", r) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", url, err) @@ -380,8 +380,8 @@ func testABEBulkCreate(t *testing.T) { } } -func testABELookup(t *testing.T) { - url := "http://localhost:8080/v1/example/a_bit_of_everything" +func testABELookup(t *testing.T, port int) { + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) cresp, err := http.Post(url, "application/json", strings.NewReader(` {"bool_value": true, "string_value": "strprefix/example"} `)) @@ -435,8 +435,8 @@ func testABELookup(t *testing.T) { } } -func testABELookupNotFound(t *testing.T) { - url := "http://localhost:8080/v1/example/a_bit_of_everything" +func testABELookupNotFound(t *testing.T, port int) { + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) uuid := "not_exist" url = fmt.Sprintf("%s/%s", url, uuid) resp, err := http.Get(url) @@ -469,6 +469,11 @@ func testABELookupNotFound(t *testing.T) { return } + if got, want := msg.Error, "not found"; got != want { + t.Errorf("msg.Error = %s; want %s", got, want) + return + } + if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), uuid; got != want { t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want) } @@ -480,8 +485,8 @@ func testABELookupNotFound(t *testing.T) { } } -func testABEList(t *testing.T) { - url := "http://localhost:8080/v1/example/a_bit_of_everything" +func testABEList(t *testing.T, port int) { + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) resp, err := http.Get(url) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", url, err) @@ -531,7 +536,7 @@ func testABEList(t *testing.T) { } } -func testABEBulkEcho(t *testing.T) { +func testABEBulkEcho(t *testing.T, port int) { reqr, reqw := io.Pipe() var wg sync.WaitGroup var want []*sub.StringMessage @@ -555,7 +560,7 @@ func testABEBulkEcho(t *testing.T) { } }() - url := "http://localhost:8080/v1/example/a_bit_of_everything/echo" + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo", port) req, err := http.NewRequest("POST", url, reqr) if err != nil { t.Errorf("http.NewRequest(%q, %q, reqr) failed with %v; want success", "POST", url, err) @@ -609,8 +614,8 @@ func testABEBulkEcho(t *testing.T) { } } -func testABEBulkEchoZeroLength(t *testing.T) { - url := "http://localhost:8080/v1/example/a_bit_of_everything/echo" +func testABEBulkEchoZeroLength(t *testing.T, port int) { + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo", port) req, err := http.NewRequest("POST", url, bytes.NewReader(nil)) if err != nil { t.Errorf("http.NewRequest(%q, %q, bytes.NewReader(nil)) failed with %v; want success", "POST", url, err) @@ -641,10 +646,10 @@ func testABEBulkEchoZeroLength(t *testing.T) { } } -func testAdditionalBindings(t *testing.T) { +func testAdditionalBindings(t *testing.T, port int) { for i, f := range []func() *http.Response{ func() *http.Response { - url := "http://localhost:8080/v1/example/a_bit_of_everything/echo/hello" + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo/hello", port) resp, err := http.Get(url) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", url, err) @@ -653,7 +658,7 @@ func testAdditionalBindings(t *testing.T) { return resp }, func() *http.Response { - url := "http://localhost:8080/v2/example/echo" + url := fmt.Sprintf("http://localhost:%d/v2/example/echo", port) resp, err := http.Post(url, "application/json", strings.NewReader(`"hello"`)) if err != nil { t.Errorf("http.Post(%q, %q, %q) failed with %v; want success", url, "application/json", `"hello"`, err) @@ -662,7 +667,7 @@ func testAdditionalBindings(t *testing.T) { return resp }, func() *http.Response { - url := "http://localhost:8080/v2/example/echo?value=hello" + url := fmt.Sprintf("http://localhost:%d/v2/example/echo?value=hello", port) resp, err := http.Get(url) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", url, err) @@ -717,3 +722,43 @@ func TestTimeout(t *testing.T) { t.Errorf("resp.StatusCode = %d; want %d", got, want) } } + +func TestUnknownPath(t *testing.T) { + url := "http://localhost:8080" + resp, err := http.Post(url, "application/json", strings.NewReader("{}")) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusNotFound; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } +} + +func TestMethodNotAllowed(t *testing.T) { + url := "http://localhost:8080/v1/example/echo/myid" + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusMethodNotAllowed; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } +} diff --git a/examples/proto_error_test.go b/examples/proto_error_test.go new file mode 100644 index 00000000000..de3b638f736 --- /dev/null +++ b/examples/proto_error_test.go @@ -0,0 +1,170 @@ +package main + +import ( + "fmt" + "io/ioutil" + "net/http" + "strings" + "testing" + "time" + + "github.com/golang/protobuf/jsonpb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + spb "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc/codes" +) + +func TestWithProtoErrorHandler(t *testing.T) { + go func() { + if err := Run( + ":8082", + runtime.WithProtoErrorHandler(runtime.DefaultHTTPProtoErrorHandler), + ); err != nil { + t.Errorf("gw.Run() failed with %v; want success", err) + return + } + }() + + time.Sleep(100 * time.Millisecond) + testEcho(t, 8082, "application/json") + testEchoBody(t, 8082) +} + +func TestABEWithProtoErrorHandler(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + + testABECreate(t, 8082) + testABECreateBody(t, 8082) + testABEBulkCreate(t, 8082) + testABELookup(t, 8082) + testABELookupNotFoundWithProtoError(t) + testABEList(t, 8082) + testABEBulkEcho(t, 8082) + testABEBulkEchoZeroLength(t, 8082) + testAdditionalBindings(t, 8082) +} + +func testABELookupNotFoundWithProtoError(t *testing.T) { + url := "http://localhost:8082/v1/example/a_bit_of_everything" + uuid := "not_exist" + url = fmt.Sprintf("%s/%s", url, uuid) + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusNotFound; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + return + } + + var msg spb.Status + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + return + } + + if got, want := msg.Code, int32(codes.NotFound); got != want { + t.Errorf("msg.Code = %d; want %d", got, want) + return + } + + if got, want := msg.Message, "not found"; got != want { + t.Errorf("msg.Message = %s; want %s", got, want) + return + } + + if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), uuid; got != want { + t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want) + } + if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want { + t.Errorf("Grpc-Trailer-Foo was %q, wanted %q", got, want) + } + if got, want := resp.Trailer.Get("Grpc-Trailer-Bar"), "bar2"; got != want { + t.Errorf("Grpc-Trailer-Bar was %q, wanted %q", got, want) + } +} + +func TestUnknownPathWithProtoError(t *testing.T) { + url := "http://localhost:8082" + resp, err := http.Post(url, "application/json", strings.NewReader("{}")) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusNotImplemented; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + var msg spb.Status + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + return + } + + if got, want := msg.Code, int32(codes.Unimplemented); got != want { + t.Errorf("msg.Code = %d; want %d", got, want) + return + } + + if msg.Message == "" { + t.Errorf("msg.Message should not be empty") + return + } +} + +func TestMethodNotAllowedWithProtoError(t *testing.T) { + url := "http://localhost:8082/v1/example/echo/myid" + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusNotImplemented; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + var msg spb.Status + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + return + } + + if got, want := msg.Code, int32(codes.Unimplemented); got != want { + t.Errorf("msg.Code = %d; want %d", got, want) + return + } + + if msg.Message == "" { + t.Errorf("msg.Message should not be empty") + return + } +} diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 07bdcce8ea9..190d0f85309 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -16,6 +16,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" ) // Implements of ABitOfEverythingServiceServer @@ -112,7 +113,7 @@ func (s *_ABitOfEverythingServer) Lookup(ctx context.Context, msg *sub2.IdMessag "foo": "foo2", "bar": "bar2", })) - return nil, grpc.Errorf(codes.NotFound, "not found") + return nil, status.Errorf(codes.NotFound, "not found") } func (s *_ABitOfEverythingServer) List(_ *empty.Empty, stream examples.StreamService_ListServer) error { @@ -139,7 +140,7 @@ func (s *_ABitOfEverythingServer) List(_ *empty.Empty, stream examples.StreamSer "foo": "foo2", "bar": "bar2", })) - return grpc.Errorf(codes.InvalidArgument, "error metadata: %v", v) + return status.Errorf(codes.InvalidArgument, "error metadata: %v", v) } } return nil @@ -153,7 +154,7 @@ func (s *_ABitOfEverythingServer) Update(ctx context.Context, msg *examples.ABit if _, ok := s.v[msg.Uuid]; ok { s.v[msg.Uuid] = msg } else { - return nil, grpc.Errorf(codes.NotFound, "not found") + return nil, status.Errorf(codes.NotFound, "not found") } return new(empty.Empty), nil } @@ -166,7 +167,7 @@ func (s *_ABitOfEverythingServer) Delete(ctx context.Context, msg *sub2.IdMessag if _, ok := s.v[msg.Uuid]; ok { delete(s.v, msg.Uuid) } else { - return nil, grpc.Errorf(codes.NotFound, "not found") + return nil, status.Errorf(codes.NotFound, "not found") } return new(empty.Empty), nil } @@ -179,7 +180,7 @@ func (s *_ABitOfEverythingServer) GetQuery(ctx context.Context, msg *examples.AB if _, ok := s.v[msg.Uuid]; ok { s.v[msg.Uuid] = msg } else { - return nil, grpc.Errorf(codes.NotFound, "not found") + return nil, status.Errorf(codes.NotFound, "not found") } return new(empty.Empty), nil } diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index a2aecd00ae0..d08609bc729 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -39,6 +39,7 @@ func New(reg *descriptor.Registry, useRequestContext bool) gen.Generator { "google.golang.org/grpc", "google.golang.org/grpc/codes", "google.golang.org/grpc/grpclog", + "google.golang.org/grpc/status", } { pkg := descriptor.GoPackage{ Path: pkgpath, diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index b743be404db..ad5112c2652 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -167,7 +167,7 @@ func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx cont } if err != nil { grpclog.Printf("Failed to decode request: %v", err) - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err = stream.Send(&protoReq); err != nil { grpclog.Printf("Failed to send request: %v", err) @@ -206,7 +206,7 @@ var ( var metadata runtime.ServerMetadata {{if .Body}} if err := marshaler.NewDecoder(req.Body).Decode(&{{.Body.RHS "protoReq"}}); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } {{end}} {{if .PathParams}} @@ -219,7 +219,7 @@ var ( {{range $param := .PathParams}} val, ok = pathParams[{{$param | printf "%q"}}] if !ok { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", {{$param | printf "%q"}}) + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", {{$param | printf "%q"}}) } {{if $param.IsNestedProto3 }} err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) @@ -233,7 +233,7 @@ var ( {{end}} {{if .HasQueryParam}} if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}); err != nil { - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } {{end}} {{if .Method.GetServerStreaming}} diff --git a/runtime/context.go b/runtime/context.go index dc5d98bbb64..571e353dd5c 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -9,10 +9,10 @@ import ( "time" "golang.org/x/net/context" - "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" ) // MetadataHeaderPrefix is the http prefix that represents custom metadata @@ -51,7 +51,7 @@ func AnnotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (con var err error timeout, err = timeoutDecode(tm) if err != nil { - return nil, grpc.Errorf(codes.InvalidArgument, "invalid grpc-timeout: %s", tm) + return nil, status.Errorf(codes.InvalidArgument, "invalid grpc-timeout: %s", tm) } } diff --git a/runtime/errors.go b/runtime/errors.go index 0b67fd9870e..8eebdcf49f4 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -6,9 +6,9 @@ import ( "github.com/golang/protobuf/proto" "golang.org/x/net/context" - "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" ) // HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. @@ -83,9 +83,15 @@ func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w w.Header().Del("Trailer") w.Header().Set("Content-Type", marshaler.ContentType()) + + s, ok := status.FromError(err) + if !ok { + s = status.New(codes.Unknown, err.Error()) + } + body := &errorBody{ - Error: grpc.ErrorDesc(err), - Code: int32(grpc.Code(err)), + Error: s.Message(), + Code: int32(s.Code()), } buf, merr := marshaler.Marshal(body) @@ -105,7 +111,7 @@ func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w handleForwardResponseServerMetadata(w, mux, md) handleForwardResponseTrailerHeader(w, md) - st := HTTPStatusFromCode(grpc.Code(err)) + st := HTTPStatusFromCode(s.Code()) w.WriteHeader(st) if _, err := w.Write(buf); err != nil { grpclog.Printf("Failed to write response: %v", err) diff --git a/runtime/errors_test.go b/runtime/errors_test.go index c5f2c530390..ee5dfb3c037 100644 --- a/runtime/errors_test.go +++ b/runtime/errors_test.go @@ -10,8 +10,8 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "golang.org/x/net/context" - "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) func TestDefaultHTTPError(t *testing.T) { @@ -28,7 +28,7 @@ func TestDefaultHTTPError(t *testing.T) { msg: "example error", }, { - err: grpc.Errorf(codes.NotFound, "no such resource"), + err: status.Error(codes.NotFound, "no such resource"), status: http.StatusNotFound, msg: "no such resource", }, @@ -49,6 +49,7 @@ func TestDefaultHTTPError(t *testing.T) { t.Errorf("json.Unmarshal(%q, &body) failed with %v; want success", w.Body.Bytes(), err) continue } + if got, want := body["error"].(string), spec.msg; !strings.Contains(got, want) { t.Errorf(`body["error"] = %q; want %q; on spec.err=%v`, got, want, spec.err) } diff --git a/runtime/handler.go b/runtime/handler.go index 43f8a56e8b7..22eb1b3dbad 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -9,8 +9,9 @@ import ( "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" "golang.org/x/net/context" - "google.golang.org/grpc" + "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" ) // ForwardResponseStream forwards the stream from gRPC server to REST client. @@ -151,7 +152,10 @@ func handleForwardResponseStreamError(marshaler Marshaler, w http.ResponseWriter func streamChunk(result proto.Message, err error) map[string]proto.Message { if err != nil { - grpcCode := grpc.Code(err) + grpcCode := codes.Unknown + if s, ok := status.FromError(err); ok { + grpcCode = s.Code() + } httpCode := HTTPStatusFromCode(grpcCode) return map[string]proto.Message{ "error": &internal.StreamError{ diff --git a/runtime/mux.go b/runtime/mux.go index 88521c69c8b..dda3db205fd 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -7,7 +7,9 @@ import ( "github.com/golang/protobuf/proto" "golang.org/x/net/context" + "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" ) // A HandlerFunc handles a specific pair of path pattern and HTTP method. @@ -23,6 +25,7 @@ type ServeMux struct { incomingHeaderMatcher HeaderMatcherFunc outgoingHeaderMatcher HeaderMatcherFunc metadataAnnotator func(context.Context, *http.Request) metadata.MD + protoErrorHandler ProtoErrorHandlerFunc } // ServeMuxOption is an option that can be given to a ServeMux on construction. @@ -87,6 +90,17 @@ func WithMetadata(annotator func(context.Context, *http.Request) metadata.MD) Se } } +// WithProtoErrorHandler returns a ServeMuxOption for passing metadata to a gRPC context. +// +// This can be used to handle an error as general proto message defined by gRPC. +// The response including body and status is not backward compatible with the default error handler. +// When this option is used, HTTPError and OtherErrorHandler are overwritten on initialization. +func WithProtoErrorHandler(fn ProtoErrorHandlerFunc) ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.protoErrorHandler = fn + } +} + // NewServeMux returns a new ServeMux whose internal mapping is empty. func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ @@ -99,6 +113,19 @@ func NewServeMux(opts ...ServeMuxOption) *ServeMux { for _, opt := range opts { opt(serveMux) } + + if serveMux.protoErrorHandler != nil { + HTTPError = serveMux.protoErrorHandler + // OtherErrorHandler is no longer used when protoErrorHandler is set. + // Overwritten by a special error handler to return Unknown. + OtherErrorHandler = func(w http.ResponseWriter, r *http.Request, _ string, _ int) { + ctx := context.Background() + _, outboundMarshaler := MarshalerForRequest(serveMux, r) + sterr := status.Error(codes.Unknown, "unexpected use of OtherErrorHandler") + serveMux.protoErrorHandler(ctx, serveMux, outboundMarshaler, w, r, sterr) + } + } + return serveMux } @@ -109,9 +136,18 @@ func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) { // ServeHTTP dispatches the request to the first handler whose pattern matches to r.Method and r.Path. func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { + // TODO: use r.Context for go 1.7+ + ctx := context.Background() + path := r.URL.Path if !strings.HasPrefix(path, "/") { - OtherErrorHandler(w, r, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + sterr := status.Error(codes.InvalidArgument, http.StatusText(http.StatusBadRequest)) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + } else { + OtherErrorHandler(w, r, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) + } return } @@ -119,7 +155,13 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { l := len(components) var verb string if idx := strings.LastIndex(components[l-1], ":"); idx == 0 { - OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound) + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + sterr := status.Error(codes.Unimplemented, http.StatusText(http.StatusNotImplemented)) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + } else { + OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound) + } return } else if idx > 0 { c := components[l-1] @@ -129,7 +171,13 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && isPathLengthFallback(r) { r.Method = strings.ToUpper(override) if err := r.ParseForm(); err != nil { - OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest) + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + sterr := status.Error(codes.InvalidArgument, err.Error()) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + } else { + OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest) + } return } } @@ -156,17 +204,36 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { // X-HTTP-Method-Override is optional. Always allow fallback to POST. if isPathLengthFallback(r) { if err := r.ParseForm(); err != nil { - OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest) + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + sterr := status.Error(codes.InvalidArgument, err.Error()) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + } else { + OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest) + } return } h.h(w, r, pathParams) return } - OtherErrorHandler(w, r, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + sterr := status.Error(codes.Unimplemented, http.StatusText(http.StatusMethodNotAllowed)) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + } else { + OtherErrorHandler(w, r, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) + } return } } - OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound) + + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + sterr := status.Error(codes.Unimplemented, http.StatusText(http.StatusNotImplemented)) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + } else { + OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound) + } } // GetForwardResponseOptions returns the ForwardResponseOptions associated with this ServeMux. diff --git a/runtime/proto_errors.go b/runtime/proto_errors.go new file mode 100644 index 00000000000..b1b089273b6 --- /dev/null +++ b/runtime/proto_errors.go @@ -0,0 +1,61 @@ +package runtime + +import ( + "io" + "net/http" + + "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// ProtoErrorHandlerFunc handles the error as a gRPC error generated via status package and replies to the request. +type ProtoErrorHandlerFunc func(context.Context, *ServeMux, Marshaler, http.ResponseWriter, *http.Request, error) + +var _ ProtoErrorHandlerFunc = DefaultHTTPProtoErrorHandler + +// DefaultHTTPProtoErrorHandler is an implementation of HTTPError. +// If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode. +// If otherwise, it replies with http.StatusInternalServerError. +// +// The response body returned by this function is a Status message marshaled by a Marshaler. +// +// Do not set this function to HTTPError variable directly, use WithProtoErrorHandler option instead. +func DefaultHTTPProtoErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) { + // return Internal when Marshal failed + const fallback = `{"code": 13, "message": "failed to marshal error message"}` + + w.Header().Del("Trailer") + w.Header().Set("Content-Type", marshaler.ContentType()) + + s, ok := status.FromError(err) + if !ok { + s = status.New(codes.Unknown, err.Error()) + } + + buf, merr := marshaler.Marshal(s.Proto()) + if merr != nil { + grpclog.Printf("Failed to marshal error message %q: %v", s.Proto(), merr) + w.WriteHeader(http.StatusInternalServerError) + if _, err := io.WriteString(w, fallback); err != nil { + grpclog.Printf("Failed to write response: %v", err) + } + return + } + + md, ok := ServerMetadataFromContext(ctx) + if !ok { + grpclog.Printf("Failed to extract ServerMetadata from context") + } + + handleForwardResponseServerMetadata(w, mux, md) + handleForwardResponseTrailerHeader(w, md) + st := HTTPStatusFromCode(s.Code()) + w.WriteHeader(st) + if _, err := w.Write(buf); err != nil { + grpclog.Printf("Failed to write response: %v", err) + } + + handleForwardResponseTrailer(w, md) +} From 3425afe2e728b88133a370fa00fce7a31af2f116 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Fri, 12 May 2017 11:48:36 -0700 Subject: [PATCH 142/552] ci: regen with current protoc-gen-go (#385) --- examples/examplepb/a_bit_of_everything.pb.go | 3 +-- examples/examplepb/echo_service.pb.go | 3 +-- examples/examplepb/flow_combination.pb.go | 3 +-- examples/examplepb/stream.pb.go | 3 +-- examples/sub/message.pb.go | 3 +-- examples/sub2/message.pb.go | 3 +-- runtime/internal/stream_chunk.pb.go | 3 +-- 7 files changed, 7 insertions(+), 14 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 0d8f3208cc6..30afc97d2d6 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: examples/examplepb/a_bit_of_everything.proto -// DO NOT EDIT! package examplepb diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 8edcf616813..447758379c1 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: examples/examplepb/echo_service.proto -// DO NOT EDIT! /* Package examplepb is a generated protocol buffer package. diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 486b7c60682..421c9a87a20 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: examples/examplepb/flow_combination.proto -// DO NOT EDIT! package examplepb diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index 2411be64e9f..71066ccd964 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: examples/examplepb/stream.proto -// DO NOT EDIT! package examplepb diff --git a/examples/sub/message.pb.go b/examples/sub/message.pb.go index 57c4ecd8e6e..9faad923a57 100644 --- a/examples/sub/message.pb.go +++ b/examples/sub/message.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: examples/sub/message.proto -// DO NOT EDIT! /* Package sub is a generated protocol buffer package. diff --git a/examples/sub2/message.pb.go b/examples/sub2/message.pb.go index 18569d9427e..710d9525101 100644 --- a/examples/sub2/message.pb.go +++ b/examples/sub2/message.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: examples/sub2/message.proto -// DO NOT EDIT! /* Package sub2 is a generated protocol buffer package. diff --git a/runtime/internal/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go index 9a140556495..44550f393b4 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: runtime/internal/stream_chunk.proto -// DO NOT EDIT! /* Package internal is a generated protocol buffer package. From c6c23f8dd10f9d6836c76ebb9a5c2144c1c80563 Mon Sep 17 00:00:00 2001 From: Maxim Perevedentsev Date: Sat, 13 May 2017 01:54:53 +0300 Subject: [PATCH 143/552] Skip unreferenced messages in definitions. (#371) * Skip unreferenced messages in definitions. If all message fields are embedded in path + query args, the message itself is not referenced, so swagger generates warnings. Here we track request messages referenced in methods, and do not include unreferenced ones. * Add a test. --- examples/clients/abe/Sub2IdMessage.go | 9 -- .../a_bit_of_everything.swagger.json | 24 ---- protoc-gen-swagger/genswagger/template.go | 24 +++- .../genswagger/template_test.go | 127 ++++++++++++++++++ protoc-gen-swagger/genswagger/types.go | 3 + 5 files changed, 148 insertions(+), 39 deletions(-) delete mode 100644 examples/clients/abe/Sub2IdMessage.go diff --git a/examples/clients/abe/Sub2IdMessage.go b/examples/clients/abe/Sub2IdMessage.go deleted file mode 100644 index 77ebe152ba0..00000000000 --- a/examples/clients/abe/Sub2IdMessage.go +++ /dev/null @@ -1,9 +0,0 @@ -package abe - -import ( -) - -type Sub2IdMessage struct { - Uuid string `json:"uuid,omitempty"` - -} diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 780d0d9c426..052b256b505 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -718,35 +718,11 @@ "default": "ZERO", "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" }, - "protobufDuration": { - "type": "object", - "properties": { - "seconds": { - "type": "string", - "format": "int64", - "description": "Signed seconds of the span of time. Must be from -315,576,000,000\nto +315,576,000,000 inclusive." - }, - "nanos": { - "type": "integer", - "format": "int32", - "description": "Signed fractions of a second at nanosecond resolution of the span\nof time. Durations less than one second are represented with a 0\n`seconds` field and a positive or negative `nanos` field. For durations\nof one second or more, a non-zero value for the `nanos` field must be\nof the same sign as the `seconds` field. Must be from -999,999,999\nto +999,999,999 inclusive." - } - }, - "description": "A Duration represents a signed, fixed-length span of time represented\nas a count of seconds and fractions of seconds at nanosecond\nresolution. It is independent of any calendar and concepts like \"day\"\nor \"month\". It is related to Timestamp in that the difference between\ntwo Timestamp values is a Duration and it can be added or subtracted\nfrom a Timestamp. Range is approximately +-10,000 years.\n\nExample 1: Compute Duration from two Timestamps in pseudo code.\n\n Timestamp start = ...;\n Timestamp end = ...;\n Duration duration = ...;\n\n duration.seconds = end.seconds - start.seconds;\n duration.nanos = end.nanos - start.nanos;\n\n if (duration.seconds \u003c 0 \u0026\u0026 duration.nanos \u003e 0) {\n duration.seconds += 1;\n duration.nanos -= 1000000000;\n } else if (durations.seconds \u003e 0 \u0026\u0026 duration.nanos \u003c 0) {\n duration.seconds -= 1;\n duration.nanos += 1000000000;\n }\n\nExample 2: Compute Timestamp from Timestamp + Duration in pseudo code.\n\n Timestamp start = ...;\n Duration duration = ...;\n Timestamp end = ...;\n\n end.seconds = start.seconds + duration.seconds;\n end.nanos = start.nanos + duration.nanos;\n\n if (end.nanos \u003c 0) {\n end.seconds -= 1;\n end.nanos += 1000000000;\n } else if (end.nanos \u003e= 1000000000) {\n end.seconds += 1;\n end.nanos -= 1000000000;\n }\n\nExample 3: Compute Duration from datetime.timedelta in Python.\n\n td = datetime.timedelta(days=3, minutes=10)\n duration = Duration()\n duration.FromTimedelta(td)" - }, "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": { - "uuid": { - "type": "string" - } - } - }, "subStringMessage": { "type": "object", "properties": { diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 022b649fb9b..170e0e4befd 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -118,11 +118,14 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st } // findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service. -func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, e enumMap) { +func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, e enumMap, refs refMap) { for _, svc := range s { for _, meth := range svc.Methods { - m[fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)] = meth.RequestType - findNestedMessagesAndEnumerations(meth.RequestType, reg, m, e) + // Request may be fully included in query + if _, ok := refs[fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg))]; ok { + m[fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)] = meth.RequestType + findNestedMessagesAndEnumerations(meth.RequestType, reg, m, e) + } m[fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)] = meth.ResponseType findNestedMessagesAndEnumerations(meth.ResponseType, reg, m, e) } @@ -431,7 +434,7 @@ func templateToSwaggerPath(path string) string { return strings.Join(parts, "/") } -func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry) error { +func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry, refs refMap) error { // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. for svcIdx, svc := range services { for methIdx, meth := range svc.Methods { @@ -524,6 +527,14 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re }, }, } + + // Fill reference map with referenced request messages + for _, param := range operationObject.Parameters { + if param.Schema != nil && param.Schema.Ref != "" { + refs[param.Schema.Ref] = struct{}{} + } + } + methComments := protoComments(reg, svc.File, nil, "Service", int32(svcIdx), methProtoPath, int32(methIdx)) if err := updateSwaggerDataFromComments(operationObject, methComments); err != nil { panic(err) @@ -575,7 +586,8 @@ func applyTemplate(p param) (string, error) { // Loops through all the services and their exposed GET/POST/PUT/DELETE definitions // and create entries for all of them. - if err := renderServices(p.Services, s.Paths, p.reg); err != nil { + refs := refMap{} + if err := renderServices(p.Services, s.Paths, p.reg, refs); err != nil { panic(err) } @@ -583,7 +595,7 @@ func applyTemplate(p param) (string, error) { // write their request and response types out as definition objects. m := messageMap{} e := enumMap{} - findServicesMessagesAndEnumerations(p.Services, p.reg, m, e) + findServicesMessagesAndEnumerations(p.Services, p.reg, m, e, refs) renderMessagesAsDefinition(m, s.Definitions, p.reg) renderEnumerationsAsDefinition(e, s.Definitions, p.reg) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index e0b25c16716..1d438936368 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -577,6 +577,133 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { } } +func TestApplyTemplateRequestWithUnusedReferences(t *testing.T) { + reqdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("string"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + }, + }, + } + respdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("EmptyMessage"), + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Example"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("EmptyMessage"), + ClientStreaming: proto.Bool(false), + ServerStreaming: proto.Bool(false), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + + req := &descriptor.Message{ + DescriptorProto: reqdesc, + } + resp := &descriptor.Message{ + DescriptorProto: respdesc, + } + stringField := &descriptor.Field{ + Message: req, + FieldDescriptorProto: req.GetField()[0], + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + MessageType: []*protodescriptor.DescriptorProto{reqdesc, respdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{req, resp}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: req, + ResponseType: resp, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: "/v1/example", + }, + }, + { + HTTPMethod: "POST", + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: "/v1/example/{string}", + }, + PathParams: []descriptor.Parameter{ + { + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "string", + Target: stringField, + }, + }), + Target: stringField, + }, + }, + Body: &descriptor.Body{ + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "string", + Target: stringField, + }, + }), + }, + }, + }, + }, + }, + }, + }, + } + + reg := descriptor.NewRegistry() + reg.Load(&plugin.CodeGeneratorRequest{ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}}) + result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + var obj swaggerObject + err = json.Unmarshal([]byte(result), &obj) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + + // Only EmptyMessage must be present, not ExampleMessage + if want, got, name := 1, len(obj.Definitions), "len(Definitions)"; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) + } + + // If there was a failure, print out the input and the json result for debugging. + if t.Failed() { + t.Errorf("had: %s", file) + t.Errorf("got: %s", result) + } +} + func TestTemplateToSwaggerPath(t *testing.T) { var tests = []struct { input string diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 3c6a5c9f0de..c328d1c60cc 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -187,3 +187,6 @@ type messageMap map[string]*descriptor.Message // Internal type mapping from FQEN to descriptor.Enum. Used as a set by the // findServiceMessages function. type enumMap map[string]*descriptor.Enum + +// Internal type to store used references. +type refMap map[string]struct{} From e6970eced788ee52bf46eaae6681a93cc3de61c9 Mon Sep 17 00:00:00 2001 From: Diep Pham Date: Sat, 13 May 2017 05:56:01 +0700 Subject: [PATCH 144/552] fixes package name override doesn't work (#277) * adds a test case for package overriding * fixes package name override doesn't work * sanitizes package name --- .../descriptor/registry.go | 25 ++++++++++++++++--- .../descriptor/registry_test.go | 18 +++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index 123280990d3..c4d70038113 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -239,6 +239,9 @@ func (r *Registry) goPackagePath(f *descriptor.FileDescriptorProto) string { gopkg := f.Options.GetGoPackage() idx := strings.LastIndex(gopkg, "/") if idx >= 0 { + if sc := strings.LastIndex(gopkg, ";"); sc > 0 { + gopkg = gopkg[:sc+1-1] + } return gopkg } @@ -269,11 +272,19 @@ func (r *Registry) SetAllowDeleteBody(allow bool) { r.allowDeleteBody = allow } +// sanitizePackageName replaces unallowed character in package name +// with allowed character. +func sanitizePackageName(pkgName string) string { + pkgName = strings.Replace(pkgName, ".", "_", -1) + pkgName = strings.Replace(pkgName, "-", "_", -1) + return pkgName +} + // defaultGoPackageName returns the default go package name to be used for go files generated from "f". // You might need to use an unique alias for the package when you import it. Use ReserveGoPackageAlias to get a unique alias. func defaultGoPackageName(f *descriptor.FileDescriptorProto) string { name := packageIdentityName(f) - return strings.Replace(name, ".", "_", -1) + return sanitizePackageName(name) } // packageIdentityName returns the identity of packages. @@ -284,10 +295,18 @@ func packageIdentityName(f *descriptor.FileDescriptorProto) string { gopkg := f.Options.GetGoPackage() idx := strings.LastIndex(gopkg, "/") if idx < 0 { - return gopkg + gopkg = gopkg[idx+1:] } - return gopkg[idx+1:] + gopkg = gopkg[idx+1:] + // package name is overrided with the string after the + // ';' character + sc := strings.IndexByte(gopkg, ';') + if sc < 0 { + return sanitizePackageName(gopkg) + + } + return sanitizePackageName(gopkg[sc+1:]) } if f.Package == nil { diff --git a/protoc-gen-grpc-gateway/descriptor/registry_test.go b/protoc-gen-grpc-gateway/descriptor/registry_test.go index ff3f4dc1799..b73c967b295 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry_test.go +++ b/protoc-gen-grpc-gateway/descriptor/registry_test.go @@ -531,3 +531,21 @@ func TestLoadWithInconsistentTargetPackage(t *testing.T) { } } } + +func TestLoadOverridedPackageName(t *testing.T) { + reg := NewRegistry() + loadFile(t, reg, ` + name: 'example.proto' + package: 'example' + options < go_package: 'example.com/xyz;pb' > + `) + file := reg.files["example.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg := GoPackage{Path: "example.com/xyz", Name: "pb"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } +} From 2bc76082606e9a6ffe94113443f7adfaf1927179 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Sat, 13 May 2017 11:05:08 -0700 Subject: [PATCH 145/552] Reference import grpc Status to suppress unused errors. (#387) --- examples/examplepb/a_bit_of_everything.pb.gw.go | 1 + examples/examplepb/echo_service.pb.gw.go | 1 + examples/examplepb/flow_combination.pb.gw.go | 1 + examples/examplepb/stream.pb.gw.go | 1 + protoc-gen-grpc-gateway/gengateway/template.go | 1 + 5 files changed, 5 insertions(+) diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index e1640d388d1..243f14013b3 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -28,6 +28,7 @@ import ( var _ codes.Code var _ io.Reader +var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index d89d2c69caf..637de220a3d 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -25,6 +25,7 @@ import ( var _ codes.Code var _ io.Reader +var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 1bdfd091f5f..ee4d3f648b9 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -25,6 +25,7 @@ import ( var _ codes.Code var _ io.Reader +var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index 67799b9ffb8..5019cb11352 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -27,6 +27,7 @@ import ( var _ codes.Code var _ io.Reader +var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index ad5112c2652..65632b41405 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -129,6 +129,7 @@ import ( var _ codes.Code var _ io.Reader +var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray `)) From 1ea023674c32256f89cc860ef612df740859aca3 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 30 May 2017 13:11:16 -0700 Subject: [PATCH 146/552] jsonpb: update tests to reflect new jsonpb behavior (#401) --- runtime/marshal_jsonpb_test.go | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index 01e7ce87251..482a45bfd71 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -19,7 +19,13 @@ import ( func TestJSONPbMarshal(t *testing.T) { msg := examplepb.ABitOfEverything{ - Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + SingleNested: &examplepb.ABitOfEverything_Nested{}, + RepeatedStringValue: []string{}, + MappedStringValue: map[string]string{}, + MappedNestedValue: map[string]*examplepb.ABitOfEverything_Nested{}, + RepeatedEnumValue: []examplepb.NumericEnum{}, + TimestampValue: ×tamp.Timestamp{}, + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", Nested: []*examplepb.ABitOfEverything_Nested{ { Name: "foo", @@ -37,7 +43,7 @@ func TestJSONPbMarshal(t *testing.T) { }, } - for _, spec := range []struct { + for i, spec := range []struct { enumsAsInts, emitDefaults bool indent string origName bool @@ -105,7 +111,7 @@ func TestJSONPbMarshal(t *testing.T) { t.Errorf("jsonpb.UnmarshalString(%q, &got) failed with %v; want success; spec=%v", string(buf), err, spec) } if want := msg; !reflect.DeepEqual(got, want) { - t.Errorf("got = %v; want %v; spec=%v", &got, &want, spec) + t.Errorf("case %d: got = %v; want %v; spec=%v", i, &got, &want, spec) } if spec.verifier != nil { spec.verifier(string(buf)) @@ -143,7 +149,7 @@ func TestJSONPbUnmarshal(t *testing.T) { m runtime.JSONPb got examplepb.ABitOfEverything ) - for _, data := range []string{ + for i, data := range []string{ `{ "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", "nested": [ @@ -185,7 +191,7 @@ func TestJSONPbUnmarshal(t *testing.T) { }`, } { if err := m.Unmarshal([]byte(data), &got); err != nil { - t.Errorf("m.Unmarshal(%q, &got) failed with %v; want success", data, err) + t.Errorf("case %d: m.Unmarshal(%q, &got) failed with %v; want success", i, data, err) } want := examplepb.ABitOfEverything{ @@ -208,7 +214,7 @@ func TestJSONPbUnmarshal(t *testing.T) { } if !reflect.DeepEqual(got, want) { - t.Errorf("got = %v; want = %v", &got, &want) + t.Errorf("case %d: got = %v; want = %v", i, &got, &want) } } } @@ -232,7 +238,13 @@ func TestJSONPbUnmarshalFields(t *testing.T) { func TestJSONPbEncoder(t *testing.T) { msg := examplepb.ABitOfEverything{ - Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + SingleNested: &examplepb.ABitOfEverything_Nested{}, + RepeatedStringValue: []string{}, + MappedStringValue: map[string]string{}, + MappedNestedValue: map[string]*examplepb.ABitOfEverything_Nested{}, + RepeatedEnumValue: []examplepb.NumericEnum{}, + TimestampValue: ×tamp.Timestamp{}, + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", Nested: []*examplepb.ABitOfEverything_Nested{ { Name: "foo", @@ -249,7 +261,7 @@ func TestJSONPbEncoder(t *testing.T) { }, } - for _, spec := range []struct { + for i, spec := range []struct { enumsAsInts, emitDefaults bool indent string origName bool @@ -319,7 +331,7 @@ func TestJSONPbEncoder(t *testing.T) { t.Errorf("jsonpb.UnmarshalString(%q, &got) failed with %v; want success; spec=%v", buf.String(), err, spec) } if want := msg; !reflect.DeepEqual(got, want) { - t.Errorf("got = %v; want %v; spec=%v", &got, &want, spec) + t.Errorf("case %d: got = %v; want %v; spec=%v", i, &got, &want, spec) } if spec.verifier != nil { spec.verifier(buf.String()) From fcb6329cd456f03066a902ff1d81e07163c18aee Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Tue, 30 May 2017 19:28:52 -0700 Subject: [PATCH 147/552] Return if runtime.AnnotateContext gave error (#403) --- .../examplepb/a_bit_of_everything.pb.gw.go | 11 ++++++++ examples/examplepb/echo_service.pb.gw.go | 2 ++ examples/examplepb/flow_combination.pb.gw.go | 26 +++++++++++++++++++ examples/examplepb/stream.pb.gw.go | 3 +++ .../gengateway/template.go | 1 + 5 files changed, 43 insertions(+) diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 243f14013b3..5e5415b5e55 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -497,6 +497,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_Create_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -525,6 +526,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_CreateBody_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -553,6 +555,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_Lookup_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -581,6 +584,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_Update_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -609,6 +613,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_Delete_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -637,6 +642,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_GetQuery_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -665,6 +671,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_Echo_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -693,6 +700,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_Echo_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -721,6 +729,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_Echo_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -749,6 +758,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_DeepPathEcho_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -777,6 +787,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_ABitOfEverythingService_Timeout_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 637de220a3d..70395244450 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -115,6 +115,7 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_EchoService_Echo_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -143,6 +144,7 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_EchoService_EchoBody_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index ee4d3f648b9..a18997ceb1e 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -1032,6 +1032,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcEmptyRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1060,6 +1061,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcEmptyStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1088,6 +1090,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_StreamEmptyRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1116,6 +1119,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_StreamEmptyStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1144,6 +1148,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1172,6 +1177,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyRpc_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1200,6 +1206,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyRpc_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1228,6 +1235,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyRpc_3(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1256,6 +1264,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyRpc_4(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1284,6 +1293,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyRpc_5(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1312,6 +1322,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyRpc_6(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1340,6 +1351,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcPathSingleNestedRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1368,6 +1380,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcPathNestedRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1396,6 +1409,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcPathNestedRpc_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1424,6 +1438,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcPathNestedRpc_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1452,6 +1467,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1480,6 +1496,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyStream_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1508,6 +1525,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyStream_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1536,6 +1554,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyStream_3(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1564,6 +1583,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyStream_4(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1592,6 +1612,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyStream_5(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1620,6 +1641,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcBodyStream_6(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1648,6 +1670,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcPathSingleNestedStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1676,6 +1699,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcPathNestedStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1704,6 +1728,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcPathNestedStream_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -1732,6 +1757,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_FlowCombination_RpcPathNestedStream_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index 5019cb11352..b72b1d15ced 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -187,6 +187,7 @@ func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, co rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_StreamService_BulkCreate_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -215,6 +216,7 @@ func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, co rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_StreamService_List_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) @@ -243,6 +245,7 @@ func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, co rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_StreamService_BulkEcho_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 65632b41405..c6fcc3bfe64 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -362,6 +362,7 @@ func Register{{$svc.GetName}}Handler(ctx context.Context, mux *runtime.ServeMux, rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return } resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) From be3bf3a06c9877563419cedb9bd8493c60236284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E5=90=89=E5=B3=B0?= Date: Tue, 6 Jun 2017 22:57:27 +0800 Subject: [PATCH 148/552] improve {incoming,outgoing}HeaderMatcher logic (#408) * default implementation over nil-check * really exclude header when outgoingHeaderMatcher returns false --- runtime/context.go | 6 ++---- runtime/handler.go | 14 +++++--------- runtime/mux.go | 12 +++++++++++- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/runtime/context.go b/runtime/context.go index 571e353dd5c..6e0eb27e285 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -61,10 +61,8 @@ func AnnotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (con if strings.ToLower(key) == "authorization" { pairs = append(pairs, "authorization", val) } - if mux.incomingHeaderMatcher != nil { - if h, ok := mux.incomingHeaderMatcher(key); ok { - pairs = append(pairs, h, val) - } + if h, ok := mux.incomingHeaderMatcher(key); ok { + pairs = append(pairs, h, val) } } } diff --git a/runtime/handler.go b/runtime/handler.go index 22eb1b3dbad..0f4750f4c80 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -68,15 +68,11 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal func handleForwardResponseServerMetadata(w http.ResponseWriter, mux *ServeMux, md ServerMetadata) { for k, vs := range md.HeaderMD { - hKey := fmt.Sprintf("%s%s", MetadataHeaderPrefix, k) - if mux.outgoingHeaderMatcher != nil { - if h, ok := mux.outgoingHeaderMatcher(k); ok { - hKey = h + if h, ok := mux.outgoingHeaderMatcher(k); ok { + for _, v := range vs { + w.Header().Add(h, v) } } - for i := range vs { - w.Header().Add(hKey, vs[i]) - } } } @@ -90,8 +86,8 @@ func handleForwardResponseTrailerHeader(w http.ResponseWriter, md ServerMetadata func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) { for k, vs := range md.TrailerMD { tKey := fmt.Sprintf("%s%s", MetadataTrailerPrefix, k) - for i := range vs { - w.Header().Add(tKey, vs[i]) + for _, v := range vs { + w.Header().Add(tKey, v) } } } diff --git a/runtime/mux.go b/runtime/mux.go index dda3db205fd..f7a228031dc 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -1,6 +1,7 @@ package runtime import ( + "fmt" "net/http" "net/textproto" "strings" @@ -107,7 +108,6 @@ func NewServeMux(opts ...ServeMuxOption) *ServeMux { handlers: make(map[string][]handler), forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), marshalers: makeMarshalerMIMERegistry(), - incomingHeaderMatcher: DefaultHeaderMatcher, } for _, opt := range opts { @@ -126,6 +126,16 @@ func NewServeMux(opts ...ServeMuxOption) *ServeMux { } } + if serveMux.incomingHeaderMatcher == nil { + serveMux.incomingHeaderMatcher = DefaultHeaderMatcher + } + + if serveMux.outgoingHeaderMatcher == nil { + serveMux.outgoingHeaderMatcher = func(key string) (string, bool) { + return fmt.Sprintf("%s%s", MetadataHeaderPrefix, key), true + } + } + return serveMux } From d1cf479bbb310681dd4499c205450c9d04a3d7ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=95=B8?= Date: Thu, 15 Jun 2017 10:43:20 +0800 Subject: [PATCH 149/552] ISSUE#405: customize the error return (#409) --- examples/clients/echo/EchoServiceApi.go | 61 ++++++++++++++ .../clients/echo/ExamplepbSimpleMessage.go | 1 + .../examplepb/a_bit_of_everything.pb.gw.go | 42 +++++----- examples/examplepb/echo_service.pb.go | 32 +++++--- examples/examplepb/echo_service.pb.gw.go | 81 ++++++++++++++++++- examples/examplepb/echo_service.proto | 4 + examples/examplepb/echo_service.swagger.json | 37 +++++++++ examples/examplepb/flow_combination.pb.gw.go | 48 +++++------ examples/integration_test.go | 20 +++++ .../gengateway/template.go | 2 +- 10 files changed, 270 insertions(+), 58 deletions(-) diff --git a/examples/clients/echo/EchoServiceApi.go b/examples/clients/echo/EchoServiceApi.go index 0cf5b582740..fe6d7341d3d 100644 --- a/examples/clients/echo/EchoServiceApi.go +++ b/examples/clients/echo/EchoServiceApi.go @@ -143,3 +143,64 @@ func (a EchoServiceApi) EchoBody (body ExamplepbSimpleMessage) (ExamplepbSimpleM return *successPayload, err } +/** + * Echo method receives a simple message and returns it. + * The message posted as the id parameter will also be\nreturned. + * @param id + * @param num + * @return ExamplepbSimpleMessage + */ +//func (a EchoServiceApi) Echo_1 (id string, num string) (ExamplepbSimpleMessage, error) { +func (a EchoServiceApi) Echo_1 (id string, num string) (ExamplepbSimpleMessage, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v1/example/echo/{id}/{num}" + path = strings.Replace(path, "{" + "id" + "}", fmt.Sprintf("%v", id), -1) + path = strings.Replace(path, "{" + "num" + "}", fmt.Sprintf("%v", num), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ExamplepbSimpleMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} diff --git a/examples/clients/echo/ExamplepbSimpleMessage.go b/examples/clients/echo/ExamplepbSimpleMessage.go index ed9ada35b70..3b1fe9bc344 100644 --- a/examples/clients/echo/ExamplepbSimpleMessage.go +++ b/examples/clients/echo/ExamplepbSimpleMessage.go @@ -5,5 +5,6 @@ import ( type ExamplepbSimpleMessage struct { Id string `json:"id,omitempty"` + Num string `json:"num,omitempty"` } diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 5e5415b5e55..ec3b01490a5 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -55,7 +55,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.FloatValue, err = runtime.Float32(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "float_value", err) } val, ok = pathParams["double_value"] @@ -66,7 +66,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.DoubleValue, err = runtime.Float64(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "double_value", err) } val, ok = pathParams["int64_value"] @@ -77,7 +77,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.Int64Value, err = runtime.Int64(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int64_value", err) } val, ok = pathParams["uint64_value"] @@ -88,7 +88,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.Uint64Value, err = runtime.Uint64(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint64_value", err) } val, ok = pathParams["int32_value"] @@ -99,7 +99,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.Int32Value, err = runtime.Int32(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int32_value", err) } val, ok = pathParams["fixed64_value"] @@ -110,7 +110,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.Fixed64Value, err = runtime.Uint64(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fixed64_value", err) } val, ok = pathParams["fixed32_value"] @@ -121,7 +121,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.Fixed32Value, err = runtime.Uint32(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fixed32_value", err) } val, ok = pathParams["bool_value"] @@ -132,7 +132,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.BoolValue, err = runtime.Bool(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bool_value", err) } val, ok = pathParams["string_value"] @@ -143,7 +143,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.StringValue, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) } val, ok = pathParams["uint32_value"] @@ -154,7 +154,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.Uint32Value, err = runtime.Uint32(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint32_value", err) } val, ok = pathParams["sfixed32_value"] @@ -165,7 +165,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.Sfixed32Value, err = runtime.Int32(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sfixed32_value", err) } val, ok = pathParams["sfixed64_value"] @@ -176,7 +176,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.Sfixed64Value, err = runtime.Int64(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sfixed64_value", err) } val, ok = pathParams["sint32_value"] @@ -187,7 +187,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.Sint32Value, err = runtime.Int32(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sint32_value", err) } val, ok = pathParams["sint64_value"] @@ -198,7 +198,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.Sint64Value, err = runtime.Int64(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sint64_value", err) } val, ok = pathParams["nonConventionalNameValue"] @@ -209,7 +209,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.NonConventionalNameValue, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonConventionalNameValue", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Create_0); err != nil { @@ -253,7 +253,7 @@ func request_ABitOfEverythingService_Lookup_0(ctx context.Context, marshaler run protoReq.Uuid, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } msg, err := client.Lookup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -284,7 +284,7 @@ func request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler run protoReq.Uuid, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -311,7 +311,7 @@ func request_ABitOfEverythingService_Delete_0(ctx context.Context, marshaler run protoReq.Uuid, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -342,7 +342,7 @@ func request_ABitOfEverythingService_GetQuery_0(ctx context.Context, marshaler r protoReq.Uuid, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_GetQuery_0); err != nil { @@ -373,7 +373,7 @@ func request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runti protoReq.Value, err = runtime.StringP(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -434,7 +434,7 @@ func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshal err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) } msg, err := client.DeepPathEcho(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 447758379c1..f4b5f3b5caa 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -50,7 +50,8 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // SimpleMessage represents a simple message sent to the Echo service. type SimpleMessage struct { // Id represents the message identifier. - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Num int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` } func (m *SimpleMessage) Reset() { *m = SimpleMessage{} } @@ -65,6 +66,13 @@ func (m *SimpleMessage) GetId() string { return "" } +func (m *SimpleMessage) GetNum() int64 { + if m != nil { + return m.Num + } + return 0 +} + func init() { proto.RegisterType((*SimpleMessage)(nil), "grpc.gateway.examples.examplepb.SimpleMessage") } @@ -187,20 +195,22 @@ var _EchoService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/echo_service.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 229 bytes of a gzipped FileDescriptorProto + // 257 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x87, 0x32, 0x0a, 0x92, 0xf4, 0x53, 0x93, 0x33, 0xf2, 0xe3, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xe4, 0xd3, 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, 0xda, 0x95, 0xe4, 0xb9, 0x78, 0x83, 0x33, + 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xda, 0x95, 0x0c, 0xb9, 0x78, 0x83, 0x33, 0x41, 0x2a, 0x7d, 0x53, 0x8b, 0x8b, 0x13, 0xd3, 0x53, 0x85, 0xf8, 0xb8, 0x98, 0x32, 0x53, 0x24, - 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x98, 0x32, 0x53, 0x8c, 0x96, 0x30, 0x71, 0x71, 0xbb, 0x26, - 0x67, 0xe4, 0x07, 0x43, 0x6c, 0x15, 0x6a, 0x65, 0xe4, 0x62, 0x01, 0xf1, 0x85, 0xf4, 0xf4, 0x08, - 0xd8, 0xac, 0x87, 0x62, 0xb0, 0x14, 0x89, 0xea, 0x95, 0x64, 0x9b, 0x2e, 0x3f, 0x99, 0xcc, 0x24, - 0xae, 0x24, 0xaa, 0x5f, 0x66, 0x08, 0x0b, 0x02, 0x70, 0x00, 0xe8, 0x57, 0x67, 0xa6, 0xd4, 0x0a, - 0xf5, 0x30, 0x72, 0x71, 0x80, 0xdc, 0xe1, 0x94, 0x9f, 0x52, 0x49, 0x73, 0xb7, 0x28, 0x80, 0xdd, - 0x22, 0x85, 0xe9, 0x96, 0xf8, 0xa4, 0xfc, 0x94, 0x4a, 0x2b, 0x46, 0x2d, 0x27, 0xee, 0x28, 0x4e, - 0xb8, 0xe6, 0x24, 0x36, 0x70, 0xd8, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x26, 0x96, 0x37, - 0xac, 0xc3, 0x01, 0x00, 0x00, + 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x98, 0x32, 0x53, 0x84, 0x04, 0xb8, 0x98, 0xf3, 0x4a, 0x73, + 0x25, 0x98, 0x14, 0x18, 0x35, 0x98, 0x83, 0x40, 0x4c, 0xa3, 0xc3, 0x4c, 0x5c, 0xdc, 0xae, 0xc9, + 0x19, 0xf9, 0xc1, 0x10, 0x77, 0x08, 0x2d, 0x61, 0xe4, 0x62, 0x01, 0xf1, 0x85, 0xf4, 0xf4, 0x08, + 0xb8, 0x45, 0x0f, 0xc5, 0x2a, 0x29, 0x12, 0xd5, 0x2b, 0xd9, 0x34, 0x5d, 0x7e, 0x32, 0x99, 0xc9, + 0x4c, 0x49, 0x54, 0xbf, 0xcc, 0x10, 0x16, 0x28, 0xe0, 0x20, 0xd1, 0xaf, 0xce, 0x4c, 0xa9, 0x8d, + 0x92, 0x15, 0x92, 0xc6, 0x2a, 0xa1, 0x5f, 0x9d, 0x57, 0x9a, 0x5b, 0x2b, 0xd4, 0xc3, 0xc8, 0xc5, + 0x01, 0x72, 0xa6, 0x53, 0x7e, 0x4a, 0x25, 0xcd, 0x9d, 0xaa, 0x00, 0x76, 0xaa, 0x14, 0xa6, 0x53, + 0xe3, 0x93, 0xf2, 0x53, 0x2a, 0xad, 0x18, 0xb5, 0x9c, 0xb8, 0xa3, 0x38, 0xe1, 0x9a, 0x93, 0xd8, + 0xc0, 0x91, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x6e, 0x70, 0xce, 0xf4, 0x01, 0x00, + 0x00, } diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 70395244450..9710887fab2 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -29,6 +29,10 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var ( + filter_EchoService_Echo_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata @@ -48,7 +52,49 @@ func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler protoReq.Id, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_EchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SimpleMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + val, ok = pathParams["num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") + } + + protoReq.Num, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -128,6 +174,35 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn }) + mux.Handle("GET", pattern_EchoService_Echo_1, 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, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_EchoService_Echo_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_EchoService_Echo_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -163,11 +238,15 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn var ( pattern_EchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, "")) + pattern_EchoService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "echo", "id", "num"}, "")) + pattern_EchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, "")) ) var ( forward_EchoService_Echo_0 = runtime.ForwardResponseMessage + forward_EchoService_Echo_1 = runtime.ForwardResponseMessage + forward_EchoService_EchoBody_0 = runtime.ForwardResponseMessage ) diff --git a/examples/examplepb/echo_service.proto b/examples/examplepb/echo_service.proto index 44555e8553f..0a7a6fa7f49 100644 --- a/examples/examplepb/echo_service.proto +++ b/examples/examplepb/echo_service.proto @@ -13,6 +13,7 @@ import "google/api/annotations.proto"; message SimpleMessage { // Id represents the message identifier. string id = 1; + int64 num = 2; } // Echo service responds to incoming echo requests. @@ -24,6 +25,9 @@ service EchoService { rpc Echo(SimpleMessage) returns (SimpleMessage) { option (google.api.http) = { post: "/v1/example/echo/{id}" + additional_bindings { + get: "/v1/example/echo/{id}/{num}" + } }; } // EchoBody method receives a simple message and returns it. diff --git a/examples/examplepb/echo_service.swagger.json b/examples/examplepb/echo_service.swagger.json index 9380472a3f9..c58fbc54cea 100644 --- a/examples/examplepb/echo_service.swagger.json +++ b/examples/examplepb/echo_service.swagger.json @@ -42,6 +42,39 @@ ] } }, + "/v1/example/echo/{id}/{num}": { + "get": { + "summary": "Echo method receives a simple message and returns it.", + "description": "The message posted as the id parameter will also be\nreturned.", + "operationId": "Echo", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/examplepbSimpleMessage" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "num", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + } + ], + "tags": [ + "EchoService" + ] + } + }, "/v1/example/echo_body": { "post": { "summary": "EchoBody method receives a simple message and returns it.", @@ -77,6 +110,10 @@ "id": { "type": "string", "description": "Id represents the message identifier." + }, + "num": { + "type": "string", + "format": "int64" } }, "description": "SimpleMessage represents a simple message sent to the Echo service." diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index a18997ceb1e..9b1ae373c6e 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -180,7 +180,7 @@ func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime protoReq.A, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } val, ok = pathParams["b"] @@ -191,7 +191,7 @@ func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime protoReq.B, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } val, ok = pathParams["c"] @@ -202,7 +202,7 @@ func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime protoReq.C, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "c", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -250,7 +250,7 @@ func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime protoReq.A, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } val, ok = pathParams["b"] @@ -261,7 +261,7 @@ func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime protoReq.B, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -317,7 +317,7 @@ func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime protoReq.A, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_5); err != nil { @@ -352,7 +352,7 @@ func request_FlowCombination_RpcBodyRpc_6(ctx context.Context, marshaler runtime protoReq.A, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_6); err != nil { @@ -387,7 +387,7 @@ func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marsh err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil { @@ -426,7 +426,7 @@ func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler r err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } val, ok = pathParams["b"] @@ -437,7 +437,7 @@ func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler r protoReq.B, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_0); err != nil { @@ -472,7 +472,7 @@ func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler r err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_1); err != nil { @@ -511,7 +511,7 @@ func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler r err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_2); err != nil { @@ -563,7 +563,7 @@ func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runt protoReq.A, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } val, ok = pathParams["b"] @@ -574,7 +574,7 @@ func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runt protoReq.B, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } val, ok = pathParams["c"] @@ -585,7 +585,7 @@ func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runt protoReq.C, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "c", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) @@ -649,7 +649,7 @@ func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runt protoReq.A, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } val, ok = pathParams["b"] @@ -660,7 +660,7 @@ func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runt protoReq.B, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } stream, err := client.RpcBodyStream(ctx, &protoReq) @@ -732,7 +732,7 @@ func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runt protoReq.A, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_5); err != nil { @@ -775,7 +775,7 @@ func request_FlowCombination_RpcBodyStream_6(ctx context.Context, marshaler runt protoReq.A, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_6); err != nil { @@ -818,7 +818,7 @@ func request_FlowCombination_RpcPathSingleNestedStream_0(ctx context.Context, ma err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathSingleNestedStream_0); err != nil { @@ -865,7 +865,7 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } val, ok = pathParams["b"] @@ -876,7 +876,7 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale protoReq.B, err = runtime.String(val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_0); err != nil { @@ -919,7 +919,7 @@ func request_FlowCombination_RpcPathNestedStream_1(ctx context.Context, marshale err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_1); err != nil { @@ -966,7 +966,7 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_2); err != nil { diff --git a/examples/integration_test.go b/examples/integration_test.go index 710b8249623..44a9fa7da21 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -762,3 +762,23 @@ func TestMethodNotAllowed(t *testing.T) { t.Logf("%s", buf) } } + +func TestInvalidArgument(t *testing.T) { + url := "http://localhost:8080/v1/example/echo/myid/not_int64" + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusBadRequest; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } +} diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index c6fcc3bfe64..b660f16d6e0 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -228,7 +228,7 @@ var ( {{$param.RHS "protoReq"}}, err = {{$param.ConvertFuncExpr}}(val) {{end}} if err != nil { - return nil, metadata, err + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) } {{end}} {{end}} From 6555f4cc38f044307e58ba7b195f230588f0aeed Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Sat, 24 Jun 2017 00:05:45 +0900 Subject: [PATCH 150/552] Update Swagger Codegen from 2.1.6 to 2.2.2 (#415) --- .travis.yml | 3 +- Makefile | 12 +- examples/client_test.go | 10 +- examples/clients/abe/.gitignore | 1 + examples/clients/abe/.swagger-codegen-ignore | 1 + .../clients/abe/ABitOfEverythingNested.go | 11 - .../clients/abe/ABitOfEverythingServiceApi.go | 764 ----------------- .../clients/abe/ExamplepbABitOfEverything.go | 36 - examples/clients/abe/ExamplepbNumericEnum.go | 8 - examples/clients/abe/NestedDeepEnum.go | 8 - examples/clients/abe/ProtobufEmpty.go | 8 - examples/clients/abe/SubStringMessage.go | 9 - .../clients/abe/a_bit_of_everything_nested.go | 22 + .../abe/a_bit_of_everything_service_api.go | 784 ++++++++++++++++++ examples/clients/abe/api_client.go | 164 ++++ examples/clients/abe/api_response.go | 44 + examples/clients/abe/configuration.go | 67 ++ .../abe/examplepb_a_bit_of_everything.go | 72 ++ .../clients/abe/examplepb_numeric_enum.go | 15 + examples/clients/abe/nested_deep_enum.go | 15 + examples/clients/abe/protobuf_empty.go | 15 + examples/clients/abe/sub_string_message.go | 16 + examples/clients/echo/.gitignore | 1 + examples/clients/echo/.swagger-codegen-ignore | 1 + examples/clients/echo/EchoServiceApi.go | 206 ----- .../clients/echo/ExamplepbSimpleMessage.go | 10 - examples/clients/echo/api_client.go | 164 ++++ examples/clients/echo/api_response.go | 44 + examples/clients/echo/configuration.go | 67 ++ examples/clients/echo/echo_service_api.go | 224 +++++ .../clients/echo/examplepb_simple_message.go | 20 + 31 files changed, 1752 insertions(+), 1070 deletions(-) create mode 100644 examples/clients/abe/.gitignore create mode 100644 examples/clients/abe/.swagger-codegen-ignore delete mode 100644 examples/clients/abe/ABitOfEverythingNested.go delete mode 100644 examples/clients/abe/ABitOfEverythingServiceApi.go delete mode 100644 examples/clients/abe/ExamplepbABitOfEverything.go delete mode 100644 examples/clients/abe/ExamplepbNumericEnum.go delete mode 100644 examples/clients/abe/NestedDeepEnum.go delete mode 100644 examples/clients/abe/ProtobufEmpty.go delete mode 100644 examples/clients/abe/SubStringMessage.go create mode 100644 examples/clients/abe/a_bit_of_everything_nested.go create mode 100644 examples/clients/abe/a_bit_of_everything_service_api.go create mode 100644 examples/clients/abe/api_client.go create mode 100644 examples/clients/abe/api_response.go create mode 100644 examples/clients/abe/configuration.go create mode 100644 examples/clients/abe/examplepb_a_bit_of_everything.go create mode 100644 examples/clients/abe/examplepb_numeric_enum.go create mode 100644 examples/clients/abe/nested_deep_enum.go create mode 100644 examples/clients/abe/protobuf_empty.go create mode 100644 examples/clients/abe/sub_string_message.go create mode 100644 examples/clients/echo/.gitignore create mode 100644 examples/clients/echo/.swagger-codegen-ignore delete mode 100644 examples/clients/echo/EchoServiceApi.go delete mode 100644 examples/clients/echo/ExamplepbSimpleMessage.go create mode 100644 examples/clients/echo/api_client.go create mode 100644 examples/clients/echo/api_response.go create mode 100644 examples/clients/echo/configuration.go create mode 100644 examples/clients/echo/echo_service_api.go create mode 100644 examples/clients/echo/examplepb_simple_message.go diff --git a/.travis.yml b/.travis.yml index c1113a5c282..37d1b5468e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,10 +11,11 @@ cache: - ${TRAVIS_BUILD_DIR}/examples/browser/node_modules before_install: - ./.travis/install-protoc.sh 3.1.0 -- ./.travis/install-swagger-codegen.sh 2.1.6 +- ./.travis/install-swagger-codegen.sh 2.2.2 - nvm install v6.1 && nvm use v6.1 && node --version - go get github.com/golang/lint/golint - go get github.com/dghubble/sling +- go get github.com/go-resty/resty install: - go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway - go get github.com/grpc-ecosystem/grpc-gateway/runtime diff --git a/Makefile b/Makefile index accde9800fe..5fe3c4850e0 100644 --- a/Makefile +++ b/Makefile @@ -109,12 +109,16 @@ $(EXAMPLE_SWAGGERSRCS): $(SWAGGER_PLUGIN) $(SWAGGER_EXAMPLES) $(ECHO_EXAMPLE_SRCS): $(ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ECHO_EXAMPLE_SPEC) \ - -l go -o examples/clients --additional-properties packageName=echo - @rm -f $(EXAMPLE_CLIENT_DIR)/README.md $(EXAMPLE_CLIENT_DIR)/git_push.sh $(EXAMPLE_CLIENT_DIR)/.gitignore + -l go -o examples/clients/echo --additional-properties packageName=echo + @rm -f $(EXAMPLE_CLIENT_DIR)/echo/README.md \ + $(EXAMPLE_CLIENT_DIR)/echo/git_push.sh \ + $(EXAMPLE_CLIENT_DIR)/echo/.travis.yml $(ABE_EXAMPLE_SRCS): $(ABE_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ABE_EXAMPLE_SPEC) \ - -l go -o examples/clients --additional-properties packageName=abe - @rm -f $(EXAMPLE_CLIENT_DIR)/README.md $(EXAMPLE_CLIENT_DIR)/git_push.sh $(EXAMPLE_CLIENT_DIR)/.gitignore + -l go -o examples/clients/abe --additional-properties packageName=abe + @rm -f $(EXAMPLE_CLIENT_DIR)/abe/README.md \ + $(EXAMPLE_CLIENT_DIR)/abe/git_push.sh \ + $(EXAMPLE_CLIENT_DIR)/abe/.travis.yml examples: $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_DEPSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) test: examples diff --git a/examples/client_test.go b/examples/client_test.go index 0574d9fbb0c..536a7a27fc2 100644 --- a/examples/client_test.go +++ b/examples/client_test.go @@ -18,7 +18,7 @@ func TestEchoClient(t *testing.T) { } cl := echo.NewEchoServiceApiWithBasePath("http://localhost:8080") - resp, err := cl.Echo("foo") + resp, _, err := cl.Echo("foo") if err != nil { t.Errorf(`cl.Echo("foo") failed with %v; want success`, err) } @@ -35,7 +35,7 @@ func TestEchoBodyClient(t *testing.T) { cl := echo.NewEchoServiceApiWithBasePath("http://localhost:8080") req := echo.ExamplepbSimpleMessage{Id: "foo"} - resp, err := cl.EchoBody(req) + resp, _, err := cl.EchoBody(req) if err != nil { t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err) } @@ -56,7 +56,7 @@ func TestAbitOfEverythingClient(t *testing.T) { } func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { - want := abe.ExamplepbABitOfEverything{ + want := &abe.ExamplepbABitOfEverything{ FloatValue: 1.5, DoubleValue: 2.5, Int64Value: "4294967296", @@ -73,7 +73,7 @@ func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { Sint64Value: "4611686018427387903", NonConventionalNameValue: "camelCase", } - resp, err := cl.Create( + resp, _, err := cl.Create( want.FloatValue, want.DoubleValue, want.Int64Value, @@ -148,7 +148,7 @@ func testABEClientCreateBody(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { "b": {Name: "y", Amount: 2}, }, } - resp, err := cl.CreateBody(want) + resp, _, err := cl.CreateBody(want) if err != nil { t.Errorf("cl.CreateBody(%#v) failed with %v; want success", want, err) } diff --git a/examples/clients/abe/.gitignore b/examples/clients/abe/.gitignore new file mode 100644 index 00000000000..2f88269126d --- /dev/null +++ b/examples/clients/abe/.gitignore @@ -0,0 +1 @@ +/docs diff --git a/examples/clients/abe/.swagger-codegen-ignore b/examples/clients/abe/.swagger-codegen-ignore new file mode 100644 index 00000000000..6c7b69a0156 --- /dev/null +++ b/examples/clients/abe/.swagger-codegen-ignore @@ -0,0 +1 @@ +.gitignore diff --git a/examples/clients/abe/ABitOfEverythingNested.go b/examples/clients/abe/ABitOfEverythingNested.go deleted file mode 100644 index 7e5488e37a7..00000000000 --- a/examples/clients/abe/ABitOfEverythingNested.go +++ /dev/null @@ -1,11 +0,0 @@ -package abe - -import ( -) - -type ABitOfEverythingNested struct { - Name string `json:"name,omitempty"` - Amount int64 `json:"amount,omitempty"` - Ok NestedDeepEnum `json:"ok,omitempty"` - -} diff --git a/examples/clients/abe/ABitOfEverythingServiceApi.go b/examples/clients/abe/ABitOfEverythingServiceApi.go deleted file mode 100644 index fcc60763608..00000000000 --- a/examples/clients/abe/ABitOfEverythingServiceApi.go +++ /dev/null @@ -1,764 +0,0 @@ -package abe - -import ( - "strings" - "fmt" - "encoding/json" - "errors" - "github.com/dghubble/sling" - "time" -) - -type ABitOfEverythingServiceApi struct { - basePath string -} - -func NewABitOfEverythingServiceApi() *ABitOfEverythingServiceApi{ - return &ABitOfEverythingServiceApi { - basePath: "http://localhost", - } -} - -func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythingServiceApi{ - return &ABitOfEverythingServiceApi { - basePath: basePath, - } -} - -/** - * - * - * @param floatValue - * @param doubleValue - * @param int64Value - * @param uint64Value - * @param int32Value - * @param fixed64Value - * @param fixed32Value - * @param boolValue - * @param stringValue - * @param uint32Value - * @param sfixed32Value - * @param sfixed64Value - * @param sint32Value - * @param sint64Value - * @param nonConventionalNameValue - * @return ExamplepbABitOfEverything - */ -//func (a ABitOfEverythingServiceApi) Create (floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string) (ExamplepbABitOfEverything, error) { -func (a ABitOfEverythingServiceApi) Create (floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string) (ExamplepbABitOfEverything, error) { - - _sling := sling.New().Post(a.basePath) - - // create path and map variables - path := "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}" - path = strings.Replace(path, "{" + "float_value" + "}", fmt.Sprintf("%v", floatValue), -1) - path = strings.Replace(path, "{" + "double_value" + "}", fmt.Sprintf("%v", doubleValue), -1) - path = strings.Replace(path, "{" + "int64_value" + "}", fmt.Sprintf("%v", int64Value), -1) - path = strings.Replace(path, "{" + "uint64_value" + "}", fmt.Sprintf("%v", uint64Value), -1) - path = strings.Replace(path, "{" + "int32_value" + "}", fmt.Sprintf("%v", int32Value), -1) - path = strings.Replace(path, "{" + "fixed64_value" + "}", fmt.Sprintf("%v", fixed64Value), -1) - path = strings.Replace(path, "{" + "fixed32_value" + "}", fmt.Sprintf("%v", fixed32Value), -1) - path = strings.Replace(path, "{" + "bool_value" + "}", fmt.Sprintf("%v", boolValue), -1) - path = strings.Replace(path, "{" + "string_value" + "}", fmt.Sprintf("%v", stringValue), -1) - path = strings.Replace(path, "{" + "uint32_value" + "}", fmt.Sprintf("%v", uint32Value), -1) - path = strings.Replace(path, "{" + "sfixed32_value" + "}", fmt.Sprintf("%v", sfixed32Value), -1) - path = strings.Replace(path, "{" + "sfixed64_value" + "}", fmt.Sprintf("%v", sfixed64Value), -1) - path = strings.Replace(path, "{" + "sint32_value" + "}", fmt.Sprintf("%v", sint32Value), -1) - path = strings.Replace(path, "{" + "sint64_value" + "}", fmt.Sprintf("%v", sint64Value), -1) - path = strings.Replace(path, "{" + "nonConventionalNameValue" + "}", fmt.Sprintf("%v", nonConventionalNameValue), -1) - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - - - var successPayload = new(ExamplepbABitOfEverything) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * - * - * @param body - * @return ExamplepbABitOfEverything - */ -//func (a ABitOfEverythingServiceApi) CreateBody (body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { -func (a ABitOfEverythingServiceApi) CreateBody (body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { - - _sling := sling.New().Post(a.basePath) - - // create path and map variables - path := "/v1/example/a_bit_of_everything" - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - -// body params - _sling = _sling.BodyJSON(body) - - var successPayload = new(ExamplepbABitOfEverything) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * - * - * @param singleNestedName - * @param body - * @return ExamplepbABitOfEverything - */ -//func (a ABitOfEverythingServiceApi) DeepPathEcho (singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { -func (a ABitOfEverythingServiceApi) DeepPathEcho (singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { - - _sling := sling.New().Post(a.basePath) - - // create path and map variables - path := "/v1/example/a_bit_of_everything/{single_nested.name}" - path = strings.Replace(path, "{" + "single_nested.name" + "}", fmt.Sprintf("%v", singleNestedName), -1) - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - -// body params - _sling = _sling.BodyJSON(body) - - var successPayload = new(ExamplepbABitOfEverything) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * - * - * @param uuid - * @return ProtobufEmpty - */ -//func (a ABitOfEverythingServiceApi) Delete (uuid string) (ProtobufEmpty, error) { -func (a ABitOfEverythingServiceApi) Delete (uuid string) (ProtobufEmpty, error) { - - _sling := sling.New().Delete(a.basePath) - - // create path and map variables - path := "/v1/example/a_bit_of_everything/{uuid}" - path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - - - var successPayload = new(ProtobufEmpty) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * - * - * @param value - * @return SubStringMessage - */ -//func (a ABitOfEverythingServiceApi) Echo (value string) (SubStringMessage, error) { -func (a ABitOfEverythingServiceApi) Echo (value string) (SubStringMessage, error) { - - _sling := sling.New().Get(a.basePath) - - // create path and map variables - path := "/v1/example/a_bit_of_everything/echo/{value}" - path = strings.Replace(path, "{" + "value" + "}", fmt.Sprintf("%v", value), -1) - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - - - var successPayload = new(SubStringMessage) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * - * - * @param value - * @return SubStringMessage - */ -//func (a ABitOfEverythingServiceApi) Echo_1 (value string) (SubStringMessage, error) { -func (a ABitOfEverythingServiceApi) Echo_1 (value string) (SubStringMessage, error) { - - _sling := sling.New().Get(a.basePath) - - // create path and map variables - path := "/v2/example/echo" - - _sling = _sling.Path(path) - - type QueryParams struct { - value string `url:"value,omitempty"` - -} - _sling = _sling.QueryStruct(&QueryParams{ value: value }) - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - - - var successPayload = new(SubStringMessage) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * - * - * @param body - * @return SubStringMessage - */ -//func (a ABitOfEverythingServiceApi) Echo_2 (body string) (SubStringMessage, error) { -func (a ABitOfEverythingServiceApi) Echo_2 (body string) (SubStringMessage, error) { - - _sling := sling.New().Post(a.basePath) - - // create path and map variables - path := "/v2/example/echo" - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - -// body params - _sling = _sling.BodyJSON(body) - - var successPayload = new(SubStringMessage) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * - * - * @param uuid - * @param singleNestedName name is nested field. - * @param singleNestedAmount - * @param singleNestedOk - FALSE: FALSE is false.\n - TRUE: TRUE is true. - * @param floatValue - * @param doubleValue - * @param int64Value - * @param uint64Value - * @param int32Value - * @param fixed64Value - * @param fixed32Value - * @param boolValue - * @param stringValue - * @param uint32Value TODO(yugui) add bytes_value. - * @param enumValue - ZERO: ZERO means 0\n - ONE: ONE means 1 - * @param sfixed32Value - * @param sfixed64Value - * @param sint32Value - * @param sint64Value - * @param repeatedStringValue - * @param oneofString - * @param nonConventionalNameValue - * @param timestampValue - * @param repeatedEnumValue repeated enum value. it is comma-separated in query.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1 - * @return ProtobufEmpty - */ -//func (a ABitOfEverythingServiceApi) GetQuery (uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (ProtobufEmpty, error) { -func (a ABitOfEverythingServiceApi) GetQuery (uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (ProtobufEmpty, error) { - - _sling := sling.New().Get(a.basePath) - - // create path and map variables - path := "/v1/example/a_bit_of_everything/query/{uuid}" - path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) - - _sling = _sling.Path(path) - - type QueryParams struct { - singleNestedName string `url:"single_nested.name,omitempty"` - singleNestedAmount int64 `url:"single_nested.amount,omitempty"` - singleNestedOk string `url:"single_nested.ok,omitempty"` - floatValue float32 `url:"float_value,omitempty"` - doubleValue float64 `url:"double_value,omitempty"` - int64Value string `url:"int64_value,omitempty"` - uint64Value string `url:"uint64_value,omitempty"` - int32Value int32 `url:"int32_value,omitempty"` - fixed64Value string `url:"fixed64_value,omitempty"` - fixed32Value int64 `url:"fixed32_value,omitempty"` - boolValue bool `url:"bool_value,omitempty"` - stringValue string `url:"string_value,omitempty"` - uint32Value int64 `url:"uint32_value,omitempty"` - enumValue string `url:"enum_value,omitempty"` - sfixed32Value int32 `url:"sfixed32_value,omitempty"` - sfixed64Value string `url:"sfixed64_value,omitempty"` - sint32Value int32 `url:"sint32_value,omitempty"` - sint64Value string `url:"sint64_value,omitempty"` - repeatedStringValue []string `url:"repeated_string_value,omitempty"` - oneofString string `url:"oneof_string,omitempty"` - nonConventionalNameValue string `url:"nonConventionalNameValue,omitempty"` - timestampValue time.Time `url:"timestamp_value,omitempty"` - repeatedEnumValue []string `url:"repeated_enum_value,omitempty"` - -} - _sling = _sling.QueryStruct(&QueryParams{ singleNestedName: singleNestedName,singleNestedAmount: singleNestedAmount,singleNestedOk: singleNestedOk,floatValue: floatValue,doubleValue: doubleValue,int64Value: int64Value,uint64Value: uint64Value,int32Value: int32Value,fixed64Value: fixed64Value,fixed32Value: fixed32Value,boolValue: boolValue,stringValue: stringValue,uint32Value: uint32Value,enumValue: enumValue,sfixed32Value: sfixed32Value,sfixed64Value: sfixed64Value,sint32Value: sint32Value,sint64Value: sint64Value,repeatedStringValue: repeatedStringValue,oneofString: oneofString,nonConventionalNameValue: nonConventionalNameValue,timestampValue: timestampValue,repeatedEnumValue: repeatedEnumValue }) - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - - - var successPayload = new(ProtobufEmpty) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * - * - * @param uuid - * @return ExamplepbABitOfEverything - */ -//func (a ABitOfEverythingServiceApi) Lookup (uuid string) (ExamplepbABitOfEverything, error) { -func (a ABitOfEverythingServiceApi) Lookup (uuid string) (ExamplepbABitOfEverything, error) { - - _sling := sling.New().Get(a.basePath) - - // create path and map variables - path := "/v1/example/a_bit_of_everything/{uuid}" - path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - - - var successPayload = new(ExamplepbABitOfEverything) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * - * - * @return ProtobufEmpty - */ -//func (a ABitOfEverythingServiceApi) Timeout () (ProtobufEmpty, error) { -func (a ABitOfEverythingServiceApi) Timeout () (ProtobufEmpty, error) { - - _sling := sling.New().Get(a.basePath) - - // create path and map variables - path := "/v2/example/timeout" - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - - - var successPayload = new(ProtobufEmpty) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * - * - * @param uuid - * @param body - * @return ProtobufEmpty - */ -//func (a ABitOfEverythingServiceApi) Update (uuid string, body ExamplepbABitOfEverything) (ProtobufEmpty, error) { -func (a ABitOfEverythingServiceApi) Update (uuid string, body ExamplepbABitOfEverything) (ProtobufEmpty, error) { - - _sling := sling.New().Put(a.basePath) - - // create path and map variables - path := "/v1/example/a_bit_of_everything/{uuid}" - path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - -// body params - _sling = _sling.BodyJSON(body) - - var successPayload = new(ProtobufEmpty) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} diff --git a/examples/clients/abe/ExamplepbABitOfEverything.go b/examples/clients/abe/ExamplepbABitOfEverything.go deleted file mode 100644 index 2892eb624d9..00000000000 --- a/examples/clients/abe/ExamplepbABitOfEverything.go +++ /dev/null @@ -1,36 +0,0 @@ -package abe - -import ( - "time" -) - -type ExamplepbABitOfEverything struct { - SingleNested ABitOfEverythingNested `json:"single_nested,omitempty"` - Uuid string `json:"uuid,omitempty"` - Nested []ABitOfEverythingNested `json:"nested,omitempty"` - FloatValue float32 `json:"float_value,omitempty"` - DoubleValue float64 `json:"double_value,omitempty"` - Int64Value string `json:"int64_value,omitempty"` - Uint64Value string `json:"uint64_value,omitempty"` - Int32Value int32 `json:"int32_value,omitempty"` - Fixed64Value string `json:"fixed64_value,omitempty"` - Fixed32Value int64 `json:"fixed32_value,omitempty"` - BoolValue bool `json:"bool_value,omitempty"` - StringValue string `json:"string_value,omitempty"` - Uint32Value int64 `json:"uint32_value,omitempty"` - EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"` - Sfixed32Value int32 `json:"sfixed32_value,omitempty"` - Sfixed64Value string `json:"sfixed64_value,omitempty"` - Sint32Value int32 `json:"sint32_value,omitempty"` - Sint64Value string `json:"sint64_value,omitempty"` - RepeatedStringValue []string `json:"repeated_string_value,omitempty"` - OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"` - OneofString string `json:"oneof_string,omitempty"` - MapValue map[string]ExamplepbNumericEnum `json:"map_value,omitempty"` - MappedStringValue map[string]string `json:"mapped_string_value,omitempty"` - MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"` - NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` - TimestampValue time.Time `json:"timestamp_value,omitempty"` - RepeatedEnumValue []ExamplepbNumericEnum `json:"repeated_enum_value,omitempty"` - -} diff --git a/examples/clients/abe/ExamplepbNumericEnum.go b/examples/clients/abe/ExamplepbNumericEnum.go deleted file mode 100644 index 51cffc77f69..00000000000 --- a/examples/clients/abe/ExamplepbNumericEnum.go +++ /dev/null @@ -1,8 +0,0 @@ -package abe - -import ( -) - -type ExamplepbNumericEnum struct { - -} diff --git a/examples/clients/abe/NestedDeepEnum.go b/examples/clients/abe/NestedDeepEnum.go deleted file mode 100644 index b48e231216c..00000000000 --- a/examples/clients/abe/NestedDeepEnum.go +++ /dev/null @@ -1,8 +0,0 @@ -package abe - -import ( -) - -type NestedDeepEnum struct { - -} diff --git a/examples/clients/abe/ProtobufEmpty.go b/examples/clients/abe/ProtobufEmpty.go deleted file mode 100644 index ac37afeb862..00000000000 --- a/examples/clients/abe/ProtobufEmpty.go +++ /dev/null @@ -1,8 +0,0 @@ -package abe - -import ( -) - -type ProtobufEmpty struct { - -} diff --git a/examples/clients/abe/SubStringMessage.go b/examples/clients/abe/SubStringMessage.go deleted file mode 100644 index f278dbf258b..00000000000 --- a/examples/clients/abe/SubStringMessage.go +++ /dev/null @@ -1,9 +0,0 @@ -package abe - -import ( -) - -type SubStringMessage struct { - Value string `json:"value,omitempty"` - -} diff --git a/examples/clients/abe/a_bit_of_everything_nested.go b/examples/clients/abe/a_bit_of_everything_nested.go new file mode 100644 index 00000000000..909f478b7dc --- /dev/null +++ b/examples/clients/abe/a_bit_of_everything_nested.go @@ -0,0 +1,22 @@ +/* + * examples/examplepb/a_bit_of_everything.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +// Nested is nested type. +type ABitOfEverythingNested struct { + + // name is nested field. + Name string `json:"name,omitempty"` + + Amount int64 `json:"amount,omitempty"` + + Ok NestedDeepEnum `json:"ok,omitempty"` +} diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go new file mode 100644 index 00000000000..669a12aed76 --- /dev/null +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -0,0 +1,784 @@ +/* + * examples/examplepb/a_bit_of_everything.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "net/url" + "strings" + "time" + "encoding/json" + "fmt" +) + +type ABitOfEverythingServiceApi struct { + Configuration *Configuration +} + +func NewABitOfEverythingServiceApi() *ABitOfEverythingServiceApi { + configuration := NewConfiguration() + return &ABitOfEverythingServiceApi{ + Configuration: configuration, + } +} + +func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythingServiceApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &ABitOfEverythingServiceApi{ + Configuration: configuration, + } +} + +/** + * + * + * @param floatValue + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param uint32Value + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param nonConventionalNameValue + * @return *ExamplepbABitOfEverything + */ +func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string) (*ExamplepbABitOfEverything, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}" + localVarPath = strings.Replace(localVarPath, "{"+"float_value"+"}", fmt.Sprintf("%v", floatValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"double_value"+"}", fmt.Sprintf("%v", doubleValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"int64_value"+"}", fmt.Sprintf("%v", int64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uint64_value"+"}", fmt.Sprintf("%v", uint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"int32_value"+"}", fmt.Sprintf("%v", int32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fixed64_value"+"}", fmt.Sprintf("%v", fixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fixed32_value"+"}", fmt.Sprintf("%v", fixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"bool_value"+"}", fmt.Sprintf("%v", boolValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"string_value"+"}", fmt.Sprintf("%v", stringValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uint32_value"+"}", fmt.Sprintf("%v", uint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sfixed32_value"+"}", fmt.Sprintf("%v", sfixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sfixed64_value"+"}", fmt.Sprintf("%v", sfixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sint32_value"+"}", fmt.Sprintf("%v", sint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sint64_value"+"}", fmt.Sprintf("%v", sint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nonConventionalNameValue"+"}", fmt.Sprintf("%v", nonConventionalNameValue), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ExamplepbABitOfEverything) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Create", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param body + * @return *ExamplepbABitOfEverything + */ +func (a ABitOfEverythingServiceApi) CreateBody(body ExamplepbABitOfEverything) (*ExamplepbABitOfEverything, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ExamplepbABitOfEverything) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "CreateBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param singleNestedName + * @param body + * @return *ExamplepbABitOfEverything + */ +func (a ABitOfEverythingServiceApi) DeepPathEcho(singleNestedName string, body ExamplepbABitOfEverything) (*ExamplepbABitOfEverything, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/{single_nested.name}" + localVarPath = strings.Replace(localVarPath, "{"+"single_nested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ExamplepbABitOfEverything) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "DeepPathEcho", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param uuid + * @return *ProtobufEmpty + */ +func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Delete") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Delete", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param value + * @return *SubStringMessage + */ +func (a ABitOfEverythingServiceApi) Echo(value string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" + localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param value + * @return *SubStringMessage + */ +func (a ABitOfEverythingServiceApi) Echo_1(value string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo_0", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param body + * @return *SubStringMessage + */ +func (a ABitOfEverythingServiceApi) Echo_2(body string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo_1", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param uuid + * @param singleNestedName name is nested field. + * @param singleNestedAmount + * @param singleNestedOk - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param floatValue + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param uint32Value TODO(yugui) add bytes_value. + * @param enumValue - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param repeatedStringValue + * @param oneofString + * @param nonConventionalNameValue + * @param timestampValue + * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @return *ProtobufEmpty + */ +func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/query/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + localVarQueryParams.Add("single_nested.name", a.Configuration.APIClient.ParameterToString(singleNestedName, "")) + localVarQueryParams.Add("single_nested.amount", a.Configuration.APIClient.ParameterToString(singleNestedAmount, "")) + localVarQueryParams.Add("single_nested.ok", a.Configuration.APIClient.ParameterToString(singleNestedOk, "")) + localVarQueryParams.Add("float_value", a.Configuration.APIClient.ParameterToString(floatValue, "")) + localVarQueryParams.Add("double_value", a.Configuration.APIClient.ParameterToString(doubleValue, "")) + localVarQueryParams.Add("int64_value", a.Configuration.APIClient.ParameterToString(int64Value, "")) + localVarQueryParams.Add("uint64_value", a.Configuration.APIClient.ParameterToString(uint64Value, "")) + localVarQueryParams.Add("int32_value", a.Configuration.APIClient.ParameterToString(int32Value, "")) + localVarQueryParams.Add("fixed64_value", a.Configuration.APIClient.ParameterToString(fixed64Value, "")) + localVarQueryParams.Add("fixed32_value", a.Configuration.APIClient.ParameterToString(fixed32Value, "")) + localVarQueryParams.Add("bool_value", a.Configuration.APIClient.ParameterToString(boolValue, "")) + localVarQueryParams.Add("string_value", a.Configuration.APIClient.ParameterToString(stringValue, "")) + localVarQueryParams.Add("uint32_value", a.Configuration.APIClient.ParameterToString(uint32Value, "")) + localVarQueryParams.Add("enum_value", a.Configuration.APIClient.ParameterToString(enumValue, "")) + localVarQueryParams.Add("sfixed32_value", a.Configuration.APIClient.ParameterToString(sfixed32Value, "")) + localVarQueryParams.Add("sfixed64_value", a.Configuration.APIClient.ParameterToString(sfixed64Value, "")) + localVarQueryParams.Add("sint32_value", a.Configuration.APIClient.ParameterToString(sint32Value, "")) + localVarQueryParams.Add("sint64_value", a.Configuration.APIClient.ParameterToString(sint64Value, "")) + var repeatedStringValueCollectionFormat = "csv" + localVarQueryParams.Add("repeated_string_value", a.Configuration.APIClient.ParameterToString(repeatedStringValue, repeatedStringValueCollectionFormat)) + + localVarQueryParams.Add("oneof_string", a.Configuration.APIClient.ParameterToString(oneofString, "")) + localVarQueryParams.Add("nonConventionalNameValue", a.Configuration.APIClient.ParameterToString(nonConventionalNameValue, "")) + localVarQueryParams.Add("timestamp_value", a.Configuration.APIClient.ParameterToString(timestampValue, "")) + var repeatedEnumValueCollectionFormat = "csv" + localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) + + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "GetQuery", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param uuid + * @return *ExamplepbABitOfEverything + */ +func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEverything, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ExamplepbABitOfEverything) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Lookup", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @return *ProtobufEmpty + */ +func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/timeout" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Timeout", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param uuid + * @param body + * @return *ProtobufEmpty + */ +func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Put") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Update", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + diff --git a/examples/clients/abe/api_client.go b/examples/clients/abe/api_client.go new file mode 100644 index 00000000000..2825dd48e13 --- /dev/null +++ b/examples/clients/abe/api_client.go @@ -0,0 +1,164 @@ +/* + * examples/examplepb/a_bit_of_everything.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "bytes" + "fmt" + "path/filepath" + "reflect" + "strings" + "net/url" + "io/ioutil" + "github.com/go-resty/resty" +) + +type APIClient struct { + config *Configuration +} + +func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { + + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +func (c *APIClient) SelectHeaderAccept(accepts []string) string { + + if len(accepts) == 0 { + return "" + } + if contains(accepts, "application/json") { + return "application/json" + } + return strings.Join(accepts, ",") +} + +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +func (c *APIClient) CallAPI(path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams map[string]string, + fileName string, + fileBytes []byte) (*resty.Response, error) { + + rClient := c.prepareClient() + request := c.prepareRequest(rClient, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + + switch strings.ToUpper(method) { + case "GET": + response, err := request.Get(path) + return response, err + case "POST": + response, err := request.Post(path) + return response, err + case "PUT": + response, err := request.Put(path) + return response, err + case "PATCH": + response, err := request.Patch(path) + return response, err + case "DELETE": + response, err := request.Delete(path) + return response, err + } + + return nil, fmt.Errorf("invalid method %v", method) +} + +func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string { + delimiter := "" + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } + + return fmt.Sprintf("%v", obj) +} + +func (c *APIClient) prepareClient() *resty.Client { + + rClient := resty.New() + + rClient.SetDebug(c.config.Debug) + if c.config.Transport != nil { + rClient.SetTransport(c.config.Transport) + } + + if c.config.Timeout != nil { + rClient.SetTimeout(*c.config.Timeout) + } + rClient.SetLogger(ioutil.Discard) + return rClient +} + +func (c *APIClient) prepareRequest( + rClient *resty.Client, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams map[string]string, + fileName string, + fileBytes []byte) *resty.Request { + + + request := rClient.R() + request.SetBody(postBody) + + if c.config.UserAgent != "" { + request.SetHeader("User-Agent", c.config.UserAgent) + } + + // add header parameter, if any + if len(headerParams) > 0 { + request.SetHeaders(headerParams) + } + + // add query parameter, if any + if len(queryParams) > 0 { + request.SetMultiValueQueryParams(queryParams) + } + + // add form parameter, if any + if len(formParams) > 0 { + request.SetFormData(formParams) + } + + if len(fileBytes) > 0 && fileName != "" { + _, fileNm := filepath.Split(fileName) + request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) + } + return request +} diff --git a/examples/clients/abe/api_response.go b/examples/clients/abe/api_response.go new file mode 100644 index 00000000000..8c14424b574 --- /dev/null +++ b/examples/clients/abe/api_response.go @@ -0,0 +1,44 @@ +/* + * examples/examplepb/a_bit_of_everything.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "net/http" +) + +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the swagger operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/examples/clients/abe/configuration.go b/examples/clients/abe/configuration.go new file mode 100644 index 00000000000..5cacaadcb9d --- /dev/null +++ b/examples/clients/abe/configuration.go @@ -0,0 +1,67 @@ +/* + * examples/examplepb/a_bit_of_everything.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "encoding/base64" + "net/http" + "time" +) + + +type Configuration struct { + Username string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` + APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` + APIKey map[string]string `json:"APIKey,omitempty"` + Debug bool `json:"debug,omitempty"` + DebugFile string `json:"debugFile,omitempty"` + OAuthToken string `json:"oAuthToken,omitempty"` + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + AccessToken string `json:"accessToken,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + APIClient *APIClient + Transport *http.Transport + Timeout *time.Duration `json:"timeout,omitempty"` +} + +func NewConfiguration() *Configuration { + cfg := &Configuration{ + BasePath: "http://localhost", + DefaultHeader: make(map[string]string), + APIKey: make(map[string]string), + APIKeyPrefix: make(map[string]string), + UserAgent: "Swagger-Codegen/1.0.0/go", + APIClient: &APIClient{}, + } + + cfg.APIClient.config = cfg + return cfg +} + +func (c *Configuration) GetBasicAuthEncodedString() string { + return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password)) +} + +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string { + if c.APIKeyPrefix[APIKeyIdentifier] != "" { + return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] + } + + return c.APIKey[APIKeyIdentifier] +} diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go new file mode 100644 index 00000000000..338ac379878 --- /dev/null +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -0,0 +1,72 @@ +/* + * examples/examplepb/a_bit_of_everything.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "time" +) + +type ExamplepbABitOfEverything struct { + + SingleNested ABitOfEverythingNested `json:"single_nested,omitempty"` + + Uuid string `json:"uuid,omitempty"` + + Nested []ABitOfEverythingNested `json:"nested,omitempty"` + + FloatValue float32 `json:"float_value,omitempty"` + + DoubleValue float64 `json:"double_value,omitempty"` + + Int64Value string `json:"int64_value,omitempty"` + + Uint64Value string `json:"uint64_value,omitempty"` + + Int32Value int32 `json:"int32_value,omitempty"` + + Fixed64Value string `json:"fixed64_value,omitempty"` + + Fixed32Value int64 `json:"fixed32_value,omitempty"` + + BoolValue bool `json:"bool_value,omitempty"` + + StringValue string `json:"string_value,omitempty"` + + Uint32Value int64 `json:"uint32_value,omitempty"` + + EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"` + + Sfixed32Value int32 `json:"sfixed32_value,omitempty"` + + Sfixed64Value string `json:"sfixed64_value,omitempty"` + + Sint32Value int32 `json:"sint32_value,omitempty"` + + Sint64Value string `json:"sint64_value,omitempty"` + + RepeatedStringValue []string `json:"repeated_string_value,omitempty"` + + OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"` + + OneofString string `json:"oneof_string,omitempty"` + + MapValue map[string]ExamplepbNumericEnum `json:"map_value,omitempty"` + + MappedStringValue map[string]string `json:"mapped_string_value,omitempty"` + + MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"` + + NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` + + TimestampValue time.Time `json:"timestamp_value,omitempty"` + + RepeatedEnumValue []ExamplepbNumericEnum `json:"repeated_enum_value,omitempty"` +} diff --git a/examples/clients/abe/examplepb_numeric_enum.go b/examples/clients/abe/examplepb_numeric_enum.go new file mode 100644 index 00000000000..bfb776292b3 --- /dev/null +++ b/examples/clients/abe/examplepb_numeric_enum.go @@ -0,0 +1,15 @@ +/* + * examples/examplepb/a_bit_of_everything.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +// NumericEnum is one or zero. - ZERO: ZERO means 0 - ONE: ONE means 1 +type ExamplepbNumericEnum struct { +} diff --git a/examples/clients/abe/nested_deep_enum.go b/examples/clients/abe/nested_deep_enum.go new file mode 100644 index 00000000000..50bf6235a29 --- /dev/null +++ b/examples/clients/abe/nested_deep_enum.go @@ -0,0 +1,15 @@ +/* + * examples/examplepb/a_bit_of_everything.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +// DeepEnum is one or zero. - FALSE: FALSE is false. - TRUE: TRUE is true. +type NestedDeepEnum struct { +} diff --git a/examples/clients/abe/protobuf_empty.go b/examples/clients/abe/protobuf_empty.go new file mode 100644 index 00000000000..0cf664849d2 --- /dev/null +++ b/examples/clients/abe/protobuf_empty.go @@ -0,0 +1,15 @@ +/* + * examples/examplepb/a_bit_of_everything.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +// service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. +type ProtobufEmpty struct { +} diff --git a/examples/clients/abe/sub_string_message.go b/examples/clients/abe/sub_string_message.go new file mode 100644 index 00000000000..0331c7abb94 --- /dev/null +++ b/examples/clients/abe/sub_string_message.go @@ -0,0 +1,16 @@ +/* + * examples/examplepb/a_bit_of_everything.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +type SubStringMessage struct { + + Value string `json:"value,omitempty"` +} diff --git a/examples/clients/echo/.gitignore b/examples/clients/echo/.gitignore new file mode 100644 index 00000000000..2f88269126d --- /dev/null +++ b/examples/clients/echo/.gitignore @@ -0,0 +1 @@ +/docs diff --git a/examples/clients/echo/.swagger-codegen-ignore b/examples/clients/echo/.swagger-codegen-ignore new file mode 100644 index 00000000000..6c7b69a0156 --- /dev/null +++ b/examples/clients/echo/.swagger-codegen-ignore @@ -0,0 +1 @@ +.gitignore diff --git a/examples/clients/echo/EchoServiceApi.go b/examples/clients/echo/EchoServiceApi.go deleted file mode 100644 index fe6d7341d3d..00000000000 --- a/examples/clients/echo/EchoServiceApi.go +++ /dev/null @@ -1,206 +0,0 @@ -package echo - -import ( - "strings" - "fmt" - "encoding/json" - "errors" - "github.com/dghubble/sling" -) - -type EchoServiceApi struct { - basePath string -} - -func NewEchoServiceApi() *EchoServiceApi{ - return &EchoServiceApi { - basePath: "http://localhost", - } -} - -func NewEchoServiceApiWithBasePath(basePath string) *EchoServiceApi{ - return &EchoServiceApi { - basePath: basePath, - } -} - -/** - * Echo method receives a simple message and returns it. - * The message posted as the id parameter will also be\nreturned. - * @param id - * @return ExamplepbSimpleMessage - */ -//func (a EchoServiceApi) Echo (id string) (ExamplepbSimpleMessage, error) { -func (a EchoServiceApi) Echo (id string) (ExamplepbSimpleMessage, error) { - - _sling := sling.New().Post(a.basePath) - - // create path and map variables - path := "/v1/example/echo/{id}" - path = strings.Replace(path, "{" + "id" + "}", fmt.Sprintf("%v", id), -1) - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - - - var successPayload = new(ExamplepbSimpleMessage) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * EchoBody method receives a simple message and returns it. - * - * @param body - * @return ExamplepbSimpleMessage - */ -//func (a EchoServiceApi) EchoBody (body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, error) { -func (a EchoServiceApi) EchoBody (body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, error) { - - _sling := sling.New().Post(a.basePath) - - // create path and map variables - path := "/v1/example/echo_body" - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - -// body params - _sling = _sling.BodyJSON(body) - - var successPayload = new(ExamplepbSimpleMessage) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} -/** - * Echo method receives a simple message and returns it. - * The message posted as the id parameter will also be\nreturned. - * @param id - * @param num - * @return ExamplepbSimpleMessage - */ -//func (a EchoServiceApi) Echo_1 (id string, num string) (ExamplepbSimpleMessage, error) { -func (a EchoServiceApi) Echo_1 (id string, num string) (ExamplepbSimpleMessage, error) { - - _sling := sling.New().Get(a.basePath) - - // create path and map variables - path := "/v1/example/echo/{id}/{num}" - path = strings.Replace(path, "{" + "id" + "}", fmt.Sprintf("%v", id), -1) - path = strings.Replace(path, "{" + "num" + "}", fmt.Sprintf("%v", num), -1) - - _sling = _sling.Path(path) - - // accept header - accepts := []string { "application/json" } - for key := range accepts { - _sling = _sling.Set("Accept", accepts[key]) - break // only use the first Accept - } - - - var successPayload = new(ExamplepbSimpleMessage) - - // We use this map (below) so that any arbitrary error JSON can be handled. - // FIXME: This is in the absence of this Go generator honoring the non-2xx - // response (error) models, which needs to be implemented at some point. - var failurePayload map[string]interface{} - - httpResponse, err := _sling.Receive(successPayload, &failurePayload) - - if err == nil { - // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) - if failurePayload != nil { - // If the failurePayload is present, there likely was some kind of non-2xx status - // returned (and a JSON payload error present) - var str []byte - str, err = json.Marshal(failurePayload) - if err == nil { // For safety, check for an error marshalling... probably superfluous - // This will return the JSON error body as a string - err = errors.New(string(str)) - } - } else { - // So, there was no network-type error, and nothing in the failure payload, - // but we should still check the status code - if httpResponse == nil { - // This should never happen... - err = errors.New("No HTTP Response received.") - } else if code := httpResponse.StatusCode; 200 > code || code > 299 { - err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) - } - } - } - - return *successPayload, err -} diff --git a/examples/clients/echo/ExamplepbSimpleMessage.go b/examples/clients/echo/ExamplepbSimpleMessage.go deleted file mode 100644 index 3b1fe9bc344..00000000000 --- a/examples/clients/echo/ExamplepbSimpleMessage.go +++ /dev/null @@ -1,10 +0,0 @@ -package echo - -import ( -) - -type ExamplepbSimpleMessage struct { - Id string `json:"id,omitempty"` - Num string `json:"num,omitempty"` - -} diff --git a/examples/clients/echo/api_client.go b/examples/clients/echo/api_client.go new file mode 100644 index 00000000000..7a517148026 --- /dev/null +++ b/examples/clients/echo/api_client.go @@ -0,0 +1,164 @@ +/* + * Echo Service + * + * Echo Service API consists of a single service which returns a message. + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package echo + +import ( + "bytes" + "fmt" + "path/filepath" + "reflect" + "strings" + "net/url" + "io/ioutil" + "github.com/go-resty/resty" +) + +type APIClient struct { + config *Configuration +} + +func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { + + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +func (c *APIClient) SelectHeaderAccept(accepts []string) string { + + if len(accepts) == 0 { + return "" + } + if contains(accepts, "application/json") { + return "application/json" + } + return strings.Join(accepts, ",") +} + +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +func (c *APIClient) CallAPI(path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams map[string]string, + fileName string, + fileBytes []byte) (*resty.Response, error) { + + rClient := c.prepareClient() + request := c.prepareRequest(rClient, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + + switch strings.ToUpper(method) { + case "GET": + response, err := request.Get(path) + return response, err + case "POST": + response, err := request.Post(path) + return response, err + case "PUT": + response, err := request.Put(path) + return response, err + case "PATCH": + response, err := request.Patch(path) + return response, err + case "DELETE": + response, err := request.Delete(path) + return response, err + } + + return nil, fmt.Errorf("invalid method %v", method) +} + +func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string { + delimiter := "" + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } + + return fmt.Sprintf("%v", obj) +} + +func (c *APIClient) prepareClient() *resty.Client { + + rClient := resty.New() + + rClient.SetDebug(c.config.Debug) + if c.config.Transport != nil { + rClient.SetTransport(c.config.Transport) + } + + if c.config.Timeout != nil { + rClient.SetTimeout(*c.config.Timeout) + } + rClient.SetLogger(ioutil.Discard) + return rClient +} + +func (c *APIClient) prepareRequest( + rClient *resty.Client, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams map[string]string, + fileName string, + fileBytes []byte) *resty.Request { + + + request := rClient.R() + request.SetBody(postBody) + + if c.config.UserAgent != "" { + request.SetHeader("User-Agent", c.config.UserAgent) + } + + // add header parameter, if any + if len(headerParams) > 0 { + request.SetHeaders(headerParams) + } + + // add query parameter, if any + if len(queryParams) > 0 { + request.SetMultiValueQueryParams(queryParams) + } + + // add form parameter, if any + if len(formParams) > 0 { + request.SetFormData(formParams) + } + + if len(fileBytes) > 0 && fileName != "" { + _, fileNm := filepath.Split(fileName) + request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) + } + return request +} diff --git a/examples/clients/echo/api_response.go b/examples/clients/echo/api_response.go new file mode 100644 index 00000000000..8b0d07c4a13 --- /dev/null +++ b/examples/clients/echo/api_response.go @@ -0,0 +1,44 @@ +/* + * Echo Service + * + * Echo Service API consists of a single service which returns a message. + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package echo + +import ( + "net/http" +) + +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the swagger operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/examples/clients/echo/configuration.go b/examples/clients/echo/configuration.go new file mode 100644 index 00000000000..9a75a30aeec --- /dev/null +++ b/examples/clients/echo/configuration.go @@ -0,0 +1,67 @@ +/* + * Echo Service + * + * Echo Service API consists of a single service which returns a message. + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package echo + +import ( + "encoding/base64" + "net/http" + "time" +) + + +type Configuration struct { + Username string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` + APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` + APIKey map[string]string `json:"APIKey,omitempty"` + Debug bool `json:"debug,omitempty"` + DebugFile string `json:"debugFile,omitempty"` + OAuthToken string `json:"oAuthToken,omitempty"` + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + AccessToken string `json:"accessToken,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + APIClient *APIClient + Transport *http.Transport + Timeout *time.Duration `json:"timeout,omitempty"` +} + +func NewConfiguration() *Configuration { + cfg := &Configuration{ + BasePath: "http://localhost", + DefaultHeader: make(map[string]string), + APIKey: make(map[string]string), + APIKeyPrefix: make(map[string]string), + UserAgent: "Swagger-Codegen/1.0.0/go", + APIClient: &APIClient{}, + } + + cfg.APIClient.config = cfg + return cfg +} + +func (c *Configuration) GetBasicAuthEncodedString() string { + return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password)) +} + +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string { + if c.APIKeyPrefix[APIKeyIdentifier] != "" { + return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] + } + + return c.APIKey[APIKeyIdentifier] +} diff --git a/examples/clients/echo/echo_service_api.go b/examples/clients/echo/echo_service_api.go new file mode 100644 index 00000000000..a37a837adb2 --- /dev/null +++ b/examples/clients/echo/echo_service_api.go @@ -0,0 +1,224 @@ +/* + * Echo Service + * + * Echo Service API consists of a single service which returns a message. + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package echo + +import ( + "net/url" + "strings" + "encoding/json" + "fmt" +) + +type EchoServiceApi struct { + Configuration *Configuration +} + +func NewEchoServiceApi() *EchoServiceApi { + configuration := NewConfiguration() + return &EchoServiceApi{ + Configuration: configuration, + } +} + +func NewEchoServiceApiWithBasePath(basePath string) *EchoServiceApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &EchoServiceApi{ + Configuration: configuration, + } +} + +/** + * Echo method receives a simple message and returns it. + * The message posted as the id parameter will also be returned. + * + * @param id + * @return *ExamplepbSimpleMessage + */ +func (a EchoServiceApi) Echo(id string) (*ExamplepbSimpleMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ExamplepbSimpleMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * EchoBody method receives a simple message and returns it. + * + * @param body + * @return *ExamplepbSimpleMessage + */ +func (a EchoServiceApi) EchoBody(body ExamplepbSimpleMessage) (*ExamplepbSimpleMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/echo_body" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ExamplepbSimpleMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "EchoBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * Echo method receives a simple message and returns it. + * The message posted as the id parameter will also be returned. + * + * @param id + * @param num + * @return *ExamplepbSimpleMessage + */ +func (a EchoServiceApi) Echo_1(id string, num string) (*ExamplepbSimpleMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}/{num}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ExamplepbSimpleMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo_0", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + diff --git a/examples/clients/echo/examplepb_simple_message.go b/examples/clients/echo/examplepb_simple_message.go new file mode 100644 index 00000000000..98eb8325083 --- /dev/null +++ b/examples/clients/echo/examplepb_simple_message.go @@ -0,0 +1,20 @@ +/* + * Echo Service + * + * Echo Service API consists of a single service which returns a message. + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package echo + +// SimpleMessage represents a simple message sent to the Echo service. +type ExamplepbSimpleMessage struct { + + // Id represents the message identifier. + Id string `json:"id,omitempty"` + + Num string `json:"num,omitempty"` +} From e31cf4c2a02d87cd45b2a376a6846ecea9eb6886 Mon Sep 17 00:00:00 2001 From: Alexey Palazhchenko Date: Fri, 14 Jul 2017 20:28:03 +0300 Subject: [PATCH 151/552] Update DO NOT EDIT template. (#434) Fixes #433. Signed-off-by: Alexey Palazhchenko --- examples/examplepb/a_bit_of_everything.pb.gw.go | 3 +-- examples/examplepb/echo_service.pb.gw.go | 3 +-- examples/examplepb/flow_combination.pb.gw.go | 3 +-- examples/examplepb/stream.pb.gw.go | 3 +-- protoc-gen-grpc-gateway/gengateway/template.go | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index ec3b01490a5..be3ea26b318 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-grpc-gateway +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/examplepb/a_bit_of_everything.proto -// DO NOT EDIT! /* Package examplepb is a reverse proxy. diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 9710887fab2..f067c0d9ac6 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-grpc-gateway +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/examplepb/echo_service.proto -// DO NOT EDIT! /* Package examplepb is a reverse proxy. diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 9b1ae373c6e..a71b1867479 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-grpc-gateway +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/examplepb/flow_combination.proto -// DO NOT EDIT! /* Package examplepb is a reverse proxy. diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index b72b1d15ced..f252bbd35f4 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-grpc-gateway +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: examples/examplepb/stream.proto -// DO NOT EDIT! /* Package examplepb is a reverse proxy. diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index b660f16d6e0..d4cb912d65f 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -111,9 +111,8 @@ func applyTemplate(p param) (string, error) { var ( headerTemplate = template.Must(template.New("header").Parse(` -// Code generated by protoc-gen-grpc-gateway +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: {{.GetName}} -// DO NOT EDIT! /* Package {{.GoPkg.Name}} is a reverse proxy. From 411667ccdcbcf240645a4d8349b8ae6398d7e739 Mon Sep 17 00:00:00 2001 From: Peter Ebden Date: Mon, 24 Jul 2017 01:48:29 +0100 Subject: [PATCH 152/552] Memoise calls to fullyQualifiedNameToSwaggerName to speed it up for large registries (#421) Memoise calls to fullyQualifiedNameToSwaggerName for all registries ever seen instead of just the last one. --- protoc-gen-swagger/genswagger/template.go | 19 ++++++++++++++++--- .../genswagger/template_test.go | 3 ++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 170e0e4befd..b2353aa5341 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -8,6 +8,7 @@ import ( "regexp" "strconv" "strings" + "sync" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" @@ -329,9 +330,21 @@ func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, r // Take in a FQMN or FQEN and return a swagger safe version of the FQMN func fullyQualifiedNameToSwaggerName(fqn string, reg *descriptor.Registry) string { - return resolveFullyQualifiedNameToSwaggerName(fqn, append(reg.GetAllFQMNs(), reg.GetAllFQENs()...)) + registriesSeenMutex.Lock() + defer registriesSeenMutex.Unlock() + if mapping, present := registriesSeen[reg]; present { + return mapping[fqn] + } + mapping := resolveFullyQualifiedNameToSwaggerNames(append(reg.GetAllFQMNs(), reg.GetAllFQENs()...)) + registriesSeen[reg] = mapping + return mapping[fqn] } +// registriesSeen is used to memoise calls to resolveFullyQualifiedNameToSwaggerNames so +// we don't repeat it unnecessarily, since it can take some time. +var registriesSeen = map[*descriptor.Registry]map[string]string{} +var registriesSeenMutex sync.Mutex + // Take the names of every proto and "uniq-ify" them. The idea is to produce a // set of names that meet a couple of conditions. They must be stable, they // must be unique, and they must be shorter than the FQN. @@ -339,7 +352,7 @@ func fullyQualifiedNameToSwaggerName(fqn string, reg *descriptor.Registry) strin // This likely could be made better. This will always generate the same names // but may not always produce optimal names. This is a reasonably close // approximation of what they should look like in most cases. -func resolveFullyQualifiedNameToSwaggerName(fqn string, messages []string) string { +func resolveFullyQualifiedNameToSwaggerNames(messages []string) map[string]string { packagesByDepth := make(map[int][][]string) uniqueNames := make(map[string]string) @@ -379,7 +392,7 @@ func resolveFullyQualifiedNameToSwaggerName(fqn string, messages []string) strin } } } - return uniqueNames[fqn] + return uniqueNames } // Swagger expects paths of the form /path/{string_value} but grpc-gateway paths are expected to be of the form /path/{string_value=strprefix/*}. This should reformat it correctly. diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 1d438936368..4633a0bbac6 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -758,7 +758,8 @@ func TestResolveFullyQualifiedNameToSwaggerName(t *testing.T) { } for _, data := range tests { - output := resolveFullyQualifiedNameToSwaggerName(data.input, data.listOfFQMNs) + names := resolveFullyQualifiedNameToSwaggerNames(data.listOfFQMNs) + output := names[data.input] if output != data.output { t.Errorf("Expected fullyQualifiedNameToSwaggerName(%v) to be %s but got %s", data.input, data.output, output) From c7928cbc75d88bd919471f084e613c847f78a436 Mon Sep 17 00:00:00 2001 From: Alexey Palazhchenko Date: Thu, 14 Sep 2017 01:39:41 +0300 Subject: [PATCH 153/552] Test with Go 1.9. --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 37d1b5468e7..312a9b818cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,10 @@ language: go sudo: false go: -- 1.8.x - 1.7.x -- tip +- 1.8.x +- 1.9.x +- master go_import_path: github.com/grpc-ecosystem/grpc-gateway cache: directories: From 5e2f5315e08a1ee130638431c666f59ac63d718a Mon Sep 17 00:00:00 2001 From: Alexey Palazhchenko Date: Thu, 14 Sep 2017 01:58:50 +0300 Subject: [PATCH 154/552] Fix build. See grpc/grpc-go#1392. --- examples/server/a_bit_of_everything.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 190d0f85309..38c6467c54e 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -134,7 +134,7 @@ func (s *_ABitOfEverythingServer) List(_ *empty.Empty, stream examples.StreamSer } // return error when metadata includes error header - if header, ok := metadata.FromContext(stream.Context()); ok { + if header, ok := metadata.FromIncomingContext(stream.Context()); ok { if v, ok := header["error"]; ok { stream.SetTrailer(metadata.New(map[string]string{ "foo": "foo2", From 273c15139b98e1b3bda75f1242239c3e42bc84bd Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Wed, 13 Sep 2017 21:55:05 -0600 Subject: [PATCH 155/552] Reference Gulp by a more complete path --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 312a9b818cd..9ca6f5d7020 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ script: - if (go version | grep -q 1.8) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi - env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... - make lint -- sh -c 'cd examples/browser && gulp' +- sh -c 'cd examples/browser && node ./node_modules/gulp/bin/gulp' env: global: - "PATH=$PATH:$HOME/local/bin" From 62bb0782040a7f5c9379e11d068e5b860cdf16e4 Mon Sep 17 00:00:00 2001 From: Hector Jusforgues Date: Wed, 6 Sep 2017 20:37:07 +0200 Subject: [PATCH 156/552] fix 2 typos in Registry.SetPrefix's comment --- protoc-gen-grpc-gateway/descriptor/registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index c4d70038113..9e4f3428dd3 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -207,7 +207,7 @@ func (r *Registry) AddPkgMap(file, protoPkg string) { r.pkgMap[file] = protoPkg } -// SetPrefix registeres the perfix to be added to go package paths generated from proto package names. +// SetPrefix registers the prefix to be added to go package paths generated from proto package names. func (r *Registry) SetPrefix(prefix string) { r.prefix = prefix } From fcf298f28690c797ab4ee0241373bfec517bda71 Mon Sep 17 00:00:00 2001 From: tgeng Date: Mon, 2 Oct 2017 17:07:40 -0700 Subject: [PATCH 157/552] Fallback to JSON name when matching URL parameter. (#450) * Fallback to JSON name when matching URL parameter. * Add tests using JSON name for URL param parsing. --- runtime/query.go | 3 ++ runtime/query_test.go | 108 ++++++++++++++++++++++++++++++++---------- 2 files changed, 87 insertions(+), 24 deletions(-) diff --git a/runtime/query.go b/runtime/query.go index 4b031219c1f..9c30cd0e5b5 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -113,6 +113,9 @@ func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Prope if p.OrigName == name { return m.FieldByName(p.Name), p, nil } + if p.JSONName == name { + return m.FieldByName(p.Name), p, nil + } } return reflect.Value{}, nil, nil } diff --git a/runtime/query_test.go b/runtime/query_test.go index 07262fad67f..93006357879 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -61,6 +61,37 @@ func TestPopulateParameters(t *testing.T) { TimestampValue: timePb, }, }, + { + values: url.Values{ + "floatValue": {"1.5"}, + "doubleValue": {"2.5"}, + "int64Value": {"-1"}, + "int32Value": {"-2"}, + "uint64Value": {"3"}, + "uint32Value": {"4"}, + "boolValue": {"true"}, + "stringValue": {"str"}, + "repeatedValue": {"a", "b", "c"}, + "enumValue": {"1"}, + "repeatedEnum": {"1", "2", "0"}, + "timestampValue": {timeStr}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: -1, + Int32Value: -2, + Uint64Value: 3, + Uint32Value: 4, + BoolValue: true, + StringValue: "str", + RepeatedValue: []string{"a", "b", "c"}, + EnumValue: EnumValue_Y, + RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, + TimestampValue: timePb, + }, + }, { values: url.Values{ "enum_value": {"EnumValue_Z"}, @@ -101,6 +132,35 @@ func TestPopulateParameters(t *testing.T) { RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, }, }, + { + values: url.Values{ + "floatValue": {"1.5"}, + "doubleValue": {"2.5"}, + "int64Value": {"-1"}, + "int32Value": {"-2"}, + "uint64Value": {"3"}, + "uint32Value": {"4"}, + "boolValue": {"true"}, + "stringValue": {"str"}, + "repeatedValue": {"a", "b", "c"}, + "enumValue": {"1"}, + "repeatedEnum": {"1", "2", "0"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto2Message{ + FloatValue: proto.Float32(1.5), + DoubleValue: proto.Float64(2.5), + Int64Value: proto.Int64(-1), + Int32Value: proto.Int32(-2), + Uint64Value: proto.Uint64(3), + Uint32Value: proto.Uint32(4), + BoolValue: proto.Bool(true), + StringValue: proto.String("str"), + RepeatedValue: []string{"a", "b", "c"}, + EnumValue: EnumValue_Y, + RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, + }, + }, { values: url.Values{ "nested.nested.nested.repeated_value": {"a", "b", "c"}, @@ -368,20 +428,20 @@ func TestPopulateQueryParametersWithInvalidNestedParameters(t *testing.T) { } type proto3Message struct { - Nested *proto2Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` - NestedNonNull proto2Message `protobuf:"bytes,15,opt,name=nested_non_null" json:"nested_non_null,omitempty"` - FloatValue float32 `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"` - DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value" json:"double_value,omitempty"` - Int64Value int64 `protobuf:"varint,4,opt,name=int64_value" json:"int64_value,omitempty"` - Int32Value int32 `protobuf:"varint,5,opt,name=int32_value" json:"int32_value,omitempty"` - Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value" json:"uint64_value,omitempty"` - Uint32Value uint32 `protobuf:"varint,7,opt,name=uint32_value" json:"uint32_value,omitempty"` - BoolValue bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` - StringValue string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` - RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` + Nested *proto2Message `protobuf:"bytes,1,opt,name=nested,json=nested" json:"nested,omitempty"` + NestedNonNull proto2Message `protobuf:"bytes,15,opt,name=nested_non_null,json=nestedNonNull" json:"nested_non_null,omitempty"` + FloatValue float32 `protobuf:"fixed32,2,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,4,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` + Int32Value int32 `protobuf:"varint,5,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,7,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` + BoolValue bool `protobuf:"varint,8,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,9,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"` EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` - RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` - TimestampValue *timestamp.Timestamp `protobuf:"bytes,16,opt,name=timestamp_value" json:"timestamp_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeatedEnum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` + TimestampValue *timestamp.Timestamp `protobuf:"bytes,16,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` OneofValue proto3Message_OneofValue `protobuf_oneof:"oneof_value"` } @@ -501,18 +561,18 @@ func _proto3Message_OneofSizer(msg proto.Message) (n int) { } type proto2Message struct { - Nested *proto3Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` - FloatValue *float32 `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"` - DoubleValue *float64 `protobuf:"fixed64,3,opt,name=double_value" json:"double_value,omitempty"` - Int64Value *int64 `protobuf:"varint,4,opt,name=int64_value" json:"int64_value,omitempty"` - Int32Value *int32 `protobuf:"varint,5,opt,name=int32_value" json:"int32_value,omitempty"` - Uint64Value *uint64 `protobuf:"varint,6,opt,name=uint64_value" json:"uint64_value,omitempty"` - Uint32Value *uint32 `protobuf:"varint,7,opt,name=uint32_value" json:"uint32_value,omitempty"` - BoolValue *bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` - StringValue *string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` - RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` + Nested *proto3Message `protobuf:"bytes,1,opt,name=nested,json=nested" json:"nested,omitempty"` + FloatValue *float32 `protobuf:"fixed32,2,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` + DoubleValue *float64 `protobuf:"fixed64,3,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + Int64Value *int64 `protobuf:"varint,4,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` + Int32Value *int32 `protobuf:"varint,5,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` + Uint64Value *uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` + Uint32Value *uint32 `protobuf:"varint,7,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` + BoolValue *bool `protobuf:"varint,8,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` + StringValue *string `protobuf:"bytes,9,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"` EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` - RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeatedEnum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` XXX_unrecognized []byte `json:"-"` } From aaf82a8684eb083033df1958877fc5bba9edb60b Mon Sep 17 00:00:00 2001 From: Thomas Jackson Date: Tue, 3 Oct 2017 23:37:05 -0600 Subject: [PATCH 158/552] Add Handler method to pass in a client (#454) * Add Handler method to pass in a client Right now if you want to embed the JSON proxy into your service you end up having to have a client talking to loopback which is messy. With this API addition you can simply pass in something which implements the client interface -- meaning you could wrap it yourself and return directly (without all the loopback and serialization overhead). Note that this does not apply interceptors and other gRPC niceties. Please ensure your application doesn't need interceptors before using this method. --- examples/examplepb/a_bit_of_everything.pb.gw.go | 10 +++++++++- examples/examplepb/echo_service.pb.gw.go | 10 +++++++++- examples/examplepb/flow_combination.pb.gw.go | 10 +++++++++- examples/examplepb/stream.pb.gw.go | 10 +++++++++- protoc-gen-grpc-gateway/gengateway/template.go | 10 +++++++++- 5 files changed, 45 insertions(+), 5 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index be3ea26b318..c62dbd038f6 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -478,7 +478,15 @@ func RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx context.Context, mux // RegisterABitOfEverythingServiceHandler registers the http handlers for service ABitOfEverythingService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - client := NewABitOfEverythingServiceClient(conn) + return RegisterABitOfEverythingServiceHandlerClient(ctx, mux, NewABitOfEverythingServiceClient(conn)) +} + +// RegisterABitOfEverythingServiceHandler registers the http handlers for service ABitOfEverythingService to "mux". +// The handlers forward requests to the grpc endpoint over the given implementation of "ABitOfEverythingServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ABitOfEverythingServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "ABitOfEverythingServiceClient" to call the correct interceptors. +func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ABitOfEverythingServiceClient) error { mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(ctx) diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index f067c0d9ac6..100b0dd030d 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -142,7 +142,15 @@ func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.Se // RegisterEchoServiceHandler registers the http handlers for service EchoService to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - client := NewEchoServiceClient(conn) + return RegisterEchoServiceHandlerClient(ctx, mux, NewEchoServiceClient(conn)) +} + +// RegisterEchoServiceHandler registers the http handlers for service EchoService to "mux". +// The handlers forward requests to the grpc endpoint over the given implementation of "EchoServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EchoServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "EchoServiceClient" to call the correct interceptors. +func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoServiceClient) error { mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(ctx) diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index a71b1867479..a7b9e3b2d5c 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -1013,7 +1013,15 @@ func RegisterFlowCombinationHandlerFromEndpoint(ctx context.Context, mux *runtim // RegisterFlowCombinationHandler registers the http handlers for service FlowCombination to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - client := NewFlowCombinationClient(conn) + return RegisterFlowCombinationHandlerClient(ctx, mux, NewFlowCombinationClient(conn)) +} + +// RegisterFlowCombinationHandler registers the http handlers for service FlowCombination to "mux". +// The handlers forward requests to the grpc endpoint over the given implementation of "FlowCombinationClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "FlowCombinationClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "FlowCombinationClient" to call the correct interceptors. +func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FlowCombinationClient) error { mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(ctx) diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index f252bbd35f4..91a9065f4bd 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -168,7 +168,15 @@ func RegisterStreamServiceHandlerFromEndpoint(ctx context.Context, mux *runtime. // 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) + return RegisterStreamServiceHandlerClient(ctx, mux, NewStreamServiceClient(conn)) +} + +// RegisterStreamServiceHandler registers the http handlers for service StreamService to "mux". +// The handlers forward requests to the grpc endpoint over the given implementation of "StreamServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "StreamServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "StreamServiceClient" to call the correct interceptors. +func RegisterStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client StreamServiceClient) error { mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(ctx) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index d4cb912d65f..c6e55c130f7 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -338,7 +338,15 @@ func Register{{$svc.GetName}}HandlerFromEndpoint(ctx context.Context, mux *runti // Register{{$svc.GetName}}Handler registers the http handlers for service {{$svc.GetName}} to "mux". // The handlers forward requests to the grpc endpoint over "conn". func Register{{$svc.GetName}}Handler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - client := New{{$svc.GetName}}Client(conn) + return Register{{$svc.GetName}}HandlerClient(ctx, mux, New{{$svc.GetName}}Client(conn)) +} + +// Register{{$svc.GetName}}Handler registers the http handlers for service {{$svc.GetName}} to "mux". +// The handlers forward requests to the grpc endpoint over the given implementation of "{{$svc.GetName}}Client". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "{{$svc.GetName}}Client" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "{{$svc.GetName}}Client" to call the correct interceptors. +func Register{{$svc.GetName}}HandlerClient(ctx context.Context, mux *runtime.ServeMux, client {{$svc.GetName}}Client) error { {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { From ce5732a7bff930cd5e3d67a4e8a95a0ffb51bd30 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 11 Oct 2017 21:10:42 +0200 Subject: [PATCH 159/552] runtime: use r.Context() (#473) Signed-off-by: Stephan Renatus --- runtime/mux.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runtime/mux.go b/runtime/mux.go index f7a228031dc..205bc430921 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -146,8 +146,7 @@ func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) { // ServeHTTP dispatches the request to the first handler whose pattern matches to r.Method and r.Path. func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { - // TODO: use r.Context for go 1.7+ - ctx := context.Background() + ctx := r.Context() path := r.URL.Path if !strings.HasPrefix(path, "/") { From 9ab4d022c292ab1ac355b0577f7f5c6227b40f99 Mon Sep 17 00:00:00 2001 From: Tianyu Geng Date: Wed, 25 Oct 2017 18:38:26 -0700 Subject: [PATCH 160/552] Fix logic handling primitive wrapper in URL params In ESP, wrapped primitives in URL can also be parsed from seralized string format of the primitive directly without ".value" field reference. This PR changes URL parsing logic to conform with this behavior. --- runtime/query.go | 39 ++++++++++ runtime/query_test.go | 167 ++++++++++++++++++++++++++---------------- 2 files changed, 143 insertions(+), 63 deletions(-) diff --git a/runtime/query.go b/runtime/query.go index 9c30cd0e5b5..c00e0b914e2 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -164,6 +164,45 @@ func populateField(f reflect.Value, value string, props *proto.Properties) error f.Field(0).SetInt(int64(t.Unix())) f.Field(1).SetInt(int64(t.Nanosecond())) return nil + case "DoubleValue": + fallthrough + case "FloatValue": + float64Val, err := strconv.ParseFloat(value, 64) + if err != nil { + return fmt.Errorf("bad DoubleValue: %s", value) + } + f.Field(0).SetFloat(float64Val) + return nil + case "Int64Value": + fallthrough + case "Int32Value": + int64Val, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return fmt.Errorf("bad DoubleValue: %s", value) + } + f.Field(0).SetInt(int64Val) + return nil + case "UInt64Value": + fallthrough + case "UInt32Value": + uint64Val, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return fmt.Errorf("bad DoubleValue: %s", value) + } + f.Field(0).SetUint(uint64Val) + return nil + case "BoolValue": + if value == "true" { + f.Field(0).SetBool(true) + } else if value == "false" { + f.Field(0).SetBool(false) + } else { + return fmt.Errorf("bad BoolValue: %s", value) + } + return nil + case "StringValue": + f.Field(0).SetString(value) + return nil } } diff --git a/runtime/query_test.go b/runtime/query_test.go index 93006357879..95a72a4af1c 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -12,6 +12,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/timestamp" + "github.com/golang/protobuf/ptypes/wrappers" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" ) @@ -32,64 +33,96 @@ func TestPopulateParameters(t *testing.T) { }{ { values: url.Values{ - "float_value": {"1.5"}, - "double_value": {"2.5"}, - "int64_value": {"-1"}, - "int32_value": {"-2"}, - "uint64_value": {"3"}, - "uint32_value": {"4"}, - "bool_value": {"true"}, - "string_value": {"str"}, - "repeated_value": {"a", "b", "c"}, - "enum_value": {"1"}, - "repeated_enum": {"1", "2", "0"}, - "timestamp_value": {timeStr}, + "float_value": {"1.5"}, + "double_value": {"2.5"}, + "int64_value": {"-1"}, + "int32_value": {"-2"}, + "uint64_value": {"3"}, + "uint32_value": {"4"}, + "bool_value": {"true"}, + "string_value": {"str"}, + "repeated_value": {"a", "b", "c"}, + "enum_value": {"1"}, + "repeated_enum": {"1", "2", "0"}, + "timestamp_value": {timeStr}, + "wrapper_float_value": {"1.5"}, + "wrapper_double_value": {"2.5"}, + "wrapper_int64_value": {"-1"}, + "wrapper_int32_value": {"-2"}, + "wrapper_u_int64_value": {"3"}, + "wrapper_u_int32_value": {"4"}, + "wrapper_bool_value": {"true"}, + "wrapper_string_value": {"str"}, }, filter: utilities.NewDoubleArray(nil), want: &proto3Message{ - FloatValue: 1.5, - DoubleValue: 2.5, - Int64Value: -1, - Int32Value: -2, - Uint64Value: 3, - Uint32Value: 4, - BoolValue: true, - StringValue: "str", - RepeatedValue: []string{"a", "b", "c"}, - EnumValue: EnumValue_Y, - RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, - TimestampValue: timePb, + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: -1, + Int32Value: -2, + Uint64Value: 3, + Uint32Value: 4, + BoolValue: true, + StringValue: "str", + RepeatedValue: []string{"a", "b", "c"}, + EnumValue: EnumValue_Y, + RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, + TimestampValue: timePb, + WrapperFloatValue: &wrappers.FloatValue{1.5}, + WrapperDoubleValue: &wrappers.DoubleValue{2.5}, + WrapperInt64Value: &wrappers.Int64Value{-1}, + WrapperInt32Value: &wrappers.Int32Value{-2}, + WrapperUInt64Value: &wrappers.UInt64Value{3}, + WrapperUInt32Value: &wrappers.UInt32Value{4}, + WrapperBoolValue: &wrappers.BoolValue{true}, + WrapperStringValue: &wrappers.StringValue{"str"}, }, }, { values: url.Values{ - "floatValue": {"1.5"}, - "doubleValue": {"2.5"}, - "int64Value": {"-1"}, - "int32Value": {"-2"}, - "uint64Value": {"3"}, - "uint32Value": {"4"}, - "boolValue": {"true"}, - "stringValue": {"str"}, - "repeatedValue": {"a", "b", "c"}, - "enumValue": {"1"}, - "repeatedEnum": {"1", "2", "0"}, - "timestampValue": {timeStr}, + "floatValue": {"1.5"}, + "doubleValue": {"2.5"}, + "int64Value": {"-1"}, + "int32Value": {"-2"}, + "uint64Value": {"3"}, + "uint32Value": {"4"}, + "boolValue": {"true"}, + "stringValue": {"str"}, + "repeatedValue": {"a", "b", "c"}, + "enumValue": {"1"}, + "repeatedEnum": {"1", "2", "0"}, + "timestampValue": {timeStr}, + "wrapperFloatValue": {"1.5"}, + "wrapperDoubleValue": {"2.5"}, + "wrapperInt64Value": {"-1"}, + "wrapperInt32Value": {"-2"}, + "wrapperUInt64Value": {"3"}, + "wrapperUInt32Value": {"4"}, + "wrapperBoolValue": {"true"}, + "wrapperStringValue": {"str"}, }, filter: utilities.NewDoubleArray(nil), want: &proto3Message{ - FloatValue: 1.5, - DoubleValue: 2.5, - Int64Value: -1, - Int32Value: -2, - Uint64Value: 3, - Uint32Value: 4, - BoolValue: true, - StringValue: "str", - RepeatedValue: []string{"a", "b", "c"}, - EnumValue: EnumValue_Y, - RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, - TimestampValue: timePb, + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: -1, + Int32Value: -2, + Uint64Value: 3, + Uint32Value: 4, + BoolValue: true, + StringValue: "str", + RepeatedValue: []string{"a", "b", "c"}, + EnumValue: EnumValue_Y, + RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, + TimestampValue: timePb, + WrapperFloatValue: &wrappers.FloatValue{1.5}, + WrapperDoubleValue: &wrappers.DoubleValue{2.5}, + WrapperInt64Value: &wrappers.Int64Value{-1}, + WrapperInt32Value: &wrappers.Int32Value{-2}, + WrapperUInt64Value: &wrappers.UInt64Value{3}, + WrapperUInt32Value: &wrappers.UInt32Value{4}, + WrapperBoolValue: &wrappers.BoolValue{true}, + WrapperStringValue: &wrappers.StringValue{"str"}, }, }, { @@ -428,21 +461,29 @@ func TestPopulateQueryParametersWithInvalidNestedParameters(t *testing.T) { } type proto3Message struct { - Nested *proto2Message `protobuf:"bytes,1,opt,name=nested,json=nested" json:"nested,omitempty"` - NestedNonNull proto2Message `protobuf:"bytes,15,opt,name=nested_non_null,json=nestedNonNull" json:"nested_non_null,omitempty"` - FloatValue float32 `protobuf:"fixed32,2,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` - DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` - Int64Value int64 `protobuf:"varint,4,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` - Int32Value int32 `protobuf:"varint,5,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` - Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` - Uint32Value uint32 `protobuf:"varint,7,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` - BoolValue bool `protobuf:"varint,8,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` - StringValue string `protobuf:"bytes,9,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"` - EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` - RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeatedEnum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` - TimestampValue *timestamp.Timestamp `protobuf:"bytes,16,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` - OneofValue proto3Message_OneofValue `protobuf_oneof:"oneof_value"` + Nested *proto2Message `protobuf:"bytes,1,opt,name=nested,json=nested" json:"nested,omitempty"` + NestedNonNull proto2Message `protobuf:"bytes,15,opt,name=nested_non_null,json=nestedNonNull" json:"nested_non_null,omitempty"` + FloatValue float32 `protobuf:"fixed32,2,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,4,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` + Int32Value int32 `protobuf:"varint,5,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,7,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` + BoolValue bool `protobuf:"varint,8,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,9,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"` + EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeatedEnum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` + TimestampValue *timestamp.Timestamp `protobuf:"bytes,16,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` + OneofValue proto3Message_OneofValue `protobuf_oneof:"oneof_value"` + WrapperDoubleValue *wrappers.DoubleValue `protobuf:"bytes,17,opt,name=wrapper_double_value,json=wrapperDoubleValue" json:"wrapper_double_value,omitempty"` + WrapperFloatValue *wrappers.FloatValue `protobuf:"bytes,18,opt,name=wrapper_float_value,json=wrapperFloatValue" json:"wrapper_float_value,omitempty"` + WrapperInt64Value *wrappers.Int64Value `protobuf:"bytes,19,opt,name=wrapper_int64_value,json=wrapperInt64Value" json:"wrapper_int64_value,omitempty"` + WrapperInt32Value *wrappers.Int32Value `protobuf:"bytes,20,opt,name=wrapper_int32_value,json=wrapperInt32Value" json:"wrapper_int32_value,omitempty"` + WrapperUInt64Value *wrappers.UInt64Value `protobuf:"bytes,21,opt,name=wrapper_u_int64_value,json=wrapperUInt64Value" json:"wrapper_u_int64_value,omitempty"` + WrapperUInt32Value *wrappers.UInt32Value `protobuf:"bytes,22,opt,name=wrapper_u_int32_value,json=wrapperUInt32Value" json:"wrapper_u_int32_value,omitempty"` + WrapperBoolValue *wrappers.BoolValue `protobuf:"bytes,23,opt,name=wrapper_bool_value,json=wrapperBoolValue" json:"wrapper_bool_value,omitempty"` + WrapperStringValue *wrappers.StringValue `protobuf:"bytes,24,opt,name=wrapper_string_value,json=wrapperStringValue" json:"wrapper_string_value,omitempty"` } func (m *proto3Message) Reset() { *m = proto3Message{} } From 1bd21773766aeea082ccbdd2b93981be93c6ca4b Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Wed, 27 Sep 2017 11:36:38 +0100 Subject: [PATCH 161/552] protoc-gen-swagger optional SourceCodeInfo --- protoc-gen-swagger/genswagger/template.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index b2353aa5341..a7ef682ea8b 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "fmt" + "os" "reflect" "regexp" "strconv" @@ -722,13 +723,8 @@ func enumValueProtoComments(reg *descriptor.Registry, enum *descriptor.Enum) str func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []string, typeName string, typeIndex int32, fieldPaths ...int32) string { if file.SourceCodeInfo == nil { - // Curious! A file without any source code info. - // This could be a test that's providing incomplete - // descriptor.File information. - // - // We could simply return no comments, but panic - // could make debugging easier. - panic("descriptor.File should not contain nil SourceCodeInfo") + fmt.Fprintln(os.Stderr, "descriptor.File should not contain nil SourceCodeInfo") + return "" } outerPaths := make([]int32, len(outers)) From 0dbd1a70e4f04bc51a69c5afcce2a2f872e6b14c Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Wed, 25 Oct 2017 17:38:55 +0100 Subject: [PATCH 162/552] runtime: fix chunk encoding --- runtime/handler.go | 2 +- runtime/handler_test.go | 67 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 runtime/handler_test.go diff --git a/runtime/handler.go b/runtime/handler.go index 0f4750f4c80..ae6a5d551cf 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -58,7 +58,7 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal grpclog.Printf("Failed to marshal response chunk: %v", err) return } - if _, err = fmt.Fprintf(w, "%s\n", buf); err != nil { + if _, err = w.Write(buf); err != nil { grpclog.Printf("Failed to send response chunk: %v", err) return } diff --git a/runtime/handler_test.go b/runtime/handler_test.go new file mode 100644 index 00000000000..8c61ee1510a --- /dev/null +++ b/runtime/handler_test.go @@ -0,0 +1,67 @@ +package runtime_test + +import ( + "io" + "io/ioutil" + "net/http" + "net/http/httptest" + "testing" + + "github.com/golang/protobuf/proto" + pb "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "golang.org/x/net/context" +) + +func TestForwardResponseStream(t *testing.T) { + var ( + msgs = []proto.Message{ + &pb.SimpleMessage{Id: "One"}, + &pb.SimpleMessage{Id: "Two"}, + } + + ctx = runtime.NewServerMetadataContext( + context.Background(), runtime.ServerMetadata{}, + ) + mux = runtime.NewServeMux() + marshaler = &runtime.JSONPb{} + req = httptest.NewRequest("GET", "http://example.com/foo", nil) + resp = httptest.NewRecorder() + count = 0 + recv = func() (proto.Message, error) { + if count >= len(msgs) { + return nil, io.EOF + } + count++ + return msgs[count-1], nil + } + ) + + runtime.ForwardResponseStream(ctx, mux, marshaler, resp, req, recv) + + w := resp.Result() + if w.StatusCode != http.StatusOK { + t.Errorf(" got %d want %d", w.StatusCode, http.StatusOK) + } + if h := w.Header.Get("Transfer-Encoding"); h != "chunked" { + t.Errorf("ForwardResponseStream missing header chunked") + } + body, err := ioutil.ReadAll(w.Body) + if err != nil { + t.Errorf("Failed to read response body with %v", err) + } + w.Body.Close() + + var want []byte + for _, msg := range msgs { + b, err := marshaler.Marshal(map[string]proto.Message{"result": msg}) + if err != nil { + t.Errorf("marshaler.Marshal() failed %v", err) + } + want = append(want, b...) + } + + if string(body) != string(want) { + t.Errorf("ForwardResponseStream() = \"%s\" want \"%s\"", body, want) + } +} From 38be6dddc2141183ea8e45a4998682e1ae0e588b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Fri, 3 Nov 2017 16:55:59 +0000 Subject: [PATCH 163/552] Add custom options to allow more control of swagger/openapi output (#145) Creates additional options that can be applied to RPCs and messages that provide additional information in the OpenAPIv2 spec. These new options allow for the inclusion of Swagger object information (maps to a .proto file): * `info` * `host` * `base_path` * `schemes` * `consumes` * `produces` * `external_docs` Service information: * `tags` * `summary` * `description` * `external_docs` * `operation_id` * `consumes` * `produces` * `schemes` Operation information (maps to a method): * `tags` * `summary` * `description` * `external_docs` * `operation_id` * `consumes` * `produces` * `schemes` Schema information (maps to a message): * `json_schema` * `descriptor` * `read_only` * `external_docs` * `example` Additionally: * Change from 'Swagger: ' to 'OpenAPI: ' prefix. It should also be relatively simple to add any field that is missing to the new OpenAPI proto objects. --- Makefile | 11 +- .../clients/abe/a_bit_of_everything_nested.go | 6 +- .../abe/a_bit_of_everything_service_api.go | 70 +- examples/clients/abe/api_client.go | 6 +- examples/clients/abe/api_response.go | 6 +- examples/clients/abe/configuration.go | 6 +- .../abe/examplepb_a_bit_of_everything.go | 6 +- .../clients/abe/examplepb_numeric_enum.go | 6 +- examples/clients/abe/nested_deep_enum.go | 6 +- examples/clients/abe/protobuf_empty.go | 6 +- examples/clients/abe/sub_string_message.go | 6 +- examples/clients/echo/echo_service_api.go | 36 +- examples/examplepb/a_bit_of_everything.pb.go | 199 +++-- examples/examplepb/a_bit_of_everything.proto | 64 ++ .../a_bit_of_everything.swagger.json | 63 +- examples/examplepb/echo_service.swagger.json | 2 +- protoc-gen-swagger/genswagger/template.go | 201 ++++- protoc-gen-swagger/genswagger/types.go | 27 +- protoc-gen-swagger/options/annotations.pb.go | 83 ++ protoc-gen-swagger/options/annotations.proto | 37 + protoc-gen-swagger/options/openapiv2.pb.go | 739 ++++++++++++++++++ protoc-gen-swagger/options/openapiv2.proto | 223 ++++++ 22 files changed, 1612 insertions(+), 197 deletions(-) create mode 100644 protoc-gen-swagger/options/annotations.pb.go create mode 100644 protoc-gen-swagger/options/annotations.proto create mode 100644 protoc-gen-swagger/options/openapiv2.pb.go create mode 100644 protoc-gen-swagger/options/openapiv2.proto diff --git a/Makefile b/Makefile index 5fe3c4850e0..c6a645e0ef7 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,9 @@ OUTPUT_DIR=_output RUNTIME_PROTO=runtime/internal/stream_chunk.proto RUNTIME_GO=$(RUNTIME_PROTO:.proto=.pb.go) +OPENAPIV2_PROTO=protoc-gen-swagger/options/openapiv2.proto protoc-gen-swagger/options/annotations.proto +OPENAPIV2_GO=$(OPENAPIV2_PROTO:.proto=.pb.go) + PKGMAP=Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mexamples/sub/message.proto=$(PKG)/examples/sub ADDITIONAL_FLAGS= ifneq "$(GATEWAY_PLUGIN_FLAGS)" "" @@ -83,17 +86,20 @@ generate: $(RUNTIME_GO) .SUFFIXES: .go .proto -$(GO_PLUGIN): +$(GO_PLUGIN): go get $(GO_PLUGIN_PKG) go build -o $@ $(GO_PLUGIN_PKG) $(RUNTIME_GO): $(RUNTIME_PROTO) $(GO_PLUGIN) protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP):. $(RUNTIME_PROTO) +$(OPENAPIV2_GO): $(OPENAPIV2_PROTO) $(GO_PLUGIN) + protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP):$(GOPATH)/src $(OPENAPIV2_PROTO) + $(GATEWAY_PLUGIN): $(RUNTIME_GO) $(GATEWAY_PLUGIN_SRC) go build -o $@ $(GATEWAY_PLUGIN_PKG) -$(SWAGGER_PLUGIN): $(SWAGGER_PLUGIN_SRC) +$(SWAGGER_PLUGIN): $(SWAGGER_PLUGIN_SRC) $(OPENAPIV2_GO) go build -o $@ $(SWAGGER_PLUGIN_PKG) $(EXAMPLE_SVCSRCS): $(GO_PLUGIN) $(EXAMPLES) @@ -143,5 +149,6 @@ realclean: distclean rm -f $(GO_PLUGIN) rm -f $(SWAGGER_PLUGIN) rm -f $(EXAMPLE_CLIENT_SRCS) + rm -f $(OPENAPIV2_GO) .PHONY: generate examples test lint clean distclean realclean diff --git a/examples/clients/abe/a_bit_of_everything_nested.go b/examples/clients/abe/a_bit_of_everything_nested.go index 909f478b7dc..095e8c5f118 100644 --- a/examples/clients/abe/a_bit_of_everything_nested.go +++ b/examples/clients/abe/a_bit_of_everything_nested.go @@ -1,10 +1,10 @@ /* - * examples/examplepb/a_bit_of_everything.proto + * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * + * OpenAPI spec version: 1.0 + * Contact: none@example.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 669a12aed76..d66b34f54b2 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -1,10 +1,10 @@ /* - * examples/examplepb/a_bit_of_everything.proto + * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * + * OpenAPI spec version: 1.0 + * Contact: none@example.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ @@ -91,7 +91,7 @@ func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float } // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -101,6 +101,7 @@ func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header @@ -150,7 +151,7 @@ func (a ABitOfEverythingServiceApi) CreateBody(body ExamplepbABitOfEverything) ( } // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -160,6 +161,7 @@ func (a ABitOfEverythingServiceApi) CreateBody(body ExamplepbABitOfEverything) ( // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header @@ -213,7 +215,7 @@ func (a ABitOfEverythingServiceApi) DeepPathEcho(singleNestedName string, body E } // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -223,6 +225,7 @@ func (a ABitOfEverythingServiceApi) DeepPathEcho(singleNestedName string, body E // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header @@ -275,7 +278,7 @@ func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIRes } // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -285,6 +288,7 @@ func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIRes // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header @@ -311,7 +315,8 @@ func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIRes } /** - * + * Echo allows posting a StringMessage value. + * It also exposes multiple bindings. This makes it useful when validating that the OpenAPI v2 API description exposes documentation correctly on all paths defined as additional_bindings in the proto. * * @param value * @return *SubStringMessage @@ -335,7 +340,7 @@ func (a ABitOfEverythingServiceApi) Echo(value string) (*SubStringMessage, *APIR } // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -345,6 +350,7 @@ func (a ABitOfEverythingServiceApi) Echo(value string) (*SubStringMessage, *APIR // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header @@ -371,14 +377,15 @@ func (a ABitOfEverythingServiceApi) Echo(value string) (*SubStringMessage, *APIR } /** - * + * Echo allows posting a StringMessage value. + * It also exposes multiple bindings. This makes it useful when validating that the OpenAPI v2 API description exposes documentation correctly on all paths defined as additional_bindings in the proto. * - * @param value + * @param body * @return *SubStringMessage */ -func (a ABitOfEverythingServiceApi) Echo_1(value string) (*SubStringMessage, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) Echo2(body string) (*SubStringMessage, *APIResponse, error) { - var localVarHttpMethod = strings.ToUpper("Get") + var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables localVarPath := a.Configuration.BasePath + "/v2/example/echo" @@ -392,10 +399,9 @@ func (a ABitOfEverythingServiceApi) Echo_1(value string) (*SubStringMessage, *AP for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] } - localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -405,6 +411,7 @@ func (a ABitOfEverythingServiceApi) Echo_1(value string) (*SubStringMessage, *AP // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header @@ -412,12 +419,14 @@ func (a ABitOfEverythingServiceApi) Echo_1(value string) (*SubStringMessage, *AP if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } + // body params + localVarPostBody = &body var successPayload = new(SubStringMessage) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo_0", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} if localVarHttpResponse != nil { localVarAPIResponse.Response = localVarHttpResponse.RawResponse localVarAPIResponse.Payload = localVarHttpResponse.Body() @@ -431,14 +440,15 @@ func (a ABitOfEverythingServiceApi) Echo_1(value string) (*SubStringMessage, *AP } /** - * + * Echo allows posting a StringMessage value. + * It also exposes multiple bindings. This makes it useful when validating that the OpenAPI v2 API description exposes documentation correctly on all paths defined as additional_bindings in the proto. * - * @param body + * @param value * @return *SubStringMessage */ -func (a ABitOfEverythingServiceApi) Echo_2(body string) (*SubStringMessage, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) Echo3(value string) (*SubStringMessage, *APIResponse, error) { - var localVarHttpMethod = strings.ToUpper("Post") + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables localVarPath := a.Configuration.BasePath + "/v2/example/echo" @@ -452,9 +462,10 @@ func (a ABitOfEverythingServiceApi) Echo_2(body string) (*SubStringMessage, *API for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] } + localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -464,6 +475,7 @@ func (a ABitOfEverythingServiceApi) Echo_2(body string) (*SubStringMessage, *API // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header @@ -471,14 +483,12 @@ func (a ABitOfEverythingServiceApi) Echo_2(body string) (*SubStringMessage, *API if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - // body params - localVarPostBody = &body var successPayload = new(SubStringMessage) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo_1", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + var localVarAPIResponse = &APIResponse{Operation: "Echo3", Method: localVarHttpMethod, RequestURL: localVarURL.String()} if localVarHttpResponse != nil { localVarAPIResponse.Response = localVarHttpResponse.RawResponse localVarAPIResponse.Payload = localVarHttpResponse.Body() @@ -566,7 +576,7 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName strin // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -576,6 +586,7 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName strin // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header @@ -626,7 +637,7 @@ func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEveryth } // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -636,6 +647,7 @@ func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEveryth // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header @@ -684,7 +696,7 @@ func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, err } // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -694,6 +706,7 @@ func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, err // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header @@ -745,7 +758,7 @@ func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEver } // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -755,6 +768,7 @@ func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEver // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", + "application/x-foo-mime", } // set Accept header diff --git a/examples/clients/abe/api_client.go b/examples/clients/abe/api_client.go index 2825dd48e13..bf3e21a9fb1 100644 --- a/examples/clients/abe/api_client.go +++ b/examples/clients/abe/api_client.go @@ -1,10 +1,10 @@ /* - * examples/examplepb/a_bit_of_everything.proto + * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * + * OpenAPI spec version: 1.0 + * Contact: none@example.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ diff --git a/examples/clients/abe/api_response.go b/examples/clients/abe/api_response.go index 8c14424b574..ee1315f513c 100644 --- a/examples/clients/abe/api_response.go +++ b/examples/clients/abe/api_response.go @@ -1,10 +1,10 @@ /* - * examples/examplepb/a_bit_of_everything.proto + * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * + * OpenAPI spec version: 1.0 + * Contact: none@example.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ diff --git a/examples/clients/abe/configuration.go b/examples/clients/abe/configuration.go index 5cacaadcb9d..ccc319c34aa 100644 --- a/examples/clients/abe/configuration.go +++ b/examples/clients/abe/configuration.go @@ -1,10 +1,10 @@ /* - * examples/examplepb/a_bit_of_everything.proto + * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * + * OpenAPI spec version: 1.0 + * Contact: none@example.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go index 338ac379878..d8775d9c863 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -1,10 +1,10 @@ /* - * examples/examplepb/a_bit_of_everything.proto + * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * + * OpenAPI spec version: 1.0 + * Contact: none@example.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ diff --git a/examples/clients/abe/examplepb_numeric_enum.go b/examples/clients/abe/examplepb_numeric_enum.go index bfb776292b3..e953bbe34e8 100644 --- a/examples/clients/abe/examplepb_numeric_enum.go +++ b/examples/clients/abe/examplepb_numeric_enum.go @@ -1,10 +1,10 @@ /* - * examples/examplepb/a_bit_of_everything.proto + * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * + * OpenAPI spec version: 1.0 + * Contact: none@example.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ diff --git a/examples/clients/abe/nested_deep_enum.go b/examples/clients/abe/nested_deep_enum.go index 50bf6235a29..e5fc17d50a4 100644 --- a/examples/clients/abe/nested_deep_enum.go +++ b/examples/clients/abe/nested_deep_enum.go @@ -1,10 +1,10 @@ /* - * examples/examplepb/a_bit_of_everything.proto + * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * + * OpenAPI spec version: 1.0 + * Contact: none@example.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ diff --git a/examples/clients/abe/protobuf_empty.go b/examples/clients/abe/protobuf_empty.go index 0cf664849d2..97c7bf612b8 100644 --- a/examples/clients/abe/protobuf_empty.go +++ b/examples/clients/abe/protobuf_empty.go @@ -1,10 +1,10 @@ /* - * examples/examplepb/a_bit_of_everything.proto + * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * + * OpenAPI spec version: 1.0 + * Contact: none@example.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ diff --git a/examples/clients/abe/sub_string_message.go b/examples/clients/abe/sub_string_message.go index 0331c7abb94..2a0874fc5fa 100644 --- a/examples/clients/abe/sub_string_message.go +++ b/examples/clients/abe/sub_string_message.go @@ -1,10 +1,10 @@ /* - * examples/examplepb/a_bit_of_everything.proto + * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * + * OpenAPI spec version: 1.0 + * Contact: none@example.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ diff --git a/examples/clients/echo/echo_service_api.go b/examples/clients/echo/echo_service_api.go index a37a837adb2..1f562327d3d 100644 --- a/examples/clients/echo/echo_service_api.go +++ b/examples/clients/echo/echo_service_api.go @@ -99,16 +99,20 @@ func (a EchoServiceApi) Echo(id string) (*ExamplepbSimpleMessage, *APIResponse, } /** - * EchoBody method receives a simple message and returns it. + * Echo method receives a simple message and returns it. + * The message posted as the id parameter will also be returned. * - * @param body + * @param id + * @param num * @return *ExamplepbSimpleMessage */ -func (a EchoServiceApi) EchoBody(body ExamplepbSimpleMessage) (*ExamplepbSimpleMessage, *APIResponse, error) { +func (a EchoServiceApi) Echo2(id string, num string) (*ExamplepbSimpleMessage, *APIResponse, error) { - var localVarHttpMethod = strings.ToUpper("Post") + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo_body" + localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}/{num}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -139,14 +143,12 @@ func (a EchoServiceApi) EchoBody(body ExamplepbSimpleMessage) (*ExamplepbSimpleM if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - // body params - localVarPostBody = &body var successPayload = new(ExamplepbSimpleMessage) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "EchoBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} if localVarHttpResponse != nil { localVarAPIResponse.Response = localVarHttpResponse.RawResponse localVarAPIResponse.Payload = localVarHttpResponse.Body() @@ -160,20 +162,16 @@ func (a EchoServiceApi) EchoBody(body ExamplepbSimpleMessage) (*ExamplepbSimpleM } /** - * Echo method receives a simple message and returns it. - * The message posted as the id parameter will also be returned. + * EchoBody method receives a simple message and returns it. * - * @param id - * @param num + * @param body * @return *ExamplepbSimpleMessage */ -func (a EchoServiceApi) Echo_1(id string, num string) (*ExamplepbSimpleMessage, *APIResponse, error) { +func (a EchoServiceApi) EchoBody(body ExamplepbSimpleMessage) (*ExamplepbSimpleMessage, *APIResponse, error) { - var localVarHttpMethod = strings.ToUpper("Get") + var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}/{num}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) - localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) + localVarPath := a.Configuration.BasePath + "/v1/example/echo_body" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -204,12 +202,14 @@ func (a EchoServiceApi) Echo_1(id string, num string) (*ExamplepbSimpleMessage, if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } + // body params + localVarPostBody = &body var successPayload = new(ExamplepbSimpleMessage) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo_0", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + var localVarAPIResponse = &APIResponse{Operation: "EchoBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} if localVarHttpResponse != nil { localVarAPIResponse.Response = localVarHttpResponse.RawResponse localVarAPIResponse.Payload = localVarHttpResponse.Body() diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 30afc97d2d6..2727fba7b07 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -12,6 +12,7 @@ import google_protobuf2 "github.com/golang/protobuf/ptypes/duration" import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" import sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp" +import _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" import ( context "golang.org/x/net/context" @@ -452,6 +453,13 @@ type ABitOfEverythingServiceClient interface { 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) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + // Echo allows posting a StringMessage value. + // + // It also exposes multiple bindings. + // + // This makes it useful when validating that the OpenAPI v2 API + // description exposes documentation correctly on all paths + // defined as additional_bindings in the proto. Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) NoBindings(ctx context.Context, in *google_protobuf2.Duration, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) @@ -565,6 +573,13 @@ type ABitOfEverythingServiceServer interface { Update(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error) Delete(context.Context, *sub2.IdMessage) (*google_protobuf1.Empty, error) GetQuery(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error) + // Echo allows posting a StringMessage value. + // + // It also exposes multiple bindings. + // + // This makes it useful when validating that the OpenAPI v2 API + // description exposes documentation correctly on all paths + // defined as additional_bindings in the proto. Echo(context.Context, *grpc_gateway_examples_sub.StringMessage) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) NoBindings(context.Context, *google_protobuf2.Duration) (*google_protobuf1.Empty, error) @@ -871,87 +886,105 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xd8, 0x89, 0x13, 0x3f, 0xc7, 0x89, 0x33, 0x69, 0x53, 0xd7, 0x2d, 0x64, 0x71, 0x01, - 0xad, 0x42, 0xb5, 0xab, 0xba, 0x15, 0x6a, 0x23, 0x41, 0x95, 0x34, 0x86, 0x22, 0xda, 0xb4, 0xdd, - 0xfe, 0x41, 0x8a, 0x5a, 0xac, 0xb5, 0x3d, 0xb6, 0x57, 0xf1, 0xee, 0x2c, 0xbb, 0xb3, 0x26, 0x96, - 0x31, 0x07, 0x0e, 0x5c, 0x38, 0x72, 0xef, 0x05, 0x09, 0x71, 0xe1, 0xc8, 0x19, 0xbe, 0x03, 0x5f, - 0x81, 0x03, 0x1f, 0x03, 0xed, 0xcc, 0xec, 0x76, 0xd7, 0x89, 0xe5, 0x26, 0x45, 0xbd, 0xed, 0xcc, - 0x7b, 0xef, 0xf7, 0x7b, 0x7f, 0xe6, 0xbd, 0x99, 0x85, 0xab, 0xe4, 0xc8, 0xb4, 0xdd, 0x3e, 0xf1, - 0x75, 0xf9, 0xe1, 0x36, 0x75, 0xb3, 0xd1, 0xb4, 0x58, 0x83, 0x76, 0x1a, 0x64, 0x40, 0xbc, 0x21, - 0xeb, 0x59, 0x4e, 0x57, 0x73, 0x3d, 0xca, 0x28, 0xde, 0xec, 0x7a, 0x6e, 0x4b, 0xeb, 0x9a, 0x8c, - 0x7c, 0x6b, 0x0e, 0xb5, 0xc8, 0x54, 0x8b, 0x4d, 0x2b, 0x97, 0xbb, 0x94, 0x76, 0xfb, 0x44, 0x37, - 0x5d, 0x4b, 0x37, 0x1d, 0x87, 0x32, 0x93, 0x59, 0xd4, 0xf1, 0x85, 0x79, 0xe5, 0x92, 0x94, 0xf2, - 0x55, 0x33, 0xe8, 0xe8, 0xc4, 0x76, 0xd9, 0x50, 0x0a, 0xdf, 0x9d, 0x14, 0xb6, 0x03, 0x8f, 0x5b, - 0x4b, 0x79, 0x25, 0xf6, 0xd4, 0x0f, 0x9a, 0xba, 0x4d, 0x7c, 0xdf, 0xec, 0x92, 0x08, 0x38, 0x29, - 0xab, 0x4d, 0x08, 0x37, 0x27, 0x81, 0x99, 0x65, 0x13, 0x9f, 0x99, 0xb6, 0x2b, 0x14, 0xaa, 0x7f, - 0xad, 0x42, 0x69, 0x67, 0xd7, 0x62, 0x0f, 0x3a, 0xf5, 0x38, 0x60, 0xfc, 0x02, 0x8a, 0xbe, 0xe5, - 0x74, 0xfb, 0xa4, 0xe1, 0x10, 0x9f, 0x91, 0x76, 0xf9, 0xa2, 0x82, 0xd4, 0x42, 0xed, 0xa6, 0x36, - 0x23, 0x05, 0xda, 0x24, 0x92, 0xb6, 0xcf, 0xed, 0x8d, 0x65, 0x01, 0x27, 0x56, 0x18, 0xc3, 0x7c, - 0x10, 0x58, 0xed, 0x32, 0x52, 0x90, 0x9a, 0x37, 0xf8, 0x37, 0x7e, 0x08, 0x39, 0xc9, 0x95, 0x51, - 0xb2, 0x6f, 0xc4, 0x25, 0x71, 0xf0, 0x26, 0x14, 0x3a, 0x7d, 0x6a, 0xb2, 0xc6, 0xc0, 0xec, 0x07, - 0xa4, 0x9c, 0x55, 0x90, 0x9a, 0x31, 0x80, 0x6f, 0x3d, 0x0b, 0x77, 0xf0, 0x7b, 0xb0, 0xdc, 0xa6, - 0x41, 0xb3, 0x4f, 0xa4, 0xc6, 0xbc, 0x82, 0x54, 0x64, 0x14, 0xc4, 0x9e, 0x50, 0xd9, 0x84, 0x82, - 0xe5, 0xb0, 0x8f, 0x6f, 0x48, 0x8d, 0x05, 0x05, 0xa9, 0x59, 0x03, 0xf8, 0x56, 0x8c, 0x11, 0x24, - 0x35, 0x72, 0x0a, 0x52, 0xe7, 0x8d, 0x42, 0x90, 0x50, 0x11, 0x18, 0xd7, 0x6b, 0x52, 0x63, 0x51, - 0x41, 0xea, 0x02, 0xc7, 0xb8, 0x5e, 0x13, 0x0a, 0x57, 0xa0, 0xd8, 0xb1, 0x8e, 0x48, 0x3b, 0x06, - 0x59, 0x52, 0x90, 0x9a, 0x33, 0x96, 0xe5, 0x66, 0x5a, 0x29, 0xc6, 0xc9, 0x2b, 0x48, 0x5d, 0x94, - 0x4a, 0x11, 0xd2, 0x3b, 0x00, 0x4d, 0x4a, 0xfb, 0x52, 0x03, 0x14, 0xa4, 0x2e, 0x19, 0xf9, 0x70, - 0x27, 0x76, 0xd6, 0x67, 0x9e, 0xe5, 0x74, 0xa5, 0x42, 0x81, 0xe7, 0xbf, 0x20, 0xf6, 0x52, 0xf1, - 0xc4, 0x2c, 0x45, 0x05, 0xa9, 0x45, 0x11, 0x4f, 0x44, 0xf2, 0x25, 0x00, 0x71, 0x02, 0x5b, 0x2a, - 0xac, 0x28, 0x48, 0x5d, 0xa9, 0x5d, 0x9d, 0x59, 0xad, 0xfd, 0xc0, 0x26, 0x9e, 0xd5, 0xaa, 0x3b, - 0x81, 0x6d, 0xe4, 0x43, 0x7b, 0x01, 0xf6, 0x01, 0xac, 0xf8, 0xe9, 0xb8, 0x56, 0x15, 0xa4, 0xae, - 0x1a, 0x45, 0x3f, 0x15, 0x58, 0xac, 0x16, 0xe7, 0xa8, 0xa4, 0x20, 0xb5, 0x14, 0xa9, 0x25, 0xaa, - 0xe1, 0x27, 0xbd, 0x5f, 0x53, 0x90, 0xba, 0x66, 0x14, 0xfc, 0x84, 0xf7, 0x52, 0x25, 0xc6, 0xc1, - 0x0a, 0x52, 0xb1, 0x50, 0x89, 0x50, 0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0xe3, 0xf5, 0x64, 0x3e, 0x99, - 0x00, 0xab, 0x7d, 0x0d, 0x97, 0x77, 0x1c, 0xca, 0x7a, 0xc4, 0x93, 0x17, 0xcc, 0x57, 0x16, 0xeb, - 0x25, 0x9c, 0xfd, 0x34, 0xe5, 0xfa, 0x69, 0xa9, 0xe7, 0x76, 0x0b, 0x07, 0xf9, 0x38, 0xb3, 0xcd, - 0x1c, 0x17, 0x5f, 0xff, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xab, 0xe5, 0x92, 0x0d, 0xc9, 0x0f, 0x00, - 0x00, + // 1590 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0xd8, 0x89, 0x13, 0x8f, 0xf3, 0xc3, 0x99, 0xb4, 0xa9, 0xeb, 0xe6, 0xfb, 0xcd, 0xd4, + 0x2d, 0x68, 0x15, 0xe2, 0x5d, 0xe2, 0x56, 0xa8, 0xb5, 0x04, 0xc5, 0x49, 0xdc, 0x1f, 0xa2, 0x4d, + 0xdb, 0xed, 0x0f, 0xaa, 0xd0, 0x12, 0xad, 0xed, 0xb1, 0xbd, 0x8d, 0x77, 0x67, 0xd9, 0x9d, 0x4d, + 0x63, 0x19, 0x73, 0xe0, 0x80, 0xd4, 0x6b, 0xb8, 0x21, 0xd1, 0x0b, 0x12, 0x02, 0x09, 0x8e, 0x9c, + 0x38, 0x70, 0xe7, 0xca, 0x5f, 0x80, 0xc4, 0x1f, 0x82, 0x76, 0x66, 0x77, 0xb3, 0xb6, 0x63, 0xa5, + 0x4e, 0x51, 0x4f, 0xde, 0x99, 0xf9, 0xbc, 0xcf, 0xe7, 0xbd, 0x37, 0xf3, 0xde, 0x8c, 0xe1, 0x2a, + 0xd9, 0xd7, 0x0c, 0xab, 0x45, 0x1c, 0xc5, 0xff, 0xb0, 0x2a, 0x8a, 0x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, 0x36, 0x5d, 0x43, 0x4d, 0x7a, + 0xf6, 0x82, 0xec, 0x1d, 0x38, 0xeb, 0xf4, 0xc6, 0x35, 0x87, 0x81, 0x34, 0xa7, 0xce, 0x38, 0x3d, + 0x81, 0x85, 0xb0, 0x30, 0x47, 0x69, 0x0c, 0xa4, 0x74, 0x00, 0x8b, 0xec, 0x86, 0x13, 0xf5, 0x7e, + 0x1e, 0x03, 0x69, 0x5e, 0x4d, 0x39, 0x11, 0xef, 0x7d, 0x48, 0xc8, 0x83, 0x30, 0x90, 0x90, 0x80, + 0x04, 0x2c, 0x05, 0x78, 0xda, 0x26, 0x16, 0xd1, 0x18, 0xa9, 0xed, 0xf4, 0xe4, 0x6b, 0x01, 0xc7, + 0xa5, 0xa4, 0xba, 0x10, 0x2c, 0x3e, 0x88, 0xe4, 0xed, 0x2a, 0x4c, 0x51, 0x93, 0x78, 0x4d, 0xc6, + 0xeb, 0x01, 0x99, 0x53, 0xbc, 0x5e, 0x16, 0x65, 0x51, 0xab, 0x72, 0x50, 0xab, 0x72, 0xd9, 0x5b, + 0xbd, 0x39, 0xa6, 0x42, 0x0e, 0xe6, 0x23, 0x74, 0x01, 0x4e, 0x0b, 0x53, 0xa1, 0x95, 0x39, 0xed, + 0xed, 0xca, 0xcd, 0x31, 0x55, 0x10, 0x0a, 0x11, 0xf4, 0x14, 0x26, 0x0d, 0xcd, 0xf2, 0xfd, 0x58, + 0xe4, 0x15, 0x72, 0x6d, 0xf4, 0x0a, 0xb9, 0xa3, 0x59, 0xdc, 0xdd, 0xb2, 0xc9, 0xec, 0xb6, 0x3a, + 0x65, 0xf8, 0x43, 0xb4, 0x0f, 0x17, 0x0c, 0xcd, 0xb2, 0xfa, 0xe3, 0x3d, 0xc3, 0x75, 0x6e, 0x9e, + 0x48, 0xc7, 0xea, 0xc9, 0x8f, 0x10, 0x9c, 0x37, 0xfa, 0xe7, 0x23, 0xca, 0xa2, 0x6a, 0x7d, 0xe5, + 0xcc, 0x9b, 0x29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, 0x7d, + 0xbe, 0x6f, 0xd5, 0x12, 0x00, 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 91e561e06a8..6250bdd4381 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -8,10 +8,43 @@ import "google/protobuf/duration.proto"; import "examples/sub/message.proto"; import "examples/sub2/message.proto"; import "google/protobuf/timestamp.proto"; +import "protoc-gen-swagger/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { + info: { + title: "A Bit of Everything"; + version: "1.0"; + contact: { + name: "gRPC-Gateway project"; + url: "https://github.com/grpc-ecosystem/grpc-gateway"; + email: "none@example.com"; + }; + }; + // Overwriting host entry breaks tests, so this is not done here. + external_docs: { + url: "https://github.com/grpc-ecosystem/grpc-gateway"; + description: "More about gRPC-Gateway"; + } + schemes: HTTP; + schemes: HTTPS; + schemes: WSS; + consumes: "application/json"; + consumes: "application/x-foo-mime"; + produces: "application/json"; + produces: "application/x-foo-mime"; +}; + // Intentionaly complicated message type to cover much features of Protobuf. // NEXT ID: 27 message ABitOfEverything { + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = { + external_docs: { + url: "https://github.com/grpc-ecosystem/grpc-gateway"; + description: "Find out more about ABitOfEverything"; + } + }; + // Nested is nested type. message Nested { // name is nested field. @@ -72,7 +105,18 @@ enum NumericEnum { ONE = 1; } +// ABitOfEverything service is used to validate that APIs with complicated +// proto messages and URL templates are still processed correctly. service ABitOfEverythingService { + + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_tag) = { + description: "ABitOfEverythingService description -- which should not be used in place of the documentation comment!" + external_docs: { + url: "https://github.com/grpc-ecosystem/grpc-gateway"; + description: "Find out more about EchoService"; + } + }; + rpc Create(ABitOfEverything) returns (ABitOfEverything) { // TODO add enum_value option (google.api.http) = { @@ -105,7 +149,21 @@ service ABitOfEverythingService { option (google.api.http) = { get: "/v1/example/a_bit_of_everything/query/{uuid}" }; + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { + deprecated: true // For testing purposes. + external_docs: { + url: "https://github.com/grpc-ecosystem/grpc-gateway"; + description: "Find out more about GetQuery"; + } + }; } + // Echo allows posting a StringMessage value. + // + // It also exposes multiple bindings. + // + // This makes it useful when validating that the OpenAPI v2 API + // description exposes documentation correctly on all paths + // defined as additional_bindings in the proto. rpc Echo(grpc.gateway.examples.sub.StringMessage) returns (grpc.gateway.examples.sub.StringMessage) { option (google.api.http) = { get: "/v1/example/a_bit_of_everything/echo/{value}" @@ -117,6 +175,12 @@ service ABitOfEverythingService { get: "/v2/example/echo" } }; + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { + external_docs: { + url: "https://github.com/grpc-ecosystem/grpc-gateway"; + description: "Find out more Echo"; + } + }; } rpc DeepPathEcho(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = { diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 052b256b505..c42cd34ed13 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -1,18 +1,26 @@ { "swagger": "2.0", "info": { - "title": "examples/examplepb/a_bit_of_everything.proto", - "version": "version not set" + "title": "A Bit of Everything", + "version": "1.0", + "contact": { + "name": "gRPC-Gateway project", + "url": "https://github.com/grpc-ecosystem/grpc-gateway", + "email": "none@example.com" + } }, "schemes": [ "http", - "https" + "https", + "wss" ], "consumes": [ - "application/json" + "application/json", + "application/x-foo-mime" ], "produces": [ - "application/json" + "application/json", + "application/x-foo-mime" ], "paths": { "/v1/example/a_bit_of_everything": { @@ -43,6 +51,8 @@ }, "/v1/example/a_bit_of_everything/echo/{value}": { "get": { + "summary": "Echo allows posting a StringMessage value.", + "description": "It also exposes multiple bindings.\n\nThis makes it useful when validating that the OpenAPI v2 API\ndescription exposes documentation correctly on all paths\ndefined as additional_bindings in the proto.", "operationId": "Echo", "responses": { "200": { @@ -62,7 +72,11 @@ ], "tags": [ "ABitOfEverythingService" - ] + ], + "externalDocs": { + "description": "Find out more Echo", + "url": "https://github.com/grpc-ecosystem/grpc-gateway" + } } }, "/v1/example/a_bit_of_everything/query/{uuid}": { @@ -264,7 +278,12 @@ ], "tags": [ "ABitOfEverythingService" - ] + ], + "deprecated": true, + "externalDocs": { + "description": "Find out more about GetQuery", + "url": "https://github.com/grpc-ecosystem/grpc-gateway" + } } }, "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}": { @@ -498,7 +517,9 @@ }, "/v2/example/echo": { "get": { - "operationId": "Echo", + "summary": "Echo allows posting a StringMessage value.", + "description": "It also exposes multiple bindings.\n\nThis makes it useful when validating that the OpenAPI v2 API\ndescription exposes documentation correctly on all paths\ndefined as additional_bindings in the proto.", + "operationId": "Echo3", "responses": { "200": { "description": "", @@ -517,10 +538,16 @@ ], "tags": [ "ABitOfEverythingService" - ] + ], + "externalDocs": { + "description": "Find out more Echo", + "url": "https://github.com/grpc-ecosystem/grpc-gateway" + } }, "post": { - "operationId": "Echo", + "summary": "Echo allows posting a StringMessage value.", + "description": "It also exposes multiple bindings.\n\nThis makes it useful when validating that the OpenAPI v2 API\ndescription exposes documentation correctly on all paths\ndefined as additional_bindings in the proto.", + "operationId": "Echo2", "responses": { "200": { "description": "", @@ -541,7 +568,11 @@ ], "tags": [ "ABitOfEverythingService" - ] + ], + "externalDocs": { + "description": "Find out more Echo", + "url": "https://github.com/grpc-ecosystem/grpc-gateway" + } } }, "/v2/example/timeout": { @@ -707,7 +738,11 @@ "title": "repeated enum value. it is comma-separated in query" } }, - "title": "Intentionaly complicated message type to cover much features of Protobuf.\nNEXT ID: 27" + "title": "Intentionaly complicated message type to cover much features of Protobuf.\nNEXT ID: 27", + "externalDocs": { + "description": "Find out more about ABitOfEverything", + "url": "https://github.com/grpc-ecosystem/grpc-gateway" + } }, "examplepbNumericEnum": { "type": "string", @@ -731,5 +766,9 @@ } } } + }, + "externalDocs": { + "description": "More about gRPC-Gateway", + "url": "https://github.com/grpc-ecosystem/grpc-gateway" } } diff --git a/examples/examplepb/echo_service.swagger.json b/examples/examplepb/echo_service.swagger.json index c58fbc54cea..cf617932212 100644 --- a/examples/examplepb/echo_service.swagger.json +++ b/examples/examplepb/echo_service.swagger.json @@ -46,7 +46,7 @@ "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", - "operationId": "Echo", + "operationId": "Echo2", "responses": { "200": { "description": "", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index a7ef682ea8b..5bd1c3f9328 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -11,8 +11,10 @@ import ( "strings" "sync" + "github.com/golang/protobuf/proto" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) func listEnumNames(enum *descriptor.Enum) (names []string) { @@ -176,6 +178,25 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, if err := updateSwaggerDataFromComments(&schema, msgComments); err != nil { panic(err) } + opts, err := extractSchemaOptionFromMessageDescriptor(msg.DescriptorProto) + if err != nil { + panic(err) + } + if opts != nil { + if opts.ExternalDocs != nil { + if schema.ExternalDocs == nil { + schema.ExternalDocs = &swaggerExternalDocumentationObject{} + } + if opts.ExternalDocs.Description != "" { + schema.ExternalDocs.Description = opts.ExternalDocs.Description + } + if opts.ExternalDocs.Url != "" { + schema.ExternalDocs.URL = opts.ExternalDocs.Url + } + } + + // TODO(ivucica): add remaining fields of schema object + } for _, f := range msg.Fields { fieldValue := schemaOfField(f, reg) @@ -452,7 +473,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. for svcIdx, svc := range services { for methIdx, meth := range svc.Methods { - for _, b := range meth.Bindings { + for bIdx, b := range meth.Bindings { // Iterate over all the swagger parameters parameters := swaggerParametersObject{} for _, parameter := range b.PathParams { @@ -527,9 +548,8 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re desc += "(streaming responses)" } operationObject := &swaggerOperationObject{ - Tags: []string{svc.GetName()}, - OperationID: fmt.Sprintf("%s", meth.GetName()), - Parameters: parameters, + Tags: []string{svc.GetName()}, + Parameters: parameters, Responses: swaggerResponsesObject{ "200": swaggerResponseObject{ Description: desc, @@ -541,6 +561,12 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re }, }, } + if bIdx == 0 { + operationObject.OperationID = fmt.Sprintf("%s", meth.GetName()) + } else { + // OperationID must be unique in an OpenAPI v2 definition. + operationObject.OperationID = fmt.Sprintf("%s%d", meth.GetName(), bIdx+1) + } // Fill reference map with referenced request messages for _, param := range operationObject.Parameters { @@ -554,6 +580,28 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re panic(err) } + opts, err := extractOperationOptionFromMethodDescriptor(meth.MethodDescriptorProto) + if opts != nil { + if err != nil { + panic(err) + } + if opts.ExternalDocs != nil { + if operationObject.ExternalDocs == nil { + operationObject.ExternalDocs = &swaggerExternalDocumentationObject{} + } + if opts.ExternalDocs.Description != "" { + operationObject.ExternalDocs.Description = opts.ExternalDocs.Description + } + if opts.ExternalDocs.Url != "" { + operationObject.ExternalDocs.URL = opts.ExternalDocs.Url + } + } + // TODO(ivucica): this would be better supported by looking whether the method is deprecated in the proto file + operationObject.Deprecated = opts.Deprecated + + // TODO(ivucica): add remaining fields of operation object + } + switch b.HTTPMethod { case "DELETE": pathItemObject.Delete = operationObject @@ -620,6 +668,73 @@ func applyTemplate(p param) (string, error) { panic(err) } + // There may be additional options in the swagger option in the proto. + spb, err := extractSwaggerOptionFromFileDescriptor(p.FileDescriptorProto) + if err != nil { + panic(err) + } + if spb != nil { + if spb.Swagger != "" { + s.Swagger = spb.Swagger + } + if spb.Info != nil { + if spb.Info.Title != "" { + s.Info.Title = spb.Info.Title + } + if spb.Info.Version != "" { + s.Info.Version = spb.Info.Version + } + if spb.Info.Contact != nil { + if s.Info.Contact == nil { + s.Info.Contact = &swaggerContactObject{} + } + if spb.Info.Contact.Name != "" { + s.Info.Contact.Name = spb.Info.Contact.Name + } + if spb.Info.Contact.Url != "" { + s.Info.Contact.URL = spb.Info.Contact.Url + } + if spb.Info.Contact.Email != "" { + s.Info.Contact.Email = spb.Info.Contact.Email + } + } + } + if spb.Host != "" { + s.Host = spb.Host + } + if spb.BasePath != "" { + s.BasePath = spb.BasePath + } + if len(spb.Schemes) > 0 { + s.Schemes = make([]string, len(spb.Schemes)) + for i, scheme := range spb.Schemes { + s.Schemes[i] = strings.ToLower(scheme.String()) + } + } + if len(spb.Consumes) > 0 { + s.Consumes = make([]string, len(spb.Consumes)) + copy(s.Consumes, spb.Consumes) + } + if len(spb.Produces) > 0 { + s.Produces = make([]string, len(spb.Produces)) + copy(s.Produces, spb.Produces) + } + if spb.ExternalDocs != nil { + if s.ExternalDocs == nil { + s.ExternalDocs = &swaggerExternalDocumentationObject{} + } + if spb.ExternalDocs.Description != "" { + s.ExternalDocs.Description = spb.ExternalDocs.Description + } + if spb.ExternalDocs.Url != "" { + s.ExternalDocs.URL = spb.ExternalDocs.Url + } + } + + // Additional fields on the OpenAPI v2 spec's "Swagger" object + // should be added here, once supported in the proto. + } + // We now have rendered the entire swagger object. Write the bytes out to a // string so it can be written to disk. var w bytes.Buffer @@ -632,9 +747,9 @@ func applyTemplate(p param) (string, error) { // updateSwaggerDataFromComments updates a Swagger object based on a comment // from the proto file. // -// First paragraph of a comment is used for summary. Remaining paragraphs of a -// comment are used for description. If 'Summary' field is not present on the -// passed swaggerObject, the summary and description are joined by \n\n. +// First paragraph of a comment is used for summary. Remaining paragraphs of +// a comment are used for description. If 'Summary' field is not present on +// the passed swaggerObject, the summary and description are joined by \n\n. // // If there is a field named 'Info', its 'Summary' and 'Description' fields // will be updated instead. @@ -664,17 +779,15 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er usingTitle = true } + paragraphs := strings.Split(comment, "\n\n") + // If there is a summary (or summary-equivalent), use the first // paragraph as summary, and the rest as description. if summaryValue.CanSet() { - paragraphs := strings.Split(comment, "\n\n") - summary := strings.TrimSpace(paragraphs[0]) description := strings.TrimSpace(strings.Join(paragraphs[1:], "\n\n")) - if !usingTitle || summary == "" || summary[len(summary)-1] != '.' { - if len(summary) > 0 { - summaryValue.Set(reflect.ValueOf(summary)) - } + if !usingTitle || (len(summary) > 0 && summary[len(summary)-1] != '.') { + summaryValue.Set(reflect.ValueOf(summary)) if len(description) > 0 { if !descriptionValue.CanSet() { return fmt.Errorf("Encountered object type with a summary, but no description") @@ -688,7 +801,7 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er // There was no summary field on the swaggerObject. Try to apply the // whole comment into description. if descriptionValue.CanSet() { - descriptionValue.Set(reflect.ValueOf(comment)) + descriptionValue.Set(reflect.ValueOf(strings.Join(paragraphs, "\n\n"))) return nil } @@ -854,3 +967,63 @@ func protoPathIndex(descriptorType reflect.Type, what string) int32 { return int32(path) } + +// extractOperationOptionFromMethodDescriptor extracts the message of type +// swagger_options.Operation from a given proto method's descriptor. +func extractOperationOptionFromMethodDescriptor(meth *pbdescriptor.MethodDescriptorProto) (*swagger_options.Operation, error) { + if meth.Options == nil { + return nil, nil + } + if !proto.HasExtension(meth.Options, swagger_options.E_Openapiv2Operation) { + return nil, nil + } + ext, err := proto.GetExtension(meth.Options, swagger_options.E_Openapiv2Operation) + if err != nil { + return nil, err + } + opts, ok := ext.(*swagger_options.Operation) + if !ok { + return nil, fmt.Errorf("extension is %T; want an Operation", ext) + } + return opts, nil +} + +// extractSchemaOptionFromMessageDescriptor extracts the message of type +// swagger_options.Schema from a given proto message's descriptor. +func extractSchemaOptionFromMessageDescriptor(msg *pbdescriptor.DescriptorProto) (*swagger_options.Schema, error) { + if msg.Options == nil { + return nil, nil + } + if !proto.HasExtension(msg.Options, swagger_options.E_Openapiv2Schema) { + return nil, nil + } + ext, err := proto.GetExtension(msg.Options, swagger_options.E_Openapiv2Schema) + if err != nil { + return nil, err + } + opts, ok := ext.(*swagger_options.Schema) + if !ok { + return nil, fmt.Errorf("extension is %T; want a Schema", ext) + } + return opts, nil +} + +// extractSwaggerOptionFromFileDescriptor extracts the message of type +// swagger_options.Swagger from a given proto method's descriptor. +func extractSwaggerOptionFromFileDescriptor(file *pbdescriptor.FileDescriptorProto) (*swagger_options.Swagger, error) { + if file.Options == nil { + return nil, nil + } + if !proto.HasExtension(file.Options, swagger_options.E_Openapiv2Swagger) { + return nil, nil + } + ext, err := proto.GetExtension(file.Options, swagger_options.E_Openapiv2Swagger) + if err != nil { + return nil, err + } + opts, ok := ext.(*swagger_options.Swagger) + if !ok { + return nil, fmt.Errorf("extension is %T; want a Swagger object", ext) + } + return opts, nil +} diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index c328d1c60cc..7263e66b7e0 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -23,9 +23,8 @@ type swaggerInfoObject struct { TermsOfService string `json:"termsOfService,omitempty"` Version string `json:"version"` - Contact *swaggerContactObject `json:"contact,omitempty"` - License *swaggerLicenseObject `json:"license,omitempty"` - ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` + Contact *swaggerContactObject `json:"contact,omitempty"` + License *swaggerLicenseObject `json:"license,omitempty"` } // http://swagger.io/specification/#contactObject @@ -49,15 +48,16 @@ type swaggerExternalDocumentationObject struct { // http://swagger.io/specification/#swaggerObject type swaggerObject struct { - Swagger string `json:"swagger"` - Info swaggerInfoObject `json:"info"` - Host string `json:"host,omitempty"` - BasePath string `json:"basePath,omitempty"` - Schemes []string `json:"schemes"` - Consumes []string `json:"consumes"` - Produces []string `json:"produces"` - Paths swaggerPathsObject `json:"paths"` - Definitions swaggerDefinitionsObject `json:"definitions"` + Swagger string `json:"swagger"` + Info swaggerInfoObject `json:"info"` + Host string `json:"host,omitempty"` + BasePath string `json:"basePath,omitempty"` + Schemes []string `json:"schemes"` + Consumes []string `json:"consumes"` + Produces []string `json:"produces"` + Paths swaggerPathsObject `json:"paths"` + Definitions swaggerDefinitionsObject `json:"definitions"` + ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` } // http://swagger.io/specification/#pathsObject @@ -80,6 +80,7 @@ type swaggerOperationObject struct { Responses swaggerResponsesObject `json:"responses"` Parameters swaggerParametersObject `json:"parameters,omitempty"` Tags []string `json:"tags,omitempty"` + Deprecated bool `json:"deprecated,omitempty"` ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` } @@ -170,6 +171,8 @@ type swaggerSchemaObject struct { Description string `json:"description,omitempty"` Title string `json:"title,omitempty"` + + ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` } // http://swagger.io/specification/#referenceObject diff --git a/protoc-gen-swagger/options/annotations.pb.go b/protoc-gen-swagger/options/annotations.pb.go new file mode 100644 index 00000000000..7bc93b91c63 --- /dev/null +++ b/protoc-gen-swagger/options/annotations.pb.go @@ -0,0 +1,83 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: protoc-gen-swagger/options/annotations.proto + +package options + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf1 "github.com/golang/protobuf/protoc-gen-go/descriptor" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +var E_Openapiv2Swagger = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf1.FileOptions)(nil), + ExtensionType: (*Swagger)(nil), + Field: 1042, + Name: "grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger", + Tag: "bytes,1042,opt,name=openapiv2_swagger,json=openapiv2Swagger", + Filename: "protoc-gen-swagger/options/annotations.proto", +} + +var E_Openapiv2Operation = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf1.MethodOptions)(nil), + ExtensionType: (*Operation)(nil), + Field: 1042, + Name: "grpc.gateway.protoc_gen_swagger.options.openapiv2_operation", + Tag: "bytes,1042,opt,name=openapiv2_operation,json=openapiv2Operation", + Filename: "protoc-gen-swagger/options/annotations.proto", +} + +var E_Openapiv2Schema = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf1.MessageOptions)(nil), + ExtensionType: (*Schema)(nil), + Field: 1042, + Name: "grpc.gateway.protoc_gen_swagger.options.openapiv2_schema", + Tag: "bytes,1042,opt,name=openapiv2_schema,json=openapiv2Schema", + Filename: "protoc-gen-swagger/options/annotations.proto", +} + +var E_Openapiv2Tag = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf1.ServiceOptions)(nil), + ExtensionType: (*Tag)(nil), + Field: 1042, + Name: "grpc.gateway.protoc_gen_swagger.options.openapiv2_tag", + Tag: "bytes,1042,opt,name=openapiv2_tag,json=openapiv2Tag", + Filename: "protoc-gen-swagger/options/annotations.proto", +} + +func init() { + proto.RegisterExtension(E_Openapiv2Swagger) + proto.RegisterExtension(E_Openapiv2Operation) + proto.RegisterExtension(E_Openapiv2Schema) + proto.RegisterExtension(E_Openapiv2Tag) +} + +func init() { proto.RegisterFile("protoc-gen-swagger/options/annotations.proto", fileDescriptor1) } + +var fileDescriptor1 = []byte{ + // 311 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x4b, 0x03, 0x31, + 0x10, 0x85, 0xe9, 0x45, 0x64, 0x55, 0xac, 0xeb, 0x45, 0x8a, 0x68, 0x6f, 0x8a, 0xb4, 0x89, 0xd4, + 0xdb, 0xde, 0x54, 0xf0, 0x26, 0x85, 0x6d, 0x4f, 0x5e, 0x4a, 0x9a, 0x8e, 0xd3, 0x40, 0x9b, 0x09, + 0x49, 0xda, 0x52, 0xe8, 0xd1, 0x5f, 0xe0, 0x2f, 0x16, 0x93, 0xed, 0x56, 0xd6, 0x2a, 0x7b, 0xdb, + 0x99, 0x9d, 0xf7, 0xbe, 0xc7, 0x23, 0x49, 0xc7, 0x58, 0xf2, 0x24, 0xbb, 0x08, 0xba, 0xeb, 0x56, + 0x02, 0x11, 0x2c, 0x27, 0xe3, 0x15, 0x69, 0xc7, 0x85, 0xd6, 0xe4, 0x45, 0xf8, 0x66, 0xe1, 0x2c, + 0xbd, 0x41, 0x6b, 0x24, 0x43, 0xe1, 0x61, 0x25, 0xd6, 0x71, 0x27, 0x47, 0x08, 0x7a, 0x54, 0x48, + 0x59, 0x21, 0x6d, 0xdd, 0xfd, 0x63, 0x4b, 0x06, 0xb4, 0x30, 0x6a, 0xd9, 0x8b, 0x06, 0xad, 0x36, + 0x12, 0xe1, 0x0c, 0x78, 0x98, 0xc6, 0x8b, 0x77, 0x3e, 0x01, 0x27, 0xad, 0x32, 0x9e, 0x6c, 0xbc, + 0xc8, 0x36, 0xc9, 0x59, 0x29, 0xda, 0xa2, 0xd2, 0x4b, 0x16, 0x75, 0x6c, 0xab, 0x63, 0x2f, 0x6a, + 0x06, 0xfd, 0x08, 0xb9, 0xf8, 0x3c, 0x6c, 0x37, 0x6e, 0x8f, 0x7a, 0xf7, 0xac, 0x66, 0x62, 0x36, + 0x88, 0x73, 0xde, 0x2c, 0x49, 0xc5, 0x26, 0xfb, 0x68, 0x24, 0xe7, 0x3b, 0x3c, 0x19, 0xb0, 0xa1, + 0x93, 0xf4, 0xea, 0x57, 0x80, 0x57, 0xf0, 0x53, 0x9a, 0x54, 0x22, 0xf4, 0x6a, 0x47, 0xe8, 0x6f, + 0xad, 0xf3, 0xb4, 0xe4, 0x95, 0xbb, 0x6c, 0x93, 0x34, 0x7f, 0x94, 0x20, 0xa7, 0x30, 0x17, 0xe9, + 0xf5, 0x9e, 0x08, 0xce, 0x09, 0xac, 0xd6, 0xc0, 0xeb, 0xd7, 0x10, 0x8c, 0xf3, 0xd3, 0x5d, 0x0b, + 0x61, 0x91, 0xb9, 0xe4, 0x64, 0x47, 0xf7, 0x02, 0xf7, 0xa0, 0x07, 0x60, 0x97, 0x4a, 0x56, 0xd1, + 0x9d, 0xda, 0xe8, 0xa1, 0xc0, 0xfc, 0xb8, 0x84, 0x0c, 0x05, 0x3e, 0x3d, 0xbf, 0x3d, 0xa2, 0xf2, + 0xd3, 0xc5, 0x98, 0x49, 0x9a, 0xf3, 0x6f, 0x9f, 0x2e, 0x48, 0x72, 0x6b, 0xe7, 0xa1, 0x18, 0x0b, + 0x5b, 0xfe, 0xf7, 0x73, 0x1b, 0x1f, 0x84, 0x7f, 0x0f, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x80, + 0x7f, 0xc1, 0x6a, 0xea, 0x02, 0x00, 0x00, +} diff --git a/protoc-gen-swagger/options/annotations.proto b/protoc-gen-swagger/options/annotations.proto new file mode 100644 index 00000000000..8746192b7a8 --- /dev/null +++ b/protoc-gen-swagger/options/annotations.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; + +package grpc.gateway.protoc_gen_swagger.options; + +option go_package = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"; + +import "protoc-gen-swagger/options/openapiv2.proto"; +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FileOptions { + // ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project. + // + // All IDs are the same, as assigned. It is okay that they are the same, as they extend + // different descriptor messages. + Swagger openapiv2_swagger = 1042; +} +extend google.protobuf.MethodOptions { + // ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project. + // + // All IDs are the same, as assigned. It is okay that they are the same, as they extend + // different descriptor messages. + Operation openapiv2_operation = 1042; +} +extend google.protobuf.MessageOptions { + // ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project. + // + // All IDs are the same, as assigned. It is okay that they are the same, as they extend + // different descriptor messages. + Schema openapiv2_schema = 1042; +} +extend google.protobuf.ServiceOptions { + // ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project. + // + // All IDs are the same, as assigned. It is okay that they are the same, as they extend + // different descriptor messages. + Tag openapiv2_tag = 1042; +} diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go new file mode 100644 index 00000000000..7564c52e500 --- /dev/null +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -0,0 +1,739 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: protoc-gen-swagger/options/openapiv2.proto + +/* +Package options is a generated protocol buffer package. + +It is generated from these files: + protoc-gen-swagger/options/openapiv2.proto + protoc-gen-swagger/options/annotations.proto + +It has these top-level messages: + Swagger + Operation + Info + Contact + ExternalDocumentation + Schema + JSONSchema + Tag +*/ +package options + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf "github.com/golang/protobuf/ptypes/any" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Swagger_SwaggerScheme int32 + +const ( + Swagger_UNKNOWN Swagger_SwaggerScheme = 0 + Swagger_HTTP Swagger_SwaggerScheme = 1 + Swagger_HTTPS Swagger_SwaggerScheme = 2 + Swagger_WS Swagger_SwaggerScheme = 3 + Swagger_WSS Swagger_SwaggerScheme = 4 +) + +var Swagger_SwaggerScheme_name = map[int32]string{ + 0: "UNKNOWN", + 1: "HTTP", + 2: "HTTPS", + 3: "WS", + 4: "WSS", +} +var Swagger_SwaggerScheme_value = map[string]int32{ + "UNKNOWN": 0, + "HTTP": 1, + "HTTPS": 2, + "WS": 3, + "WSS": 4, +} + +func (x Swagger_SwaggerScheme) String() string { + return proto.EnumName(Swagger_SwaggerScheme_name, int32(x)) +} +func (Swagger_SwaggerScheme) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } + +type JSONSchema_JSONSchemaSimpleTypes int32 + +const ( + JSONSchema_UNKNOWN JSONSchema_JSONSchemaSimpleTypes = 0 + JSONSchema_ARRAY JSONSchema_JSONSchemaSimpleTypes = 1 + JSONSchema_BOOLEAN JSONSchema_JSONSchemaSimpleTypes = 2 + JSONSchema_INTEGER JSONSchema_JSONSchemaSimpleTypes = 3 + JSONSchema_NULL JSONSchema_JSONSchemaSimpleTypes = 4 + JSONSchema_NUMBER JSONSchema_JSONSchemaSimpleTypes = 5 + JSONSchema_OBJECT JSONSchema_JSONSchemaSimpleTypes = 6 + JSONSchema_STRING JSONSchema_JSONSchemaSimpleTypes = 7 +) + +var JSONSchema_JSONSchemaSimpleTypes_name = map[int32]string{ + 0: "UNKNOWN", + 1: "ARRAY", + 2: "BOOLEAN", + 3: "INTEGER", + 4: "NULL", + 5: "NUMBER", + 6: "OBJECT", + 7: "STRING", +} +var JSONSchema_JSONSchemaSimpleTypes_value = map[string]int32{ + "UNKNOWN": 0, + "ARRAY": 1, + "BOOLEAN": 2, + "INTEGER": 3, + "NULL": 4, + "NUMBER": 5, + "OBJECT": 6, + "STRING": 7, +} + +func (x JSONSchema_JSONSchemaSimpleTypes) String() string { + return proto.EnumName(JSONSchema_JSONSchemaSimpleTypes_name, int32(x)) +} +func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{6, 0} +} + +// `Swagger` is a representation of OpenAPI v2 specification's Swagger object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject +// +// TODO(ivucica): document fields +type Swagger struct { + Swagger string `protobuf:"bytes,1,opt,name=swagger" json:"swagger,omitempty"` + Info *Info `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"` + Host string `protobuf:"bytes,3,opt,name=host" json:"host,omitempty"` + BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath" json:"base_path,omitempty"` + Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` + Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"` + Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` +} + +func (m *Swagger) Reset() { *m = Swagger{} } +func (m *Swagger) String() string { return proto.CompactTextString(m) } +func (*Swagger) ProtoMessage() {} +func (*Swagger) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Swagger) GetSwagger() string { + if m != nil { + return m.Swagger + } + return "" +} + +func (m *Swagger) GetInfo() *Info { + if m != nil { + return m.Info + } + return nil +} + +func (m *Swagger) GetHost() string { + if m != nil { + return m.Host + } + return "" +} + +func (m *Swagger) GetBasePath() string { + if m != nil { + return m.BasePath + } + return "" +} + +func (m *Swagger) GetSchemes() []Swagger_SwaggerScheme { + if m != nil { + return m.Schemes + } + return nil +} + +func (m *Swagger) GetConsumes() []string { + if m != nil { + return m.Consumes + } + return nil +} + +func (m *Swagger) GetProduces() []string { + if m != nil { + return m.Produces + } + return nil +} + +func (m *Swagger) GetExternalDocs() *ExternalDocumentation { + if m != nil { + return m.ExternalDocs + } + return nil +} + +// `Operation` is a representation of OpenAPI v2 specification's Operation object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject +// +// TODO(ivucica): document fields +type Operation struct { + Tags []string `protobuf:"bytes,1,rep,name=tags" json:"tags,omitempty"` + Summary string `protobuf:"bytes,2,opt,name=summary" json:"summary,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` + OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId" json:"operation_id,omitempty"` + Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"` + Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` + Schemes []string `protobuf:"bytes,10,rep,name=schemes" json:"schemes,omitempty"` + Deprecated bool `protobuf:"varint,11,opt,name=deprecated" json:"deprecated,omitempty"` +} + +func (m *Operation) Reset() { *m = Operation{} } +func (m *Operation) String() string { return proto.CompactTextString(m) } +func (*Operation) ProtoMessage() {} +func (*Operation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *Operation) GetTags() []string { + if m != nil { + return m.Tags + } + return nil +} + +func (m *Operation) GetSummary() string { + if m != nil { + return m.Summary + } + return "" +} + +func (m *Operation) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Operation) GetExternalDocs() *ExternalDocumentation { + if m != nil { + return m.ExternalDocs + } + return nil +} + +func (m *Operation) GetOperationId() string { + if m != nil { + return m.OperationId + } + return "" +} + +func (m *Operation) GetConsumes() []string { + if m != nil { + return m.Consumes + } + return nil +} + +func (m *Operation) GetProduces() []string { + if m != nil { + return m.Produces + } + return nil +} + +func (m *Operation) GetSchemes() []string { + if m != nil { + return m.Schemes + } + return nil +} + +func (m *Operation) GetDeprecated() bool { + if m != nil { + return m.Deprecated + } + return false +} + +// `Info` is a representation of OpenAPI v2 specification's Info object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject +// +// TODO(ivucica): document fields +type Info struct { + Title string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService" json:"terms_of_service,omitempty"` + Contact *Contact `protobuf:"bytes,4,opt,name=contact" json:"contact,omitempty"` + Version string `protobuf:"bytes,6,opt,name=version" json:"version,omitempty"` +} + +func (m *Info) Reset() { *m = Info{} } +func (m *Info) String() string { return proto.CompactTextString(m) } +func (*Info) ProtoMessage() {} +func (*Info) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *Info) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *Info) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Info) GetTermsOfService() string { + if m != nil { + return m.TermsOfService + } + return "" +} + +func (m *Info) GetContact() *Contact { + if m != nil { + return m.Contact + } + return nil +} + +func (m *Info) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +// `Contact` is a representation of OpenAPI v2 specification's Contact object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject +// +// TODO(ivucica): document fields +type Contact struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` + Email string `protobuf:"bytes,3,opt,name=email" json:"email,omitempty"` +} + +func (m *Contact) Reset() { *m = Contact{} } +func (m *Contact) String() string { return proto.CompactTextString(m) } +func (*Contact) ProtoMessage() {} +func (*Contact) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *Contact) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Contact) GetUrl() string { + if m != nil { + return m.Url + } + return "" +} + +func (m *Contact) GetEmail() string { + if m != nil { + return m.Email + } + return "" +} + +// `ExternalDocumentation` is a representation of OpenAPI v2 specification's +// ExternalDocumentation object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#externalDocumentationObject +// +// TODO(ivucica): document fields +type ExternalDocumentation struct { + Description string `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` +} + +func (m *ExternalDocumentation) Reset() { *m = ExternalDocumentation{} } +func (m *ExternalDocumentation) String() string { return proto.CompactTextString(m) } +func (*ExternalDocumentation) ProtoMessage() {} +func (*ExternalDocumentation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *ExternalDocumentation) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *ExternalDocumentation) GetUrl() string { + if m != nil { + return m.Url + } + return "" +} + +// `Schema` is a representation of OpenAPI v2 specification's Schema object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject +// +// TODO(ivucica): document fields +type Schema struct { + JsonSchema *JSONSchema `protobuf:"bytes,1,opt,name=json_schema,json=jsonSchema" json:"json_schema,omitempty"` + Discriminator string `protobuf:"bytes,2,opt,name=discriminator" json:"discriminator,omitempty"` + ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly" json:"read_only,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,5,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` + Example *google_protobuf.Any `protobuf:"bytes,6,opt,name=example" json:"example,omitempty"` +} + +func (m *Schema) Reset() { *m = Schema{} } +func (m *Schema) String() string { return proto.CompactTextString(m) } +func (*Schema) ProtoMessage() {} +func (*Schema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *Schema) GetJsonSchema() *JSONSchema { + if m != nil { + return m.JsonSchema + } + return nil +} + +func (m *Schema) GetDiscriminator() string { + if m != nil { + return m.Discriminator + } + return "" +} + +func (m *Schema) GetReadOnly() bool { + if m != nil { + return m.ReadOnly + } + return false +} + +func (m *Schema) GetExternalDocs() *ExternalDocumentation { + if m != nil { + return m.ExternalDocs + } + return nil +} + +func (m *Schema) GetExample() *google_protobuf.Any { + if m != nil { + return m.Example + } + return nil +} + +// `JSONSchema` represents properties from JSON Schema taken, and as used, in +// the OpenAPI v2 spec. +// +// This includes changes made by OpenAPI v2. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject +// +// See also: https://cswr.github.io/JsonSchema/spec/basic_types/, +// https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json +// +// TODO(ivucica): document fields +type JSONSchema struct { + Title string `protobuf:"bytes,5,opt,name=title" json:"title,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description" json:"description,omitempty"` + Default string `protobuf:"bytes,7,opt,name=default" json:"default,omitempty"` + MultipleOf float64 `protobuf:"fixed64,10,opt,name=multiple_of,json=multipleOf" json:"multiple_of,omitempty"` + Maximum float64 `protobuf:"fixed64,11,opt,name=maximum" json:"maximum,omitempty"` + ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum" json:"exclusive_maximum,omitempty"` + Minimum float64 `protobuf:"fixed64,13,opt,name=minimum" json:"minimum,omitempty"` + ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum" json:"exclusive_minimum,omitempty"` + MaxLength uint64 `protobuf:"varint,15,opt,name=max_length,json=maxLength" json:"max_length,omitempty"` + MinLength uint64 `protobuf:"varint,16,opt,name=min_length,json=minLength" json:"min_length,omitempty"` + Pattern string `protobuf:"bytes,17,opt,name=pattern" json:"pattern,omitempty"` + MaxItems uint64 `protobuf:"varint,20,opt,name=max_items,json=maxItems" json:"max_items,omitempty"` + MinItems uint64 `protobuf:"varint,21,opt,name=min_items,json=minItems" json:"min_items,omitempty"` + UniqueItems bool `protobuf:"varint,22,opt,name=unique_items,json=uniqueItems" json:"unique_items,omitempty"` + MaxProperties uint64 `protobuf:"varint,24,opt,name=max_properties,json=maxProperties" json:"max_properties,omitempty"` + MinProperties uint64 `protobuf:"varint,25,opt,name=min_properties,json=minProperties" json:"min_properties,omitempty"` + Required []string `protobuf:"bytes,26,rep,name=required" json:"required,omitempty"` + // Items in 'array' must be unique. + Array []string `protobuf:"bytes,34,rep,name=array" json:"array,omitempty"` + Type []JSONSchema_JSONSchemaSimpleTypes `protobuf:"varint,35,rep,packed,name=type,enum=grpc.gateway.protoc_gen_swagger.options.JSONSchema_JSONSchemaSimpleTypes" json:"type,omitempty"` +} + +func (m *JSONSchema) Reset() { *m = JSONSchema{} } +func (m *JSONSchema) String() string { return proto.CompactTextString(m) } +func (*JSONSchema) ProtoMessage() {} +func (*JSONSchema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *JSONSchema) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *JSONSchema) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *JSONSchema) GetDefault() string { + if m != nil { + return m.Default + } + return "" +} + +func (m *JSONSchema) GetMultipleOf() float64 { + if m != nil { + return m.MultipleOf + } + return 0 +} + +func (m *JSONSchema) GetMaximum() float64 { + if m != nil { + return m.Maximum + } + return 0 +} + +func (m *JSONSchema) GetExclusiveMaximum() bool { + if m != nil { + return m.ExclusiveMaximum + } + return false +} + +func (m *JSONSchema) GetMinimum() float64 { + if m != nil { + return m.Minimum + } + return 0 +} + +func (m *JSONSchema) GetExclusiveMinimum() bool { + if m != nil { + return m.ExclusiveMinimum + } + return false +} + +func (m *JSONSchema) GetMaxLength() uint64 { + if m != nil { + return m.MaxLength + } + return 0 +} + +func (m *JSONSchema) GetMinLength() uint64 { + if m != nil { + return m.MinLength + } + return 0 +} + +func (m *JSONSchema) GetPattern() string { + if m != nil { + return m.Pattern + } + return "" +} + +func (m *JSONSchema) GetMaxItems() uint64 { + if m != nil { + return m.MaxItems + } + return 0 +} + +func (m *JSONSchema) GetMinItems() uint64 { + if m != nil { + return m.MinItems + } + return 0 +} + +func (m *JSONSchema) GetUniqueItems() bool { + if m != nil { + return m.UniqueItems + } + return false +} + +func (m *JSONSchema) GetMaxProperties() uint64 { + if m != nil { + return m.MaxProperties + } + return 0 +} + +func (m *JSONSchema) GetMinProperties() uint64 { + if m != nil { + return m.MinProperties + } + return 0 +} + +func (m *JSONSchema) GetRequired() []string { + if m != nil { + return m.Required + } + return nil +} + +func (m *JSONSchema) GetArray() []string { + if m != nil { + return m.Array + } + return nil +} + +func (m *JSONSchema) GetType() []JSONSchema_JSONSchemaSimpleTypes { + if m != nil { + return m.Type + } + return nil +} + +// `Tag` is a representation of OpenAPI v2 specification's Tag object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject +// +// TODO(ivucica): document fields +type Tag struct { + // TODO(ivucica): Description should be extracted from comments on the proto + // service object. + Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` +} + +func (m *Tag) Reset() { *m = Tag{} } +func (m *Tag) String() string { return proto.CompactTextString(m) } +func (*Tag) ProtoMessage() {} +func (*Tag) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *Tag) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Tag) GetExternalDocs() *ExternalDocumentation { + if m != nil { + return m.ExternalDocs + } + return nil +} + +func init() { + proto.RegisterType((*Swagger)(nil), "grpc.gateway.protoc_gen_swagger.options.Swagger") + proto.RegisterType((*Operation)(nil), "grpc.gateway.protoc_gen_swagger.options.Operation") + proto.RegisterType((*Info)(nil), "grpc.gateway.protoc_gen_swagger.options.Info") + proto.RegisterType((*Contact)(nil), "grpc.gateway.protoc_gen_swagger.options.Contact") + proto.RegisterType((*ExternalDocumentation)(nil), "grpc.gateway.protoc_gen_swagger.options.ExternalDocumentation") + proto.RegisterType((*Schema)(nil), "grpc.gateway.protoc_gen_swagger.options.Schema") + proto.RegisterType((*JSONSchema)(nil), "grpc.gateway.protoc_gen_swagger.options.JSONSchema") + proto.RegisterType((*Tag)(nil), "grpc.gateway.protoc_gen_swagger.options.Tag") + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme", Swagger_SwaggerScheme_name, Swagger_SwaggerScheme_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.JSONSchema_JSONSchemaSimpleTypes", JSONSchema_JSONSchemaSimpleTypes_name, JSONSchema_JSONSchemaSimpleTypes_value) +} + +func init() { proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 1175 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xed, 0x6e, 0xdb, 0x36, + 0x17, 0x7e, 0x65, 0xd3, 0x36, 0x7d, 0x6c, 0xe7, 0x65, 0xd5, 0x74, 0x63, 0xd3, 0x8f, 0xb9, 0x5e, + 0x87, 0x19, 0x2d, 0xe2, 0x0c, 0xe9, 0xff, 0x01, 0x49, 0x67, 0x74, 0x51, 0x53, 0xbb, 0x90, 0x5d, + 0x74, 0x1b, 0x30, 0x18, 0x8c, 0x4c, 0x3b, 0x1c, 0x24, 0x4a, 0x95, 0xa8, 0xd4, 0xbe, 0x8d, 0x5d, + 0xcf, 0x2e, 0x63, 0xf7, 0xb0, 0x3b, 0xd8, 0x8f, 0xfd, 0x1a, 0x48, 0x51, 0xf9, 0x72, 0x37, 0x04, + 0x45, 0xf7, 0xcb, 0x3c, 0xcf, 0x73, 0xce, 0x23, 0x9e, 0x0f, 0x92, 0x86, 0x27, 0x49, 0x1a, 0xab, + 0x38, 0xd8, 0x5d, 0x72, 0xb9, 0x9b, 0xbd, 0x67, 0xcb, 0x25, 0x4f, 0xf7, 0xe2, 0x44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, 0x82, 0x5c, 0x80, 0xfa, 0xe8, 0xcd, 0xab, 0xc3, + 0xa1, 0x4f, 0x6a, 0x7a, 0x3d, 0x3e, 0xf4, 0x86, 0xcf, 0xa7, 0xa4, 0xae, 0xd7, 0x93, 0xa9, 0x7f, + 0x34, 0x7a, 0x41, 0x1a, 0x1e, 0xc2, 0x0e, 0xa9, 0x78, 0x08, 0x57, 0x48, 0xd5, 0x43, 0xb8, 0x6a, + 0x9e, 0x59, 0x44, 0x6a, 0xd7, 0x2e, 0x7c, 0x97, 0xdc, 0xf6, 0x10, 0xbe, 0x4d, 0xb6, 0x3d, 0x84, + 0x3f, 0x27, 0xd4, 0x43, 0xf8, 0x1e, 0xb9, 0xef, 0x21, 0x7c, 0x9f, 0x3c, 0xf0, 0x10, 0x7e, 0x40, + 0x1e, 0x7a, 0x08, 0x3f, 0x24, 0x3d, 0x0f, 0xe1, 0xc7, 0xe4, 0x89, 0x87, 0xf0, 0x13, 0xf2, 0xd4, + 0x43, 0xf8, 0x29, 0x19, 0xf4, 0x7e, 0x75, 0xa0, 0x3a, 0x65, 0xcb, 0x1b, 0xbc, 0x07, 0x1b, 0x37, + 0x48, 0xf5, 0xd3, 0xdf, 0x20, 0x45, 0xba, 0x87, 0xcf, 0x7f, 0x3a, 0x58, 0x0a, 0x75, 0x9a, 0x9f, + 0x0c, 0x82, 0x38, 0xda, 0xd3, 0xfa, 0xbb, 0x3c, 0x88, 0xb3, 0x75, 0xa6, 0xb8, 0x35, 0xed, 0xe7, + 0xf6, 0xfe, 0xf9, 0x7f, 0xeb, 0x49, 0xdd, 0x70, 0xcf, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf8, + 0x2b, 0xe7, 0x47, 0xdc, 0x0a, 0x00, 0x00, +} diff --git a/protoc-gen-swagger/options/openapiv2.proto b/protoc-gen-swagger/options/openapiv2.proto new file mode 100644 index 00000000000..6c1854613dd --- /dev/null +++ b/protoc-gen-swagger/options/openapiv2.proto @@ -0,0 +1,223 @@ +syntax = "proto3"; + +package grpc.gateway.protoc_gen_swagger.options; + +option go_package = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"; + +import "google/protobuf/any.proto"; + +// `Swagger` is a representation of OpenAPI v2 specification's Swagger object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject +// +// TODO(ivucica): document fields +message Swagger { + string swagger = 1; + Info info = 2; + string host = 3; + string base_path = 4; + enum SwaggerScheme { + UNKNOWN = 0; + HTTP = 1; + HTTPS = 2; + WS = 3; + WSS = 4; + } + repeated SwaggerScheme schemes = 5; + repeated string consumes = 6; + repeated string produces = 7; + // field 8 is reserved for 'paths'. + reserved 8; + // field 9 is reserved for 'definitions', which at this time are already + // exposed as and customizable as proto messages. + reserved 9; + // field 10 is reserved for 'responses'. + reserved 10; + // field 11 is reserved for 'securityDefinitions'. + reserved 11; + // field 12 is reserved for repeated 'security'. + reserved 12; + // field 13 is reserved for 'tags', which are supposed to be exposed as and + // customizable as proto services. TODO(ivucica): add processing of proto + // service objects into OpenAPI v2 Tag objects. + reserved 13; + ExternalDocumentation external_docs = 14; +} + +// `Operation` is a representation of OpenAPI v2 specification's Operation object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject +// +// TODO(ivucica): document fields +message Operation { + repeated string tags = 1; + string summary = 2; + string description = 3; + ExternalDocumentation external_docs = 4; + string operation_id = 5; + repeated string consumes = 6; + repeated string produces = 7; + // field 8 is reserved for 'parameters'. + reserved 8; + // field 9 is reserved for 'responses'. + reserved 9; + repeated string schemes = 10; + bool deprecated = 11; + // field 12 is reserved for 'security'. + reserved 12; + +} + +// `Info` is a representation of OpenAPI v2 specification's Info object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject +// +// TODO(ivucica): document fields +message Info { + string title = 1; + string description = 2; + string terms_of_service = 3; + Contact contact = 4; + // field 5 is reserved for 'license'. + reserved 5; + string version = 6; +} + +// `Contact` is a representation of OpenAPI v2 specification's Contact object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject +// +// TODO(ivucica): document fields +message Contact { + string name = 1; + string url = 2; + string email = 3; +} + +// `ExternalDocumentation` is a representation of OpenAPI v2 specification's +// ExternalDocumentation object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#externalDocumentationObject +// +// TODO(ivucica): document fields +message ExternalDocumentation { + string description = 1; + string url = 2; +} + +// `Schema` is a representation of OpenAPI v2 specification's Schema object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject +// +// TODO(ivucica): document fields +message Schema { + JSONSchema json_schema = 1; + string discriminator = 2; + bool read_only = 3; + // field 4 is reserved for 'xml'. + reserved 4; + ExternalDocumentation external_docs = 5; + google.protobuf.Any example = 6; +} + +// `JSONSchema` represents properties from JSON Schema taken, and as used, in +// the OpenAPI v2 spec. +// +// This includes changes made by OpenAPI v2. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject +// +// See also: https://cswr.github.io/JsonSchema/spec/basic_types/, +// https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json +// +// TODO(ivucica): document fields +message JSONSchema { + // field 1 is reserved for '$id', omitted from OpenAPI v2. + reserved 1; + // field 2 is reserved for '$schema', omitted from OpenAPI v2. + reserved 2; + // field 3 is reserved for '$ref', although it is unclear how it would be used. + reserved 3; + // field 4 is reserved for '$comment', omitted from OpenAPI v2. + reserved 4; + string title = 5; + string description = 6; + string default = 7; + // field 8 is reserved for 'readOnly', which has an OpenAPI v2-specific meaning and is defined there. + reserved 8; + // field 9 is reserved for 'examples', which is omitted from OpenAPI v2 in favor of 'example' field. + reserved 9; + double multiple_of = 10; + double maximum = 11; + bool exclusive_maximum = 12; + double minimum = 13; + bool exclusive_minimum = 14; + uint64 max_length = 15; + uint64 min_length = 16; + string pattern = 17; + // field 18 is reserved for 'additionalItems', omitted from OpenAPI v2. + reserved 18; + // field 19 is reserved for 'items', but in OpenAPI-specific way. TODO(ivucica): add 'items'? + reserved 19; + uint64 max_items = 20; + uint64 min_items = 21; + bool unique_items = 22; + // field 23 is reserved for 'contains', omitted from OpenAPI v2. + reserved 23; + uint64 max_properties = 24; + uint64 min_properties = 25; + repeated string required = 26; + // field 27 is reserved for 'additionalProperties', but in OpenAPI-specific way. TODO(ivucica): add 'additionalProperties'? + reserved 27; + // field 28 is reserved for 'definitions', omitted from OpenAPI v2. + reserved 28; + // field 29 is reserved for 'properties', but in OpenAPI-specific way. TODO(ivucica): add 'additionalProperties'? + reserved 29; + // following fields are reserved, as the properties have been omitted from OpenAPI v2: + // patternProperties, dependencies, propertyNames, const + reserved 30 to 33; + // Items in 'array' must be unique. + repeated string array = 34; + + enum JSONSchemaSimpleTypes { + UNKNOWN = 0; + ARRAY = 1; + BOOLEAN = 2; + INTEGER = 3; + NULL = 4; + NUMBER = 5; + OBJECT = 6; + STRING = 7; + } + + repeated JSONSchemaSimpleTypes type = 35; + // following fields are reserved, as the properties have been omitted from OpenAPI v2: + // format, contentMediaType, contentEncoding, if, then, else + reserved 36 to 41; + // field 42 is reserved for 'allOf', but in OpenAPI-specific way. TODO(ivucica): add 'allOf'? + reserved 42; + // following fields are reserved, as the properties have been omitted from OpenAPI v2: + // anyOf, oneOf, not + reserved 43 to 45; +} + +// `Tag` is a representation of OpenAPI v2 specification's Tag object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject +// +// TODO(ivucica): document fields +message Tag { + // field 1 is reserved for 'name'. In our generator, this is (to be) extracted + // from the name of proto service, and thus not exposed to the user, as + // changing tag object's name would break the link to the references to the + // tag in individual operation specifications. + // + // TODO(ivucica): Add 'name' property. Use it to allow override of the name of + // global Tag object, then use that name to reference the tag throughout the + // Swagger file. + reserved 1; + // TODO(ivucica): Description should be extracted from comments on the proto + // service object. + string description = 2; + ExternalDocumentation external_docs = 3; +} From f59b980a6d127022d1e4b489bfff01c195b980c0 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 8 Nov 2017 03:39:50 +0100 Subject: [PATCH 164/552] protoc-gen-grpc-gateway: flip request_context default to true (#474) Follow up to #473. Signed-off-by: Stephan Renatus --- .travis.yml | 2 +- .../examplepb/a_bit_of_everything.pb.gw.go | 22 ++++---- examples/examplepb/echo_service.pb.gw.go | 6 +-- examples/examplepb/flow_combination.pb.gw.go | 52 +++++++++---------- examples/examplepb/stream.pb.gw.go | 6 +-- protoc-gen-grpc-gateway/main.go | 2 +- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9ca6f5d7020..eea6dd82026 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,4 +35,4 @@ env: - "PATH=$PATH:$HOME/local/bin" matrix: - GATEWAY_PLUGIN_FLAGS= - - GATEWAY_PLUGIN_FLAGS=request_context=true + - GATEWAY_PLUGIN_FLAGS=request_context=false diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index c62dbd038f6..25885abd8ef 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -489,7 +489,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ABitOfEverythingServiceClient) error { mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -518,7 +518,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) mux.Handle("POST", pattern_ABitOfEverythingService_CreateBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -547,7 +547,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) mux.Handle("GET", pattern_ABitOfEverythingService_Lookup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -576,7 +576,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) mux.Handle("PUT", pattern_ABitOfEverythingService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -605,7 +605,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) mux.Handle("DELETE", pattern_ABitOfEverythingService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -634,7 +634,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) mux.Handle("GET", pattern_ABitOfEverythingService_GetQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -663,7 +663,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) mux.Handle("GET", pattern_ABitOfEverythingService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -692,7 +692,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) mux.Handle("POST", pattern_ABitOfEverythingService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -721,7 +721,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) mux.Handle("GET", pattern_ABitOfEverythingService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -750,7 +750,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) mux.Handle("POST", pattern_ABitOfEverythingService_DeepPathEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -779,7 +779,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) mux.Handle("GET", pattern_ABitOfEverythingService_Timeout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 100b0dd030d..654919e6599 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -153,7 +153,7 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoServiceClient) error { mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -182,7 +182,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) mux.Handle("GET", pattern_EchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -211,7 +211,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index a7b9e3b2d5c..2f868050aec 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -1024,7 +1024,7 @@ func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FlowCombinationClient) error { mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1053,7 +1053,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1082,7 +1082,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1111,7 +1111,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1140,7 +1140,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1169,7 +1169,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1198,7 +1198,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1227,7 +1227,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1256,7 +1256,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1285,7 +1285,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1314,7 +1314,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1343,7 +1343,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1372,7 +1372,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1401,7 +1401,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1430,7 +1430,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1459,7 +1459,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1488,7 +1488,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1517,7 +1517,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1546,7 +1546,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1575,7 +1575,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1604,7 +1604,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1633,7 +1633,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1662,7 +1662,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1691,7 +1691,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1720,7 +1720,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -1749,7 +1749,7 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index 91a9065f4bd..3ef9faacd62 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -179,7 +179,7 @@ func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, co func RegisterStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client StreamServiceClient) error { mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -208,7 +208,7 @@ func RegisterStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeM }) mux.Handle("GET", pattern_StreamService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { @@ -237,7 +237,7 @@ func RegisterStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeM }) mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index cf365f249e1..917f5cf6d9b 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -24,7 +24,7 @@ import ( var ( importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") - useRequestContext = flag.Bool("request_context", false, "determine whether to use http.Request's context or not") + useRequestContext = flag.Bool("request_context", true, "determine whether to use http.Request's context or not") allowDeleteBody = flag.Bool("allow_delete_body", false, "unless set, HTTP DELETE methods may not have a body") ) From e32ac8132068848df232801d57fdee9fb31a0092 Mon Sep 17 00:00:00 2001 From: Gorka Lerchundi Osa Date: Wed, 8 Nov 2017 21:29:01 +0100 Subject: [PATCH 165/552] grpc-gateway/generator: respect full package (#462) If you provide a go_package, your wishes will be reflected in the grpc-gateway output. --- .../gengateway/generator.go | 3 + .../gengateway/generator_test.go | 79 +++++++++++++++++-- 2 files changed, 75 insertions(+), 7 deletions(-) diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index d08609bc729..cb2f5e14a9f 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -78,6 +78,9 @@ func (g *generator) Generate(targets []*descriptor.File) ([]*plugin.CodeGenerato return nil, err } name := file.GetName() + if file.GoPkg.Path != "" { + name = fmt.Sprintf("%s/%s", file.GoPkg.Path, filepath.Base(name)) + } ext := filepath.Ext(name) base := strings.TrimSuffix(name, ext) output := fmt.Sprintf("%s.pb.gw.go", base) diff --git a/protoc-gen-grpc-gateway/gengateway/generator_test.go b/protoc-gen-grpc-gateway/gengateway/generator_test.go index 755a09236e2..986ff4151e5 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator_test.go +++ b/protoc-gen-grpc-gateway/gengateway/generator_test.go @@ -1,6 +1,7 @@ package gengateway import ( + "path/filepath" "strings" "testing" @@ -9,7 +10,16 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) -func TestGenerateServiceWithoutBindings(t *testing.T) { +func newExampleFileDescriptor() *descriptor.File { + return newExampleFileDescriptorWithGoPkg( + &descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + ) +} + +func newExampleFileDescriptorWithGoPkg(gp *descriptor.GoPackage) *descriptor.File { msgdesc := &protodescriptor.DescriptorProto{ Name: proto.String("ExampleMessage"), } @@ -39,7 +49,7 @@ func TestGenerateServiceWithoutBindings(t *testing.T) { Name: proto.String("ExampleService"), Method: []*protodescriptor.MethodDescriptorProto{meth, meth1}, } - file := descriptor.File{ + return &descriptor.File{ FileDescriptorProto: &protodescriptor.FileDescriptorProto{ Name: proto.String("example.proto"), Package: proto.String("example"), @@ -47,10 +57,7 @@ func TestGenerateServiceWithoutBindings(t *testing.T) { MessageType: []*protodescriptor.DescriptorProto{msgdesc}, Service: []*protodescriptor.ServiceDescriptorProto{svc}, }, - GoPkg: descriptor.GoPackage{ - Path: "example.com/path/to/example/example.pb", - Name: "example_pb", - }, + GoPkg: *gp, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { @@ -76,8 +83,12 @@ func TestGenerateServiceWithoutBindings(t *testing.T) { }, }, } +} + +func TestGenerateServiceWithoutBindings(t *testing.T) { + file := newExampleFileDescriptor() g := &generator{} - got, err := g.generate(crossLinkFixture(&file)) + got, err := g.generate(crossLinkFixture(file)) if err != nil { t.Errorf("generate(%#v) failed with %v; want success", file, err) return @@ -86,3 +97,57 @@ func TestGenerateServiceWithoutBindings(t *testing.T) { t.Errorf("generate(%#v) = %s; does not want to contain %s", file, got, notwanted) } } + +func TestGenerateOutputPath(t *testing.T) { + cases := []struct { + file *descriptor.File + expected string + }{ + { + file: newExampleFileDescriptorWithGoPkg( + &descriptor.GoPackage{ + Path: "example.com/path/to/example", + Name: "example_pb", + }, + ), + expected: "example.com/path/to/example", + }, + { + file: newExampleFileDescriptorWithGoPkg( + &descriptor.GoPackage{ + Path: "example", + Name: "example_pb", + }, + ), + expected: "example", + }, + } + + g := &generator{} + for _, c := range cases { + file := c.file + gots, err := g.Generate([]*descriptor.File{crossLinkFixture(file)}) + if err != nil { + t.Errorf("Generate(%#v) failed with %v; wants success", file, err) + return + } + + if len(gots) != 1 { + t.Errorf("Generate(%#v) failed; expects on result got %d", file, len(gots)) + return + } + + got := gots[0] + if got.Name == nil { + t.Errorf("Generate(%#v) failed; expects non-nil Name(%v)", file, got.Name) + return + } + + gotPath := filepath.Dir(*got.Name) + expectedPath := c.expected + if gotPath != expectedPath { + t.Errorf("Generate(%#v) failed; got path: %s expected path: %s", file, gotPath, expectedPath) + return + } + } +} From 5d31793d6048a36ff5fc00c4310088503ca2d7d8 Mon Sep 17 00:00:00 2001 From: Matthew Dolan Date: Wed, 15 Nov 2017 19:10:28 -0800 Subject: [PATCH 166/552] Add proto marshaller for proto-over-http (#459) --- .gitignore | 1 + runtime/marshal_proto.go | 62 ++++++++++++++++++++++++ runtime/marshal_proto_test.go | 91 +++++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 runtime/marshal_proto.go create mode 100644 runtime/marshal_proto_test.go diff --git a/.gitignore b/.gitignore index 88ddcdf4d4d..eb15433281d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ _output/ +.idea diff --git a/runtime/marshal_proto.go b/runtime/marshal_proto.go new file mode 100644 index 00000000000..f65d1a2676b --- /dev/null +++ b/runtime/marshal_proto.go @@ -0,0 +1,62 @@ +package runtime + +import ( + "io" + + "errors" + "github.com/golang/protobuf/proto" + "io/ioutil" +) + +// ProtoMarshaller is a Marshaller which marshals/unmarshals into/from serialize proto bytes +type ProtoMarshaller struct{} + +// ContentType always returns "application/octet-stream". +func (*ProtoMarshaller) ContentType() string { + return "application/octet-stream" +} + +// Marshal marshals "value" into Proto +func (*ProtoMarshaller) Marshal(value interface{}) ([]byte, error) { + message, ok := value.(proto.Message) + if !ok { + return nil, errors.New("unable to marshal non proto field") + } + return proto.Marshal(message) +} + +// Unmarshal unmarshals proto "data" into "value" +func (*ProtoMarshaller) Unmarshal(data []byte, value interface{}) error { + message, ok := value.(proto.Message) + if !ok { + return errors.New("unable to unmarshal non proto field") + } + return proto.Unmarshal(data, message) +} + +// NewDecoder returns a Decoder which reads proto stream from "reader". +func (marshaller *ProtoMarshaller) NewDecoder(reader io.Reader) Decoder { + return DecoderFunc(func(value interface{}) error { + buffer, err := ioutil.ReadAll(reader) + if err != nil { + return err + } + return marshaller.Unmarshal(buffer, value) + }) +} + +// NewEncoder returns an Encoder which writes proto stream into "writer". +func (marshaller *ProtoMarshaller) NewEncoder(writer io.Writer) Encoder { + return EncoderFunc(func(value interface{}) error { + buffer, err := marshaller.Marshal(value) + if err != nil { + return err + } + _, err = writer.Write(buffer) + if err != nil { + return err + } + + return nil + }) +} diff --git a/runtime/marshal_proto_test.go b/runtime/marshal_proto_test.go new file mode 100644 index 00000000000..07dac47bd5c --- /dev/null +++ b/runtime/marshal_proto_test.go @@ -0,0 +1,91 @@ +package runtime_test + +import ( + "reflect" + "testing" + + "bytes" + "github.com/golang/protobuf/ptypes/timestamp" + "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" +) + +var message = &examplepb.ABitOfEverything{ + SingleNested: &examplepb.ABitOfEverything_Nested{}, + RepeatedStringValue: nil, + MappedStringValue: nil, + MappedNestedValue: nil, + RepeatedEnumValue: nil, + TimestampValue: ×tamp.Timestamp{}, + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + Nested: []*examplepb.ABitOfEverything_Nested{ + { + Name: "foo", + Amount: 12345, + }, + }, + Uint64Value: 0xFFFFFFFFFFFFFFFF, + EnumValue: examplepb.NumericEnum_ONE, + OneofValue: &examplepb.ABitOfEverything_OneofString{ + OneofString: "bar", + }, + MapValue: map[string]examplepb.NumericEnum{ + "a": examplepb.NumericEnum_ONE, + "b": examplepb.NumericEnum_ZERO, + }, +} + +func TestProtoMarshalUnmarshal(t *testing.T) { + marshaller := runtime.ProtoMarshaller{} + + // Marshal + buffer, err := marshaller.Marshal(message) + if err != nil { + t.Fatalf("Marshalling returned error: %s", err.Error()) + } + + // Unmarshal + unmarshalled := &examplepb.ABitOfEverything{} + err = marshaller.Unmarshal(buffer, unmarshalled) + if err != nil { + t.Fatalf("Unmarshalling returned error: %s", err.Error()) + } + + if !reflect.DeepEqual(unmarshalled, message) { + t.Errorf( + "Unmarshalled didn't match original message: (original = %v) != (unmarshalled = %v)", + unmarshalled, + message, + ) + } +} + +func TestProtoEncoderDecodert(t *testing.T) { + marshaller := runtime.ProtoMarshaller{} + + var buf bytes.Buffer + + encoder := marshaller.NewEncoder(&buf) + decoder := marshaller.NewDecoder(&buf) + + // Encode + err := encoder.Encode(message) + if err != nil { + t.Fatalf("Encoding returned error: %s", err.Error()) + } + + // Decode + unencoded := &examplepb.ABitOfEverything{} + err = decoder.Decode(unencoded) + if err != nil { + t.Fatalf("Unmarshalling returned error: %s", err.Error()) + } + + if !reflect.DeepEqual(unencoded, message) { + t.Errorf( + "Unencoded didn't match original message: (original = %v) != (unencoded = %v)", + unencoded, + message, + ) + } +} From c6b4148dcdb426adc1aef7aa7d79ced3d3f332bc Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Tue, 7 Nov 2017 15:43:22 +0000 Subject: [PATCH 167/552] runtime: stream errors forwarding --- runtime/handler.go | 23 +++++--- runtime/handler_test.go | 116 ++++++++++++++++++++++++++-------------- 2 files changed, 92 insertions(+), 47 deletions(-) diff --git a/runtime/handler.go b/runtime/handler.go index ae6a5d551cf..38bd516a024 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -34,34 +34,36 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal w.Header().Set("Transfer-Encoding", "chunked") w.Header().Set("Content-Type", marshaler.ContentType()) if err := handleForwardResponseOptions(ctx, w, nil, opts); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) + HTTPError(ctx, mux, marshaler, w, req, err) return } - w.WriteHeader(http.StatusOK) - f.Flush() + + var wroteHeader bool for { resp, err := recv() if err == io.EOF { return } if err != nil { - handleForwardResponseStreamError(marshaler, w, err) + handleForwardResponseStreamError(wroteHeader, marshaler, w, err) return } if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { - handleForwardResponseStreamError(marshaler, w, err) + handleForwardResponseStreamError(wroteHeader, marshaler, w, err) return } buf, err := marshaler.Marshal(streamChunk(resp, nil)) if err != nil { grpclog.Printf("Failed to marshal response chunk: %v", err) + handleForwardResponseStreamError(wroteHeader, marshaler, w, err) return } if _, err = w.Write(buf); err != nil { grpclog.Printf("Failed to send response chunk: %v", err) return } + wroteHeader = true f.Flush() } } @@ -134,13 +136,20 @@ func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, re return nil } -func handleForwardResponseStreamError(marshaler Marshaler, w http.ResponseWriter, err error) { +func handleForwardResponseStreamError(wroteHeader bool, marshaler Marshaler, w http.ResponseWriter, err error) { buf, merr := marshaler.Marshal(streamChunk(nil, err)) if merr != nil { grpclog.Printf("Failed to marshal an error: %v", merr) return } - if _, werr := fmt.Fprintf(w, "%s\n", buf); werr != nil { + if !wroteHeader { + s, ok := status.FromError(err) + if !ok { + s = status.New(codes.Unknown, err.Error()) + } + w.WriteHeader(HTTPStatusFromCode(s.Code())) + } + if _, werr := w.Write(buf); werr != nil { grpclog.Printf("Failed to notify error to client: %v", werr) return } diff --git a/runtime/handler_test.go b/runtime/handler_test.go index 8c61ee1510a..d63948cdd9f 100644 --- a/runtime/handler_test.go +++ b/runtime/handler_test.go @@ -11,57 +11,93 @@ import ( pb "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "github.com/grpc-ecosystem/grpc-gateway/runtime" "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" ) func TestForwardResponseStream(t *testing.T) { - var ( - msgs = []proto.Message{ - &pb.SimpleMessage{Id: "One"}, - &pb.SimpleMessage{Id: "Two"}, - } + type msg struct { + pb proto.Message + err error + } + tests := []struct { + name string + msgs []msg + statusCode int + }{{ + name: "encoding", + msgs: []msg{ + {&pb.SimpleMessage{Id: "One"}, nil}, + {&pb.SimpleMessage{Id: "Two"}, nil}, + }, + statusCode: http.StatusOK, + }, { + name: "empty", + statusCode: http.StatusOK, + }, { + name: "error", + msgs: []msg{{nil, grpc.Errorf(codes.OutOfRange, "400")}}, + statusCode: http.StatusBadRequest, + }, { + name: "stream_error", + msgs: []msg{ + {&pb.SimpleMessage{Id: "One"}, nil}, + {nil, grpc.Errorf(codes.OutOfRange, "400")}, + }, + statusCode: http.StatusOK, + }} - ctx = runtime.NewServerMetadataContext( - context.Background(), runtime.ServerMetadata{}, - ) - mux = runtime.NewServeMux() - marshaler = &runtime.JSONPb{} - req = httptest.NewRequest("GET", "http://example.com/foo", nil) - resp = httptest.NewRecorder() - count = 0 - recv = func() (proto.Message, error) { - if count >= len(msgs) { + newTestRecv := func(t *testing.T, msgs []msg) func() (proto.Message, error) { + var count int + return func() (proto.Message, error) { + if count == len(msgs) { return nil, io.EOF + } else if count > len(msgs) { + t.Errorf("recv() called %d times for %d messages", count, len(msgs)) } count++ - return msgs[count-1], nil + msg := msgs[count-1] + return msg.pb, msg.err } - ) + } + ctx := runtime.NewServerMetadataContext(context.Background(), runtime.ServerMetadata{}) + marshaler := &runtime.JSONPb{} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + recv := newTestRecv(t, tt.msgs) + req := httptest.NewRequest("GET", "http://example.com/foo", nil) + resp := httptest.NewRecorder() - runtime.ForwardResponseStream(ctx, mux, marshaler, resp, req, recv) + runtime.ForwardResponseStream(ctx, runtime.NewServeMux(), marshaler, resp, req, recv) - w := resp.Result() - if w.StatusCode != http.StatusOK { - t.Errorf(" got %d want %d", w.StatusCode, http.StatusOK) - } - if h := w.Header.Get("Transfer-Encoding"); h != "chunked" { - t.Errorf("ForwardResponseStream missing header chunked") - } - body, err := ioutil.ReadAll(w.Body) - if err != nil { - t.Errorf("Failed to read response body with %v", err) - } - w.Body.Close() + w := resp.Result() + if w.StatusCode != tt.statusCode { + t.Errorf("StatusCode %d want %d", w.StatusCode, tt.statusCode) + } + if h := w.Header.Get("Transfer-Encoding"); h != "chunked" { + t.Errorf("ForwardResponseStream missing header chunked") + } + body, err := ioutil.ReadAll(w.Body) + if err != nil { + t.Errorf("Failed to read response body with %v", err) + } + w.Body.Close() - var want []byte - for _, msg := range msgs { - b, err := marshaler.Marshal(map[string]proto.Message{"result": msg}) - if err != nil { - t.Errorf("marshaler.Marshal() failed %v", err) - } - want = append(want, b...) - } + var want []byte + for _, msg := range tt.msgs { + if msg.err != nil { + t.Skip("checking erorr encodings") + } + b, err := marshaler.Marshal(map[string]proto.Message{"result": msg.pb}) + if err != nil { + t.Errorf("marshaler.Marshal() failed %v", err) + } + want = append(want, b...) + } - if string(body) != string(want) { - t.Errorf("ForwardResponseStream() = \"%s\" want \"%s\"", body, want) + if string(body) != string(want) { + t.Errorf("ForwardResponseStream() = \"%s\" want \"%s\"", body, want) + } + }) } } From 69e097e7a5ee5d8bea5923c769b90eb430c54f28 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Sun, 26 Nov 2017 11:57:40 -0800 Subject: [PATCH 168/552] runtime: marshal custom stream delimiters --- runtime/handler.go | 9 +++++++++ runtime/handler_test.go | 1 + runtime/marshal_json.go | 5 +++++ runtime/marshal_jsonpb.go | 5 +++++ runtime/marshaler.go | 6 ++++++ 5 files changed, 26 insertions(+) diff --git a/runtime/handler.go b/runtime/handler.go index 38bd516a024..cdf5510d247 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -38,6 +38,11 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal return } + var delimiter []byte + if d, ok := marshaler.(Delimited); ok { + delimiter = d.Delimiter() + } + var wroteHeader bool for { resp, err := recv() @@ -64,6 +69,10 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal return } wroteHeader = true + if _, err = w.Write(delimiter); err != nil { + grpclog.Printf("Failed to send delimiter chunk: %v", err) + return + } f.Flush() } } diff --git a/runtime/handler_test.go b/runtime/handler_test.go index d63948cdd9f..344521c8a9c 100644 --- a/runtime/handler_test.go +++ b/runtime/handler_test.go @@ -93,6 +93,7 @@ func TestForwardResponseStream(t *testing.T) { t.Errorf("marshaler.Marshal() failed %v", err) } want = append(want, b...) + want = append(want, marshaler.Delimiter()...) } if string(body) != string(want) { diff --git a/runtime/marshal_json.go b/runtime/marshal_json.go index 0acd2ca29ef..b3a21418be4 100644 --- a/runtime/marshal_json.go +++ b/runtime/marshal_json.go @@ -35,3 +35,8 @@ func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder { func (j *JSONBuiltin) NewEncoder(w io.Writer) Encoder { return json.NewEncoder(w) } + +// Delimiter for newline encoded JSON streams. +func (j *JSONBuiltin) Delimiter() []byte { + return []byte("\n") +} diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index 49f13f7fc74..d42cc593e51 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -182,3 +182,8 @@ type protoEnum interface { } var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem() + +// Delimiter for newline encoded JSON streams. +func (j *JSONPb) Delimiter() []byte { + return []byte("\n") +} diff --git a/runtime/marshaler.go b/runtime/marshaler.go index 6d434f13cb4..98fe6e88ac5 100644 --- a/runtime/marshaler.go +++ b/runtime/marshaler.go @@ -40,3 +40,9 @@ type EncoderFunc func(v interface{}) error // Encode delegates invocations to the underlying function itself. func (f EncoderFunc) Encode(v interface{}) error { return f(v) } + +// Delimited defines the streaming delimiter. +type Delimited interface { + // Delimiter returns the record seperator for the stream. + Delimiter() []byte +} From 1b9e3beefa54cc3b996bdb9d67eb3f24024001f9 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 28 May 2017 18:13:32 -0700 Subject: [PATCH 169/552] improve WKT handling in gateway and openapi output --- .../descriptor/services.go | 7 ++++- protoc-gen-grpc-gateway/descriptor/types.go | 14 ++++++++++ protoc-gen-swagger/genswagger/template.go | 27 ++++++++++++++----- runtime/convert.go | 18 +++++++++++++ 4 files changed, 59 insertions(+), 7 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index c9dfec8e040..a62bd06fe16 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -194,7 +194,12 @@ func (r *Registry) newParam(meth *Method, path string) (Parameter, error) { target := fields[l-1].Target switch target.GetType() { case descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_GROUP: - return Parameter{}, fmt.Errorf("aggregate type %s in parameter of %s.%s: %s", target.Type, meth.Service.GetName(), meth.GetName(), path) + glog.V(2).Infoln("found aggregate type:", target, target.TypeName) + if IsWellKnownType(*target.TypeName) { + glog.V(2).Infoln("found well known aggregate type:", target) + } else { + return Parameter{}, fmt.Errorf("aggregate type %s in parameter of %s.%s: %s", target.Type, meth.Service.GetName(), meth.GetName(), path) + } } return Parameter{ FieldPath: FieldPath(fields), diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index 248538e7bad..c24bd61c890 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -9,6 +9,12 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) +// IsWellKnownType returns true if the provided fully qualified type name is considered 'well-known'. +func IsWellKnownType(typeName string) bool { + _, ok := wellKnownTypeConv[typeName] + return ok +} + // GoPackage represents a golang package type GoPackage struct { // Path is the package path to the package. @@ -194,6 +200,9 @@ func (p Parameter) ConvertFuncExpr() (string, error) { } typ := p.Target.GetType() conv, ok := tbl[typ] + if !ok { + conv, ok = wellKnownTypeConv[p.Target.GetTypeName()] + } if !ok { return "", fmt.Errorf("unsupported field type %s of parameter %s in %s.%s", typ, p.FieldPath, p.Method.Service.GetName(), p.Method.GetName()) } @@ -319,4 +328,9 @@ var ( descriptor.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32P", descriptor.FieldDescriptorProto_TYPE_SINT64: "runtime.Int64P", } + + wellKnownTypeConv = map[string]string{ + ".google.protobuf.Timestamp": "runtime.Timestamp", + ".google.protobuf.Duration": "runtime.Duration", + } ) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 5bd1c3f9328..bf671963efe 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -17,6 +17,16 @@ import ( swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) +var wktSchemas = map[string]schemaCore{ + ".google.protobuf.Timestamp": schemaCore{ + Type: "string", + Format: "date-time", + }, + ".google.protobuf.Duration": schemaCore{ + Type: "string", + }, +} + func listEnumNames(enum *descriptor.Enum) (names []string) { for _, value := range enum.GetValue() { names = append(names, value.GetName()) @@ -165,6 +175,8 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, switch name { case ".google.protobuf.Timestamp": continue + case ".google.protobuf.Duration": + continue } if opt := msg.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { continue @@ -236,11 +248,8 @@ func schemaOfField(f *descriptor.Field, reg *descriptor.Registry) swaggerSchemaO switch ft := fd.GetType(); ft { case pbdescriptor.FieldDescriptorProto_TYPE_ENUM, pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE, pbdescriptor.FieldDescriptorProto_TYPE_GROUP: - if fd.GetTypeName() == ".google.protobuf.Timestamp" && pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE == ft { - core = schemaCore{ - Type: "string", - Format: "date-time", - } + if wktSchema, ok := wktSchemas[fd.GetTypeName()]; ok { + core = wktSchema } else { core = schemaCore{ Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(fd.GetTypeName(), reg), @@ -481,7 +490,13 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re var paramType, paramFormat string switch pt := parameter.Target.GetType(); pt { case pbdescriptor.FieldDescriptorProto_TYPE_GROUP, pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE: - return fmt.Errorf("only primitive types are allowed in path parameters") + if descriptor.IsWellKnownType(parameter.Target.GetTypeName()) { + schema := schemaOfField(parameter.Target, reg) + paramType = schema.Type + paramFormat = schema.Format + } else { + return fmt.Errorf("only primitive and well-known types are allowed in path parameters") + } case pbdescriptor.FieldDescriptorProto_TYPE_ENUM: paramType = fullyQualifiedNameToSwaggerName(parameter.Target.GetTypeName(), reg) paramFormat = "" diff --git a/runtime/convert.go b/runtime/convert.go index 1af5cc4ebdd..eb6893b58bc 100644 --- a/runtime/convert.go +++ b/runtime/convert.go @@ -2,6 +2,10 @@ package runtime import ( "strconv" + + "github.com/gogo/protobuf/jsonpb" + "github.com/golang/protobuf/ptypes/duration" + "github.com/golang/protobuf/ptypes/timestamp" ) // String just returns the given string. @@ -56,3 +60,17 @@ func Uint32(val string) (uint32, error) { } return uint32(i), nil } + +// Timestamp converts the given RFC3339 formatted string into a timestamp.Timestamp. +func Timestamp(val string) (*timestamp.Timestamp, error) { + var r *timestamp.Timestamp + err := jsonpb.UnmarshalString(val, r) + return r, err +} + +// Duration converts the given string into a timestamp.Duration. +func Duration(val string) (*duration.Duration, error) { + var r *duration.Duration + err := jsonpb.UnmarshalString(val, r) + return r, err +} From 945beb453f53c86312e46e585045ae3e361df37c Mon Sep 17 00:00:00 2001 From: Shouichi Kamiya Date: Wed, 6 Dec 2017 14:49:28 +0900 Subject: [PATCH 170/552] Use golang/protobuf instead of gogo/protobuf (#494) --- runtime/convert.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/convert.go b/runtime/convert.go index eb6893b58bc..f8931864100 100644 --- a/runtime/convert.go +++ b/runtime/convert.go @@ -3,7 +3,7 @@ package runtime import ( "strconv" - "github.com/gogo/protobuf/jsonpb" + "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/timestamp" ) From f28f5cd07e8ad75f19a84c72d3aee29658ca6780 Mon Sep 17 00:00:00 2001 From: Thomas Jackson Date: Thu, 7 Dec 2017 11:15:34 -0800 Subject: [PATCH 171/552] Maintain default delimiter of newline With the addition of the delimiter interface users can now override the delimiter in the stream. With this additional interface we want to maintain compatibility-- namely we want to continue using a newline in the event that the marshaler doesn't implement the new interface (for backwards compatibility). Fixes #495 --- runtime/handler.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/handler.go b/runtime/handler.go index cdf5510d247..1770b85344d 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -41,6 +41,8 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal var delimiter []byte if d, ok := marshaler.(Delimited); ok { delimiter = d.Delimiter() + } else { + delimiter = []byte("\n") } var wroteHeader bool From cd6ac5066efd99f14623905bdb92b18cfe1e6d42 Mon Sep 17 00:00:00 2001 From: Thomas Jackson Date: Thu, 7 Dec 2017 18:50:44 -0800 Subject: [PATCH 172/552] Add test for custom marshaler and chunked responses --- runtime/handler_test.go | 100 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/runtime/handler_test.go b/runtime/handler_test.go index 344521c8a9c..493aa5e5495 100644 --- a/runtime/handler_test.go +++ b/runtime/handler_test.go @@ -102,3 +102,103 @@ func TestForwardResponseStream(t *testing.T) { }) } } + + +// A custom marshaler implementation, that doesn't implement the delimited interface +type CustomMarshaler struct { + m *runtime.JSONPb +} +func (c *CustomMarshaler) Marshal(v interface{}) ([]byte, error) { return c.m.Marshal(v) } +func (c *CustomMarshaler) Unmarshal(data []byte, v interface{}) error { return c.m.Unmarshal(data, v) } +func (c *CustomMarshaler) NewDecoder(r io.Reader) runtime.Decoder { return c.m.NewDecoder(r) } +func (c *CustomMarshaler) NewEncoder(w io.Writer) runtime.Encoder { return c.m.NewEncoder(w) } +func (c *CustomMarshaler) ContentType() string { return c.m.ContentType() } + + +func TestForwardResponseStreamCustomMarshaler(t *testing.T) { + type msg struct { + pb proto.Message + err error + } + tests := []struct { + name string + msgs []msg + statusCode int + }{{ + name: "encoding", + msgs: []msg{ + {&pb.SimpleMessage{Id: "One"}, nil}, + {&pb.SimpleMessage{Id: "Two"}, nil}, + }, + statusCode: http.StatusOK, + }, { + name: "empty", + statusCode: http.StatusOK, + }, { + name: "error", + msgs: []msg{{nil, grpc.Errorf(codes.OutOfRange, "400")}}, + statusCode: http.StatusBadRequest, + }, { + name: "stream_error", + msgs: []msg{ + {&pb.SimpleMessage{Id: "One"}, nil}, + {nil, grpc.Errorf(codes.OutOfRange, "400")}, + }, + statusCode: http.StatusOK, + }} + + newTestRecv := func(t *testing.T, msgs []msg) func() (proto.Message, error) { + var count int + return func() (proto.Message, error) { + if count == len(msgs) { + return nil, io.EOF + } else if count > len(msgs) { + t.Errorf("recv() called %d times for %d messages", count, len(msgs)) + } + count++ + msg := msgs[count-1] + return msg.pb, msg.err + } + } + ctx := runtime.NewServerMetadataContext(context.Background(), runtime.ServerMetadata{}) + marshaler := &CustomMarshaler{&runtime.JSONPb{}} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + recv := newTestRecv(t, tt.msgs) + req := httptest.NewRequest("GET", "http://example.com/foo", nil) + resp := httptest.NewRecorder() + + runtime.ForwardResponseStream(ctx, runtime.NewServeMux(), marshaler, resp, req, recv) + + w := resp.Result() + if w.StatusCode != tt.statusCode { + t.Errorf("StatusCode %d want %d", w.StatusCode, tt.statusCode) + } + if h := w.Header.Get("Transfer-Encoding"); h != "chunked" { + t.Errorf("ForwardResponseStream missing header chunked") + } + body, err := ioutil.ReadAll(w.Body) + if err != nil { + t.Errorf("Failed to read response body with %v", err) + } + w.Body.Close() + + var want []byte + for _, msg := range tt.msgs { + if msg.err != nil { + t.Skip("checking erorr encodings") + } + b, err := marshaler.Marshal(map[string]proto.Message{"result": msg.pb}) + if err != nil { + t.Errorf("marshaler.Marshal() failed %v", err) + } + want = append(want, b...) + want = append(want, "\n"...) + } + + if string(body) != string(want) { + t.Errorf("ForwardResponseStream() = \"%s\" want \"%s\"", body, want) + } + }) + } +} From 6a715f61d5669b5ab1adf9046b3b356c6818c33e Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Wed, 20 Dec 2017 14:30:08 -0700 Subject: [PATCH 173/552] Add support for --Import_path (#507) Fixes: #443 --- protoc-gen-grpc-gateway/descriptor/registry.go | 13 +++++++++++++ protoc-gen-grpc-gateway/main.go | 2 ++ 2 files changed, 15 insertions(+) diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index 9e4f3428dd3..61d6eb9bc74 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -25,6 +25,9 @@ type Registry struct { // prefix is a prefix to be inserted to golang package paths generated from proto package names. prefix string + // importPath is used as the package if no input files declare go_package. If it contains slashes, everything up to the rightmost slash is ignored. + importPath string + // pkgMap is a user-specified mapping from file path to proto package. pkgMap map[string]string @@ -212,6 +215,13 @@ func (r *Registry) SetPrefix(prefix string) { r.prefix = prefix } +// SetImportPath registers the importPath which is used as the package if no +// input files declare go_package. If it contains slashes, everything up to the +// rightmost slash is ignored. +func (r *Registry) SetImportPath(importPath string) { + r.importPath = importPath +} + // ReserveGoPackageAlias reserves the unique alias of go package. // If succeeded, the alias will be never used for other packages in generated go files. // If failed, the alias is already taken by another package, so you need to use another @@ -237,6 +247,9 @@ func (r *Registry) goPackagePath(f *descriptor.FileDescriptorProto) string { } gopkg := f.Options.GetGoPackage() + if len(gopkg) == 0 { + gopkg = r.importPath + } idx := strings.LastIndex(gopkg, "/") if idx >= 0 { if sc := strings.LastIndex(gopkg, ";"); sc > 0 { diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 917f5cf6d9b..4b875d51b36 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -24,6 +24,7 @@ import ( var ( importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") + importPath = flag.String("import_path", "", "used as the package if no input files declare go_package. If it contains slashes, everything up to the rightmost slash is ignored.") useRequestContext = flag.Bool("request_context", true, "determine whether to use http.Request's context or not") allowDeleteBody = flag.Bool("allow_delete_body", false, "unless set, HTTP DELETE methods may not have a body") ) @@ -78,6 +79,7 @@ func main() { g := gengateway.New(reg, *useRequestContext) reg.SetPrefix(*importPrefix) + reg.SetImportPath(*importPath) reg.SetAllowDeleteBody(*allowDeleteBody) if err := reg.Load(req); err != nil { emitError(err) From cccb822540e6e48e9b6a9d75c46cb9648a345685 Mon Sep 17 00:00:00 2001 From: Stefan Warman Date: Sat, 23 Dec 2017 17:54:58 +0100 Subject: [PATCH 174/552] Fix to swagger generator to ensure all definitions are output for nested structs. (#505) --- .../abe/a_bit_of_everything_service_api.go | 64 ++++ examples/clients/abe/examplepb_body.go | 16 + examples/examplepb/a_bit_of_everything.pb.go | 282 +++++++++++------- .../examplepb/a_bit_of_everything.pb.gw.go | 64 ++++ examples/examplepb/a_bit_of_everything.proto | 16 + .../a_bit_of_everything.swagger.json | 40 +++ examples/examplepb/echo_service.pb.go | 2 + examples/server/a_bit_of_everything.go | 5 + protoc-gen-swagger/genswagger/template.go | 3 +- 9 files changed, 390 insertions(+), 102 deletions(-) create mode 100644 examples/clients/abe/examplepb_body.go diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index d66b34f54b2..a9cf948d7ae 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -501,6 +501,70 @@ func (a ABitOfEverythingServiceApi) Echo3(value string) (*SubStringMessage, *API return successPayload, localVarAPIResponse, err } +/** + * + * + * @param id + * @param body + * @return *ProtobufEmpty + */ +func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body ExamplepbBody) (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/withbody/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "GetMessageWithBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + /** * * diff --git a/examples/clients/abe/examplepb_body.go b/examples/clients/abe/examplepb_body.go new file mode 100644 index 00000000000..13f4c2dc1e1 --- /dev/null +++ b/examples/clients/abe/examplepb_body.go @@ -0,0 +1,16 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0 + * Contact: none@example.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +type ExamplepbBody struct { + + Name string `json:"name,omitempty"` +} diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 2727fba7b07..7ac85fc900d 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -429,9 +429,51 @@ func (m *ABitOfEverything_Nested) GetOk() ABitOfEverything_Nested_DeepEnum { return ABitOfEverything_Nested_FALSE } +type Body struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *Body) Reset() { *m = Body{} } +func (m *Body) String() string { return proto.CompactTextString(m) } +func (*Body) ProtoMessage() {} +func (*Body) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } + +func (m *Body) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type MessageWithBody struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Data *Body `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` +} + +func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } +func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } +func (*MessageWithBody) ProtoMessage() {} +func (*MessageWithBody) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } + +func (m *MessageWithBody) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *MessageWithBody) GetData() *Body { + if m != nil { + return m.Data + } + return nil +} + func init() { proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything") proto.RegisterType((*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.Nested") + proto.RegisterType((*Body)(nil), "grpc.gateway.examples.examplepb.Body") + proto.RegisterType((*MessageWithBody)(nil), "grpc.gateway.examples.examplepb.MessageWithBody") proto.RegisterEnum("grpc.gateway.examples.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) proto.RegisterEnum("grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value) } @@ -464,6 +506,7 @@ type ABitOfEverythingServiceClient interface { DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) NoBindings(ctx context.Context, in *google_protobuf2.Duration, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } type aBitOfEverythingServiceClient struct { @@ -564,6 +607,15 @@ func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *google_ return out, nil } +func (c *aBitOfEverythingServiceClient) GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetMessageWithBody", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for ABitOfEverythingService service type ABitOfEverythingServiceServer interface { @@ -584,6 +636,7 @@ type ABitOfEverythingServiceServer interface { DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) NoBindings(context.Context, *google_protobuf2.Duration) (*google_protobuf1.Empty, error) Timeout(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) + GetMessageWithBody(context.Context, *MessageWithBody) (*google_protobuf1.Empty, error) } func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingServiceServer) { @@ -770,6 +823,24 @@ func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_GetMessageWithBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MessageWithBody) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).GetMessageWithBody(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetMessageWithBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).GetMessageWithBody(ctx, req.(*MessageWithBody)) + } + return interceptor(ctx, in, info, handler) +} + var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.examplepb.ABitOfEverythingService", HandlerType: (*ABitOfEverythingServiceServer)(nil), @@ -814,6 +885,10 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "Timeout", Handler: _ABitOfEverythingService_Timeout_Handler, }, + { + MethodName: "GetMessageWithBody", + Handler: _ABitOfEverythingService_GetMessageWithBody_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/examplepb/a_bit_of_everything.proto", @@ -886,105 +961,110 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1590 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xcf, 0xd8, 0x89, 0x13, 0x8f, 0xf3, 0xc3, 0x99, 0xb4, 0xa9, 0xeb, 0xe6, 0xfb, 0xcd, 0xd4, - 0x2d, 0x68, 0x15, 0xe2, 0x5d, 0xe2, 0x56, 0xa8, 0xb5, 0x04, 0xc5, 0x49, 0xdc, 0x1f, 0xa2, 0x4d, - 0xdb, 0xed, 0x0f, 0xaa, 0xd0, 0x12, 0xad, 0xed, 0xb1, 0xbd, 0x8d, 0x77, 0x67, 0xd9, 0x9d, 0x4d, - 0x63, 0x19, 0x73, 0xe0, 0x80, 0xd4, 0x6b, 0xb8, 0x21, 0xd1, 0x0b, 0x12, 0x02, 0x09, 0x8e, 0x9c, - 0x38, 0x70, 0xe7, 0xca, 0x5f, 0x80, 0xc4, 0x1f, 0x82, 0x76, 0x66, 0x77, 0xb3, 0xb6, 0x63, 0xa5, - 0x4e, 0x51, 0x4f, 0xde, 0x99, 0xf9, 0xbc, 0xcf, 0xe7, 0xbd, 0x37, 0xf3, 0xde, 0x8c, 0xe1, 0x2a, - 0xd9, 0xd7, 0x0c, 0xab, 0x45, 0x1c, 0xc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af, 0x65, 0x00, - 0x06, 0x52, 0x52, 0xe5, 0xdf, 0xe8, 0x1e, 0x4c, 0xf8, 0x5a, 0x31, 0x1c, 0x7f, 0x23, 0x2d, 0x9f, - 0x07, 0x2d, 0xc3, 0x54, 0xbd, 0x45, 0x35, 0xb6, 0xb3, 0xa7, 0xb5, 0x5c, 0x92, 0x89, 0x63, 0x20, - 0xc5, 0x54, 0xc8, 0xa7, 0x1e, 0x7b, 0x33, 0xe8, 0x3c, 0x9c, 0xae, 0x51, 0xb7, 0xd2, 0x22, 0x3e, - 0x62, 0x1c, 0x03, 0x09, 0xa8, 0x29, 0x31, 0x27, 0x20, 0xcb, 0x30, 0xa5, 0x9b, 0xec, 0x83, 0xcb, - 0x3e, 0x62, 0x02, 0x03, 0x29, 0xae, 0x42, 0x3e, 0x15, 0x72, 0xb8, 0x51, 0x44, 0x02, 0x03, 0x69, - 0x5c, 0x4d, 0xb9, 0x11, 0x88, 0xe0, 0xb8, 0x54, 0xf0, 0x11, 0x93, 0x18, 0x48, 0x13, 0x9c, 0xe3, - 0x52, 0x41, 0x00, 0x2e, 0xc0, 0x99, 0xba, 0xbe, 0x4f, 0x6a, 0x21, 0xc9, 0x14, 0x06, 0x52, 0x42, - 0x9d, 0xf6, 0x27, 0x7b, 0x41, 0x21, 0x4f, 0x12, 0x03, 0x69, 0xd2, 0x07, 0x05, 0x4c, 0xff, 0x83, - 0xb0, 0x42, 0x69, 0xcb, 0x47, 0x40, 0x0c, 0xa4, 0x29, 0x35, 0xe9, 0xcd, 0x84, 0xce, 0x3a, 0xcc, - 0xd6, 0xcd, 0x86, 0x0f, 0x48, 0xf1, 0xfc, 0xa7, 0xc4, 0x5c, 0x4f, 0x3c, 0xa1, 0xca, 0x0c, 0x06, - 0xd2, 0x8c, 0x88, 0x27, 0x10, 0xf9, 0x04, 0x42, 0x62, 0xba, 0x86, 0x0f, 0x98, 0xc5, 0x40, 0x9a, - 0x2d, 0xac, 0x1e, 0xbb, 0x5b, 0x5b, 0xae, 0x41, 0x6c, 0xbd, 0x5a, 0x36, 0x5d, 0x43, 0x4d, 0x7a, - 0xf6, 0x82, 0xec, 0x1d, 0x38, 0xeb, 0xf4, 0xc6, 0x35, 0x87, 0x81, 0x34, 0xa7, 0xce, 0x38, 0x3d, - 0x81, 0x85, 0xb0, 0x30, 0x47, 0x69, 0x0c, 0xa4, 0x74, 0x00, 0x8b, 0xec, 0x86, 0x13, 0xf5, 0x7e, - 0x1e, 0x03, 0x69, 0x5e, 0x4d, 0x39, 0x11, 0xef, 0x7d, 0x48, 0xc8, 0x83, 0x30, 0x90, 0x90, 0x80, - 0x04, 0x2c, 0x05, 0x78, 0xda, 0x26, 0x16, 0xd1, 0x18, 0xa9, 0xed, 0xf4, 0xe4, 0x6b, 0x01, 0xc7, - 0xa5, 0xa4, 0xba, 0x10, 0x2c, 0x3e, 0x88, 0xe4, 0xed, 0x2a, 0x4c, 0x51, 0x93, 0x78, 0x4d, 0xc6, - 0xeb, 0x01, 0x99, 0x53, 0xbc, 0x5e, 0x16, 0x65, 0x51, 0xab, 0x72, 0x50, 0xab, 0x72, 0xd9, 0x5b, - 0xbd, 0x39, 0xa6, 0x42, 0x0e, 0xe6, 0x23, 0x74, 0x01, 0x4e, 0x0b, 0x53, 0xa1, 0x95, 0x39, 0xed, - 0xed, 0xca, 0xcd, 0x31, 0x55, 0x10, 0x0a, 0x11, 0xf4, 0x14, 0x26, 0x0d, 0xcd, 0xf2, 0xfd, 0x58, - 0xe4, 0x15, 0x72, 0x6d, 0xf4, 0x0a, 0xb9, 0xa3, 0x59, 0xdc, 0xdd, 0xb2, 0xc9, 0xec, 0xb6, 0x3a, - 0x65, 0xf8, 0x43, 0xb4, 0x0f, 0x17, 0x0c, 0xcd, 0xb2, 0xfa, 0xe3, 0x3d, 0xc3, 0x75, 0x6e, 0x9e, - 0x48, 0xc7, 0xea, 0xc9, 0x8f, 0x10, 0x9c, 0x37, 0xfa, 0xe7, 0x23, 0xca, 0xa2, 0x6a, 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x1b, 0x00, 0x00, 0xff, 0xff, 0x88, 0x7d, - 0xbe, 0x6f, 0xd5, 0x12, 0x00, 0x00, + // 1671 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4d, 0x6f, 0xdb, 0xc8, + 0x19, 0xf6, 0x50, 0x8a, 0x62, 0xbd, 0xf2, 0x87, 0x32, 0x4e, 0x1c, 0x45, 0x49, 0xeb, 0x89, 0x76, + 0xb7, 0x25, 0xdc, 0x88, 0xdc, 0x28, 0x8b, 0x62, 0x23, 0xa0, 0xdd, 0xca, 0xb1, 0x92, 0x2c, 0xba, + 0x71, 0x12, 0x66, 0x37, 0x0d, 0xdc, 0x6c, 0x0d, 0x4a, 0x1c, 0x49, 0x5c, 0x8b, 0x1c, 0x96, 0x1c, + 0xda, 0x16, 0x54, 0xf5, 0xd0, 0x43, 0x8b, 0xbd, 0xba, 0xb7, 0x02, 0xdd, 0x4b, 0x81, 0xa2, 0x05, + 0xda, 0x63, 0x4f, 0x3d, 0xf4, 0x47, 0xb4, 0x7f, 0xa0, 0x40, 0x7f, 0x48, 0xc1, 0xe1, 0x87, 0x29, + 0xc9, 0x82, 0x22, 0x67, 0x91, 0x93, 0x39, 0x33, 0xef, 0xfb, 0x3c, 0xef, 0xf7, 0x8c, 0x05, 0x77, + 0xe8, 0x89, 0x6e, 0x39, 0x7d, 0xea, 0xa9, 0xd1, 0x87, 0xd3, 0x52, 0xf5, 0x83, 0x96, 0xc9, 0x0f, + 0x58, 0xe7, 0x80, 0x1e, 0x51, 0x77, 0xc0, 0x7b, 0xa6, 0xdd, 0x55, 0x1c, 0x97, 0x71, 0x86, 0xb7, + 0xba, 0xae, 0xd3, 0x56, 0xba, 0x3a, 0xa7, 0xc7, 0xfa, 0x40, 0x89, 0x55, 0x95, 0x44, 0xb5, 0x7c, + 0xab, 0xcb, 0x58, 0xb7, 0x4f, 0x55, 0xdd, 0x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 0x7d, 0x1a, 0x49, + 0x64, 0x09, 0x92, 0x91, 0x56, 0x08, 0xf7, 0x42, 0x91, 0x2d, 0x28, 0x98, 0x36, 0xff, 0xe1, 0x47, + 0x91, 0xc4, 0x25, 0x82, 0xe4, 0x8c, 0x06, 0x62, 0x2b, 0xc1, 0xf0, 0xd3, 0x12, 0x39, 0x82, 0xe4, + 0xac, 0x56, 0xf0, 0x53, 0x22, 0x21, 0xc6, 0xbd, 0x5a, 0x24, 0x71, 0x99, 0x20, 0xf9, 0x92, 0xc0, + 0xb8, 0x57, 0x0b, 0x05, 0xde, 0x83, 0xd5, 0x8e, 0x79, 0x42, 0x8d, 0x04, 0x64, 0x99, 0x20, 0x39, + 0xa7, 0xad, 0x44, 0x9b, 0xe3, 0x42, 0x09, 0x4e, 0x9e, 0x20, 0xf9, 0x72, 0x24, 0x14, 0x23, 0x7d, + 0x07, 0xa0, 0xc5, 0x58, 0x3f, 0x92, 0x00, 0x82, 0xe4, 0x65, 0x2d, 0x1f, 0xec, 0x24, 0xc6, 0x7a, + 0xdc, 0x35, 0xed, 0x6e, 0x24, 0x50, 0x10, 0xf1, 0x2f, 0x84, 0x7b, 0x63, 0xfe, 0x24, 0x2c, 0xab, + 0x04, 0xc9, 0xab, 0xa1, 0x3f, 0x31, 0xc9, 0x4f, 0x01, 0xa8, 0xed, 0x5b, 0x91, 0xc0, 0x1a, 0x41, + 0xf2, 0x5a, 0xed, 0xce, 0xdc, 0x6c, 0xed, 0xf9, 0x16, 0x75, 0xcd, 0x76, 0xd3, 0xf6, 0x2d, 0x2d, + 0x1f, 0xe8, 0x87, 0x60, 0x1f, 0xc0, 0x9a, 0x37, 0xee, 0xd7, 0x3a, 0x41, 0xf2, 0xba, 0xb6, 0xea, + 0x8d, 0x39, 0x96, 0x88, 0x25, 0x31, 0x2a, 0x12, 0x24, 0x17, 0x63, 0xb1, 0x54, 0x36, 0xbc, 0xb4, + 0xf5, 0x57, 0x08, 0x92, 0xaf, 0x68, 0x05, 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x8a, 0x8c, 0x97, + 0xa7, 0x32, 0xfe, 0x79, 0x2c, 0xa7, 0xad, 0x25, 0x2a, 0x21, 0xc8, 0x6b, 0x48, 0x2a, 0xe9, 0x20, + 0xd5, 0x50, 0xb7, 0x48, 0x66, 0xe1, 0x86, 0xba, 0x12, 0x03, 0x35, 0xe3, 0xc6, 0x2a, 0xff, 0x05, + 0x41, 0xee, 0x6c, 0xdc, 0xda, 0xba, 0x45, 0xe3, 0x71, 0x1b, 0x7c, 0xe3, 0x4d, 0xc8, 0xe9, 0x16, + 0xf3, 0x6d, 0x5e, 0x92, 0x44, 0x87, 0x47, 0x2b, 0xfc, 0x1c, 0x24, 0x76, 0x28, 0x66, 0xe5, 0x5a, + 0xad, 0x71, 0xd1, 0x11, 0xac, 0xec, 0x52, 0xea, 0x08, 0xc3, 0x24, 0x76, 0x58, 0xd9, 0x82, 0xe5, + 0x78, 0x8d, 0xf3, 0x70, 0xe9, 0x61, 0xe3, 0xb3, 0x17, 0xcd, 0xe2, 0x12, 0x5e, 0x86, 0xec, 0xe7, + 0xda, 0x17, 0xcd, 0x22, 0x2a, 0x9b, 0xb0, 0x3a, 0x56, 0x98, 0xb8, 0x08, 0x99, 0x43, 0x3a, 0x88, + 0xec, 0x0d, 0x3e, 0xf1, 0x0e, 0x5c, 0x0a, 0xa3, 0x23, 0x5d, 0x60, 0xdc, 0x84, 0xaa, 0x75, 0xe9, + 0x63, 0x54, 0xde, 0x85, 0xcd, 0xf3, 0x6b, 0xf3, 0x1c, 0xce, 0xab, 0x69, 0xce, 0x7c, 0x1a, 0xe5, + 0xd7, 0x31, 0xca, 0x64, 0x9d, 0x9d, 0x83, 0xb2, 0x97, 0x46, 0x79, 0x9b, 0x6b, 0xed, 0x8c, 0xbf, + 0xfe, 0xf3, 0xd3, 0xc6, 0xab, 0xed, 0x97, 0xf0, 0xfe, 0x43, 0xd3, 0x36, 0x08, 0xf3, 0x39, 0xb1, + 0x98, 0x4b, 0x89, 0xde, 0x0a, 0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, 0x61, 0xac, 0x6a, 0x99, 0x16, 0xad, 0x4f, + 0x49, 0xd6, 0x67, 0x48, 0xba, 0x9f, 0xc2, 0xf5, 0x27, 0x67, 0xf1, 0x4f, 0xbb, 0xb0, 0xa8, 0xe9, + 0xfb, 0xf9, 0xa4, 0x3c, 0x5b, 0x39, 0x11, 0xbd, 0x7b, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xd7, + 0x0d, 0x07, 0x7a, 0xd9, 0x13, 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 25885abd8ef..f1c3ceee88f 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -450,6 +450,37 @@ func request_ABitOfEverythingService_Timeout_0(ctx context.Context, marshaler ru } +func request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MessageWithBody + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Data); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.GetMessageWithBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + // RegisterABitOfEverythingServiceHandlerFromEndpoint is same as RegisterABitOfEverythingServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { @@ -807,6 +838,35 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) + mux.Handle("POST", pattern_ABitOfEverythingService_GetMessageWithBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + 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, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_GetMessageWithBody_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_GetMessageWithBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -832,6 +892,8 @@ var ( 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"}, "")) + + pattern_ABitOfEverythingService_GetMessageWithBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "withbody", "id"}, "")) ) var ( @@ -856,4 +918,6 @@ var ( forward_ABitOfEverythingService_DeepPathEcho_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Timeout_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_GetMessageWithBody_0 = runtime.ForwardResponseMessage ) diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 6250bdd4381..15d0cd9f6b0 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -97,6 +97,16 @@ message ABitOfEverything { repeated NumericEnum repeated_enum_value = 28; } +message Body { + string name = 1; +} + +message MessageWithBody { + string id = 1; + Body data = 2; +} + + // NumericEnum is one or zero. enum NumericEnum { // ZERO means 0 @@ -194,6 +204,12 @@ service ABitOfEverythingService { get: "/v2/example/timeout", }; } + rpc GetMessageWithBody(MessageWithBody) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2/example/withbody/{id}", + body: "data" + }; + } } service AnotherServiceWithNoBindings { diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index c42cd34ed13..1840421f2c1 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -590,6 +590,38 @@ "ABitOfEverythingService" ] } + }, + "/v2/example/withbody/{id}": { + "post": { + "operationId": "GetMessageWithBody", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbBody" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } } }, "definitions": { @@ -744,6 +776,14 @@ "url": "https://github.com/grpc-ecosystem/grpc-gateway" } }, + "examplepbBody": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + } + }, "examplepbNumericEnum": { "type": "string", "enum": [ diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index f4b5f3b5caa..0cca760395b 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -18,6 +18,8 @@ It is generated from these files: It has these top-level messages: SimpleMessage ABitOfEverything + Body + MessageWithBody EmptyProto NonEmptyProto UnaryProto diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 38c6467c54e..e0d1ebdb928 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -17,6 +17,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + ) // Implements of ABitOfEverythingServiceServer @@ -246,3 +247,7 @@ func (s *_ABitOfEverythingServer) Timeout(ctx context.Context, msg *empty.Empty) return nil, ctx.Err() } } + +func (s *_ABitOfEverythingServer) GetMessageWithBody(ctx context.Context, msg *examples.MessageWithBody) (*empty.Empty, error) { + return &empty.Empty{}, nil +} diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index bf671963efe..3d67ee6973b 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -138,8 +138,9 @@ func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descripto // Request may be fully included in query if _, ok := refs[fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg))]; ok { m[fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)] = meth.RequestType - findNestedMessagesAndEnumerations(meth.RequestType, reg, m, e) } + findNestedMessagesAndEnumerations(meth.RequestType, reg, m, e) + m[fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)] = meth.ResponseType findNestedMessagesAndEnumerations(meth.ResponseType, reg, m, e) } From 0d072b2584dc84ce20855f203d9427855ae70b30 Mon Sep 17 00:00:00 2001 From: Shouichi Kamiya Date: Sun, 24 Dec 2017 07:25:17 +0900 Subject: [PATCH 175/552] Fix gen-swagger to support more well known types (#496) * Fix gen-swagger to support more well known types --- protoc-gen-swagger/genswagger/template.go | 23 ++++ .../genswagger/template_test.go | 118 ++++++++++++++++++ protoc-gen-swagger/genswagger/types.go | 7 ++ 3 files changed, 148 insertions(+) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 3d67ee6973b..01746940e38 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -25,6 +25,29 @@ var wktSchemas = map[string]schemaCore{ ".google.protobuf.Duration": schemaCore{ Type: "string", }, + ".google.protobuf.StringValue": schemaCore{ + Type: "string", + }, + ".google.protobuf.Int32Value": schemaCore{ + Type: "integer", + Format: "int32", + }, + ".google.protobuf.Int64Value": schemaCore{ + Type: "integer", + Format: "int64", + }, + ".google.protobuf.FloatValue": schemaCore{ + Type: "number", + Format: "float", + }, + ".google.protobuf.DoubleValue": schemaCore{ + Type: "number", + Format: "double", + }, + ".google.protobuf.BoolValue": schemaCore{ + Type: "boolean", + Format: "boolean", + }, } func listEnumNames(enum *descriptor.Enum) (names []string) { diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 4633a0bbac6..d24f978fbeb 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -787,3 +787,121 @@ func TestFQMNtoSwaggerName(t *testing.T) { } } } + +func TestSchemaOfField(t *testing.T) { + type test struct { + field *descriptor.Field + expected schemaCore + } + + tests := []test{ + { + field: &descriptor.Field{ + FieldDescriptorProto: &protodescriptor.FieldDescriptorProto{ + Name: proto.String("primitive_field"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + }, + }, + expected: schemaCore{ + Type: "string", + }, + }, + { + field: &descriptor.Field{ + FieldDescriptorProto: &protodescriptor.FieldDescriptorProto{ + Name: proto.String("repeated_primitive_field"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: protodescriptor.FieldDescriptorProto_LABEL_REPEATED.Enum(), + }, + }, + expected: schemaCore{ + Type: "array", + Items: &swaggerItemsObject{ + Type: "string", + }, + }, + }, + { + field: &descriptor.Field{ + FieldDescriptorProto: &protodescriptor.FieldDescriptorProto{ + Name: proto.String("wrapped_field"), + TypeName: proto.String(".google.protobuf.StringValue"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + }, + }, + expected: schemaCore{ + Type: "string", + }, + }, + { + field: &descriptor.Field{ + FieldDescriptorProto: &protodescriptor.FieldDescriptorProto{ + Name: proto.String("repeated_wrapped_field"), + TypeName: proto.String(".google.protobuf.StringValue"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + Label: protodescriptor.FieldDescriptorProto_LABEL_REPEATED.Enum(), + }, + }, + expected: schemaCore{ + Type: "array", + Items: &swaggerItemsObject{ + Type: "string", + }, + }, + }, + { + field: &descriptor.Field{ + FieldDescriptorProto: &protodescriptor.FieldDescriptorProto{ + Name: proto.String("message_field"), + TypeName: proto.String(".example.Message"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + }, + }, + expected: schemaCore{ + Ref: "#/definitions/exampleMessage", + }, + }, + } + + reg := descriptor.NewRegistry() + reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*protodescriptor.FileDescriptorProto{ + { + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{}, + MessageType: []*protodescriptor.DescriptorProto{ + { + Name: proto.String("Message"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("value"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + }, + }, + }, + }, + EnumType: []*protodescriptor.EnumDescriptorProto{ + { + Name: proto.String("Message"), + }, + }, + Service: []*protodescriptor.ServiceDescriptorProto{}, + }, + }, + }) + + for _, test := range tests { + actual := schemaOfField(test.field, reg) + if e, a := test.expected.Type, actual.Type; e != a { + t.Errorf("Expected schemaOfField(%v).Type = %s, actual: %s", test.field, e, a) + } + if e, a := test.expected.Ref, actual.Ref; e != a { + t.Errorf("Expected schemaOfField(%v).Ref = %s, actual: %s", test.field, e, a) + } + if e, a := test.expected.Items.getType(), actual.Items.getType(); e != a { + t.Errorf("Expected schemaOfField(%v).Items.Type = %v, actual.Type: %v", test.field, e, a) + } + } +} diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 7263e66b7e0..35e8542083e 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -122,6 +122,13 @@ type schemaCore struct { type swaggerItemsObject schemaCore +func (o *swaggerItemsObject) getType() string { + if o == nil { + return "" + } + return o.Type +} + // http://swagger.io/specification/#responsesObject type swaggerResponsesObject map[string]swaggerResponseObject From 7ef50b8314ee5fe4397cdb68728d22ba6c8ca5fe Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sat, 23 Dec 2017 14:49:19 -0800 Subject: [PATCH 176/552] CHANGELOG: update for 1.3.1 release (#509) This was generated with github_changelog_generator with the following parameters: git_remote=upstream author=false compare-link=false user=grpc-ecosystem project=grpc-gateway issues=false --- CHANGELOG.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d613fec084..2855894912e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,53 @@ # Change Log +## [1.3.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/1.3.1) (2017-12-23) +**Merged pull requests:** + +- Add support for --Import\_path [\#507](https://github.com/grpc-ecosystem/grpc-gateway/pull/507) +- Fix \#504 Missing Definitions [\#505](https://github.com/grpc-ecosystem/grpc-gateway/pull/505) +- Maintain default delimiter of newline [\#497](https://github.com/grpc-ecosystem/grpc-gateway/pull/497) +- Fix gen-swagger to support more well known types [\#496](https://github.com/grpc-ecosystem/grpc-gateway/pull/496) +- Use golang/protobuf instead of gogo/protobuf [\#494](https://github.com/grpc-ecosystem/grpc-gateway/pull/494) +- Fix stream delimiters [\#488](https://github.com/grpc-ecosystem/grpc-gateway/pull/488) +- ForwardResponseStream status code errors [\#482](https://github.com/grpc-ecosystem/grpc-gateway/pull/482) +- protoc-gen-grpc-gateway: flip request\_context default to true [\#474](https://github.com/grpc-ecosystem/grpc-gateway/pull/474) +- grpc-gateway/generator: respect full package [\#462](https://github.com/grpc-ecosystem/grpc-gateway/pull/462) +- Add proto marshaller for proto-over-http [\#459](https://github.com/grpc-ecosystem/grpc-gateway/pull/459) + +## [v1.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) +## [v1.3.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) +**Merged pull requests:** + +- Streaming forward handler fix chunk encoding [\#479](https://github.com/grpc-ecosystem/grpc-gateway/pull/479) +- Fix logic handling primitive wrapper in URL params [\#478](https://github.com/grpc-ecosystem/grpc-gateway/pull/478) +- runtime: use r.Context\(\) [\#473](https://github.com/grpc-ecosystem/grpc-gateway/pull/473) +- Optional SourceCodeInfo [\#466](https://github.com/grpc-ecosystem/grpc-gateway/pull/466) +- Some steps to fix Travis CI [\#461](https://github.com/grpc-ecosystem/grpc-gateway/pull/461) +- fix 2 typos in Registry.SetPrefix's comment [\#455](https://github.com/grpc-ecosystem/grpc-gateway/pull/455) +- Add Handler method to pass in client [\#454](https://github.com/grpc-ecosystem/grpc-gateway/pull/454) +- Fallback to JSON name when matching URL parameter. [\#450](https://github.com/grpc-ecosystem/grpc-gateway/pull/450) +- Update DO NOT EDIT template. [\#434](https://github.com/grpc-ecosystem/grpc-gateway/pull/434) +- Memoise calls to fullyQualifiedNameToSwaggerName to speed it up for large registries [\#421](https://github.com/grpc-ecosystem/grpc-gateway/pull/421) +- Update Swagger Codegen from 2.1.6 to 2.2.2 [\#415](https://github.com/grpc-ecosystem/grpc-gateway/pull/415) +- Return codes.InvalidArgument to rather return HTTP 400 instead of HTTP 500 [\#409](https://github.com/grpc-ecosystem/grpc-gateway/pull/409) +- improve {incoming,outgoing}HeaderMatcher logic [\#408](https://github.com/grpc-ecosystem/grpc-gateway/pull/408) +- improve WKT handling in gateway and openapi output [\#404](https://github.com/grpc-ecosystem/grpc-gateway/pull/404) +- Return if runtime.AnnotateContext gave error [\#403](https://github.com/grpc-ecosystem/grpc-gateway/pull/403) +- jsonpb: update tests to reflect new jsonpb behavior [\#401](https://github.com/grpc-ecosystem/grpc-gateway/pull/401) +- Reference import grpc Status to suppress unused errors. [\#387](https://github.com/grpc-ecosystem/grpc-gateway/pull/387) +- ci: regen with current protoc-gen-go [\#385](https://github.com/grpc-ecosystem/grpc-gateway/pull/385) +- Use status package for error and introduce WithProtoErrorHandler option [\#378](https://github.com/grpc-ecosystem/grpc-gateway/pull/378) +- Return response headers from grpc server [\#374](https://github.com/grpc-ecosystem/grpc-gateway/pull/374) +- Skip unreferenced messages in definitions. [\#371](https://github.com/grpc-ecosystem/grpc-gateway/pull/371) +- Use canonical header form in default header matcher. [\#369](https://github.com/grpc-ecosystem/grpc-gateway/pull/369) +- support allow\_delete\_body for protoc-gen-grpc-gateway [\#318](https://github.com/grpc-ecosystem/grpc-gateway/pull/318) +- fixes package name override doesn't work [\#277](https://github.com/grpc-ecosystem/grpc-gateway/pull/277) +- add custom options to allow more control of swagger/openapi output [\#145](https://github.com/grpc-ecosystem/grpc-gateway/pull/145) + ## [v1.2.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.2) (2017-04-17) **Merged pull requests:** +- Add changelog for 1.2.2 [\#363](https://github.com/grpc-ecosystem/grpc-gateway/pull/363) - metadata: fix properly and change to Outgoing [\#361](https://github.com/grpc-ecosystem/grpc-gateway/pull/361) ## [v1.2.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.1) (2017-04-17) @@ -19,6 +64,7 @@ ## [v1.2.0.rc1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.0.rc1) (2017-03-24) **Merged pull requests:** +- Support user configurable header forwarding & context metadata [\#336](https://github.com/grpc-ecosystem/grpc-gateway/pull/336) - Update go\_out parameter to remove comma [\#333](https://github.com/grpc-ecosystem/grpc-gateway/pull/333) - Update stale path in README [\#332](https://github.com/grpc-ecosystem/grpc-gateway/pull/332) - improve documentation regarding external dependencies [\#330](https://github.com/grpc-ecosystem/grpc-gateway/pull/330) From 3c3b12325932741340e420f65be86b3e4ad13271 Mon Sep 17 00:00:00 2001 From: Lukas Malkmus Date: Tue, 2 Jan 2018 16:01:13 +0100 Subject: [PATCH 177/552] Add missing fields (#512) --- protoc-gen-swagger/genswagger/template.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 01746940e38..349e8556279 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -720,6 +720,12 @@ func applyTemplate(p param) (string, error) { if spb.Info.Title != "" { s.Info.Title = spb.Info.Title } + if spb.Info.Description != "" { + s.Info.Description = spb.Info.Description + } + if spb.Info.TermsOfService != "" { + s.Info.TermsOfService = spb.Info.TermsOfService + } if spb.Info.Version != "" { s.Info.Version = spb.Info.Version } From e15945ad72b8f3a32d7be8f9bb23fea8cfd76911 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Tue, 2 Jan 2018 16:20:55 -0800 Subject: [PATCH 178/552] ci: add codecov (#514) --- .travis.yml | 5 ++++- bin/coverage | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 bin/coverage diff --git a/.travis.yml b/.travis.yml index eea6dd82026..ba23646d656 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,10 +26,13 @@ before_script: - sh -c 'cd examples/browser && npm install' script: - make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" -- if (go version | grep -q 1.8) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi +- if (go version | grep -q 1.9) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi - env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... +- if (go version | grep -q 1.9) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then env GLOG_logtostderr=1 ./bin/coverage; fi - make lint - sh -c 'cd examples/browser && node ./node_modules/gulp/bin/gulp' +after_success: + - bash <(curl -s https://codecov.io/bash) env: global: - "PATH=$PATH:$HOME/local/bin" diff --git a/bin/coverage b/bin/coverage new file mode 100755 index 00000000000..bab0b81e7fd --- /dev/null +++ b/bin/coverage @@ -0,0 +1,11 @@ +#!/bin/bash +set -euo pipefail +> coverage.txt + +for d in $(go list ./... | grep -v vendor); do + go test -race -coverprofile=profile.out -covermode=atomic $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done From 2331cd2730ebe2028cf4187c984f37a483463f0d Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Wed, 10 Jan 2018 12:07:11 -0700 Subject: [PATCH 179/552] Fix travis to only difftest on go 1.9 Go master contains the commit hash that it was built at (or some similar token). Unfortunately our regexp that we were checking against had an escaping error. `grep -q 1.9` instead of `grep -q 1\.9` which meant it was matching 1[any character]2. The current golang master commit is "go version devel +15bc0a129a Wed Jan 3 04:34:11 2018 +0000 linux/amd64" Fixes by making the string A LOT more specific and escaping. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ba23646d656..f0845ec73a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: go sudo: false go: -- 1.7.x - 1.8.x - 1.9.x - master @@ -26,9 +25,9 @@ before_script: - sh -c 'cd examples/browser && npm install' script: - make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" -- if (go version | grep -q 1.9) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi +- if (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi - env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... -- if (go version | grep -q 1.9) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then env GLOG_logtostderr=1 ./bin/coverage; fi +- if (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then env GLOG_logtostderr=1 ./bin/coverage; fi - make lint - sh -c 'cd examples/browser && node ./node_modules/gulp/bin/gulp' after_success: @@ -36,6 +35,7 @@ after_success: env: global: - "PATH=$PATH:$HOME/local/bin" + - GO_VERSION_TO_DIFF_TEST="go version go1\.9\.[0-9]+ linux/amd64" matrix: - GATEWAY_PLUGIN_FLAGS= - GATEWAY_PLUGIN_FLAGS=request_context=false From e6ec1453ec9e9724248984686cf23d962b8c9682 Mon Sep 17 00:00:00 2001 From: Charles Francoise Date: Thu, 11 Jan 2018 08:58:32 +0100 Subject: [PATCH 180/552] Support mapping bytes to []byte (#489) --- README.md | 1 - .../abe/a_bit_of_everything_service_api.go | 6 +- .../abe/examplepb_a_bit_of_everything.go | 2 + examples/examplepb/a_bit_of_everything.pb.go | 262 +++++++++--------- examples/examplepb/a_bit_of_everything.proto | 4 +- .../a_bit_of_everything.swagger.json | 17 +- protoc-gen-grpc-gateway/descriptor/types.go | 3 +- runtime/convert.go | 11 + runtime/query.go | 16 +- runtime/query_test.go | 10 + 10 files changed, 192 insertions(+), 140 deletions(-) diff --git a/README.md b/README.md index c7396cc154b..5d86a5addc5 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,6 @@ To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRP ### Want to support But not yet. -* bytes fields in path parameter. #5 * Optionally generating the entrypoint. #8 * `import_path` parameter diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index a9cf948d7ae..13c637b9737 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -581,7 +581,8 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param fixed32Value * @param boolValue * @param stringValue - * @param uint32Value TODO(yugui) add bytes_value. + * @param bytesValue + * @param uint32Value * @param enumValue - ZERO: ZERO means 0 - ONE: ONE means 1 * @param sfixed32Value * @param sfixed64Value @@ -594,7 +595,7 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 * @return *ProtobufEmpty */ -func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*ProtobufEmpty, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables @@ -623,6 +624,7 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName strin localVarQueryParams.Add("fixed32_value", a.Configuration.APIClient.ParameterToString(fixed32Value, "")) localVarQueryParams.Add("bool_value", a.Configuration.APIClient.ParameterToString(boolValue, "")) localVarQueryParams.Add("string_value", a.Configuration.APIClient.ParameterToString(stringValue, "")) + localVarQueryParams.Add("bytes_value", a.Configuration.APIClient.ParameterToString(bytesValue, "")) localVarQueryParams.Add("uint32_value", a.Configuration.APIClient.ParameterToString(uint32Value, "")) localVarQueryParams.Add("enum_value", a.Configuration.APIClient.ParameterToString(enumValue, "")) localVarQueryParams.Add("sfixed32_value", a.Configuration.APIClient.ParameterToString(sfixed32Value, "")) diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go index d8775d9c863..cb6fb3a487d 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -40,6 +40,8 @@ type ExamplepbABitOfEverything struct { StringValue string `json:"string_value,omitempty"` + BytesValue string `json:"bytes_value,omitempty"` + Uint32Value int64 `json:"uint32_value,omitempty"` EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"` diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 7ac85fc900d..ed65af9d794 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -75,28 +75,28 @@ func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { } // Intentionaly complicated message type to cover much features of Protobuf. -// NEXT ID: 27 +// NEXT ID: 30 type ABitOfEverything struct { - SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested" json:"single_nested,omitempty"` - Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` - Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested" json:"nested,omitempty"` - FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` - DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` - Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` - Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` - Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` - Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value" json:"fixed64_value,omitempty"` - Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value" json:"fixed32_value,omitempty"` - BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` - StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - // TODO(yugui) add bytes_value - Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` - EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` - Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` - Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` - Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` - Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` - RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` + SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested" json:"single_nested,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` + Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested" json:"nested,omitempty"` + FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` + Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` + Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value" json:"fixed64_value,omitempty"` + Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value" json:"fixed32_value,omitempty"` + BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + BytesValue []byte `protobuf:"bytes,29,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` + EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` + Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` + Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` + Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` + Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` + RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` // Types that are valid to be assigned to OneofValue: // *ABitOfEverything_OneofEmpty // *ABitOfEverything_OneofString @@ -220,6 +220,13 @@ func (m *ABitOfEverything) GetStringValue() string { return "" } +func (m *ABitOfEverything) GetBytesValue() []byte { + if m != nil { + return m.BytesValue + } + return nil +} + func (m *ABitOfEverything) GetUint32Value() uint32 { if m != nil { return m.Uint32Value @@ -961,110 +968,111 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1671 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4d, 0x6f, 0xdb, 0xc8, - 0x19, 0xf6, 0x50, 0x8a, 0x62, 0xbd, 0xf2, 0x87, 0x32, 0x4e, 0x1c, 0x45, 0x49, 0xeb, 0x89, 0x76, - 0xb7, 0x25, 0xdc, 0x88, 0xdc, 0x28, 0x8b, 0x62, 0x23, 0xa0, 0xdd, 0xca, 0xb1, 0x92, 0x2c, 0xba, - 0x71, 0x12, 0x66, 0x37, 0x0d, 0xdc, 0x6c, 0x0d, 0x4a, 0x1c, 0x49, 0x5c, 0x8b, 0x1c, 0x96, 0x1c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0x0c, 0x9f, 0x76, 0xa2, 0xf2, 0xc7, 0x22, 0x14, 0x1b, 0x3b, - 0x26, 0x7f, 0xda, 0x69, 0x26, 0xe1, 0xc1, 0x5f, 0xc2, 0xaa, 0x67, 0xda, 0xdd, 0x3e, 0x3d, 0xb0, - 0xa9, 0xc7, 0xa9, 0x51, 0xba, 0x41, 0x90, 0x5c, 0xa8, 0x7d, 0xac, 0xcc, 0x09, 0x98, 0x32, 0x89, - 0xa4, 0xec, 0x09, 0x7d, 0x6d, 0x25, 0x84, 0x0b, 0x57, 0x18, 0x43, 0xd6, 0xf7, 0x4d, 0xa3, 0x84, - 0x08, 0x92, 0xf3, 0x9a, 0xf8, 0xc6, 0xcf, 0x20, 0x17, 0x71, 0x49, 0x24, 0xf3, 0x56, 0x5c, 0x11, - 0x0e, 0xde, 0x82, 0x42, 0xa7, 0xcf, 0x74, 0x7e, 0x70, 0xa4, 0xf7, 0x7d, 0x5a, 0xca, 0x10, 0x24, - 0x4b, 0x1a, 0x88, 0xad, 0x97, 0xc1, 0x0e, 0xbe, 0x0d, 0x2b, 0x06, 0xf3, 0x5b, 0x7d, 0x1a, 0x49, - 0x64, 0x09, 0x92, 0x91, 0x56, 0x08, 0xf7, 0x42, 0x91, 0x2d, 0x28, 0x98, 0x36, 0xff, 0xe1, 0x47, - 0x91, 0xc4, 0x25, 0x82, 0xe4, 0x8c, 0x06, 0x62, 0x2b, 0xc1, 0xf0, 0xd3, 0x12, 0x39, 0x82, 0xe4, - 0xac, 0x56, 0xf0, 0x53, 0x22, 0x21, 0xc6, 0xbd, 0x5a, 0x24, 0x71, 0x99, 0x20, 0xf9, 0x92, 0xc0, - 0xb8, 0x57, 0x0b, 0x05, 0xde, 0x83, 0xd5, 0x8e, 0x79, 0x42, 0x8d, 0x04, 0x64, 0x99, 0x20, 0x39, - 0xa7, 0xad, 0x44, 0x9b, 0xe3, 0x42, 0x09, 0x4e, 0x9e, 0x20, 0xf9, 0x72, 0x24, 0x14, 0x23, 0x7d, - 0x07, 0xa0, 0xc5, 0x58, 0x3f, 0x92, 0x00, 0x82, 0xe4, 0x65, 0x2d, 0x1f, 0xec, 0x24, 0xc6, 0x7a, - 0xdc, 0x35, 0xed, 0x6e, 0x24, 0x50, 0x10, 0xf1, 0x2f, 0x84, 0x7b, 0x63, 0xfe, 0x24, 0x2c, 0xab, - 0x04, 0xc9, 0xab, 0xa1, 0x3f, 0x31, 0xc9, 0x4f, 0x01, 0xa8, 0xed, 0x5b, 0x91, 0xc0, 0x1a, 0x41, - 0xf2, 0x5a, 0xed, 0xce, 0xdc, 0x6c, 0xed, 0xf9, 0x16, 0x75, 0xcd, 0x76, 0xd3, 0xf6, 0x2d, 0x2d, - 0x1f, 0xe8, 0x87, 0x60, 0x1f, 0xc0, 0x9a, 0x37, 0xee, 0xd7, 0x3a, 0x41, 0xf2, 0xba, 0xb6, 0xea, - 0x8d, 0x39, 0x96, 0x88, 0x25, 0x31, 0x2a, 0x12, 0x24, 0x17, 0x63, 0xb1, 0x54, 0x36, 0xbc, 0xb4, - 0xf5, 0x57, 0x08, 0x92, 0xaf, 0x68, 0x05, 0x2f, 0x65, 0x7d, 0x24, 0x92, 0xe0, 0x60, 0x82, 0x64, - 0x1c, 0x8a, 0xc4, 0x28, 0x35, 0xb8, 0xe6, 0x52, 0x87, 0xea, 0x9c, 0x1a, 0x07, 0x63, 0xf1, 0xda, - 0x20, 0x19, 0x39, 0xaf, 0x6d, 0xc4, 0x87, 0x2f, 0x52, 0x71, 0xbb, 0x0f, 0x05, 0x66, 0xd3, 0x60, - 0xc8, 0x04, 0x33, 0xa0, 0x74, 0x55, 0xf4, 0xcb, 0xa6, 0x12, 0xf6, 0xaa, 0x12, 0xf7, 0xaa, 0xd2, - 0x0c, 0x4e, 0x1f, 0x2f, 0x69, 0x20, 0x84, 0xc5, 0x0a, 0xbf, 0x07, 0x2b, 0xa1, 0x6a, 0xc8, 0x55, - 0xba, 0x16, 0x64, 0xe5, 0xf1, 0x92, 0x16, 0x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e2, 0xa7, 0xc0, 0x82, 0x1d, 0x50, 0xfb, 0x05, 0xdc, 0x6a, 0xd8, 0x8c, 0xf7, 0xa8, - 0x1b, 0x21, 0x04, 0xc1, 0x49, 0x25, 0xfe, 0xc7, 0x63, 0x65, 0xb0, 0x68, 0x1a, 0x97, 0x76, 0xfe, - 0x2a, 0x9d, 0x36, 0xfe, 0x20, 0x61, 0x0e, 0x1b, 0x0d, 0xb2, 0x63, 0xf2, 0xc0, 0xc1, 0x54, 0x95, - 0xbe, 0x82, 0xab, 0x5d, 0xed, 0xd9, 0x83, 0xea, 0xa3, 0xd0, 0x1a, 0xe2, 0xb8, 0xec, 0x2b, 0xda, - 0xe6, 0x8b, 0x7a, 0x51, 0x2e, 0xda, 0xcc, 0xa6, 0x3f, 0x89, 0x32, 0x15, 0x48, 0xd7, 0x32, 0x77, - 0x95, 0x0f, 0xb7, 0x33, 0x48, 0xca, 0xd6, 0x8a, 0xba, 0xe3, 0xf4, 0xcd, 0xb6, 0x08, 0xa5, 0xfa, - 0x95, 0xc7, 0xec, 0xda, 0x66, 0x7a, 0xe7, 0xa4, 0xda, 0x61, 0xac, 0x6a, 0x99, 0x16, 0xad, 0x4f, - 0x49, 0xd6, 0x67, 0x48, 0xba, 0x9f, 0xc2, 0xf5, 0x27, 0x67, 0xf1, 0x4f, 0xbb, 0xb0, 0xa8, 0xe9, - 0xfb, 0xf9, 0xa4, 0x3c, 0x5b, 0x39, 0x11, 0xbd, 0x7b, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xd7, - 0x0d, 0x07, 0x7a, 0xd9, 0x13, 0x00, 0x00, + // 1686 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4f, 0x6f, 0xdb, 0xc8, + 0x15, 0xf7, 0x50, 0x8e, 0x62, 0x3d, 0xf9, 0x8f, 0x32, 0x4e, 0x1c, 0x45, 0xc9, 0xd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x97, 0x26, 0xc4, 0xd9, 0xb3, 0xda, 0xc4, 0xe1, 0xf6, 0x24, 0x31, 0xb7, 0x1d, + 0x1a, 0x70, 0xd3, 0xf1, 0x24, 0xe0, 0x86, 0xf8, 0xd3, 0xde, 0xed, 0x52, 0x77, 0x37, 0x78, 0x65, + 0x76, 0xbb, 0xd4, 0xd7, 0x99, 0x27, 0x0c, 0x9f, 0x76, 0xa2, 0xfa, 0x8f, 0x12, 0x94, 0x1a, 0x7b, + 0x36, 0x7f, 0xd8, 0x69, 0xa6, 0xe1, 0xc1, 0x5f, 0xc1, 0x5a, 0x60, 0xbb, 0xdd, 0x3e, 0x3d, 0x74, + 0x69, 0xc0, 0xa9, 0x55, 0xbe, 0x42, 0x90, 0x5a, 0xac, 0x7d, 0xa2, 0xcd, 0x09, 0x98, 0x36, 0xc9, + 0xa4, 0x1d, 0x08, 0x79, 0x63, 0x35, 0xa6, 0x8b, 0x57, 0x18, 0xc3, 0x72, 0x18, 0xda, 0x56, 0x19, + 0x11, 0xa4, 0x16, 0x0c, 0xf1, 0x8d, 0x1f, 0x41, 0x5e, 0xea, 0x52, 0x48, 0xee, 0xad, 0x74, 0x49, + 0x1e, 0xbc, 0x0d, 0xc5, 0x4e, 0x9f, 0x99, 0xfc, 0xf0, 0xc8, 0xec, 0x87, 0xb4, 0x9c, 0x23, 0x48, + 0x55, 0x0c, 0x10, 0x5b, 0x4f, 0xa3, 0x1d, 0x7c, 0x1d, 0x56, 0x2d, 0x16, 0xb6, 0xfa, 0x54, 0x22, + 0x96, 0x09, 0x52, 0x91, 0x51, 0x8c, 0xf7, 0x62, 0xc8, 0x36, 0x14, 0x6d, 0x97, 0xff, 0xe0, 0x63, + 0x89, 0x38, 0x47, 0x90, 0x9a, 0x33, 0x40, 0x6c, 0xa5, 0x1c, 0x61, 0x16, 0x91, 0x27, 0x48, 0x5d, + 0x36, 0x8a, 0x61, 0x06, 0x12, 0x73, 0xdc, 0xaa, 0x49, 0xc4, 0x79, 0x82, 0xd4, 0x73, 0x82, 0xe3, + 0x56, 0x2d, 0x06, 0xbc, 0x0f, 0x6b, 0x1d, 0xfb, 0x98, 0x5a, 0x29, 0xc9, 0x0a, 0x41, 0x6a, 0xde, + 0x58, 0x95, 0x9b, 0xe3, 0xa0, 0x94, 0xa7, 0x40, 0x90, 0x7a, 0x5e, 0x82, 0x12, 0xa6, 0xf7, 0x00, + 0x5a, 0x8c, 0xf5, 0x25, 0x02, 0x08, 0x52, 0x57, 0x8c, 0x42, 0xb4, 0x93, 0x1a, 0x1b, 0x70, 0xdf, + 0x76, 0xbb, 0x12, 0x50, 0x14, 0xf1, 0x2f, 0xc6, 0x7b, 0xa9, 0xb1, 0xad, 0x01, 0xa7, 0x81, 0x44, + 0xbc, 0x47, 0x90, 0xba, 0x6a, 0x80, 0xd8, 0x1a, 0x73, 0x38, 0x35, 0x63, 0x8d, 0x20, 0x75, 0x2d, + 0x76, 0x38, 0xb1, 0xe2, 0x27, 0x00, 0xd4, 0x0d, 0x1d, 0x09, 0x58, 0x27, 0x48, 0x5d, 0xaf, 0xdd, + 0x98, 0x9b, 0xce, 0x83, 0xd0, 0xa1, 0xbe, 0xdd, 0x6e, 0xba, 0xa1, 0x63, 0x14, 0x22, 0xf9, 0x98, + 0xec, 0x43, 0x58, 0x0f, 0xc6, 0x1d, 0xdf, 0x20, 0x48, 0xdd, 0x30, 0xd6, 0x82, 0x31, 0xcf, 0x53, + 0x58, 0x1a, 0xc4, 0x12, 0x41, 0x6a, 0x29, 0x81, 0x65, 0xd2, 0x15, 0x64, 0xad, 0xbf, 0x40, 0x90, + 0x7a, 0xc1, 0x28, 0x06, 0x19, 0xeb, 0x25, 0x24, 0xe5, 0xc1, 0x04, 0xa9, 0x38, 0x86, 0x24, 0x2c, + 0x35, 0xb8, 0xe4, 0x53, 0x8f, 0x9a, 0x9c, 0x5a, 0x87, 0x63, 0x01, 0xdd, 0x24, 0x39, 0xb5, 0x60, + 0x6c, 0x26, 0x87, 0x4f, 0x32,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 0x45, 0xf4, 0x6e, 0xfd, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x34, 0xb2, + 0xff, 0x60, 0xfa, 0x13, 0x00, 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 15d0cd9f6b0..8da0c2e8e3d 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -36,7 +36,7 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { // Intentionaly complicated message type to cover much features of Protobuf. -// NEXT ID: 27 +// NEXT ID: 30 message ABitOfEverything { option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = { external_docs: { @@ -72,7 +72,7 @@ message ABitOfEverything { fixed32 fixed32_value = 9; bool bool_value = 10; string string_value = 11; - // TODO(yugui) add bytes_value + bytes bytes_value = 29; uint32 uint32_value = 13; NumericEnum enum_value = 14; sfixed32 sfixed32_value = 15; diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 1840421f2c1..59fa4c77daa 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -185,9 +185,15 @@ "required": false, "type": "string" }, + { + "name": "bytes_value", + "in": "query", + "required": false, + "type": "string", + "format": "byte" + }, { "name": "uint32_value", - "description": "TODO(yugui) add bytes_value.", "in": "query", "required": false, "type": "integer", @@ -701,10 +707,13 @@ "string_value": { "type": "string" }, + "bytes_value": { + "type": "string", + "format": "byte" + }, "uint32_value": { "type": "integer", - "format": "int64", - "title": "TODO(yugui) add bytes_value" + "format": "int64" }, "enum_value": { "$ref": "#/definitions/examplepbNumericEnum" @@ -770,7 +779,7 @@ "title": "repeated enum value. it is comma-separated in query" } }, - "title": "Intentionaly complicated message type to cover much features of Protobuf.\nNEXT ID: 27", + "title": "Intentionaly complicated message type to cover much features of Protobuf.\nNEXT ID: 30", "externalDocs": { "description": "Find out more about ABitOfEverything", "url": "https://github.com/grpc-ecosystem/grpc-gateway" diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index c24bd61c890..88dff7bb902 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -295,8 +295,7 @@ var ( descriptor.FieldDescriptorProto_TYPE_STRING: "runtime.String", // FieldDescriptorProto_TYPE_GROUP // FieldDescriptorProto_TYPE_MESSAGE - // FieldDescriptorProto_TYPE_BYTES - // TODO(yugui) Handle bytes + descriptor.FieldDescriptorProto_TYPE_BYTES: "runtime.Bytes", descriptor.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32", // FieldDescriptorProto_TYPE_ENUM // TODO(yugui) Handle Enum diff --git a/runtime/convert.go b/runtime/convert.go index f8931864100..afbcbd4fa10 100644 --- a/runtime/convert.go +++ b/runtime/convert.go @@ -1,6 +1,7 @@ package runtime import ( + "encoding/base64" "strconv" "github.com/golang/protobuf/jsonpb" @@ -61,6 +62,16 @@ func Uint32(val string) (uint32, error) { return uint32(i), nil } +// Bytes converts the given string representation of a byte sequence into a slice of bytes +// A bytes sequence is encoded in URL-safe base64 without padding +func Bytes(val string) ([]byte, error) { + b, err := base64.RawURLEncoding.DecodeString(val) + if err != nil { + return nil, err + } + return b, nil +} + // Timestamp converts the given RFC3339 formatted string into a timestamp.Timestamp. func Timestamp(val string) (*timestamp.Timestamp, error) { var r *timestamp.Timestamp diff --git a/runtime/query.go b/runtime/query.go index c00e0b914e2..d9f3b2583c7 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -1,6 +1,7 @@ package runtime import ( + "encoding/base64" "fmt" "net/url" "reflect" @@ -64,10 +65,14 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] } m = f case reflect.Slice: - // TODO(yugui) Support []byte if !isLast { return fmt.Errorf("unexpected repeated field in %s", strings.Join(fieldPath, ".")) } + // Handle []byte + if f.Type().Elem().Kind() == reflect.Uint8 { + m = f + break + } return populateRepeatedField(f, values, props) case reflect.Ptr: if f.IsNil() { @@ -203,6 +208,13 @@ func populateField(f reflect.Value, value string, props *proto.Properties) error case "StringValue": f.Field(0).SetString(value) return nil + case "BytesValue": + bytesVal, err := base64.RawURLEncoding.DecodeString(value) + if err != nil { + return fmt.Errorf("bad BytesValue: %s", value) + } + f.Field(0).SetBytes(bytesVal) + return nil } } @@ -274,6 +286,6 @@ var ( reflect.Int32: reflect.ValueOf(Int32), reflect.Uint64: reflect.ValueOf(Uint64), reflect.Uint32: reflect.ValueOf(Uint32), - // TODO(yugui) Support []byte + reflect.Slice: reflect.ValueOf(Bytes), } ) diff --git a/runtime/query_test.go b/runtime/query_test.go index 95a72a4af1c..d5b4c758469 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -41,6 +41,7 @@ func TestPopulateParameters(t *testing.T) { "uint32_value": {"4"}, "bool_value": {"true"}, "string_value": {"str"}, + "bytes_value": {"Ynl0ZXM"}, "repeated_value": {"a", "b", "c"}, "enum_value": {"1"}, "repeated_enum": {"1", "2", "0"}, @@ -53,6 +54,7 @@ func TestPopulateParameters(t *testing.T) { "wrapper_u_int32_value": {"4"}, "wrapper_bool_value": {"true"}, "wrapper_string_value": {"str"}, + "wrapper_bytes_value": {"Ynl0ZXM"}, }, filter: utilities.NewDoubleArray(nil), want: &proto3Message{ @@ -64,6 +66,7 @@ func TestPopulateParameters(t *testing.T) { Uint32Value: 4, BoolValue: true, StringValue: "str", + BytesValue: []byte("bytes"), RepeatedValue: []string{"a", "b", "c"}, EnumValue: EnumValue_Y, RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, @@ -76,6 +79,7 @@ func TestPopulateParameters(t *testing.T) { WrapperUInt32Value: &wrappers.UInt32Value{4}, WrapperBoolValue: &wrappers.BoolValue{true}, WrapperStringValue: &wrappers.StringValue{"str"}, + WrapperBytesValue: &wrappers.BytesValue{[]byte("bytes")}, }, }, { @@ -88,6 +92,7 @@ func TestPopulateParameters(t *testing.T) { "uint32Value": {"4"}, "boolValue": {"true"}, "stringValue": {"str"}, + "bytesValue": {"Ynl0ZXM"}, "repeatedValue": {"a", "b", "c"}, "enumValue": {"1"}, "repeatedEnum": {"1", "2", "0"}, @@ -100,6 +105,7 @@ func TestPopulateParameters(t *testing.T) { "wrapperUInt32Value": {"4"}, "wrapperBoolValue": {"true"}, "wrapperStringValue": {"str"}, + "wrapperBytesValue": {"Ynl0ZXM"}, }, filter: utilities.NewDoubleArray(nil), want: &proto3Message{ @@ -111,6 +117,7 @@ func TestPopulateParameters(t *testing.T) { Uint32Value: 4, BoolValue: true, StringValue: "str", + BytesValue: []byte("bytes"), RepeatedValue: []string{"a", "b", "c"}, EnumValue: EnumValue_Y, RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, @@ -123,6 +130,7 @@ func TestPopulateParameters(t *testing.T) { WrapperUInt32Value: &wrappers.UInt32Value{4}, WrapperBoolValue: &wrappers.BoolValue{true}, WrapperStringValue: &wrappers.StringValue{"str"}, + WrapperBytesValue: &wrappers.BytesValue{[]byte("bytes")}, }, }, { @@ -471,6 +479,7 @@ type proto3Message struct { Uint32Value uint32 `protobuf:"varint,7,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` BoolValue bool `protobuf:"varint,8,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` StringValue string `protobuf:"bytes,9,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + BytesValue []byte `protobuf:"bytes,25,opt,name=bytes_value,json=bytesValue" json:"bytes_value,omitempty"` RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"` EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeatedEnum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` @@ -484,6 +493,7 @@ type proto3Message struct { WrapperUInt32Value *wrappers.UInt32Value `protobuf:"bytes,22,opt,name=wrapper_u_int32_value,json=wrapperUInt32Value" json:"wrapper_u_int32_value,omitempty"` WrapperBoolValue *wrappers.BoolValue `protobuf:"bytes,23,opt,name=wrapper_bool_value,json=wrapperBoolValue" json:"wrapper_bool_value,omitempty"` WrapperStringValue *wrappers.StringValue `protobuf:"bytes,24,opt,name=wrapper_string_value,json=wrapperStringValue" json:"wrapper_string_value,omitempty"` + WrapperBytesValue *wrappers.BytesValue `protobuf:"bytes,26,opt,name=wrapper_bytes_value,json=wrapperBytesValue" json:"wrapper_bytes_value,omitempty"` } func (m *proto3Message) Reset() { *m = proto3Message{} } From d1dd61c3719a4efb5ea2e96f4deaddb9de94e580 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Thu, 11 Jan 2018 09:51:12 -0800 Subject: [PATCH 181/552] add error details to error json (#515) Signed-off-by: Stephan Renatus --- .../abe/a_bit_of_everything_service_api.go | 59 +++++ examples/examplepb/a_bit_of_everything.pb.go | 245 ++++++++++-------- .../examplepb/a_bit_of_everything.pb.gw.go | 42 +++ examples/examplepb/a_bit_of_everything.proto | 5 + .../a_bit_of_everything.swagger.json | 16 ++ examples/integration_test.go | 60 ++++- examples/server/a_bit_of_everything.go | 17 +- runtime/errors.go | 13 +- 8 files changed, 345 insertions(+), 112 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 13c637b9737..222e5c7c777 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -501,6 +501,65 @@ func (a ABitOfEverythingServiceApi) Echo3(value string) (*SubStringMessage, *API return successPayload, localVarAPIResponse, err } +/** + * + * + * @return *ProtobufEmpty + */ +func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/errorwithdetails" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "ErrorWithDetails", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + /** * * diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index ed65af9d794..db453f78b04 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -513,6 +513,7 @@ type ABitOfEverythingServiceClient interface { DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) NoBindings(ctx context.Context, in *google_protobuf2.Duration, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + ErrorWithDetails(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } @@ -614,6 +615,15 @@ func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *google_ return out, nil } +func (c *aBitOfEverythingServiceClient) ErrorWithDetails(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/ErrorWithDetails", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *aBitOfEverythingServiceClient) GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetMessageWithBody", in, out, c.cc, opts...) @@ -643,6 +653,7 @@ type ABitOfEverythingServiceServer interface { DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) NoBindings(context.Context, *google_protobuf2.Duration) (*google_protobuf1.Empty, error) Timeout(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) + ErrorWithDetails(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) GetMessageWithBody(context.Context, *MessageWithBody) (*google_protobuf1.Empty, error) } @@ -830,6 +841,24 @@ func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_ErrorWithDetails_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf1.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).ErrorWithDetails(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/ErrorWithDetails", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).ErrorWithDetails(ctx, req.(*google_protobuf1.Empty)) + } + return interceptor(ctx, in, info, handler) +} + func _ABitOfEverythingService_GetMessageWithBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MessageWithBody) if err := dec(in); err != nil { @@ -892,6 +921,10 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "Timeout", Handler: _ABitOfEverythingService_Timeout_Handler, }, + { + MethodName: "ErrorWithDetails", + Handler: _ABitOfEverythingService_ErrorWithDetails_Handler, + }, { MethodName: "GetMessageWithBody", Handler: _ABitOfEverythingService_GetMessageWithBody_Handler, @@ -968,111 +1001,113 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1686 bytes of a gzipped FileDescriptorProto + // 1719 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4f, 0x6f, 0xdb, 0xc8, - 0x15, 0xf7, 0x50, 0x8e, 0x62, 0x3d, 0xf9, 0x8f, 0x32, 0x4e, 0x1c, 0x45, 0xc9, 0xd6, 0x13, 0xed,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xff, 0xe0, 0x63, - 0x89, 0x38, 0x47, 0x90, 0x9a, 0x33, 0x40, 0x6c, 0xa5, 0x1c, 0x61, 0x16, 0x91, 0x27, 0x48, 0x5d, - 0x36, 0x8a, 0x61, 0x06, 0x12, 0x73, 0xdc, 0xaa, 0x49, 0xc4, 0x79, 0x82, 0xd4, 0x73, 0x82, 0xe3, - 0x56, 0x2d, 0x06, 0xbc, 0x0f, 0x6b, 0x1d, 0xfb, 0x98, 0x5a, 0x29, 0xc9, 0x0a, 0x41, 0x6a, 0xde, - 0x58, 0x95, 0x9b, 0xe3, 0xa0, 0x94, 0xa7, 0x40, 0x90, 0x7a, 0x5e, 0x82, 0x12, 0xa6, 0xf7, 0x00, - 0x5a, 0x8c, 0xf5, 0x25, 0x02, 0x08, 0x52, 0x57, 0x8c, 0x42, 0xb4, 0x93, 0x1a, 0x1b, 0x70, 0xdf, - 0x76, 0xbb, 0x12, 0x50, 0x14, 0xf1, 0x2f, 0xc6, 0x7b, 0xa9, 0xb1, 0xad, 0x01, 0xa7, 0x81, 0x44, - 0xbc, 0x47, 0x90, 0xba, 0x6a, 0x80, 0xd8, 0x1a, 0x73, 0x38, 0x35, 0x63, 0x8d, 0x20, 0x75, 0x2d, - 0x76, 0x38, 0xb1, 0xe2, 0x27, 0x00, 0xd4, 0x0d, 0x1d, 0x09, 0x58, 0x27, 0x48, 0x5d, 0xaf, 0xdd, - 0x98, 0x9b, 0xce, 0x83, 0xd0, 0xa1, 0xbe, 0xdd, 0x6e, 0xba, 0xa1, 0x63, 0x14, 0x22, 0xf9, 0x98, - 0xec, 0x43, 0x58, 0x0f, 0xc6, 0x1d, 0xdf, 0x20, 0x48, 0xdd, 0x30, 0xd6, 0x82, 0x31, 0xcf, 0x53, - 0x58, 0x1a, 0xc4, 0x12, 0x41, 0x6a, 0x29, 0x81, 0x65, 0xd2, 0x15, 0x64, 0xad, 0xbf, 0x40, 0x90, - 0x7a, 0xc1, 0x28, 0x06, 0x19, 0xeb, 0x25, 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3, 0x88, 0x3c, 0x41, + 0xea, 0xbc, 0x51, 0x0c, 0x33, 0x90, 0x98, 0xe3, 0x76, 0x4d, 0x22, 0x2e, 0x12, 0xa4, 0x5e, 0x10, + 0x1c, 0xb7, 0x6b, 0x31, 0xe0, 0x03, 0x58, 0x6a, 0xdb, 0x47, 0xd4, 0x4a, 0x49, 0x16, 0x08, 0x52, + 0xf3, 0xc6, 0xa2, 0xdc, 0x1c, 0x06, 0xa5, 0x3c, 0x05, 0x82, 0xd4, 0x8b, 0x12, 0x94, 0x30, 0xbd, + 0x07, 0xd0, 0x64, 0xac, 0x27, 0x11, 0x40, 0x90, 0xba, 0x60, 0x14, 0xa2, 0x9d, 0xd4, 0xd8, 0x80, + 0xfb, 0xb6, 0xdb, 0x91, 0x80, 0xa2, 0x88, 0x7f, 0x31, 0xde, 0x4b, 0x8d, 0x6d, 0xf6, 0x39, 0x0d, + 0x24, 0xe2, 0x3d, 0x82, 0xd4, 0x45, 0x03, 0xc4, 0xd6, 0x90, 0xc3, 0xa9, 0x19, 0x4b, 0x04, 0xa9, + 0x4b, 0xb1, 0xc3, 0x89, 0x15, 0x3f, 0x07, 0xa0, 0x6e, 0xe8, 0x48, 0xc0, 0x32, 0x41, 0xea, 0x72, + 0xed, 0xe6, 0xd4, 0xeb, 0xdc, 0x0f, 0x1d, 0xea, 0xdb, 0xad, 0x86, 0x1b, 0x3a, 0x46, 0x21, 0x92, + 0x8f, 0xc9, 0x3e, 0x84, 0xe5, 0x60, 0xd8, 0xf1, 0x15, 0x82, 0xd4, 0x15, 0x63, 0x29, 0x18, 0xf2, + 0x3c, 0x85, 0xa5, 0x41, 0x2c, 0x11, 0xa4, 0x96, 0x12, 0x58, 0xe6, 0xba, 0x82, 0xac, 0xf5, 0xab, + 0x04, 0xa9, 0xab, 0x46, 0x31, 0xc8, 0x58, 0x2f, 0x21, 0x29, 0x0f, 0x26, 0x48, 0xc5, 0x31, 0x24, + 0x61, 0xa9, 0xc1, 0x65, 0x9f, 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, 0xe6, 0x6b, 0x25, 0xd3, 0xf3, 0x7a, 0x76, 0x4b, 0x84, 0x52, 0xff, + 0x3a, 0x60, 0x6e, 0x6d, 0x3d, 0xbb, 0x73, 0xb4, 0xdd, 0x66, 0x6c, 0xdb, 0xb1, 0x1d, 0xba, 0x33, + 0x86, 0xdc, 0x99, 0x80, 0xf4, 0x3f, 0x83, 0x2b, 0x0f, 0x4f, 0xe3, 0x9f, 0x75, 0x61, 0x56, 0xd3, + 0x5f, 0x14, 0xd2, 0xf4, 0x6c, 0xe6, 0x45, 0xf4, 0x6e, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xd3, + 0x03, 0xe4, 0x9d, 0x64, 0x14, 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 f1c3ceee88f..a2cc99df253 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -450,6 +450,15 @@ func request_ABitOfEverythingService_Timeout_0(ctx context.Context, marshaler ru } +func request_ABitOfEverythingService_ErrorWithDetails_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + msg, err := client.ErrorWithDetails(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + func request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MessageWithBody var metadata runtime.ServerMetadata @@ -838,6 +847,35 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) + mux.Handle("GET", pattern_ABitOfEverythingService_ErrorWithDetails_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + 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, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_ErrorWithDetails_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_ErrorWithDetails_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_ABitOfEverythingService_GetMessageWithBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -893,6 +931,8 @@ var ( pattern_ABitOfEverythingService_Timeout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "timeout"}, "")) + pattern_ABitOfEverythingService_ErrorWithDetails_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "errorwithdetails"}, "")) + pattern_ABitOfEverythingService_GetMessageWithBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "withbody", "id"}, "")) ) @@ -919,5 +959,7 @@ var ( forward_ABitOfEverythingService_Timeout_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_ErrorWithDetails_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_GetMessageWithBody_0 = runtime.ForwardResponseMessage ) diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 8da0c2e8e3d..7336e66084b 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -204,6 +204,11 @@ service ABitOfEverythingService { get: "/v2/example/timeout", }; } + rpc ErrorWithDetails(google.protobuf.Empty) returns (google.protobuf.Empty) { + option (google.api.http) = { + get: "/v2/example/errorwithdetails", + }; + } rpc GetMessageWithBody(MessageWithBody) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v2/example/withbody/{id}", diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 59fa4c77daa..81f7599582a 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -581,6 +581,22 @@ } } }, + "/v2/example/errorwithdetails": { + "get": { + "operationId": "ErrorWithDetails", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + } + }, + "tags": [ + "ABitOfEverythingService" + ] + } + }, "/v2/example/timeout": { "get": { "operationId": "Timeout", diff --git a/examples/integration_test.go b/examples/integration_test.go index 44a9fa7da21..096e53b908b 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -25,8 +25,9 @@ import ( ) type errorBody struct { - Error string `json:"error"` - Code int `json:"code"` + Error string `json:"error"` + Code int `json:"code"` + Details []interface{} `json:"details"` } func TestEcho(t *testing.T) { @@ -460,7 +461,7 @@ func testABELookupNotFound(t *testing.T, port int) { var msg errorBody if err := json.Unmarshal(buf, &msg); err != nil { - t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + t.Errorf("json.Unmarshal(%s, &msg) failed with %v; want success", buf, err) return } @@ -723,6 +724,59 @@ func TestTimeout(t *testing.T) { } } +func TestErrorWithDetails(t *testing.T) { + url := "http://localhost:8080/v2/example/errorwithdetails" + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatalf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + } + + if got, want := resp.StatusCode, http.StatusInternalServerError; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + } + + var msg errorBody + if err := json.Unmarshal(buf, &msg); err != nil { + t.Fatalf("json.Unmarshal(%s, &msg) failed with %v; want success", buf, err) + } + + if got, want := msg.Code, int(codes.Unknown); got != want { + t.Errorf("msg.Code = %d; want %d", got, want) + } + if got, want := msg.Error, "with details"; got != want { + t.Errorf("msg.Error = %s; want %s", got, want) + } + if got, want := len(msg.Details), 1; got != want { + t.Fatalf("len(msg.Details) = %q; want %q", got, want) + } + + details, ok := msg.Details[0].(map[string]interface{}) + if got, want := ok, true; got != want { + t.Fatalf("msg.Details[0] got type: %T, want %T", msg.Details[0], map[string]interface{}{}) + } + if got, want := details["detail"], "error debug details"; got != want { + t.Errorf("msg.Details[\"detail\"] = %q; want %q", got, want) + } + entries, ok := details["stack_entries"].([]interface{}) + if got, want := ok, true; got != want { + t.Fatalf("msg.Details[0][\"stack_entries\"] got type: %T, want %T", entries, []string{}) + } + entry, ok := entries[0].(string) + if got, want := ok, true; got != want { + t.Fatalf("msg.Details[0][\"stack_entries\"][0] got type: %T, want %T", entry, "") + } + if got, want := entries[0], "foo:1"; got != want { + t.Errorf("msg.Details[\"stack_entries\"][0] = %q; want %q", got, want) + } +} + func TestUnknownPath(t *testing.T) { url := "http://localhost:8080" resp, err := http.Post(url, "application/json", strings.NewReader("{}")) diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index e0d1ebdb928..7542801b7cc 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -6,6 +6,7 @@ import ( "sync" "github.com/golang/glog" + "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/empty" examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" @@ -13,11 +14,11 @@ import ( sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" "github.com/rogpeppe/fastuuid" "golang.org/x/net/context" + "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - ) // Implements of ABitOfEverythingServiceServer @@ -248,6 +249,20 @@ func (s *_ABitOfEverythingServer) Timeout(ctx context.Context, msg *empty.Empty) } } +func (s *_ABitOfEverythingServer) ErrorWithDetails(ctx context.Context, msg *empty.Empty) (*empty.Empty, error) { + stat, err := status.New(codes.Unknown, "with details"). + WithDetails(proto.Message( + &errdetails.DebugInfo{ + StackEntries: []string{"foo:1"}, + Detail: "error debug details", + }, + )) + if err != nil { + return nil, status.Errorf(codes.Internal, "unexpected error adding details: %s", err) + } + return nil, stat.Err() +} + func (s *_ABitOfEverythingServer) GetMessageWithBody(ctx context.Context, msg *examples.MessageWithBody) (*empty.Empty, error) { return &empty.Empty{}, nil } diff --git a/runtime/errors.go b/runtime/errors.go index 8eebdcf49f4..7b8c690ac1c 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -63,11 +63,12 @@ var ( ) type errorBody struct { - Error string `protobuf:"bytes,1,name=error" json:"error"` - Code int32 `protobuf:"varint,2,name=code" json:"code"` + Error string `protobuf:"bytes,1,name=error" json:"error"` + Code int32 `protobuf:"varint,2,name=code" json:"code"` + Details []proto.Message `protobuf:"bytes,3,name=details" json:"details"` } -//Make this also conform to proto.Message for builtin JSONPb Marshaler +// Make this also conform to proto.Message for builtin JSONPb Marshaler func (e *errorBody) Reset() { *e = errorBody{} } func (e *errorBody) String() string { return proto.CompactTextString(e) } func (*errorBody) ProtoMessage() {} @@ -94,6 +95,12 @@ func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w Code: int32(s.Code()), } + for _, detail := range s.Details() { + if det, ok := detail.(proto.Message); ok { + body.Details = append(body.Details, det) + } + } + buf, merr := marshaler.Marshal(body) if merr != nil { grpclog.Printf("Failed to marshal error message %q: %v", body, merr) From 730ddb5e20ccf345762774cf41d529bde4891f54 Mon Sep 17 00:00:00 2001 From: Max Kuznetsov Date: Sat, 20 Jan 2018 22:56:44 -0500 Subject: [PATCH 182/552] Fix decoding empty request body (#527) --- .../abe/a_bit_of_everything_service_api.go | 66 ++++- examples/examplepb/a_bit_of_everything.pb.go | 253 ++++++++++-------- .../examplepb/a_bit_of_everything.pb.gw.go | 96 ++++++- examples/examplepb/a_bit_of_everything.proto | 6 + .../a_bit_of_everything.swagger.json | 32 +++ examples/examplepb/echo_service.pb.gw.go | 6 +- examples/examplepb/flow_combination.pb.gw.go | 72 +++-- examples/integration_test.go | 16 ++ examples/server/a_bit_of_everything.go | 4 + .../gengateway/template.go | 6 +- 10 files changed, 409 insertions(+), 148 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 222e5c7c777..eec4725130c 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -502,7 +502,7 @@ func (a ABitOfEverythingServiceApi) Echo3(value string) (*SubStringMessage, *API } /** - * + * * * @return *ProtobufEmpty */ @@ -798,6 +798,70 @@ func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEveryth return successPayload, localVarAPIResponse, err } +/** + * + * + * @param name + * @param body + * @return *ProtobufEmpty + */ +func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body ExamplepbBody) (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/postwithemptybody/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "PostWithEmptyBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + /** * * diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index db453f78b04..f8994b6b4a8 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -515,6 +515,7 @@ type ABitOfEverythingServiceClient interface { Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) ErrorWithDetails(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + PostWithEmptyBody(ctx context.Context, in *Body, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } type aBitOfEverythingServiceClient struct { @@ -633,6 +634,15 @@ func (c *aBitOfEverythingServiceClient) GetMessageWithBody(ctx context.Context, return out, nil } +func (c *aBitOfEverythingServiceClient) PostWithEmptyBody(ctx context.Context, in *Body, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PostWithEmptyBody", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for ABitOfEverythingService service type ABitOfEverythingServiceServer interface { @@ -655,6 +665,7 @@ type ABitOfEverythingServiceServer interface { Timeout(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) ErrorWithDetails(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) GetMessageWithBody(context.Context, *MessageWithBody) (*google_protobuf1.Empty, error) + PostWithEmptyBody(context.Context, *Body) (*google_protobuf1.Empty, error) } func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingServiceServer) { @@ -877,6 +888,24 @@ func _ABitOfEverythingService_GetMessageWithBody_Handler(srv interface{}, ctx co return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_PostWithEmptyBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Body) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).PostWithEmptyBody(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PostWithEmptyBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).PostWithEmptyBody(ctx, req.(*Body)) + } + return interceptor(ctx, in, info, handler) +} + var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.examplepb.ABitOfEverythingService", HandlerType: (*ABitOfEverythingServiceServer)(nil), @@ -929,6 +958,10 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "GetMessageWithBody", Handler: _ABitOfEverythingService_GetMessageWithBody_Handler, }, + { + MethodName: "PostWithEmptyBody", + Handler: _ABitOfEverythingService_PostWithEmptyBody_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/examplepb/a_bit_of_everything.proto", @@ -1001,113 +1034,115 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1719 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4f, 0x6f, 0xdb, 0xc8, - 0x15, 0xf7, 0x50, 0x8e, 0x62, 0x3d, 0xf9, 0x8f, 0x3c, 0x4e, 0x1c, 0x45, 0xf1, 0xae, 0x27, 0xda, - 0x6c, 0x4b, 0xb8, 0x31, 0xb9, 0x51, 0x16, 0xc5, 0xc6, 0x40, 0xbb, 0x95, 0x63, 0x25, 0x59, 0x74, - 0xe3, 0x24, 0xcc, 0x6e, 0x1a, 0xa4, 0xd9, 0x1a, 0x94, 0x38, 0x92, 0xb8, 0x11, 0x39, 0x2c, 0x39, - 0x74, 0x2c, 0xa8, 0xee, 0xa1, 0x87, 0x16, 0x7b, 0x75, 0x6f, 0x3d, 0xec, 0xa5, 0x40, 0xd1, 0x02, - 0xed, 0xb1, 0xa7, 0x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12, 0xfd, 0x47, 0x43, + 0x69, 0x3f, 0x6b, 0x56, 0xcd, 0xed, 0xfe, 0x45, 0x39, 0xa9, 0xff, 0x41, 0xc1, 0x1c, 0xd6, 0xea, + 0x64, 0xd7, 0xe6, 0xc2, 0xc1, 0x4c, 0x55, 0x3e, 0x87, 0x4b, 0x1d, 0xe3, 0xf1, 0xdd, 0xed, 0xfb, + 0x11, 0x1b, 0xe2, 0xf9, 0xec, 0x4b, 0xda, 0xe2, 0xb3, 0x7a, 0x51, 0x29, 0xb9, 0xcc, 0xa5, 0x3f, + 0x8e, 0x6f, 0x4c, 0x48, 0xd7, 0x72, 0xb7, 0xb4, 0x0f, 0xb6, 0x72, 0x48, 0x99, 0xaf, 0x95, 0x4c, + 0xcf, 0xeb, 0xd9, 0x2d, 0x19, 0x4a, 0xfd, 0xcb, 0x80, 0xb9, 0xb5, 0xf5, 0xec, 0xce, 0xd1, 0x76, + 0x9b, 0xb1, 0x6d, 0xc7, 0x76, 0xe8, 0xce, 0x98, 0xe4, 0xce, 0x04, 0x49, 0xff, 0x13, 0xb8, 0xf2, + 0xf0, 0x4d, 0xfc, 0xb3, 0x2e, 0xcc, 0x4a, 0xfd, 0x45, 0x21, 0xcd, 0xcd, 0x66, 0x5e, 0x46, 0xef, + 0xf6, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x74, 0xcd, 0x98, 0xea, 0x14, 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 a2cc99df253..b2f40a3f04e 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -224,8 +224,10 @@ func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler var protoReq ABitOfEverything var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } msg, err := client.CreateBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -264,8 +266,10 @@ func request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler run var protoReq ABitOfEverything var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( @@ -384,8 +388,10 @@ func request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runti var protoReq sub.StringMessage var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Value); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Value); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -414,8 +420,10 @@ func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshal var protoReq ABitOfEverything var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( @@ -463,8 +471,10 @@ func request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, m var protoReq MessageWithBody var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Data); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Data); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( @@ -490,6 +500,39 @@ func request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, m } +func request_ABitOfEverythingService_PostWithEmptyBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Body + var metadata runtime.ServerMetadata + + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.PostWithEmptyBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + // RegisterABitOfEverythingServiceHandlerFromEndpoint is same as RegisterABitOfEverythingServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { @@ -905,6 +948,35 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) + mux.Handle("POST", pattern_ABitOfEverythingService_PostWithEmptyBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + 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, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_PostWithEmptyBody_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_PostWithEmptyBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -934,6 +1006,8 @@ var ( pattern_ABitOfEverythingService_ErrorWithDetails_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "errorwithdetails"}, "")) pattern_ABitOfEverythingService_GetMessageWithBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "withbody", "id"}, "")) + + pattern_ABitOfEverythingService_PostWithEmptyBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "postwithemptybody", "name"}, "")) ) var ( @@ -962,4 +1036,6 @@ var ( forward_ABitOfEverythingService_ErrorWithDetails_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_GetMessageWithBody_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_PostWithEmptyBody_0 = runtime.ForwardResponseMessage ) diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 7336e66084b..4866bc6d581 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -215,6 +215,12 @@ service ABitOfEverythingService { body: "data" }; } + rpc PostWithEmptyBody(Body) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2/example/postwithemptybody/{name}", + body: "*" + }; + } } service AnotherServiceWithNoBindings { diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 81f7599582a..9271ba5af0c 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -597,6 +597,38 @@ ] } }, + "/v2/example/postwithemptybody/{name}": { + "post": { + "operationId": "PostWithEmptyBody", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + } + }, + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbBody" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, "/v2/example/timeout": { "get": { "operationId": "Timeout", diff --git a/examples/examplepb/echo_service.pb.gw.go b/examples/examplepb/echo_service.pb.gw.go index 654919e6599..bc766f7b808 100644 --- a/examples/examplepb/echo_service.pb.gw.go +++ b/examples/examplepb/echo_service.pb.gw.go @@ -105,8 +105,10 @@ func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marsh var protoReq SimpleMessage var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 2f868050aec..11ae2e3c5bc 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -151,8 +151,10 @@ func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -230,8 +232,10 @@ func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( @@ -276,8 +280,10 @@ func request_FlowCombination_RpcBodyRpc_4(ctx context.Context, marshaler runtime var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_4); err != nil { @@ -297,8 +303,10 @@ func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( @@ -406,8 +414,10 @@ func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler r var protoReq NestedProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( @@ -491,8 +501,10 @@ func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler r var protoReq NestedProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( @@ -526,8 +538,10 @@ func request_FlowCombination_RpcBodyStream_0(ctx context.Context, marshaler runt var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } stream, err := client.RpcBodyStream(ctx, &protoReq) @@ -629,8 +643,10 @@ func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runt var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( @@ -683,8 +699,10 @@ func request_FlowCombination_RpcBodyStream_4(ctx context.Context, marshaler runt var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_4); err != nil { @@ -712,8 +730,10 @@ func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runt var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( @@ -845,8 +865,10 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale var protoReq NestedProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( @@ -946,8 +968,10 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale var protoReq NestedProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } var ( diff --git a/examples/integration_test.go b/examples/integration_test.go index 096e53b908b..2d658d12623 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -777,6 +777,22 @@ func TestErrorWithDetails(t *testing.T) { } } +func TestPostWithEmptyBody(t *testing.T) { + url := "http://localhost:8080/v2/example/postwithemptybody/name" + rep, err := http.Post(url, "application/json", nil) + + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + + if rep.StatusCode != http.StatusOK { + t.Errorf("http.Post(%q) response code is %d; want %d", url, + rep.StatusCode, http.StatusOK) + return + } +} + func TestUnknownPath(t *testing.T) { url := "http://localhost:8080" resp, err := http.Post(url, "application/json", strings.NewReader("{}")) diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 7542801b7cc..e29e0fa1757 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -266,3 +266,7 @@ func (s *_ABitOfEverythingServer) ErrorWithDetails(ctx context.Context, msg *emp func (s *_ABitOfEverythingServer) GetMessageWithBody(ctx context.Context, msg *examples.MessageWithBody) (*empty.Empty, error) { return &empty.Empty{}, nil } + +func (s *_ABitOfEverythingServer) PostWithEmptyBody(ctx context.Context, msg *examples.Body) (*empty.Empty, error) { + return &empty.Empty{}, nil +} diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index c6e55c130f7..2354eac533b 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -205,8 +205,10 @@ var ( var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} var metadata runtime.ServerMetadata {{if .Body}} - if err := marshaler.NewDecoder(req.Body).Decode(&{{.Body.RHS "protoReq"}}); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&{{.Body.RHS "protoReq"}}); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } } {{end}} {{if .PathParams}} From cfae8c76903d3e498bbf46b3d24fa6093778f412 Mon Sep 17 00:00:00 2001 From: devnull- Date: Sun, 21 Jan 2018 04:59:28 +0100 Subject: [PATCH 183/552] Add description, summary and tags fields in operationObject (swagger) (#526) * Add Summary field (OperationObject -- Swagger) * Add Description field (OperationObject -- Swagger) * Add Tags field (OperationObject -- Swagger) * Add description field (openapiv2_operation) in examplepb * Add summary field (openapiv2_operation) in examplepb * Add tags field (openapiv2_operation) in examplepb * Swagger (JSON format) with summary, description and tags fields (openapiv2_operation) --- examples/examplepb/a_bit_of_everything.proto | 4 ++++ .../a_bit_of_everything.swagger.json | 21 +++++++++++-------- protoc-gen-swagger/genswagger/template.go | 11 ++++++++++ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 4866bc6d581..40280c7e124 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -186,6 +186,10 @@ service ABitOfEverythingService { } }; option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { + description: "Description Echo"; + summary: "Summary: Echo rpc"; + tags: "echo service"; + tags: "echo rpc"; external_docs: { url: "https://github.com/grpc-ecosystem/grpc-gateway"; description: "Find out more Echo"; diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 9271ba5af0c..a6c1f752214 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -51,8 +51,8 @@ }, "/v1/example/a_bit_of_everything/echo/{value}": { "get": { - "summary": "Echo allows posting a StringMessage value.", - "description": "It also exposes multiple bindings.\n\nThis makes it useful when validating that the OpenAPI v2 API\ndescription exposes documentation correctly on all paths\ndefined as additional_bindings in the proto.", + "summary": "Summary: Echo rpc", + "description": "Description Echo", "operationId": "Echo", "responses": { "200": { @@ -71,7 +71,8 @@ } ], "tags": [ - "ABitOfEverythingService" + "echo service", + "echo rpc" ], "externalDocs": { "description": "Find out more Echo", @@ -523,8 +524,8 @@ }, "/v2/example/echo": { "get": { - "summary": "Echo allows posting a StringMessage value.", - "description": "It also exposes multiple bindings.\n\nThis makes it useful when validating that the OpenAPI v2 API\ndescription exposes documentation correctly on all paths\ndefined as additional_bindings in the proto.", + "summary": "Summary: Echo rpc", + "description": "Description Echo", "operationId": "Echo3", "responses": { "200": { @@ -543,7 +544,8 @@ } ], "tags": [ - "ABitOfEverythingService" + "echo service", + "echo rpc" ], "externalDocs": { "description": "Find out more Echo", @@ -551,8 +553,8 @@ } }, "post": { - "summary": "Echo allows posting a StringMessage value.", - "description": "It also exposes multiple bindings.\n\nThis makes it useful when validating that the OpenAPI v2 API\ndescription exposes documentation correctly on all paths\ndefined as additional_bindings in the proto.", + "summary": "Summary: Echo rpc", + "description": "Description Echo", "operationId": "Echo2", "responses": { "200": { @@ -573,7 +575,8 @@ } ], "tags": [ - "ABitOfEverythingService" + "echo service", + "echo rpc" ], "externalDocs": { "description": "Find out more Echo", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 349e8556279..c838a5808d7 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -638,6 +638,17 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re // TODO(ivucica): this would be better supported by looking whether the method is deprecated in the proto file operationObject.Deprecated = opts.Deprecated + if opts.Summary != "" { + operationObject.Summary = opts.Summary + } + if opts.Description != "" { + operationObject.Description = opts.Description + } + if len(opts.Tags) > 0 { + operationObject.Tags = make([]string, len(opts.Tags)) + copy(operationObject.Tags, opts.Tags) + } + // TODO(ivucica): add remaining fields of operation object } From a69588eb01deee981d1d12643e7339cc025ddab1 Mon Sep 17 00:00:00 2001 From: Gorka Lerchundi Osa Date: Sun, 21 Jan 2018 12:36:37 +0100 Subject: [PATCH 184/552] runtime: support FieldMask as query param (#529) --- runtime/query.go | 20 ++++++++++++++++++-- runtime/query_test.go | 9 +++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/runtime/query.go b/runtime/query.go index d9f3b2583c7..a71ffe13847 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -149,11 +149,13 @@ func populateRepeatedField(f reflect.Value, values []string, props *proto.Proper } func populateField(f reflect.Value, value string, props *proto.Properties) error { - // Handle well known type + i := f.Addr().Interface() + + // Handle protobuf well known types type wkt interface { XXX_WellKnownType() string } - if wkt, ok := f.Addr().Interface().(wkt); ok { + if wkt, ok := i.(wkt); ok { switch wkt.XXX_WellKnownType() { case "Timestamp": if value == "null" { @@ -218,6 +220,20 @@ func populateField(f reflect.Value, value string, props *proto.Properties) error } } + // Handle google well known types + if gwkt, ok := i.(proto.Message); ok { + switch proto.MessageName(gwkt) { + case "google.protobuf.FieldMask": + p := f.Field(0) + for _, v := range strings.Split(value, ",") { + if v != "" { + p.Set(reflect.Append(p, reflect.ValueOf(v))) + } + } + return nil + } + } + // is the destination field an enumeration type? if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil { return populateFieldEnum(f, value, enumValMap) diff --git a/runtime/query_test.go b/runtime/query_test.go index d5b4c758469..8d5ac5f7040 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -15,6 +15,7 @@ import ( "github.com/golang/protobuf/ptypes/wrappers" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/genproto/protobuf/field_mask" ) func TestPopulateParameters(t *testing.T) { @@ -25,6 +26,9 @@ func TestPopulateParameters(t *testing.T) { t.Fatalf("Couldn't setup timestamp in Protobuf format: %v", err) } + fieldmaskStr := "float_value,double_value" + fieldmaskPb := &field_mask.FieldMask{[]string{"float_value", "double_value"}} + for _, spec := range []struct { values url.Values filter *utilities.DoubleArray @@ -46,6 +50,7 @@ func TestPopulateParameters(t *testing.T) { "enum_value": {"1"}, "repeated_enum": {"1", "2", "0"}, "timestamp_value": {timeStr}, + "fieldmask_value": {fieldmaskStr}, "wrapper_float_value": {"1.5"}, "wrapper_double_value": {"2.5"}, "wrapper_int64_value": {"-1"}, @@ -71,6 +76,7 @@ func TestPopulateParameters(t *testing.T) { EnumValue: EnumValue_Y, RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, TimestampValue: timePb, + FieldMaskValue: fieldmaskPb, WrapperFloatValue: &wrappers.FloatValue{1.5}, WrapperDoubleValue: &wrappers.DoubleValue{2.5}, WrapperInt64Value: &wrappers.Int64Value{-1}, @@ -97,6 +103,7 @@ func TestPopulateParameters(t *testing.T) { "enumValue": {"1"}, "repeatedEnum": {"1", "2", "0"}, "timestampValue": {timeStr}, + "fieldmaskValue": {fieldmaskStr}, "wrapperFloatValue": {"1.5"}, "wrapperDoubleValue": {"2.5"}, "wrapperInt64Value": {"-1"}, @@ -122,6 +129,7 @@ func TestPopulateParameters(t *testing.T) { EnumValue: EnumValue_Y, RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, TimestampValue: timePb, + FieldMaskValue: fieldmaskPb, WrapperFloatValue: &wrappers.FloatValue{1.5}, WrapperDoubleValue: &wrappers.DoubleValue{2.5}, WrapperInt64Value: &wrappers.Int64Value{-1}, @@ -484,6 +492,7 @@ type proto3Message struct { EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeatedEnum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` TimestampValue *timestamp.Timestamp `protobuf:"bytes,16,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` + FieldMaskValue *field_mask.FieldMask `protobuf:"bytes,27,opt,name=fieldmask_value,json=fieldmaskValue" json:"fieldmask_value,omitempty"` OneofValue proto3Message_OneofValue `protobuf_oneof:"oneof_value"` WrapperDoubleValue *wrappers.DoubleValue `protobuf:"bytes,17,opt,name=wrapper_double_value,json=wrapperDoubleValue" json:"wrapper_double_value,omitempty"` WrapperFloatValue *wrappers.FloatValue `protobuf:"bytes,18,opt,name=wrapper_float_value,json=wrapperFloatValue" json:"wrapper_float_value,omitempty"` From b4531ceb87c217c18f9846721909fdafcd6f6651 Mon Sep 17 00:00:00 2001 From: budougumi0617 Date: Wed, 24 Jan 2018 21:45:23 +0900 Subject: [PATCH 185/552] Change error message in protoc-gen-grpc-gateway --- protoc-gen-grpc-gateway/descriptor/services.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index a62bd06fe16..e054925efec 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -75,7 +75,7 @@ func (r *Registry) newMethod(svc *Service, md *descriptor.MethodDescriptorProto, httpMethod = "GET" pathTemplate = opts.GetGet() if opts.Body != "" { - return nil, fmt.Errorf("needs request body even though http method is GET: %s", md.GetName()) + return nil, fmt.Errorf("must not set request body when http method is GET: %s", md.GetName()) } case opts.GetPut() != "": @@ -90,7 +90,7 @@ func (r *Registry) newMethod(svc *Service, md *descriptor.MethodDescriptorProto, httpMethod = "DELETE" pathTemplate = opts.GetDelete() if opts.Body != "" && !r.allowDeleteBody { - return nil, fmt.Errorf("needs request body even though http method is DELETE: %s", md.GetName()) + return nil, fmt.Errorf("must not set request body when http method is DELETE except allow_delete_body option is true: %s", md.GetName()) } case opts.GetPatch() != "": From 2f7217ca8e61f9cbd68377c7b80e63af44b07a29 Mon Sep 17 00:00:00 2001 From: Adam Struck Date: Tue, 30 Jan 2018 13:49:56 -0800 Subject: [PATCH 186/552] Support for map type in query string (#535) --- runtime/query.go | 50 +++++++++++++++++++ runtime/query_test.go | 108 ++++++++++++++++++++++++++++++++---------- 2 files changed, 134 insertions(+), 24 deletions(-) diff --git a/runtime/query.go b/runtime/query.go index a71ffe13847..fb8f4fc0bf7 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -5,6 +5,7 @@ import ( "fmt" "net/url" "reflect" + "regexp" "strconv" "strings" "time" @@ -18,6 +19,15 @@ import ( // A value is ignored if its key starts with one of the elements in "filter". func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { for key, values := range values { + re, err := regexp.Compile("^(.*)\\[(.*)\\]$") + if err != nil { + return err + } + match := re.FindStringSubmatch(key) + if len(match) == 3 { + key = match[1] + values = append([]string{match[2]}, values...) + } fieldPath := strings.Split(key, ".") if filter.HasCommonPrefix(fieldPath) { continue @@ -84,6 +94,11 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] case reflect.Struct: m = f continue + case reflect.Map: + if !isLast { + return fmt.Errorf("unexpected nested field %s in %s", fieldPath[i+1], strings.Join(fieldPath[:i+1], ".")) + } + return populateMapField(f, values, props) default: return fmt.Errorf("unexpected type %s in %T", f.Type(), msg) } @@ -125,6 +140,41 @@ func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Prope return reflect.Value{}, nil, nil } +func populateMapField(f reflect.Value, values []string, props *proto.Properties) error { + if len(values) != 2 { + return fmt.Errorf("more than one value provided for key %s in map %s", values[0], props.Name) + } + + key, value := values[0], values[1] + keyType := f.Type().Key() + valueType := f.Type().Elem() + if f.IsNil() { + f.Set(reflect.MakeMap(f.Type())) + } + + keyConv, ok := convFromType[keyType.Kind()] + if !ok { + return fmt.Errorf("unsupported key type %s in map %s", keyType, props.Name) + } + valueConv, ok := convFromType[valueType.Kind()] + if !ok { + return fmt.Errorf("unsupported value type %s in map %s", valueType, props.Name) + } + + keyV := keyConv.Call([]reflect.Value{reflect.ValueOf(key)}) + if err := keyV[1].Interface(); err != nil { + return err.(error) + } + valueV := valueConv.Call([]reflect.Value{reflect.ValueOf(value)}) + if err := valueV[1].Interface(); err != nil { + return err.(error) + } + + f.SetMapIndex(keyV[0].Convert(keyType), valueV[0].Convert(valueType)) + + return nil +} + func populateRepeatedField(f reflect.Value, values []string, props *proto.Properties) error { elemType := f.Type().Elem() diff --git a/runtime/query_test.go b/runtime/query_test.go index 8d5ac5f7040..ae5d20f124d 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -6,7 +6,6 @@ import ( "net/url" "reflect" "testing" - "time" "github.com/golang/protobuf/proto" @@ -37,29 +36,48 @@ func TestPopulateParameters(t *testing.T) { }{ { values: url.Values{ - "float_value": {"1.5"}, - "double_value": {"2.5"}, - "int64_value": {"-1"}, - "int32_value": {"-2"}, - "uint64_value": {"3"}, - "uint32_value": {"4"}, - "bool_value": {"true"}, - "string_value": {"str"}, - "bytes_value": {"Ynl0ZXM"}, - "repeated_value": {"a", "b", "c"}, - "enum_value": {"1"}, - "repeated_enum": {"1", "2", "0"}, - "timestamp_value": {timeStr}, - "fieldmask_value": {fieldmaskStr}, - "wrapper_float_value": {"1.5"}, - "wrapper_double_value": {"2.5"}, - "wrapper_int64_value": {"-1"}, - "wrapper_int32_value": {"-2"}, - "wrapper_u_int64_value": {"3"}, - "wrapper_u_int32_value": {"4"}, - "wrapper_bool_value": {"true"}, - "wrapper_string_value": {"str"}, - "wrapper_bytes_value": {"Ynl0ZXM"}, + "float_value": {"1.5"}, + "double_value": {"2.5"}, + "int64_value": {"-1"}, + "int32_value": {"-2"}, + "uint64_value": {"3"}, + "uint32_value": {"4"}, + "bool_value": {"true"}, + "string_value": {"str"}, + "bytes_value": {"Ynl0ZXM"}, + "repeated_value": {"a", "b", "c"}, + "enum_value": {"1"}, + "repeated_enum": {"1", "2", "0"}, + "timestamp_value": {timeStr}, + "fieldmask_value": {fieldmaskStr}, + "wrapper_float_value": {"1.5"}, + "wrapper_double_value": {"2.5"}, + "wrapper_int64_value": {"-1"}, + "wrapper_int32_value": {"-2"}, + "wrapper_u_int64_value": {"3"}, + "wrapper_u_int32_value": {"4"}, + "wrapper_bool_value": {"true"}, + "wrapper_string_value": {"str"}, + "wrapper_bytes_value": {"Ynl0ZXM"}, + "map_value[key]": {"value"}, + "map_value[second]": {"bar"}, + "map_value[third]": {"zzz"}, + "map_value[fourth]": {""}, + `map_value[~!@#$%^&*()]`: {"value"}, + "map_value2[key]": {"-2"}, + "map_value3[-2]": {"value"}, + "map_value4[key]": {"-1"}, + "map_value5[-1]": {"value"}, + "map_value6[key]": {"3"}, + "map_value7[3]": {"value"}, + "map_value8[key]": {"4"}, + "map_value9[4]": {"value"}, + "map_value10[key]": {"1.5"}, + "map_value11[1.5]": {"value"}, + "map_value12[key]": {"2.5"}, + "map_value13[2.5]": {"value"}, + "map_value14[key]": {"true"}, + "map_value15[true]": {"value"}, }, filter: utilities.NewDoubleArray(nil), want: &proto3Message{ @@ -86,6 +104,27 @@ func TestPopulateParameters(t *testing.T) { WrapperBoolValue: &wrappers.BoolValue{true}, WrapperStringValue: &wrappers.StringValue{"str"}, WrapperBytesValue: &wrappers.BytesValue{[]byte("bytes")}, + MapValue: map[string]string{ + "key": "value", + "second": "bar", + "third": "zzz", + "fourth": "", + `~!@#$%^&*()`: "value", + }, + MapValue2: map[string]int32{"key": -2}, + MapValue3: map[int32]string{-2: "value"}, + MapValue4: map[string]int64{"key": -1}, + MapValue5: map[int64]string{-1: "value"}, + MapValue6: map[string]uint32{"key": 3}, + MapValue7: map[uint32]string{3: "value"}, + MapValue8: map[string]uint64{"key": 4}, + MapValue9: map[uint64]string{4: "value"}, + MapValue10: map[string]float32{"key": 1.5}, + MapValue11: map[float32]string{1.5: "value"}, + MapValue12: map[string]float64{"key": 2.5}, + MapValue13: map[float64]string{2.5: "value"}, + MapValue14: map[string]bool{"key": true}, + MapValue15: map[bool]string{true: "value"}, }, }, { @@ -217,11 +256,17 @@ func TestPopulateParameters(t *testing.T) { "nested.nested.string_value": {"t"}, "nested.string_value": {"u"}, "nested_non_null.string_value": {"v"}, + "nested.nested.map_value[first]": {"foo"}, + "nested.nested.map_value[second]": {"bar"}, }, filter: utilities.NewDoubleArray(nil), want: &proto3Message{ Nested: &proto2Message{ Nested: &proto3Message{ + MapValue: map[string]string{ + "first": "foo", + "second": "bar", + }, Nested: &proto2Message{ RepeatedValue: []string{"a", "b", "c"}, StringValue: proto.String("s"), @@ -503,6 +548,21 @@ type proto3Message struct { WrapperBoolValue *wrappers.BoolValue `protobuf:"bytes,23,opt,name=wrapper_bool_value,json=wrapperBoolValue" json:"wrapper_bool_value,omitempty"` WrapperStringValue *wrappers.StringValue `protobuf:"bytes,24,opt,name=wrapper_string_value,json=wrapperStringValue" json:"wrapper_string_value,omitempty"` WrapperBytesValue *wrappers.BytesValue `protobuf:"bytes,26,opt,name=wrapper_bytes_value,json=wrapperBytesValue" json:"wrapper_bytes_value,omitempty"` + MapValue map[string]string `protobuf:"bytes,27,opt,name=map_value,json=mapValue" json:"map_value,omitempty"` + MapValue2 map[string]int32 `protobuf:"bytes,28,opt,name=map_value2,json=mapValue2" json:"map_value2,omitempty"` + MapValue3 map[int32]string `protobuf:"bytes,29,opt,name=map_value3,json=mapValue3" json:"map_value3,omitempty"` + MapValue4 map[string]int64 `protobuf:"bytes,30,opt,name=map_value4,json=mapValue4" json:"map_value4,omitempty"` + MapValue5 map[int64]string `protobuf:"bytes,31,opt,name=map_value5,json=mapValue5" json:"map_value5,omitempty"` + MapValue6 map[string]uint32 `protobuf:"bytes,32,opt,name=map_value6,json=mapValue6" json:"map_value6,omitempty"` + MapValue7 map[uint32]string `protobuf:"bytes,33,opt,name=map_value7,json=mapValue7" json:"map_value7,omitempty"` + MapValue8 map[string]uint64 `protobuf:"bytes,34,opt,name=map_value8,json=mapValue8" json:"map_value8,omitempty"` + MapValue9 map[uint64]string `protobuf:"bytes,35,opt,name=map_value9,json=mapValue9" json:"map_value9,omitempty"` + MapValue10 map[string]float32 `protobuf:"bytes,36,opt,name=map_value10,json=mapValue10" json:"map_value10,omitempty"` + MapValue11 map[float32]string `protobuf:"bytes,37,opt,name=map_value11,json=mapValue11" json:"map_value11,omitempty"` + MapValue12 map[string]float64 `protobuf:"bytes,38,opt,name=map_value12,json=mapValue12" json:"map_value12,omitempty"` + MapValue13 map[float64]string `protobuf:"bytes,39,opt,name=map_value13,json=mapValue13" json:"map_value13,omitempty"` + MapValue14 map[string]bool `protobuf:"bytes,40,opt,name=map_value14,json=mapValue14" json:"map_value14,omitempty"` + MapValue15 map[bool]string `protobuf:"bytes,41,opt,name=map_value15,json=mapValue15" json:"map_value15,omitempty"` } func (m *proto3Message) Reset() { *m = proto3Message{} } From 2b770af5a3ffc8c83f529cc1d5f9e8c07283d682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 11 Feb 2018 18:58:08 +0000 Subject: [PATCH 187/552] swagger: Add `securityDefinitions` and `security` fields to Swagger options proto file. --- protoc-gen-swagger/options/openapiv2.pb.go | 527 +++++++++++++++++---- protoc-gen-swagger/options/openapiv2.proto | 129 ++++- 2 files changed, 566 insertions(+), 90 deletions(-) diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index 7564c52e500..1b639f78d56 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -17,6 +17,10 @@ It has these top-level messages: Schema JSONSchema Tag + SecurityDefinitions + SecurityScheme + SecurityRequirement + Scopes */ package options @@ -107,20 +111,108 @@ func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{6, 0} } +// Required. The type of the security scheme. Valid values are "basic", +// "apiKey" or "oauth2". +type SecurityScheme_Type int32 + +const ( + SecurityScheme_TYPE_INVALID SecurityScheme_Type = 0 + SecurityScheme_TYPE_BASIC SecurityScheme_Type = 1 + SecurityScheme_TYPE_API_KEY SecurityScheme_Type = 2 + SecurityScheme_TYPE_OAUTH2 SecurityScheme_Type = 3 +) + +var SecurityScheme_Type_name = map[int32]string{ + 0: "TYPE_INVALID", + 1: "TYPE_BASIC", + 2: "TYPE_API_KEY", + 3: "TYPE_OAUTH2", +} +var SecurityScheme_Type_value = map[string]int32{ + "TYPE_INVALID": 0, + "TYPE_BASIC": 1, + "TYPE_API_KEY": 2, + "TYPE_OAUTH2": 3, +} + +func (x SecurityScheme_Type) String() string { + return proto.EnumName(SecurityScheme_Type_name, int32(x)) +} +func (SecurityScheme_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 0} } + +// Required. The location of the API key. Valid values are "query" or "header". +type SecurityScheme_In int32 + +const ( + SecurityScheme_IN_INVALID SecurityScheme_In = 0 + SecurityScheme_IN_QUERY SecurityScheme_In = 1 + SecurityScheme_IN_HEADER SecurityScheme_In = 2 +) + +var SecurityScheme_In_name = map[int32]string{ + 0: "IN_INVALID", + 1: "IN_QUERY", + 2: "IN_HEADER", +} +var SecurityScheme_In_value = map[string]int32{ + "IN_INVALID": 0, + "IN_QUERY": 1, + "IN_HEADER": 2, +} + +func (x SecurityScheme_In) String() string { + return proto.EnumName(SecurityScheme_In_name, int32(x)) +} +func (SecurityScheme_In) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 1} } + +// Required. The flow used by the OAuth2 security scheme. Valid values are +// "implicit", "password", "application" or "accessCode". +type SecurityScheme_Flow int32 + +const ( + SecurityScheme_FLOW_INVALID SecurityScheme_Flow = 0 + SecurityScheme_FLOW_IMPLICIT SecurityScheme_Flow = 1 + SecurityScheme_FLOW_PASSWORD SecurityScheme_Flow = 2 + SecurityScheme_FLOW_APPLICATION SecurityScheme_Flow = 3 + SecurityScheme_FLOW_ACCESS_CODE SecurityScheme_Flow = 4 +) + +var SecurityScheme_Flow_name = map[int32]string{ + 0: "FLOW_INVALID", + 1: "FLOW_IMPLICIT", + 2: "FLOW_PASSWORD", + 3: "FLOW_APPLICATION", + 4: "FLOW_ACCESS_CODE", +} +var SecurityScheme_Flow_value = map[string]int32{ + "FLOW_INVALID": 0, + "FLOW_IMPLICIT": 1, + "FLOW_PASSWORD": 2, + "FLOW_APPLICATION": 3, + "FLOW_ACCESS_CODE": 4, +} + +func (x SecurityScheme_Flow) String() string { + return proto.EnumName(SecurityScheme_Flow_name, int32(x)) +} +func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 2} } + // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject // // TODO(ivucica): document fields type Swagger struct { - Swagger string `protobuf:"bytes,1,opt,name=swagger" json:"swagger,omitempty"` - Info *Info `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"` - Host string `protobuf:"bytes,3,opt,name=host" json:"host,omitempty"` - BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath" json:"base_path,omitempty"` - Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` - Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"` - Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` + Swagger string `protobuf:"bytes,1,opt,name=swagger" json:"swagger,omitempty"` + Info *Info `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"` + Host string `protobuf:"bytes,3,opt,name=host" json:"host,omitempty"` + BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath" json:"base_path,omitempty"` + Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` + Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"` + Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` + SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,11,opt,name=security_definitions,json=securityDefinitions" json:"security_definitions,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security" json:"security,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` } func (m *Swagger) Reset() { *m = Swagger{} } @@ -177,6 +269,20 @@ func (m *Swagger) GetProduces() []string { return nil } +func (m *Swagger) GetSecurityDefinitions() *SecurityDefinitions { + if m != nil { + return m.SecurityDefinitions + } + return nil +} + +func (m *Swagger) GetSecurity() []*SecurityRequirement { + if m != nil { + return m.Security + } + return nil +} + func (m *Swagger) GetExternalDocs() *ExternalDocumentation { if m != nil { return m.ExternalDocs @@ -199,6 +305,7 @@ type Operation struct { Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` Schemes []string `protobuf:"bytes,10,rep,name=schemes" json:"schemes,omitempty"` Deprecated bool `protobuf:"varint,11,opt,name=deprecated" json:"deprecated,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security" json:"security,omitempty"` } func (m *Operation) Reset() { *m = Operation{} } @@ -269,6 +376,13 @@ func (m *Operation) GetDeprecated() bool { return false } +func (m *Operation) GetSecurity() []*SecurityRequirement { + if m != nil { + return m.Security + } + return nil +} + // `Info` is a representation of OpenAPI v2 specification's Info object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject @@ -645,6 +759,215 @@ func (m *Tag) GetExternalDocs() *ExternalDocumentation { return nil } +// `SecurityDefinitions` is a representation of OpenAPI v2 specification's +// Security Definitions object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject +// +// A declaration of the security schemes available to be used in the +// specification. This does not enforce the security schemes on the operations +// and only serves to provide the relevant details for each scheme. +type SecurityDefinitions struct { + // A single security scheme definition, mapping a "name" to the scheme it defines. + Security map[string]*SecurityScheme `protobuf:"bytes,1,rep,name=security" json:"security,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *SecurityDefinitions) Reset() { *m = SecurityDefinitions{} } +func (m *SecurityDefinitions) String() string { return proto.CompactTextString(m) } +func (*SecurityDefinitions) ProtoMessage() {} +func (*SecurityDefinitions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *SecurityDefinitions) GetSecurity() map[string]*SecurityScheme { + if m != nil { + return m.Security + } + return nil +} + +// `SecurityScheme` is a representation of OpenAPI v2 specification's +// Security Scheme object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject +// +// Allows the definition of a security scheme that can be used by the +// operations. Supported schemes are basic authentication, an API key (either as +// a header or as a query parameter) and OAuth2's common flows (implicit, +// password, application and access code). +type SecurityScheme struct { + // Required. The type of the security scheme. Valid values are "basic", + // "apiKey" or "oauth2". + Type SecurityScheme_Type `protobuf:"varint,1,opt,name=type,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Type" json:"type,omitempty"` + // A short description for security scheme. + Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + // Required. The name of the header or query parameter to be used. + // + // Valid for apiKey. + Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` + // Required. The location of the API key. Valid values are "query" or "header". + // + // Valid for apiKey. + In SecurityScheme_In `protobuf:"varint,4,opt,name=in,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_In" json:"in,omitempty"` + // Required. The flow used by the OAuth2 security scheme. Valid values are + // "implicit", "password", "application" or "accessCode". + // + // Valid for oauth2. + Flow SecurityScheme_Flow `protobuf:"varint,5,opt,name=flow,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Flow" json:"flow,omitempty"` + // Required. The authorization URL to be used for this flow. This SHOULD be in + // the form of a URL. + // + // Valid for oauth2/implicit and oauth2/accessCode. + AuthorizationUrl string `protobuf:"bytes,6,opt,name=authorization_url,json=authorizationUrl" json:"authorization_url,omitempty"` + // Required. The token URL to be used for this flow. This SHOULD be in the + // form of a URL. + // + // Valid for oauth2/password, oauth2/application and oauth2/accessCode. + TokenUrl string `protobuf:"bytes,7,opt,name=token_url,json=tokenUrl" json:"token_url,omitempty"` + // Required. The available scopes for the OAuth2 security scheme. + // + // Valid for oauth2. + Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes" json:"scopes,omitempty"` +} + +func (m *SecurityScheme) Reset() { *m = SecurityScheme{} } +func (m *SecurityScheme) String() string { return proto.CompactTextString(m) } +func (*SecurityScheme) ProtoMessage() {} +func (*SecurityScheme) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *SecurityScheme) GetType() SecurityScheme_Type { + if m != nil { + return m.Type + } + return SecurityScheme_TYPE_INVALID +} + +func (m *SecurityScheme) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *SecurityScheme) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *SecurityScheme) GetIn() SecurityScheme_In { + if m != nil { + return m.In + } + return SecurityScheme_IN_INVALID +} + +func (m *SecurityScheme) GetFlow() SecurityScheme_Flow { + if m != nil { + return m.Flow + } + return SecurityScheme_FLOW_INVALID +} + +func (m *SecurityScheme) GetAuthorizationUrl() string { + if m != nil { + return m.AuthorizationUrl + } + return "" +} + +func (m *SecurityScheme) GetTokenUrl() string { + if m != nil { + return m.TokenUrl + } + return "" +} + +func (m *SecurityScheme) GetScopes() *Scopes { + if m != nil { + return m.Scopes + } + return nil +} + +// `SecurityRequirement` is a representation of OpenAPI v2 specification's +// Security Requirement object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject +// +// Lists the required security schemes to execute this operation. The object can +// have multiple security schemes declared in it which are all required (that +// is, there is a logical AND between the schemes). +// +// The name used for each property MUST correspond to a security scheme +// declared in the Security Definitions. +type SecurityRequirement struct { + // Each name must correspond to a security scheme which is declared in + // the Security Definitions. If the security scheme is of type "oauth2", + // then the value is a list of scope names required for the execution. + // For other security scheme types, the array MUST be empty. + SecurityRequirement map[string]*SecurityRequirement_SecurityRequirementValue `protobuf:"bytes,1,rep,name=security_requirement,json=securityRequirement" json:"security_requirement,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} } +func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) } +func (*SecurityRequirement) ProtoMessage() {} +func (*SecurityRequirement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *SecurityRequirement) GetSecurityRequirement() map[string]*SecurityRequirement_SecurityRequirementValue { + if m != nil { + return m.SecurityRequirement + } + return nil +} + +// If the security scheme is of type "oauth2", then the value is a list of +// scope names required for the execution. For other security scheme types, +// the array MUST be empty. +type SecurityRequirement_SecurityRequirementValue struct { + Scope []string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty"` +} + +func (m *SecurityRequirement_SecurityRequirementValue) Reset() { + *m = SecurityRequirement_SecurityRequirementValue{} +} +func (m *SecurityRequirement_SecurityRequirementValue) String() string { + return proto.CompactTextString(m) +} +func (*SecurityRequirement_SecurityRequirementValue) ProtoMessage() {} +func (*SecurityRequirement_SecurityRequirementValue) Descriptor() ([]byte, []int) { + return fileDescriptor0, []int{10, 0} +} + +func (m *SecurityRequirement_SecurityRequirementValue) GetScope() []string { + if m != nil { + return m.Scope + } + return nil +} + +// `Scopes` is a representation of OpenAPI v2 specification's Scopes object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject +// +// Lists the available scopes for an OAuth2 security scheme. +type Scopes struct { + // Maps between a name of a scope to a short description of it (as the value + // of the property). + Scope map[string]string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *Scopes) Reset() { *m = Scopes{} } +func (m *Scopes) String() string { return proto.CompactTextString(m) } +func (*Scopes) ProtoMessage() {} +func (*Scopes) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *Scopes) GetScope() map[string]string { + if m != nil { + return m.Scope + } + return nil +} + func init() { proto.RegisterType((*Swagger)(nil), "grpc.gateway.protoc_gen_swagger.options.Swagger") proto.RegisterType((*Operation)(nil), "grpc.gateway.protoc_gen_swagger.options.Operation") @@ -654,86 +977,124 @@ func init() { proto.RegisterType((*Schema)(nil), "grpc.gateway.protoc_gen_swagger.options.Schema") proto.RegisterType((*JSONSchema)(nil), "grpc.gateway.protoc_gen_swagger.options.JSONSchema") proto.RegisterType((*Tag)(nil), "grpc.gateway.protoc_gen_swagger.options.Tag") + proto.RegisterType((*SecurityDefinitions)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityDefinitions") + proto.RegisterType((*SecurityScheme)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityScheme") + proto.RegisterType((*SecurityRequirement)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityRequirement") + proto.RegisterType((*SecurityRequirement_SecurityRequirementValue)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityRequirement.SecurityRequirementValue") + proto.RegisterType((*Scopes)(nil), "grpc.gateway.protoc_gen_swagger.options.Scopes") proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme", Swagger_SwaggerScheme_name, Swagger_SwaggerScheme_value) proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.JSONSchema_JSONSchemaSimpleTypes", JSONSchema_JSONSchemaSimpleTypes_name, JSONSchema_JSONSchemaSimpleTypes_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Type", SecurityScheme_Type_name, SecurityScheme_Type_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_In", SecurityScheme_In_name, SecurityScheme_In_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Flow", SecurityScheme_Flow_name, SecurityScheme_Flow_value) } func init() { proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1175 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xed, 0x6e, 0xdb, 0x36, - 0x17, 0x7e, 0x65, 0xd3, 0x36, 0x7d, 0x6c, 0xe7, 0x65, 0xd5, 0x74, 0x63, 0xd3, 0x8f, 0xb9, 0x5e, - 0x87, 0x19, 0x2d, 0xe2, 0x0c, 0xe9, 0xff, 0x01, 0x49, 0x67, 0x74, 0x51, 0x53, 0xbb, 0x90, 0x5d, - 0x74, 0x1b, 0x30, 0x18, 0x8c, 0x4c, 0x3b, 0x1c, 0x24, 0x4a, 0x95, 0xa8, 0xd4, 0xbe, 0x8d, 0x5d, - 0xcf, 0x2e, 0x63, 0xf7, 0xb0, 0x3b, 0xd8, 0x8f, 0xfd, 0x1a, 0x48, 0x51, 0xf9, 0x72, 0x37, 0x04, - 0x45, 0xf7, 0xcb, 0x3c, 0xcf, 0x73, 0xce, 0x23, 0x9e, 0x0f, 0x92, 0x86, 0x27, 0x49, 0x1a, 0xab, - 0x38, 0xd8, 0x5d, 0x72, 0xb9, 0x9b, 0xbd, 0x67, 0xcb, 0x25, 0x4f, 0xf7, 0xe2, 0x44, 0x89, 0x58, - 0x66, 0x7b, 0x71, 0xc2, 0x25, 0x4b, 0xc4, 0xd9, 0xfe, 0xc0, 0x38, 0xb9, 0x5f, 0x2f, 0xd3, 0x24, - 0x18, 0x2c, 0x99, 0xe2, 0xef, 0xd9, 0xba, 0xc0, 0x82, 0xd9, 0x92, 0xcb, 0x99, 0x0d, 0x1c, 0xd8, - 0xc0, 0x9d, 0xbb, 0xcb, 0x38,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, 0x6a, - 0x9e, 0x59, 0x44, 0x6a, 0xd7, 0x2e, 0x7c, 0x97, 0xdc, 0xf6, 0x10, 0xbe, 0x4d, 0xb6, 0x3d, 0x84, - 0x3f, 0x27, 0xd4, 0x43, 0xf8, 0x1e, 0xb9, 0xef, 0x21, 0x7c, 0x9f, 0x3c, 0xf0, 0x10, 0x7e, 0x40, - 0x1e, 0x7a, 0x08, 0x3f, 0x24, 0x3d, 0x0f, 0xe1, 0xc7, 0xe4, 0x89, 0x87, 0xf0, 0x13, 0xf2, 0xd4, - 0x43, 0xf8, 0x29, 0x19, 0xf4, 0x7e, 0x75, 0xa0, 0x3a, 0x65, 0xcb, 0x1b, 0xbc, 0x07, 0x1b, 0x37, - 0x48, 0xf5, 0xd3, 0xdf, 0x20, 0x45, 0xba, 0x87, 0xcf, 0x7f, 0x3a, 0x58, 0x0a, 0x75, 0x9a, 0x9f, - 0x0c, 0x82, 0x38, 0xda, 0xd3, 0xfa, 0xbb, 0x3c, 0x88, 0xb3, 0x75, 0xa6, 0xb8, 0x35, 0xed, 0xe7, - 0xf6, 0xfe, 0xf9, 0x7f, 0xeb, 0x49, 0xdd, 0x70, 0xcf, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf8, - 0x2b, 0xe7, 0x47, 0xdc, 0x0a, 0x00, 0x00, + // 1664 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x5b, 0x73, 0xdb, 0xc6, + 0x15, 0x0e, 0xc8, 0x25, 0x09, 0x1e, 0x4a, 0xcc, 0x7a, 0x2d, 0xb7, 0x88, 0x12, 0xbb, 0x0a, 0x9a, + 0x4e, 0x35, 0xf6, 0x98, 0x4a, 0x95, 0x87, 0x66, 0x32, 0x9d, 0xce, 0x50, 0x12, 0x63, 0x03, 0x96, + 0x49, 0x16, 0xa4, 0xa2, 0xb8, 0x33, 0x1d, 0xcc, 0x1a, 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0x38, 0xea, 0x61, 0x64, 0xfe, 0xa7, 0xb2, 0xba, 0xad, 0xa5, 0x77, 0x29, 0xf9, + 0x8b, 0x56, 0xfa, 0x98, 0x4b, 0x56, 0x0c, 0x75, 0x75, 0x4f, 0xde, 0xe6, 0xd1, 0x7b, 0x1b, 0x26, + 0x6f, 0xf1, 0xf2, 0x2b, 0xaf, 0xc4, 0xd9, 0xfe, 0x1c, 0x8c, 0x5b, 0x14, 0xbe, 0xe1, 0x57, 0x8f, + 0xcf, 0x13, 0x91, 0x34, 0xf5, 0x65, 0x23, 0x89, 0xed, 0xbf, 0x6b, 0xb7, 0xaa, 0xfc, 0x50, 0x3b, + 0x78, 0x73, 0xb5, 0x1d, 0xbc, 0x73, 0xdf, 0xc4, 0x51, 0xcb, 0xcd, 0xe2, 0x6f, 0x1a, 0x7f, 0x73, + 0xf2, 0x5a, 0x23, 0xc3, 0xb2, 0x03, 0xad, 0x9f, 0x72, 0x3f, 0x85, 0xbe, 0xfc, 0x91, 0xc1, 0x53, + 0xce, 0x7f, 0x09, 0xb0, 0x02, 0x6f, 0xf1, 0x76, 0xab, 0xec, 0x6d, 0xb3, 0x74, 0xac, 0x83, 0xc3, + 0x3f, 0x76, 0x67, 0x7e, 0x76, 0x96, 0xbf, 0xee, 0x78, 0x71, 0xb8, 0xc7, 0x0f, 0xf2, 0x94, 0x79, + 0x71, 0xba, 0x48, 0x33, 0xa6, 0x48, 0x75, 0xae, 0xbd, 0x1f, 0xfe, 0x13, 0xe6, 0x75, 0x5d, 0xf0, + 0xbe, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xb7, 0xe4, 0x3d, 0xa9, 0x11, 0x00, 0x00, } diff --git a/protoc-gen-swagger/options/openapiv2.proto b/protoc-gen-swagger/options/openapiv2.proto index 6c1854613dd..b3b9b89d995 100644 --- a/protoc-gen-swagger/options/openapiv2.proto +++ b/protoc-gen-swagger/options/openapiv2.proto @@ -33,10 +33,8 @@ message Swagger { reserved 9; // field 10 is reserved for 'responses'. reserved 10; - // field 11 is reserved for 'securityDefinitions'. - reserved 11; - // field 12 is reserved for repeated 'security'. - reserved 12; + SecurityDefinitions security_definitions = 11; + repeated SecurityRequirement security = 12; // field 13 is reserved for 'tags', which are supposed to be exposed as and // customizable as proto services. TODO(ivucica): add processing of proto // service objects into OpenAPI v2 Tag objects. @@ -63,9 +61,7 @@ message Operation { reserved 9; repeated string schemes = 10; bool deprecated = 11; - // field 12 is reserved for 'security'. - reserved 12; - + repeated SecurityRequirement security = 12; } // `Info` is a representation of OpenAPI v2 specification's Info object. @@ -221,3 +217,122 @@ message Tag { string description = 2; ExternalDocumentation external_docs = 3; } + +// `SecurityDefinitions` is a representation of OpenAPI v2 specification's +// Security Definitions object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject +// +// A declaration of the security schemes available to be used in the +// specification. This does not enforce the security schemes on the operations +// and only serves to provide the relevant details for each scheme. +message SecurityDefinitions { + // A single security scheme definition, mapping a "name" to the scheme it defines. + map security = 1; +} + +// `SecurityScheme` is a representation of OpenAPI v2 specification's +// Security Scheme object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject +// +// Allows the definition of a security scheme that can be used by the +// operations. Supported schemes are basic authentication, an API key (either as +// a header or as a query parameter) and OAuth2's common flows (implicit, +// password, application and access code). +message SecurityScheme { + // Required. The type of the security scheme. Valid values are "basic", + // "apiKey" or "oauth2". + enum Type { + TYPE_INVALID = 0; + TYPE_BASIC = 1; + TYPE_API_KEY = 2; + TYPE_OAUTH2 = 3; + } + + // Required. The location of the API key. Valid values are "query" or "header". + enum In { + IN_INVALID = 0; + IN_QUERY = 1; + IN_HEADER = 2; + } + + // Required. The flow used by the OAuth2 security scheme. Valid values are + // "implicit", "password", "application" or "accessCode". + enum Flow { + FLOW_INVALID = 0; + FLOW_IMPLICIT = 1; + FLOW_PASSWORD = 2; + FLOW_APPLICATION = 3; + FLOW_ACCESS_CODE = 4; + } + + // Required. The type of the security scheme. Valid values are "basic", + // "apiKey" or "oauth2". + Type type = 1; + // A short description for security scheme. + string description = 2; + // Required. The name of the header or query parameter to be used. + // + // Valid for apiKey. + string name = 3; + // Required. The location of the API key. Valid values are "query" or "header". + // + // Valid for apiKey. + In in = 4; + // Required. The flow used by the OAuth2 security scheme. Valid values are + // "implicit", "password", "application" or "accessCode". + // + // Valid for oauth2. + Flow flow = 5; + // Required. The authorization URL to be used for this flow. This SHOULD be in + // the form of a URL. + // + // Valid for oauth2/implicit and oauth2/accessCode. + string authorization_url = 6; + // Required. The token URL to be used for this flow. This SHOULD be in the + // form of a URL. + // + // Valid for oauth2/password, oauth2/application and oauth2/accessCode. + string token_url = 7; + // Required. The available scopes for the OAuth2 security scheme. + // + // Valid for oauth2. + Scopes scopes = 8; +} + +// `SecurityRequirement` is a representation of OpenAPI v2 specification's +// Security Requirement object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject +// +// Lists the required security schemes to execute this operation. The object can +// have multiple security schemes declared in it which are all required (that +// is, there is a logical AND between the schemes). +// +// The name used for each property MUST correspond to a security scheme +// declared in the Security Definitions. +message SecurityRequirement { + // If the security scheme is of type "oauth2", then the value is a list of + // scope names required for the execution. For other security scheme types, + // the array MUST be empty. + message SecurityRequirementValue { + repeated string scope = 1; + } + // Each name must correspond to a security scheme which is declared in + // the Security Definitions. If the security scheme is of type "oauth2", + // then the value is a list of scope names required for the execution. + // For other security scheme types, the array MUST be empty. + map security_requirement = 1; +} + +// `Scopes` is a representation of OpenAPI v2 specification's Scopes object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject +// +// Lists the available scopes for an OAuth2 security scheme. +message Scopes { + // Maps between a name of a scope to a short description of it (as the value + // of the property). + map scope = 1; +} From 3aa10cbe8330b770297c6a3449cd0752ad5a74b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 11 Feb 2018 19:00:12 +0000 Subject: [PATCH 188/552] swagger: Add security fields to a_bit_of_everything, for testing. --- examples/examplepb/a_bit_of_everything.proto | 77 ++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 40280c7e124..f9869e5fc0d 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -32,6 +32,68 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { consumes: "application/x-foo-mime"; produces: "application/json"; produces: "application/x-foo-mime"; + security_definitions: { + security: { + key: "BasicAuth"; + value: { + type: TYPE_BASIC; + } + } + security: { + key: "ApiKeyAuth"; + value: { + type: TYPE_API_KEY; + in: IN_HEADER; + name: "X-API-Key"; + } + } + security: { + key: "OAuth2"; + value: { + type: TYPE_OAUTH2; + flow: FLOW_ACCESS_CODE; + authorization_url: "https://example.com/oauth/authorize"; + token_url: "https://example.com/oauth/token"; + scopes: { + scope: { + key: "read"; + value: "Grants read access"; + } + scope: { + key: "write"; + value: "Grants write access"; + } + scope: { + key: "admin"; + value: "Grants read and write access to administrative information"; + } + } + } + } + } + security: { + security_requirement: { + key: "BasicAuth"; + value: {}; + } + security_requirement: { + key: "ApiKeyAuth"; + value: {}; + } + } + security: { + security_requirement: { + key: "OAuth2"; + value: { + scope: "read"; + scope: "write"; + } + } + security_requirement: { + key: "ApiKeyAuth"; + value: {}; + } + } }; @@ -154,6 +216,21 @@ service ABitOfEverythingService { option (google.api.http) = { delete: "/v1/example/a_bit_of_everything/{uuid}" }; + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { + security: { + security_requirement: { + key: "ApiKeyAuth"; + value: {} + } + security_requirement: { + key: "OAuth2"; + value: { + scope: "read"; + scope: "write"; + } + } + } + }; } rpc GetQuery(ABitOfEverything) returns (google.protobuf.Empty) { option (google.api.http) = { From b63ca2a37aa3e35d79095facb7f5c801bf6de26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 11 Feb 2018 19:22:17 +0000 Subject: [PATCH 189/552] swagger: Use security fields from proto options when outputting Swagger JSON. Fixes #428. --- examples/examplepb/a_bit_of_everything.pb.go | 236 ++++++++++-------- .../a_bit_of_everything.swagger.json | 43 ++++ protoc-gen-swagger/genswagger/template.go | 100 ++++++++ protoc-gen-swagger/genswagger/types.go | 46 +++- 4 files changed, 303 insertions(+), 122 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index f8994b6b4a8..a7568201619 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -1034,115 +1034,129 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1759 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5f, 0x6f, 0x1b, 0xc7, - 0x11, 0xd7, 0x1e, 0x65, 0x5a, 0x1c, 0xea, 0x0f, 0xb5, 0xb2, 0x65, 0x9a, 0x56, 0xa2, 0x35, 0xe3, - 0xb4, 0x57, 0xd5, 0xba, 0x8b, 0xe9, 0xa0, 0x88, 0x05, 0xb4, 0x29, 0x65, 0xd1, 0x76, 0xd0, 0x58, - 0xb6, 0xcf, 0x89, 0x6b, 0xb8, 0x4e, 0x85, 0x23, 0x6f, 0x49, 0x5e, 0xcc, 0xbb, 0xbd, 0xde, 0xed, - 0xc9, 0x22, 0x58, 0xf5, 0xa1, 0x05, 0x5a, 0xe4, 0x55, 0x7d, 0xeb, 0x43, 0x5e, 0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 0xc6, 0x7a, 0xb1, 0x04, 0x10, 0xa4, 0x2e, 0x18, 0x05, - 0xb1, 0x93, 0x92, 0x0d, 0xb8, 0x6f, 0xbb, 0x9d, 0x58, 0xa0, 0x28, 0xe3, 0x5f, 0x8c, 0xf6, 0x52, - 0xb2, 0xcd, 0x3e, 0xa7, 0x41, 0x2c, 0xf1, 0x0e, 0x41, 0xea, 0xa2, 0x01, 0x72, 0x6b, 0xc8, 0xe1, - 0x94, 0xc6, 0x12, 0x41, 0xea, 0x52, 0xe4, 0x70, 0xc2, 0xe2, 0x27, 0x00, 0xd4, 0x0d, 0x9d, 0x58, - 0x60, 0x99, 0x20, 0x75, 0xb9, 0x76, 0x73, 0xea, 0x75, 0xee, 0x87, 0x0e, 0xf5, 0xed, 0x56, 0xc3, - 0x0d, 0x1d, 0xa3, 0x20, 0xf4, 0x23, 0xb0, 0xf7, 0x61, 0x39, 0x18, 0x76, 0x7c, 0x85, 0x20, 0x75, - 0xc5, 0x58, 0x0a, 0x86, 0x3c, 0x4f, 0xc5, 0xd2, 0x20, 0x96, 0x08, 0x52, 0x4b, 0x89, 0x58, 0xe6, - 0xba, 0x82, 0x2c, 0xfb, 0x55, 0x82, 0xd4, 0x55, 0xa3, 0x18, 0x64, 0xd8, 0xc7, 0x22, 0x29, 0x0e, - 0x26, 0x48, 0xc5, 0x91, 0x48, 0x82, 0x52, 0x83, 0xcb, 0x3e, 0xf5, 0xa8, 0xc9, 0xa9, 0x75, 0x30, - 0x14, 0xd0, 0x35, 0x92, 0x53, 0x0b, 0xc6, 0x5a, 0x72, 0xf8, 0x34, 0x13, 0xd8, 0x3b, 0x50, 0x64, - 0x2e, 0x15, 0x5d, 0x48, 0x34, 0x89, 0xf2, 0x25, 0x59, 0x50, 0xeb, 0x5a, 0x54, 0xcc, 0x5a, 0x52, - 0xcc, 0x5a, 0x43, 0x9c, 0x3e, 0x98, 0x33, 0x40, 0x0a, 0xcb, 0x15, 0x7e, 0x0f, 0x16, 0x23, 0xd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 0xd1, 0x76, - 0x9b, 0xb1, 0x6d, 0xc7, 0x76, 0xe8, 0xce, 0x98, 0xe4, 0xce, 0x04, 0x49, 0xff, 0x13, 0xb8, 0xf2, - 0xf0, 0x4d, 0xfc, 0xb3, 0x2e, 0xcc, 0x4a, 0xfd, 0x45, 0x21, 0xcd, 0xcd, 0x66, 0x5e, 0x46, 0xef, - 0xf6, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x74, 0xcd, 0x98, 0xea, 0x14, 0x00, 0x00, + // 1983 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcb, 0x6f, 0x1b, 0xc9, + 0xd1, 0x57, 0x93, 0x14, 0x4d, 0x16, 0xf5, 0xa0, 0x5a, 0x7e, 0xc8, 0xb4, 0xbc, 0x6a, 0xd3, 0xde, + 0xef, 0x1b, 0x6b, 0xcd, 0x99, 0x35, 0xbd, 0x08, 0xd6, 0x04, 0x92, 0x0d, 0x65, 0x71, 0x6d, 0xc3, + 0x6b, 0xd9, 0x1e, 0xef, 0x3a, 0x86, 0xe3, 0x8d, 0x30, 0xe4, 0x34, 0xc9, 0x59, 0x73, 0xa6, 0x27, + 0x33, 0x3d, 0x92, 0x18, 0x45, 0x09, 0x92, 0x05, 0x12, 0xec, 0x29, 0x80, 0x72, 0xdf, 0x4b, 0x80, + 0x20, 0x97, 0x1c, 0x72, 0xc8, 0x29, 0x40, 0x72, 0xcc, 0x21, 0xc7, 0x00, 0xb9, 0x07, 0xc8, 0x29, + 0xc7, 0xfc, 0x05, 0x41, 0xf7, 0x3c, 0x3c, 0xa4, 0x44, 0xc8, 0x94, 0x83, 0xbd, 0xd8, 0xd3, 0xdd, + 0xbf, 0xaa, 0xfa, 0x55, 0x75, 0x55, 0x75, 0x51, 0x70, 0x83, 0xee, 0x19, 0xb6, 0x3b, 0xa0, 0xbe, + 0x16, 0x7d, 0xb8, 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 0x04, 0x96, 0xb9, 0x82, 0x08, 0x52, 0x8a, 0xba, 0xfc, 0xc6, + 0x8f, 0x21, 0x1f, 0xd9, 0xca, 0x90, 0xec, 0x5b, 0xd9, 0x8a, 0xf4, 0xe0, 0x35, 0x28, 0x75, 0x07, + 0xcc, 0xe0, 0xdb, 0x3b, 0xc6, 0x20, 0xa0, 0x2b, 0x59, 0x82, 0x94, 0x8c, 0x0e, 0x72, 0xeb, 0x99, + 0xd8, 0xc1, 0x57, 0x60, 0xce, 0x64, 0x41, 0x7b, 0x40, 0x23, 0x44, 0x8e, 0x20, 0x05, 0xe9, 0xa5, + 0x70, 0x2f, 0x84, 0xac, 0x41, 0xc9, 0x72, 0xf8, 0xb7, 0x3e, 0x88, 0x10, 0xb3, 0x04, 0x29, 0x59, + 0x1d, 0xe4, 0x56, 0xa2, 0x23, 0x48, 0x23, 0xf2, 0x04, 0x29, 0x39, 0xbd, 0x14, 0xa4, 0x20, 0xa1, + 0x8e, 0x5b, 0xf5, 0x08, 0x71, 0x86, 0x20, 0x65, 0x56, 0xea, 0xb8, 0x55, 0x0f, 0x01, 0x57, 0x61, + 0xbe, 0x6b, 0xed, 0x51, 0x33, 0x51, 0x52, 0x20, 0x48, 0xc9, 0xeb, 0x73, 0xd1, 0xe6, 0x28, 0x28, + 0xd1, 0x53, 0x24, 0x48, 0x39, 0x13, 0x81, 0x62, 0x4d, 0x97, 0x01, 0xda, 0x8c, 0x0d, 0x22, 0x04, + 0x10, 0xa4, 0x14, 0xf4, 0xa2, 0xd8, 0x49, 0xc8, 0xfa, 0xdc, 0xb3, 0x9c, 0x5e, 0x04, 0x28, 0xc9, + 0xf8, 0x97, 0xc2, 0xbd, 0x84, 0x6c, 0x7b, 0xc8, 0xa9, 0x1f, 0x21, 0x2e, 0x13, 0xa4, 0xcc, 0xe9, + 0x20, 0xb7, 0x46, 0x1c, 0x4e, 0x68, 0xcc, 0x13, 0xa4, 0xcc, 0x87, 0x0e, 0xc7, 0x2c, 0x1e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x0f, 0x17, 0x1e, + 0xbe, 0xce, 0xeb, 0x74, 0x6a, 0x4c, 0x9b, 0x12, 0x2f, 0x8a, 0x49, 0xcd, 0xb7, 0xf3, 0x32, 0x2b, + 0x6f, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x02, 0x53, 0x7b, 0xaf, 0x16, 0x00, 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index a6c1f752214..02c2f892dd7 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -489,6 +489,15 @@ ], "tags": [ "ABitOfEverythingService" + ], + "security": [ + { + "ApiKeyAuth": [], + "OAuth2": [ + "read", + "write" + ] + } ] }, "put": { @@ -867,6 +876,40 @@ } } }, + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "X-API-Key", + "in": "header" + }, + "BasicAuth": { + "type": "basic" + }, + "OAuth2": { + "type": "oauth2", + "flow": "accessCode", + "authorizationUrl": "https://example.com/oauth/authorize", + "tokenUrl": "https://example.com/oauth/token", + "scopes": { + "admin": "Grants read and write access to administrative information", + "read": "Grants read access", + "write": "Grants write access" + } + } + }, + "security": [ + { + "ApiKeyAuth": [], + "BasicAuth": [] + }, + { + "ApiKeyAuth": [], + "OAuth2": [ + "read", + "write" + ] + } + ], "externalDocs": { "description": "More about gRPC-Gateway", "url": "https://github.com/grpc-ecosystem/grpc-gateway" diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index c838a5808d7..2781a8b6e52 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -648,6 +648,24 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re operationObject.Tags = make([]string, len(opts.Tags)) copy(operationObject.Tags, opts.Tags) } + if opts.Security != nil { + newSecurity := []swaggerSecurityRequirementObject{} + if operationObject.Security == nil { + newSecurity = []swaggerSecurityRequirementObject{} + } else { + newSecurity = operationObject.Security + } + for _, secReq := range opts.Security { + newSecReq := swaggerSecurityRequirementObject{} + for secReqKey, secReqValue := range secReq.SecurityRequirement { + newSecReqValue := make([]string, len(secReqValue.Scope)) + copy(newSecReqValue, secReqValue.Scope) + newSecReq[secReqKey] = newSecReqValue + } + newSecurity = append(newSecurity, newSecReq) + } + operationObject.Security = newSecurity + } // TODO(ivucica): add remaining fields of operation object } @@ -775,6 +793,88 @@ func applyTemplate(p param) (string, error) { s.Produces = make([]string, len(spb.Produces)) copy(s.Produces, spb.Produces) } + if spb.SecurityDefinitions != nil && spb.SecurityDefinitions.Security != nil { + if s.SecurityDefinitions == nil { + s.SecurityDefinitions = swaggerSecurityDefinitionsObject{} + } + for secDefKey, secDefValue := range spb.SecurityDefinitions.Security { + var newSecDefValue swaggerSecuritySchemeObject + if oldSecDefValue, ok := s.SecurityDefinitions[secDefKey]; !ok { + newSecDefValue = swaggerSecuritySchemeObject{} + } else { + newSecDefValue = oldSecDefValue + } + if secDefValue.Type != swagger_options.SecurityScheme_TYPE_INVALID { + switch secDefValue.Type { + case swagger_options.SecurityScheme_TYPE_BASIC: + newSecDefValue.Type = "basic" + case swagger_options.SecurityScheme_TYPE_API_KEY: + newSecDefValue.Type = "apiKey" + case swagger_options.SecurityScheme_TYPE_OAUTH2: + newSecDefValue.Type = "oauth2" + } + } + if secDefValue.Description != "" { + newSecDefValue.Description = secDefValue.Description + } + if secDefValue.Name != "" { + newSecDefValue.Name = secDefValue.Name + } + if secDefValue.In != swagger_options.SecurityScheme_IN_INVALID { + switch secDefValue.In { + case swagger_options.SecurityScheme_IN_QUERY: + newSecDefValue.In = "query" + case swagger_options.SecurityScheme_IN_HEADER: + newSecDefValue.In = "header" + } + } + if secDefValue.Flow != swagger_options.SecurityScheme_FLOW_INVALID { + switch secDefValue.Flow { + case swagger_options.SecurityScheme_FLOW_IMPLICIT: + newSecDefValue.Flow = "implicit" + case swagger_options.SecurityScheme_FLOW_PASSWORD: + newSecDefValue.Flow = "password" + case swagger_options.SecurityScheme_FLOW_APPLICATION: + newSecDefValue.Flow = "application" + case swagger_options.SecurityScheme_FLOW_ACCESS_CODE: + newSecDefValue.Flow = "accessCode" + } + } + if secDefValue.AuthorizationUrl != "" { + newSecDefValue.AuthorizationURL = secDefValue.AuthorizationUrl + } + if secDefValue.TokenUrl != "" { + newSecDefValue.TokenURL = secDefValue.TokenUrl + } + if secDefValue.Scopes != nil { + if newSecDefValue.Scopes == nil { + newSecDefValue.Scopes = swaggerScopesObject{} + } + for scopeKey, scopeDesc := range secDefValue.Scopes.Scope { + newSecDefValue.Scopes[scopeKey] = scopeDesc + } + } + s.SecurityDefinitions[secDefKey] = newSecDefValue + } + } + if spb.Security != nil { + newSecurity := []swaggerSecurityRequirementObject{} + if s.Security == nil { + newSecurity = []swaggerSecurityRequirementObject{} + } else { + newSecurity = s.Security + } + for _, secReq := range spb.Security { + newSecReq := swaggerSecurityRequirementObject{} + for secReqKey, secReqValue := range secReq.SecurityRequirement { + newSecReqValue := make([]string, len(secReqValue.Scope)) + copy(newSecReqValue, secReqValue.Scope) + newSecReq[secReqKey] = newSecReqValue + } + newSecurity = append(newSecurity, newSecReq) + } + s.Security = newSecurity + } if spb.ExternalDocs != nil { if s.ExternalDocs == nil { s.ExternalDocs = &swaggerExternalDocumentationObject{} diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 35e8542083e..0c85d941135 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -48,17 +48,40 @@ type swaggerExternalDocumentationObject struct { // http://swagger.io/specification/#swaggerObject type swaggerObject struct { - Swagger string `json:"swagger"` - Info swaggerInfoObject `json:"info"` - Host string `json:"host,omitempty"` - BasePath string `json:"basePath,omitempty"` - Schemes []string `json:"schemes"` - Consumes []string `json:"consumes"` - Produces []string `json:"produces"` - Paths swaggerPathsObject `json:"paths"` - Definitions swaggerDefinitionsObject `json:"definitions"` - ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` -} + Swagger string `json:"swagger"` + Info swaggerInfoObject `json:"info"` + Host string `json:"host,omitempty"` + BasePath string `json:"basePath,omitempty"` + Schemes []string `json:"schemes"` + Consumes []string `json:"consumes"` + Produces []string `json:"produces"` + Paths swaggerPathsObject `json:"paths"` + Definitions swaggerDefinitionsObject `json:"definitions"` + SecurityDefinitions swaggerSecurityDefinitionsObject `json:"securityDefinitions,omitempty"` + Security []swaggerSecurityRequirementObject `json:"security,omitempty"` + ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` +} + +// http://swagger.io/specification/#securityDefinitionsObject +type swaggerSecurityDefinitionsObject map[string]swaggerSecuritySchemeObject + +// http://swagger.io/specification/#securitySchemeObject +type swaggerSecuritySchemeObject struct { + Type string `json:"type"` + Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` + In string `json:"in,omitempty"` + Flow string `json:"flow,omitempty"` + AuthorizationURL string `json:"authorizationUrl,omitempty"` + TokenURL string `json:"tokenUrl,omitempty"` + Scopes swaggerScopesObject `json:"scopes,omitempty"` +} + +// http://swagger.io/specification/#scopesObject +type swaggerScopesObject map[string]string + +// http://swagger.io/specification/#securityRequirementObject +type swaggerSecurityRequirementObject map[string][]string // http://swagger.io/specification/#pathsObject type swaggerPathsObject map[string]swaggerPathItemObject @@ -82,6 +105,7 @@ type swaggerOperationObject struct { Tags []string `json:"tags,omitempty"` Deprecated bool `json:"deprecated,omitempty"` + Security []swaggerSecurityRequirementObject `json:"security,omitempty"` ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` } From 67487e172a377b02fd767422c1874f98f9855dc2 Mon Sep 17 00:00:00 2001 From: Taylor Hurt Date: Mon, 12 Feb 2018 15:26:10 -0500 Subject: [PATCH 190/552] Converts the first letter of service name to uppercase (#522) Fixes: #484 --- examples/examplepb/a_bit_of_everything.pb.go | 316 +++++++++++------- .../examplepb/a_bit_of_everything.pb.gw.go | 87 +++++ examples/examplepb/a_bit_of_everything.proto | 9 +- .../a_bit_of_everything.swagger.json | 16 + .../gengateway/template.go | 2 + 5 files changed, 304 insertions(+), 126 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index a7568201619..a5b333230ff 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -967,6 +967,70 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ Metadata: "examples/examplepb/a_bit_of_everything.proto", } +// Client API for CamelCaseServiceName service + +type CamelCaseServiceNameClient interface { + Empty(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) +} + +type camelCaseServiceNameClient struct { + cc *grpc.ClientConn +} + +func NewCamelCaseServiceNameClient(cc *grpc.ClientConn) CamelCaseServiceNameClient { + return &camelCaseServiceNameClient{cc} +} + +func (c *camelCaseServiceNameClient) Empty(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.camelCaseServiceName/Empty", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for CamelCaseServiceName service + +type CamelCaseServiceNameServer interface { + Empty(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) +} + +func RegisterCamelCaseServiceNameServer(s *grpc.Server, srv CamelCaseServiceNameServer) { + s.RegisterService(&_CamelCaseServiceName_serviceDesc, srv) +} + +func _CamelCaseServiceName_Empty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf1.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CamelCaseServiceNameServer).Empty(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.camelCaseServiceName/Empty", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CamelCaseServiceNameServer).Empty(ctx, req.(*google_protobuf1.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +var _CamelCaseServiceName_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.camelCaseServiceName", + HandlerType: (*CamelCaseServiceNameServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Empty", + Handler: _CamelCaseServiceName_Empty_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/examplepb/a_bit_of_everything.proto", +} + // Client API for AnotherServiceWithNoBindings service type AnotherServiceWithNoBindingsClient interface { @@ -1034,129 +1098,131 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1983 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcb, 0x6f, 0x1b, 0xc9, - 0xd1, 0x57, 0x93, 0x14, 0x4d, 0x16, 0xf5, 0xa0, 0x5a, 0x7e, 0xc8, 0xb4, 0xbc, 0x6a, 0xd3, 0xde, - 0xef, 0x1b, 0x6b, 0xcd, 0x99, 0x35, 0xbd, 0x08, 0xd6, 0x04, 0x92, 0x0d, 0x65, 0x71, 0x6d, 0xc3, - 0x6b, 0xd9, 0x1e, 0xef, 0x3a, 0x86, 0xe3, 0x8d, 0x30, 0xe4, 0x34, 0xc9, 0x59, 0x73, 0xa6, 0x27, - 0x33, 0x3d, 0x92, 0x18, 0x45, 0x09, 0x92, 0x05, 0x12, 0xec, 0x29, 0x80, 0x72, 0xdf, 0x4b, 0x80, - 0x20, 0x97, 0x1c, 0x72, 0xc8, 0x29, 0x40, 0x72, 0xc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0x6e, 0x2b, 0x09, 0x0f, - 0xfe, 0x1c, 0xe6, 0x7d, 0xcb, 0xe9, 0x0d, 0xe8, 0xb6, 0x43, 0x7d, 0x4e, 0xcd, 0x95, 0x8b, 0x04, - 0x29, 0xa5, 0xfa, 0x87, 0xea, 0x09, 0x01, 0x53, 0xc7, 0x35, 0xa9, 0x5b, 0x52, 0x5e, 0x9f, 0x0b, - 0xd5, 0x85, 0x2b, 0x8c, 0x21, 0x17, 0x04, 0x96, 0xb9, 0x82, 0x08, 0x52, 0x8a, 0xba, 0xfc, 0xc6, - 0x8f, 0x21, 0x1f, 0xd9, 0xca, 0x90, 0xec, 0x5b, 0xd9, 0x8a, 0xf4, 0xe0, 0x35, 0x28, 0x75, 0x07, - 0xcc, 0xe0, 0xdb, 0x3b, 0xc6, 0x20, 0xa0, 0x2b, 0x59, 0x82, 0x94, 0x8c, 0x0e, 0x72, 0xeb, 0x99, - 0xd8, 0xc1, 0x57, 0x60, 0xce, 0x64, 0x41, 0x7b, 0x40, 0x23, 0x44, 0x8e, 0x20, 0x05, 0xe9, 0xa5, - 0x70, 0x2f, 0x84, 0xac, 0x41, 0xc9, 0x72, 0xf8, 0xb7, 0x3e, 0x88, 0x10, 0xb3, 0x04, 0x29, 0x59, - 0x1d, 0xe4, 0x56, 0xa2, 0x23, 0x48, 0x23, 0xf2, 0x04, 0x29, 0x39, 0xbd, 0x14, 0xa4, 0x20, 0xa1, - 0x8e, 0x5b, 0xf5, 0x08, 0x71, 0x86, 0x20, 0x65, 0x56, 0xea, 0xb8, 0x55, 0x0f, 0x01, 0x57, 0x61, - 0xbe, 0x6b, 0xed, 0x51, 0x33, 0x51, 0x52, 0x20, 0x48, 0xc9, 0xeb, 0x73, 0xd1, 0xe6, 0x28, 0x28, - 0xd1, 0x53, 0x24, 0x48, 0x39, 0x13, 0x81, 0x62, 0x4d, 0x97, 0x01, 0xda, 0x8c, 0x0d, 0x22, 0x04, - 0x10, 0xa4, 0x14, 0xf4, 0xa2, 0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 0x83, 0x1b, 0x23, 0xa2, 0x8e, 0x39, 0x02, 0x23, 0x9c, 0x11, 0x09, 0xb3, 0x7c, - 0x2e, 0x7a, 0xdc, 0x0e, 0x25, 0x96, 0xd3, 0x65, 0x9e, 0x2d, 0xc3, 0xd2, 0x5e, 0x83, 0xf9, 0x74, - 0x28, 0x66, 0xc6, 0xc7, 0x8c, 0xf6, 0xf5, 0x89, 0x83, 0xc6, 0x38, 0xd4, 0xbb, 0x0f, 0x17, 0x1e, - 0xbe, 0xce, 0xeb, 0x74, 0x6a, 0x4c, 0x9b, 0x12, 0x2f, 0x8a, 0x49, 0xcd, 0xb7, 0xf3, 0x32, 0x2b, - 0x6f, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x02, 0x53, 0x7b, 0xaf, 0x16, 0x00, 0x00, + // 2012 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcb, 0x6f, 0x1b, 0xc7, + 0x19, 0xd7, 0x90, 0x14, 0x2d, 0x7e, 0x7a, 0x51, 0x23, 0x3f, 0x64, 0x5a, 0x8e, 0xc6, 0xb4, 0xd3, + 0xae, 0x15, 0x73, 0x37, 0xa6, 0x83, 0x22, 0x26, 0xd0, 0xa6, 0x94, 0xc4, 0xd8, 0x86, 0x63, 0xd9, + 0x5e, 0x27, 0xae, 0xe1, 0x3a, 0x15, 0x96, 0xbb, 0x43, 0x72, 0x6d, 0xee, 0xce, 0x76, 0x77, 0x56, + 0x36, 0xab, 0xaa, 0x45, 0x1b, 0xa0, 0x45, 0x4e, 0x05, 0xd4, 0x7b, 0x2e, 0x05, 0x8a, 0x5e, 0x7a, + 0xe8, 0xa1, 0xa7, 0x02, 0xed, 0xb1, 0x87, 0x1e, 0x0b, 0xf4, 0x5e, 0xa0, 0xa7, 0x1e, 0xfb, 0x17, + 0x14, 0x33, 0xfb, 0xf0, 0x92, 0x12, 0x21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 0xe0, 0x34, 0x88, 0x11, 0x17, 0x09, 0x52, 0xe6, 0x74, 0x90, 0x57, 0x43, 0x0e, + 0xa7, 0x66, 0xcc, 0x13, 0xa4, 0xcc, 0x47, 0x0e, 0x27, 0x56, 0xdc, 0x05, 0xa0, 0x6e, 0xe8, 0xc4, + 0x80, 0x05, 0x82, 0x94, 0x85, 0xfa, 0xb5, 0x63, 0xd3, 0xb9, 0x1d, 0x3a, 0xd4, 0xb7, 0xcd, 0x96, + 0x1b, 0x3a, 0x7a, 0x49, 0xf0, 0x47, 0xc2, 0xde, 0x85, 0x85, 0x60, 0xd8, 0xf1, 0x45, 0x82, 0x94, + 0x45, 0x7d, 0x3e, 0x18, 0xf2, 0x3c, 0x85, 0xa5, 0x41, 0x2c, 0x13, 0xa4, 0x94, 0x13, 0x58, 0x26, + 0x5d, 0x41, 0xd6, 0xfa, 0x25, 0x82, 0x94, 0x25, 0x7d, 0x36, 0xc8, 0x58, 0x1f, 0x43, 0x52, 0x39, + 0x98, 0x20, 0x05, 0x47, 0x90, 0x44, 0x4a, 0x1d, 0xce, 0xf8, 0xd4, 0xa3, 0x06, 0xa7, 0xd6, 0xce, + 0x50, 0x40, 0x97, 0x49, 0x5e, 0x29, 0xe9, 0xcb, 0x09, 0xf1, 0x51, 0x26, 0xb0, 0x37, 0x61, 0x96, + 0xb9, 0x54, 0x4c, 0x21, 0x31, 0x24, 0x56, 0x4e, 0xcb, 0x86, 0x3a, 0xab, 0x46, 0xcd, 0xac, 0x26, + 0xcd, 0xac, 0xb6, 0x04, 0xf5, 0xf6, 0x94, 0x0e, 0x12, 0x2c, 0x4f, 0xf8, 0x32, 0xcc, 0x45, 0xac, + 0x91, 0xae, 0x95, 0x33, 0x22, 0x6d, 0xb7, 0xa7, 0xf4, 0x48, 0x60, 0xa4, 0x04, 0x3f, 0x83, 0x92, + 0x63, 0x78, 0xb1, 0x1d, 0x67, 0x65, 0x0b, 0x7d, 0x34, 0x79, 0x0b, 0xdd, 0x33, 0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8d, 0xd7, 0x07, 0xbc, 0x1c, 0x13, 0xe5, 0x29, 0xa1, 0x6e, 0xc2, 0xb4, 0x61, 0x39, 0xb6, 0x8b, + 0x1b, 0x43, 0xac, 0xae, 0x35, 0x04, 0x23, 0x9c, 0x11, 0x09, 0xb3, 0x03, 0x2e, 0xe6, 0xe9, 0x2e, + 0x25, 0xb6, 0xdb, 0x61, 0xbe, 0x23, 0xc3, 0xd2, 0x5e, 0x83, 0xf9, 0x6c, 0x28, 0xa6, 0x46, 0x57, + 0x9a, 0xf6, 0xd5, 0xb1, 0x4b, 0xcd, 0x28, 0xd4, 0xbf, 0x03, 0xe7, 0xee, 0xbd, 0xee, 0xa1, 0x6c, + 0x69, 0x4c, 0x5a, 0x12, 0x4f, 0x4b, 0xe9, 0x7c, 0x69, 0x17, 0x65, 0x55, 0xde, 0xf8, 0x7f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xf9, 0xc4, 0x26, 0x62, 0x1b, 0x17, 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 b2f40a3f04e..5fc7bbdb8c0 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -533,6 +533,15 @@ func request_ABitOfEverythingService_PostWithEmptyBody_0(ctx context.Context, ma } +func request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler runtime.Marshaler, client CamelCaseServiceNameClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + msg, err := client.Empty(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + // RegisterABitOfEverythingServiceHandlerFromEndpoint is same as RegisterABitOfEverythingServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { @@ -1039,3 +1048,81 @@ var ( forward_ABitOfEverythingService_PostWithEmptyBody_0 = runtime.ForwardResponseMessage ) + +// RegisterCamelCaseServiceNameHandlerFromEndpoint is same as RegisterCamelCaseServiceNameHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterCamelCaseServiceNameHandlerFromEndpoint(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 RegisterCamelCaseServiceNameHandler(ctx, mux, conn) +} + +// RegisterCamelCaseServiceNameHandler registers the http handlers for service CamelCaseServiceName to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterCamelCaseServiceNameHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterCamelCaseServiceNameHandlerClient(ctx, mux, NewCamelCaseServiceNameClient(conn)) +} + +// RegisterCamelCaseServiceNameHandler registers the http handlers for service CamelCaseServiceName to "mux". +// The handlers forward requests to the grpc endpoint over the given implementation of "CamelCaseServiceNameClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CamelCaseServiceNameClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "CamelCaseServiceNameClient" to call the correct interceptors. +func RegisterCamelCaseServiceNameHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CamelCaseServiceNameClient) error { + + mux.Handle("GET", pattern_CamelCaseServiceName_Empty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + 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, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_CamelCaseServiceName_Empty_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CamelCaseServiceName_Empty_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_CamelCaseServiceName_Empty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "empty"}, "")) +) + +var ( + forward_CamelCaseServiceName_Empty_0 = runtime.ForwardResponseMessage +) diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index f9869e5fc0d..efcc6411111 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -303,7 +303,14 @@ service ABitOfEverythingService { }; } } - +// camelCase and lowercase service names are valid but not recommended (use TitleCase instead) +service camelCaseServiceName { + rpc Empty(google.protobuf.Empty) returns (google.protobuf.Empty) { + option (google.api.http) = { + get: "/v2/example/empty", + }; + } +} service AnotherServiceWithNoBindings { rpc NoBindings(google.protobuf.Empty) returns (google.protobuf.Empty) {} } diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 02c2f892dd7..aa7f2479021 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -593,6 +593,22 @@ } } }, + "/v2/example/empty": { + "get": { + "operationId": "Empty", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + } + }, + "tags": [ + "camelCaseServiceName" + ] + } + }, "/v2/example/errorwithdetails": { "get": { "operationId": "ErrorWithDetails", diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 2354eac533b..ef52049a625 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -80,6 +80,8 @@ func applyTemplate(p param) (string, error) { var targetServices []*descriptor.Service for _, svc := range p.Services { var methodWithBindingsSeen bool + svcName := strings.Title(*svc.Name) + svc.Name = &svcName for _, meth := range svc.Methods { glog.V(2).Infof("Processing %s.%s", svc.GetName(), meth.GetName()) methName := strings.Title(*meth.Name) From 25016e8279d6f89e8e71e84aa29aff1e5e541849 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Fri, 16 Feb 2018 11:09:04 -0500 Subject: [PATCH 191/552] properly respect file flag for protoc-gen-swagger (#293) --- protoc-gen-swagger/main.go | 10 +++++++--- protoc-gen-swagger/main_test.go | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index db747704e23..ebbaecbd36f 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -17,7 +17,7 @@ import ( var ( importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") - file = flag.String("file", "stdin", "where to load data from") + file = flag.String("file", "-", "where to load data from") allowDeleteBody = flag.Bool("allow_delete_body", false, "unless set, HTTP DELETE methods may not have a body") ) @@ -45,8 +45,12 @@ func main() { glog.V(1).Info("Processing code generator request") f := os.Stdin - if *file != "stdin" { - f, _ = os.Open("input.txt") + if *file != "-" { + var err error + f, err = os.Open(*file) + if err != nil { + glog.Fatal(err) + } } req, err := parseReq(f) if err != nil { diff --git a/protoc-gen-swagger/main_test.go b/protoc-gen-swagger/main_test.go index c4d12dd20bd..d4b9d91daca 100644 --- a/protoc-gen-swagger/main_test.go +++ b/protoc-gen-swagger/main_test.go @@ -22,7 +22,7 @@ func TestParseReqParam(t *testing.T) { if !reflect.DeepEqual(pkgMap, expected) { t.Errorf("Test 0: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) } - checkFlags(false, "stdin", "", t, 0) + checkFlags(false, "-", "", t, 0) clearFlags() pkgMap = make(map[string]string) From aeee7da8eb9ef7f862aaa1b79b12ed01d823807f Mon Sep 17 00:00:00 2001 From: Richard Lincoln <36113520+rwlincoln@users.noreply.github.com> Date: Fri, 23 Feb 2018 04:27:43 +0100 Subject: [PATCH 192/552] Use importPath to set package name rather than package path. (#537) * Prioritise go_package option over import_path argument. * Adding registry tests for SetImportPath method. --- .../descriptor/registry.go | 19 ++++++---- .../descriptor/registry_test.go | 37 +++++++++++++++++++ 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index 61d6eb9bc74..16df86b4436 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -61,7 +61,7 @@ func (r *Registry) Load(req *plugin.CodeGeneratorRequest) error { if target == nil { return fmt.Errorf("no such file: %s", name) } - name := packageIdentityName(target.FileDescriptorProto) + name := r.packageIdentityName(target.FileDescriptorProto) if targetPkg == "" { targetPkg = name } else { @@ -83,7 +83,7 @@ func (r *Registry) Load(req *plugin.CodeGeneratorRequest) error { func (r *Registry) loadFile(file *descriptor.FileDescriptorProto) { pkg := GoPackage{ Path: r.goPackagePath(file), - Name: defaultGoPackageName(file), + Name: r.defaultGoPackageName(file), } if err := r.ReserveGoPackageAlias(pkg.Name, pkg.Path); err != nil { for i := 0; ; i++ { @@ -247,9 +247,6 @@ func (r *Registry) goPackagePath(f *descriptor.FileDescriptorProto) string { } gopkg := f.Options.GetGoPackage() - if len(gopkg) == 0 { - gopkg = r.importPath - } idx := strings.LastIndex(gopkg, "/") if idx >= 0 { if sc := strings.LastIndex(gopkg, ";"); sc > 0 { @@ -295,15 +292,15 @@ func sanitizePackageName(pkgName string) string { // defaultGoPackageName returns the default go package name to be used for go files generated from "f". // You might need to use an unique alias for the package when you import it. Use ReserveGoPackageAlias to get a unique alias. -func defaultGoPackageName(f *descriptor.FileDescriptorProto) string { - name := packageIdentityName(f) +func (r *Registry) defaultGoPackageName(f *descriptor.FileDescriptorProto) string { + name := r.packageIdentityName(f) return sanitizePackageName(name) } // packageIdentityName returns the identity of packages. // protoc-gen-grpc-gateway rejects CodeGenerationRequests which contains more than one packages // as protoc-gen-go does. -func packageIdentityName(f *descriptor.FileDescriptorProto) string { +func (r *Registry) packageIdentityName(f *descriptor.FileDescriptorProto) string { if f.Options != nil && f.Options.GoPackage != nil { gopkg := f.Options.GetGoPackage() idx := strings.LastIndex(gopkg, "/") @@ -321,6 +318,12 @@ func packageIdentityName(f *descriptor.FileDescriptorProto) string { } return sanitizePackageName(gopkg[sc+1:]) } + if p := r.importPath; len(p) != 0 { + if i := strings.LastIndex(p, "/"); i >= 0 { + p = p[i+1:] + } + return p + } if f.Package == nil { base := filepath.Base(f.GetName()) diff --git a/protoc-gen-grpc-gateway/descriptor/registry_test.go b/protoc-gen-grpc-gateway/descriptor/registry_test.go index b73c967b295..16e76655d59 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry_test.go +++ b/protoc-gen-grpc-gateway/descriptor/registry_test.go @@ -549,3 +549,40 @@ func TestLoadOverridedPackageName(t *testing.T) { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } } + +func TestLoadSetInputPath(t *testing.T) { + reg := NewRegistry() + reg.SetImportPath("foo/examplepb") + loadFile(t, reg, ` + name: 'example.proto' + package: 'example' + `) + file := reg.files["example.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg := GoPackage{Path: ".", Name: "examplepb"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } +} + +func TestLoadGoPackageInputPath(t *testing.T) { + reg := NewRegistry() + reg.SetImportPath("examplepb") + loadFile(t, reg, ` + name: 'example.proto' + package: 'example' + options < go_package: 'example.com/xyz;pb' > + `) + file := reg.files["example.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg := GoPackage{Path: "example.com/xyz", Name: "pb"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } +} From bbd1f3e72e6cc53ce3f71cab44d556e3884ce350 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Fri, 23 Feb 2018 04:30:28 +0100 Subject: [PATCH 193/552] error details: add @type key by switching to any.Any (#553) This is arguably more correct than what was introduced in #515. So, any error details no have a "@type" field indicating their underlying proto.Message's type, following the Cloud API docs[1]. [1]: https://cloud.google.com/apis/design/errors#http_mapping Signed-off-by: Stephan Renatus --- examples/integration_test.go | 7 +++++++ runtime/errors.go | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/examples/integration_test.go b/examples/integration_test.go index 2d658d12623..1c8da8eee61 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -761,6 +761,13 @@ func TestErrorWithDetails(t *testing.T) { if got, want := ok, true; got != want { t.Fatalf("msg.Details[0] got type: %T, want %T", msg.Details[0], map[string]interface{}{}) } + typ, ok := details["@type"].(string) + if got, want := ok, true; got != want { + t.Fatalf("msg.Details[0][\"@type\"] got type: %T, want %T", typ, "") + } + if got, want := details["@type"], "type.googleapis.com/google.rpc.DebugInfo"; got != want { + t.Errorf("msg.Details[\"@type\"] = %q; want %q", got, want) + } if got, want := details["detail"], "error debug details"; got != want { t.Errorf("msg.Details[\"detail\"] = %q; want %q", got, want) } diff --git a/runtime/errors.go b/runtime/errors.go index 7b8c690ac1c..178941344d2 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -5,6 +5,8 @@ import ( "net/http" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "github.com/golang/protobuf/ptypes/any" "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" @@ -63,9 +65,9 @@ var ( ) type errorBody struct { - Error string `protobuf:"bytes,1,name=error" json:"error"` - Code int32 `protobuf:"varint,2,name=code" json:"code"` - Details []proto.Message `protobuf:"bytes,3,name=details" json:"details"` + Error string `protobuf:"bytes,1,name=error" json:"error"` + Code int32 `protobuf:"varint,2,name=code" json:"code"` + Details []any.Any `protobuf:"bytes,3,name=details" json:"details"` } // Make this also conform to proto.Message for builtin JSONPb Marshaler @@ -97,7 +99,12 @@ func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w for _, detail := range s.Details() { if det, ok := detail.(proto.Message); ok { - body.Details = append(body.Details, det) + a, err := ptypes.MarshalAny(det) + if err != nil { + grpclog.Printf("Failed to marshal any: %v", err) + } else { + body.Details = append(body.Details, *a) + } } } From aa5b7c21bf85e17376177fcf5a9fa71bcf6aca3e Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Sat, 24 Feb 2018 11:17:18 +0100 Subject: [PATCH 194/552] fix noenc error by fixing Details error field As advised by @itizir in the discussion of #551. However, I've gone with the minimal change to make the error go away, I haven't introduced a proper, generated protobuf definition. Also, I've noticed our error body message there looks suspiciously like Status[1], except for the field name "Error" vs "Message". Fixes #551. [1]: https://github.com/google/go-genproto/blob/2b5a72b8730b0b/googleapis/rpc/status/status.pb.go#L83-L93 Signed-off-by: Stephan Renatus --- runtime/errors.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/errors.go b/runtime/errors.go index 178941344d2..be88c3bdd1f 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -65,9 +65,9 @@ var ( ) type errorBody struct { - Error string `protobuf:"bytes,1,name=error" json:"error"` - Code int32 `protobuf:"varint,2,name=code" json:"code"` - Details []any.Any `protobuf:"bytes,3,name=details" json:"details"` + Error string `protobuf:"bytes,1,name=error" json:"error"` + Code int32 `protobuf:"varint,2,name=code" json:"code"` + Details []*any.Any `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"` } // Make this also conform to proto.Message for builtin JSONPb Marshaler @@ -103,7 +103,7 @@ func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w if err != nil { grpclog.Printf("Failed to marshal any: %v", err) } else { - body.Details = append(body.Details, *a) + body.Details = append(body.Details, a) } } } From 10bbbbd90af6b8b1dd8401813ff290132291679c Mon Sep 17 00:00:00 2001 From: Sam Batschelet Date: Tue, 6 Mar 2018 07:37:36 -0500 Subject: [PATCH 195/552] runtime: return 503 vs 403 with ResourceExhausted. --- runtime/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/errors.go b/runtime/errors.go index be88c3bdd1f..429a2162400 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -35,7 +35,7 @@ func HTTPStatusFromCode(code codes.Code) int { case codes.Unauthenticated: return http.StatusUnauthorized case codes.ResourceExhausted: - return http.StatusForbidden + return http.StatusServiceUnavailable case codes.FailedPrecondition: return http.StatusPreconditionFailed case codes.Aborted: From 6932f71a43a5dfbb87039d02a7481c71b7b76927 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 7 Mar 2018 05:33:12 +0000 Subject: [PATCH 196/552] Add details to stream error response (#561) * Use the status Message when possible in errors * Add details to stream error response. --- Makefile | 6 ++-- runtime/handler.go | 10 +++++-- runtime/handler_test.go | 42 ++++++++++++++++++++------ runtime/internal/stream_chunk.pb.go | 46 ++++++++++++++++++----------- runtime/internal/stream_chunk.proto | 3 ++ 5 files changed, 77 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index c6a645e0ef7..a4dc3e36c62 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,9 @@ PKG=github.com/grpc-ecosystem/grpc-gateway GO_PLUGIN=bin/protoc-gen-go -GO_PLUGIN_PKG=github.com/golang/protobuf/protoc-gen-go +GO_PROTOBUF_REPO=github.com/golang/protobuf +GO_PLUGIN_PKG=$(GO_PROTOBUF_REPO)/protoc-gen-go +GO_PTYPES_ANY_PKG=$(GO_PROTOBUF_REPO)/ptypes/any SWAGGER_PLUGIN=bin/protoc-gen-swagger SWAGGER_PLUGIN_SRC= utilities/doc.go \ utilities/pattern.go \ @@ -91,7 +93,7 @@ $(GO_PLUGIN): go build -o $@ $(GO_PLUGIN_PKG) $(RUNTIME_GO): $(RUNTIME_PROTO) $(GO_PLUGIN) - protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP):. $(RUNTIME_PROTO) + protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I $(GOPATH)/src/$(GO_PTYPES_ANY_PKG) -I. --go_out=$(PKGMAP):. $(RUNTIME_PROTO) $(OPENAPIV2_GO): $(OPENAPIV2_PROTO) $(GO_PLUGIN) protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP):$(GOPATH)/src $(OPENAPIV2_PROTO) diff --git a/runtime/handler.go b/runtime/handler.go index 1770b85344d..50e9c88ca2e 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -7,6 +7,7 @@ import ( "net/textproto" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/any" "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" "golang.org/x/net/context" "google.golang.org/grpc/codes" @@ -42,7 +43,7 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal if d, ok := marshaler.(Delimited); ok { delimiter = d.Delimiter() } else { - delimiter = []byte("\n") + delimiter = []byte("\n") } var wroteHeader bool @@ -169,16 +170,21 @@ func handleForwardResponseStreamError(wroteHeader bool, marshaler Marshaler, w h func streamChunk(result proto.Message, err error) map[string]proto.Message { if err != nil { grpcCode := codes.Unknown + grpcMessage := err.Error() + var grpcDetails []*any.Any if s, ok := status.FromError(err); ok { grpcCode = s.Code() + grpcMessage = s.Message() + grpcDetails = s.Proto().GetDetails() } httpCode := HTTPStatusFromCode(grpcCode) return map[string]proto.Message{ "error": &internal.StreamError{ GrpcCode: int32(grpcCode), HttpCode: int32(httpCode), - Message: err.Error(), + Message: grpcMessage, HttpStatus: http.StatusText(httpCode), + Details: grpcDetails, }, } } diff --git a/runtime/handler_test.go b/runtime/handler_test.go index 493aa5e5495..59838f2b04f 100644 --- a/runtime/handler_test.go +++ b/runtime/handler_test.go @@ -10,9 +10,11 @@ import ( "github.com/golang/protobuf/proto" pb "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) func TestForwardResponseStream(t *testing.T) { @@ -84,9 +86,32 @@ func TestForwardResponseStream(t *testing.T) { w.Body.Close() var want []byte - for _, msg := range tt.msgs { + for i, msg := range tt.msgs { if msg.err != nil { - t.Skip("checking erorr encodings") + if i == 0 { + // Skip non-stream errors + t.Skip("checking error encodings") + } + st, _ := status.FromError(msg.err) + httpCode := runtime.HTTPStatusFromCode(st.Code()) + b, err := marshaler.Marshal(map[string]proto.Message{ + "error": &internal.StreamError{ + GrpcCode: int32(st.Code()), + HttpCode: int32(httpCode), + Message: st.Message(), + HttpStatus: http.StatusText(httpCode), + Details: st.Proto().GetDetails(), + }, + }) + if err != nil { + t.Errorf("marshaler.Marshal() failed %v", err) + } + errBytes := body[len(want):] + if string(errBytes) != string(b) { + t.Errorf("ForwardResponseStream() = \"%s\" want \"%s\"", errBytes, b) + } + + return } b, err := marshaler.Marshal(map[string]proto.Message{"result": msg.pb}) if err != nil { @@ -103,17 +128,16 @@ func TestForwardResponseStream(t *testing.T) { } } - // A custom marshaler implementation, that doesn't implement the delimited interface type CustomMarshaler struct { - m *runtime.JSONPb + m *runtime.JSONPb } -func (c *CustomMarshaler) Marshal(v interface{}) ([]byte, error) { return c.m.Marshal(v) } -func (c *CustomMarshaler) Unmarshal(data []byte, v interface{}) error { return c.m.Unmarshal(data, v) } -func (c *CustomMarshaler) NewDecoder(r io.Reader) runtime.Decoder { return c.m.NewDecoder(r) } -func (c *CustomMarshaler) NewEncoder(w io.Writer) runtime.Encoder { return c.m.NewEncoder(w) } -func (c *CustomMarshaler) ContentType() string { return c.m.ContentType() } +func (c *CustomMarshaler) Marshal(v interface{}) ([]byte, error) { return c.m.Marshal(v) } +func (c *CustomMarshaler) Unmarshal(data []byte, v interface{}) error { return c.m.Unmarshal(data, v) } +func (c *CustomMarshaler) NewDecoder(r io.Reader) runtime.Decoder { return c.m.NewDecoder(r) } +func (c *CustomMarshaler) NewEncoder(w io.Writer) runtime.Encoder { return c.m.NewEncoder(w) } +func (c *CustomMarshaler) ContentType() string { return c.m.ContentType() } func TestForwardResponseStreamCustomMarshaler(t *testing.T) { type msg struct { diff --git a/runtime/internal/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go index 44550f393b4..82af3a616be 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -15,6 +15,7 @@ package internal import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" +import google_protobuf "github.com/golang/protobuf/ptypes/any" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -30,10 +31,11 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // StreamError is a response type which is returned when // streaming rpc returns an error. type StreamError struct { - GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode" json:"grpc_code,omitempty"` - HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode" json:"http_code,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` - HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus" json:"http_status,omitempty"` + GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode" json:"grpc_code,omitempty"` + HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode" json:"http_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` + HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus" json:"http_status,omitempty"` + Details []*google_protobuf.Any `protobuf:"bytes,5,rep,name=details" json:"details,omitempty"` } func (m *StreamError) Reset() { *m = StreamError{} } @@ -69,6 +71,13 @@ func (m *StreamError) GetHttpStatus() string { return "" } +func (m *StreamError) GetDetails() []*google_protobuf.Any { + if m != nil { + return m.Details + } + return nil +} + func init() { proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError") } @@ -76,17 +85,20 @@ func init() { func init() { proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 181 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x8e, 0xbf, 0xee, 0x82, 0x30, - 0x14, 0x85, 0xd3, 0xdf, 0x1f, 0x85, 0xcb, 0x46, 0x1c, 0x9a, 0x38, 0x48, 0x74, 0x61, 0x82, 0xc1, - 0x37, 0xd0, 0xf8, 0x02, 0xb0, 0xb9, 0x90, 0x0a, 0x37, 0x40, 0x94, 0x96, 0xdc, 0x5e, 0x62, 0x5c, - 0x7d, 0x72, 0xd3, 0x22, 0xe3, 0xf9, 0xbe, 0x73, 0x92, 0x03, 0x07, 0x9a, 0x34, 0xf7, 0x03, 0xe6, - 0xbd, 0x66, 0x24, 0xad, 0x1e, 0xb9, 0x65, 0x42, 0x35, 0x54, 0x75, 0x37, 0xe9, 0x7b, 0x36, 0x92, - 0x61, 0x13, 0x6f, 0x5a, 0x1a, 0xeb, 0xac, 0x55, 0x8c, 0x4f, 0xf5, 0xca, 0xbe, 0x8b, 0xfd, 0x5b, - 0x40, 0x54, 0xfa, 0xf2, 0x85, 0xc8, 0x50, 0xbc, 0x85, 0xd0, 0xf5, 0xaa, 0xda, 0x34, 0x28, 0x45, - 0x22, 0xd2, 0xff, 0x22, 0x70, 0xe0, 0x6c, 0x1a, 0x74, 0xb2, 0x63, 0x1e, 0x67, 0xf9, 0x33, 0x4b, - 0x07, 0xbc, 0x94, 0xb0, 0x1e, 0xd0, 0x5a, 0xd5, 0xa2, 0xfc, 0x4d, 0x44, 0x1a, 0x16, 0x4b, 0x8c, - 0x77, 0x10, 0xf9, 0x99, 0x65, 0xc5, 0x93, 0x95, 0x7f, 0xde, 0x82, 0x43, 0xa5, 0x27, 0x27, 0xb8, - 0x06, 0xcb, 0xf3, 0xdb, 0xca, 0xbf, 0x3d, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x07, 0x92, - 0xb6, 0xd4, 0x00, 0x00, 0x00, + // 226 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0xc1, 0x4e, 0x84, 0x30, + 0x10, 0x86, 0x83, 0xeb, 0xba, 0xbb, 0xc3, 0x8d, 0xec, 0xa1, 0xea, 0x41, 0xa2, 0x17, 0x4e, 0x25, + 0xd1, 0x27, 0x50, 0xe3, 0x0b, 0xb0, 0x37, 0x2f, 0x9b, 0x59, 0x18, 0x0b, 0x11, 0x5a, 0x32, 0x1d, + 0x62, 0x78, 0x2d, 0x9f, 0xd0, 0xb4, 0xc8, 0xb1, 0xdf, 0xf7, 0xff, 0x93, 0x3f, 0x85, 0x27, 0x9e, + 0xac, 0x74, 0x03, 0x95, 0x9d, 0x15, 0x62, 0x8b, 0x7d, 0xe9, 0x85, 0x09, 0x87, 0x73, 0xdd, 0x4e, + 0xf6, 0x5b, 0x8f, 0xec, 0xc4, 0x65, 0x47, 0xc3, 0x63, 0xad, 0x0d, 0x0a, 0xfd, 0xe0, 0xac, 0xff, + 0x1b, 0x77, 0xb7, 0xc6, 0x39, 0xd3, 0x53, 0x19, 0x33, 0x97, 0xe9, 0xab, 0x44, 0x3b, 0x2f, 0x85, + 0xc7, 0xdf, 0x04, 0xd2, 0x53, 0xbc, 0xf3, 0xc1, 0xec, 0x38, 0xbb, 0x87, 0x43, 0x38, 0x71, 0xae, + 0x5d, 0x43, 0x2a, 0xc9, 0x93, 0x62, 0x5b, 0xed, 0x03, 0x78, 0x77, 0x0d, 0x05, 0xd9, 0x8a, 0x8c, + 0x8b, 0xbc, 0x5a, 0x64, 0x00, 0x51, 0x2a, 0xd8, 0x0d, 0xe4, 0x3d, 0x1a, 0x52, 0x9b, 0x3c, 0x29, + 0x0e, 0xd5, 0xfa, 0xcc, 0x1e, 0x20, 0x8d, 0x35, 0x2f, 0x28, 0x93, 0x57, 0xd7, 0xd1, 0x42, 0x40, + 0xa7, 0x48, 0x32, 0x0d, 0xbb, 0x86, 0x04, 0xbb, 0xde, 0xab, 0x6d, 0xbe, 0x29, 0xd2, 0xe7, 0xa3, + 0x5e, 0x16, 0xeb, 0x75, 0xb1, 0x7e, 0xb5, 0x73, 0xb5, 0x86, 0xde, 0xe0, 0x73, 0xbf, 0x7e, 0xc2, + 0xe5, 0x26, 0x46, 0x5e, 0xfe, 0x02, 0x00, 0x00, 0xff, 0xff, 0x16, 0x75, 0x92, 0x08, 0x1f, 0x01, + 0x00, 0x00, } diff --git a/runtime/internal/stream_chunk.proto b/runtime/internal/stream_chunk.proto index f7fba56c35b..55f42ce63ec 100644 --- a/runtime/internal/stream_chunk.proto +++ b/runtime/internal/stream_chunk.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package grpc.gateway.runtime; option go_package = "internal"; +import "google/protobuf/any.proto"; + // StreamError is a response type which is returned when // streaming rpc returns an error. message StreamError { @@ -9,4 +11,5 @@ message StreamError { int32 http_code = 2; string message = 3; string http_status = 4; + repeated google.protobuf.Any details = 5; } From c0b614053fd71864de2b5af429eb56584e76ac46 Mon Sep 17 00:00:00 2001 From: Lucas Vogelsang Date: Thu, 1 Mar 2018 11:51:46 -0500 Subject: [PATCH 197/552] []byte in query now uses base64.StdEncoding Changed default encoding of []bytes in URL Query params to use standard padded base64 encoding to be consistent with representation in json serialized objects. --- CONTRIBUTING.md | 2 +- runtime/convert.go | 2 +- runtime/query.go | 2 +- runtime/query_test.go | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 94983bc97e2..4f0c59eea8d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ Here's the recommended process of contribution. 4. Make sure that your change follows best practices in Go * [Effective Go](https://golang.org/doc/effective_go.html) * [Go Code Review Comments](https://golang.org/wiki/CodeReviewComments) -5. Make sure that `make test` passes. (use swagger-codegen 2.1.6, not newer versions) +5. Make sure that `make test` passes. (use swagger-codegen 2.2.2, not newer versions) 6. Sign [a Contributor License Agreement](https://cla.developers.google.com/clas) 7. Open a pull request in Github diff --git a/runtime/convert.go b/runtime/convert.go index afbcbd4fa10..903ae23407b 100644 --- a/runtime/convert.go +++ b/runtime/convert.go @@ -65,7 +65,7 @@ func Uint32(val string) (uint32, error) { // Bytes converts the given string representation of a byte sequence into a slice of bytes // A bytes sequence is encoded in URL-safe base64 without padding func Bytes(val string) ([]byte, error) { - b, err := base64.RawURLEncoding.DecodeString(val) + b, err := base64.StdEncoding.DecodeString(val) if err != nil { return nil, err } diff --git a/runtime/query.go b/runtime/query.go index fb8f4fc0bf7..07d0ff8c5bf 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -261,7 +261,7 @@ func populateField(f reflect.Value, value string, props *proto.Properties) error f.Field(0).SetString(value) return nil case "BytesValue": - bytesVal, err := base64.RawURLEncoding.DecodeString(value) + bytesVal, err := base64.StdEncoding.DecodeString(value) if err != nil { return fmt.Errorf("bad BytesValue: %s", value) } diff --git a/runtime/query_test.go b/runtime/query_test.go index ae5d20f124d..969a8ca1263 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -44,7 +44,7 @@ func TestPopulateParameters(t *testing.T) { "uint32_value": {"4"}, "bool_value": {"true"}, "string_value": {"str"}, - "bytes_value": {"Ynl0ZXM"}, + "bytes_value": {"Ynl0ZXM="}, "repeated_value": {"a", "b", "c"}, "enum_value": {"1"}, "repeated_enum": {"1", "2", "0"}, @@ -58,7 +58,7 @@ func TestPopulateParameters(t *testing.T) { "wrapper_u_int32_value": {"4"}, "wrapper_bool_value": {"true"}, "wrapper_string_value": {"str"}, - "wrapper_bytes_value": {"Ynl0ZXM"}, + "wrapper_bytes_value": {"Ynl0ZXM="}, "map_value[key]": {"value"}, "map_value[second]": {"bar"}, "map_value[third]": {"zzz"}, @@ -137,7 +137,7 @@ func TestPopulateParameters(t *testing.T) { "uint32Value": {"4"}, "boolValue": {"true"}, "stringValue": {"str"}, - "bytesValue": {"Ynl0ZXM"}, + "bytesValue": {"Ynl0ZXM="}, "repeatedValue": {"a", "b", "c"}, "enumValue": {"1"}, "repeatedEnum": {"1", "2", "0"}, @@ -151,7 +151,7 @@ func TestPopulateParameters(t *testing.T) { "wrapperUInt32Value": {"4"}, "wrapperBoolValue": {"true"}, "wrapperStringValue": {"str"}, - "wrapperBytesValue": {"Ynl0ZXM"}, + "wrapperBytesValue": {"Ynl0ZXM="}, }, filter: utilities.NewDoubleArray(nil), want: &proto3Message{ From 652a7b7b82804e0a6773dbd1540b07f13242d81b Mon Sep 17 00:00:00 2001 From: Alex Leigh Date: Sun, 11 Mar 2018 17:19:38 -0700 Subject: [PATCH 198/552] Omit well-known type definitions from swagger output (#541) --- Makefile | 6 +- examples/examplepb/echo_service.pb.go | 2 + examples/examplepb/wrappers.pb.go | 179 ++++++++++++++++++++++ examples/examplepb/wrappers.pb.gw.go | 122 +++++++++++++++ examples/examplepb/wrappers.proto | 24 +++ examples/examplepb/wrappers.swagger.json | 75 +++++++++ protoc-gen-swagger/genswagger/template.go | 12 ++ 7 files changed, 418 insertions(+), 2 deletions(-) create mode 100644 examples/examplepb/wrappers.pb.go create mode 100644 examples/examplepb/wrappers.pb.gw.go create mode 100644 examples/examplepb/wrappers.proto create mode 100644 examples/examplepb/wrappers.swagger.json diff --git a/Makefile b/Makefile index a4dc3e36c62..cc880094592 100644 --- a/Makefile +++ b/Makefile @@ -54,11 +54,13 @@ ifneq "$(GATEWAY_PLUGIN_FLAGS)" "" ADDITIONAL_FLAGS=,$(GATEWAY_PLUGIN_FLAGS) endif SWAGGER_EXAMPLES=examples/examplepb/echo_service.proto \ - examples/examplepb/a_bit_of_everything.proto + examples/examplepb/a_bit_of_everything.proto \ + examples/examplepb/wrappers.proto EXAMPLES=examples/examplepb/echo_service.proto \ examples/examplepb/a_bit_of_everything.proto \ examples/examplepb/stream.proto \ - examples/examplepb/flow_combination.proto + examples/examplepb/flow_combination.proto \ + examples/examplepb/wrappers.proto EXAMPLE_SVCSRCS=$(EXAMPLES:.proto=.pb.go) EXAMPLE_GWSRCS=$(EXAMPLES:.proto=.pb.gw.go) EXAMPLE_SWAGGERSRCS=$(EXAMPLES:.proto=.swagger.json) diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 0cca760395b..8a600f8dcd3 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -14,6 +14,7 @@ It is generated from these files: examples/examplepb/a_bit_of_everything.proto examples/examplepb/stream.proto examples/examplepb/flow_combination.proto + examples/examplepb/wrappers.proto It has these top-level messages: SimpleMessage @@ -25,6 +26,7 @@ It has these top-level messages: UnaryProto NestedProto SingleNestedProto + Wrappers */ package examplepb diff --git a/examples/examplepb/wrappers.pb.go b/examples/examplepb/wrappers.pb.go new file mode 100644 index 00000000000..62268e17c2e --- /dev/null +++ b/examples/examplepb/wrappers.pb.go @@ -0,0 +1,179 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: examples/examplepb/wrappers.proto + +package examplepb + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import google_protobuf5 "github.com/golang/protobuf/ptypes/wrappers" + +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 + +type Wrappers struct { + StringValue *google_protobuf5.StringValue `protobuf:"bytes,1,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + Int32Value *google_protobuf5.Int32Value `protobuf:"bytes,2,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` + Int64Value *google_protobuf5.Int64Value `protobuf:"bytes,3,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` + FloatValue *google_protobuf5.FloatValue `protobuf:"bytes,4,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` + DoubleValue *google_protobuf5.DoubleValue `protobuf:"bytes,5,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + BoolValue *google_protobuf5.BoolValue `protobuf:"bytes,6,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` +} + +func (m *Wrappers) Reset() { *m = Wrappers{} } +func (m *Wrappers) String() string { return proto.CompactTextString(m) } +func (*Wrappers) ProtoMessage() {} +func (*Wrappers) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} } + +func (m *Wrappers) GetStringValue() *google_protobuf5.StringValue { + if m != nil { + return m.StringValue + } + return nil +} + +func (m *Wrappers) GetInt32Value() *google_protobuf5.Int32Value { + if m != nil { + return m.Int32Value + } + return nil +} + +func (m *Wrappers) GetInt64Value() *google_protobuf5.Int64Value { + if m != nil { + return m.Int64Value + } + return nil +} + +func (m *Wrappers) GetFloatValue() *google_protobuf5.FloatValue { + if m != nil { + return m.FloatValue + } + return nil +} + +func (m *Wrappers) GetDoubleValue() *google_protobuf5.DoubleValue { + if m != nil { + return m.DoubleValue + } + return nil +} + +func (m *Wrappers) GetBoolValue() *google_protobuf5.BoolValue { + if m != nil { + return m.BoolValue + } + return nil +} + +func init() { + proto.RegisterType((*Wrappers)(nil), "grpc.gateway.examples.examplepb.Wrappers") +} + +// 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.SupportPackageIsVersion4 + +// Client API for WrappersService service + +type WrappersServiceClient interface { + Create(ctx context.Context, in *Wrappers, opts ...grpc.CallOption) (*Wrappers, error) +} + +type wrappersServiceClient struct { + cc *grpc.ClientConn +} + +func NewWrappersServiceClient(cc *grpc.ClientConn) WrappersServiceClient { + return &wrappersServiceClient{cc} +} + +func (c *wrappersServiceClient) Create(ctx context.Context, in *Wrappers, opts ...grpc.CallOption) (*Wrappers, error) { + out := new(Wrappers) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/Create", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for WrappersService service + +type WrappersServiceServer interface { + Create(context.Context, *Wrappers) (*Wrappers, error) +} + +func RegisterWrappersServiceServer(s *grpc.Server, srv WrappersServiceServer) { + s.RegisterService(&_WrappersService_serviceDesc, srv) +} + +func _WrappersService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Wrappers) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).Create(ctx, req.(*Wrappers)) + } + return interceptor(ctx, in, info, handler) +} + +var _WrappersService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.WrappersService", + HandlerType: (*WrappersServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Create", + Handler: _WrappersService_Create_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/examplepb/wrappers.proto", +} + +func init() { proto.RegisterFile("examples/examplepb/wrappers.proto", fileDescriptor4) } + +var fileDescriptor4 = []byte{ + // 330 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0xd2, 0xc1, 0x4a, 0x33, 0x31, + 0x10, 0x07, 0x70, 0xb6, 0xfd, 0xbe, 0x62, 0xb3, 0x82, 0xb0, 0x78, 0xd0, 0xb5, 0x58, 0xed, 0x49, + 0x3d, 0x64, 0xb1, 0x2d, 0x05, 0x45, 0x10, 0xaa, 0x08, 0x5e, 0x2d, 0x28, 0x78, 0x91, 0xa4, 0x4d, + 0x97, 0x40, 0xdc, 0x09, 0xd9, 0xb4, 0xd5, 0x93, 0xe8, 0x23, 0xe8, 0xa3, 0xf9, 0x0a, 0x3e, 0x88, + 0x6c, 0x3a, 0xd9, 0x82, 0xa5, 0xe8, 0x6d, 0x66, 0xf7, 0xff, 0x1b, 0x18, 0x32, 0x64, 0x5f, 0x3c, + 0xb1, 0x47, 0xad, 0x44, 0x9e, 0x60, 0xa1, 0x79, 0x32, 0x33, 0x4c, 0x6b, 0x61, 0x72, 0xaa, 0x0d, + 0x58, 0x88, 0x9a, 0xa9, 0xd1, 0x43, 0x9a, 0x32, 0x2b, 0x66, 0xec, 0x99, 0xfa, 0x3c, 0x2d, 0xf3, + 0x71, 0x23, 0x05, 0x48, 0x95, 0x48, 0x98, 0x96, 0x09, 0xcb, 0x32, 0xb0, 0xcc, 0x4a, 0xc8, 0x90, + 0xc7, 0xbb, 0xf8, 0xd7, 0x75, 0x7c, 0x32, 0xfe, 0x31, 0xbe, 0xf5, 0x5a, 0x25, 0x6b, 0x77, 0xf8, + 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, 0x00, 0x00, +} diff --git a/examples/examplepb/wrappers.pb.gw.go b/examples/examplepb/wrappers.pb.gw.go new file mode 100644 index 00000000000..bd57b237e34 --- /dev/null +++ b/examples/examplepb/wrappers.pb.gw.go @@ -0,0 +1,122 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: examples/examplepb/wrappers.proto + +/* +Package examplepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package examplepb + +import ( + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray + +func request_WrappersService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Wrappers + var metadata runtime.ServerMetadata + + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + } + + msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +// RegisterWrappersServiceHandlerFromEndpoint is same as RegisterWrappersServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterWrappersServiceHandlerFromEndpoint(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 RegisterWrappersServiceHandler(ctx, mux, conn) +} + +// RegisterWrappersServiceHandler registers the http handlers for service WrappersService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterWrappersServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterWrappersServiceHandlerClient(ctx, mux, NewWrappersServiceClient(conn)) +} + +// RegisterWrappersServiceHandler registers the http handlers for service WrappersService to "mux". +// The handlers forward requests to the grpc endpoint over the given implementation of "WrappersServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WrappersServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "WrappersServiceClient" to call the correct interceptors. +func RegisterWrappersServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WrappersServiceClient) error { + + mux.Handle("POST", pattern_WrappersService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + 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, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_Create_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_Create_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_WrappersService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "wrappers"}, "")) +) + +var ( + forward_WrappersService_Create_0 = runtime.ForwardResponseMessage +) diff --git a/examples/examplepb/wrappers.proto b/examples/examplepb/wrappers.proto new file mode 100644 index 00000000000..094b0a4c662 --- /dev/null +++ b/examples/examplepb/wrappers.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +option go_package = "examplepb"; +package grpc.gateway.examples.examplepb; + +import "google/api/annotations.proto"; +import "google/protobuf/wrappers.proto"; + +message Wrappers { + google.protobuf.StringValue string_value = 1; + google.protobuf.Int32Value int32_value = 2; + google.protobuf.Int64Value int64_value = 3; + google.protobuf.FloatValue float_value = 4; + google.protobuf.DoubleValue double_value = 5; + google.protobuf.BoolValue bool_value = 6; +} + +service WrappersService { + rpc Create(Wrappers) returns (Wrappers) { + option (google.api.http) = { + post: "/v1/example/wrappers" + body: "*" + }; + } +} diff --git a/examples/examplepb/wrappers.swagger.json b/examples/examplepb/wrappers.swagger.json new file mode 100644 index 00000000000..01fd9d2e6a9 --- /dev/null +++ b/examples/examplepb/wrappers.swagger.json @@ -0,0 +1,75 @@ +{ + "swagger": "2.0", + "info": { + "title": "examples/examplepb/wrappers.proto", + "version": "version not set" + }, + "schemes": [ + "http", + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/example/wrappers": { + "post": { + "operationId": "Create", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/examplepbWrappers" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbWrappers" + } + } + ], + "tags": [ + "WrappersService" + ] + } + } + }, + "definitions": { + "examplepbWrappers": { + "type": "object", + "properties": { + "string_value": { + "type": "string" + }, + "int32_value": { + "type": "integer", + "format": "int32" + }, + "int64_value": { + "type": "integer", + "format": "int64" + }, + "float_value": { + "type": "number", + "format": "float" + }, + "double_value": { + "type": "number", + "format": "double" + }, + "bool_value": { + "type": "boolean", + "format": "boolean" + } + } + } + } +} diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 2781a8b6e52..7c55d5367c9 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -201,6 +201,18 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, continue case ".google.protobuf.Duration": continue + case ".google.protobuf.StringValue": + continue + case ".google.protobuf.Int32Value": + continue + case ".google.protobuf.Int64Value": + continue + case ".google.protobuf.FloatValue": + continue + case ".google.protobuf.DoubleValue": + continue + case ".google.protobuf.BoolValue": + continue } if opt := msg.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { continue From cb42acbdcffc4c785a78964f56a8850dec997149 Mon Sep 17 00:00:00 2001 From: Stan Nelson Date: Tue, 3 Apr 2018 15:17:52 -0700 Subject: [PATCH 199/552] Changed to use more appropriate http status code for ResourceExhausted (#580) * Adjust status codes to match googleapis code.proto --- examples/integration_test.go | 2 +- runtime/errors.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/integration_test.go b/examples/integration_test.go index 1c8da8eee61..7a51868a99d 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -719,7 +719,7 @@ func TestTimeout(t *testing.T) { } defer resp.Body.Close() - if got, want := resp.StatusCode, http.StatusRequestTimeout; got != want { + if got, want := resp.StatusCode, http.StatusGatewayTimeout; got != want { t.Errorf("resp.StatusCode = %d; want %d", got, want) } } diff --git a/runtime/errors.go b/runtime/errors.go index 429a2162400..0276585a317 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -14,6 +14,7 @@ import ( ) // HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. +// See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto func HTTPStatusFromCode(code codes.Code) int { switch code { case codes.OK: @@ -25,7 +26,7 @@ func HTTPStatusFromCode(code codes.Code) int { case codes.InvalidArgument: return http.StatusBadRequest case codes.DeadlineExceeded: - return http.StatusRequestTimeout + return http.StatusGatewayTimeout case codes.NotFound: return http.StatusNotFound case codes.AlreadyExists: @@ -35,9 +36,9 @@ func HTTPStatusFromCode(code codes.Code) int { case codes.Unauthenticated: return http.StatusUnauthorized case codes.ResourceExhausted: - return http.StatusServiceUnavailable + return http.StatusTooManyRequests case codes.FailedPrecondition: - return http.StatusPreconditionFailed + return http.StatusBadRequest case codes.Aborted: return http.StatusConflict case codes.OutOfRange: From 3aa05c14f73bf622f3f9002abb158e1538f28f25 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sun, 8 Apr 2018 14:15:51 -0600 Subject: [PATCH 200/552] Add an issue template --- ISSUE_TEMPLATE.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 ISSUE_TEMPLATE.md diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 00000000000..9edbaa64c96 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,41 @@ + +# Please follow the general troubleshooting steps first: + +- [ ] Update your protoc to the [latest version](https://github.com/google/protobuf/releases) +- [ ] Update your copy of `grpc-gateway` to the latest version from github. with + `git fetch https://github.com/grpc-ecosystem/grpc-gateway master && git reset --hard FETCH_HEAD` +- [ ] Delete the `protoc-gen-grpc-gateway` and `protoc-gen-swagger` binary from your `PATH`, + and install locally built binaries. + +### Bug reports: + +Fill in the following sections with explanations of what's gone wrong. + +Steps you follow to reproduce the error: + + + +Your steps here. + +What did you expect to happen instead: + + + +Your answer here. + +What's your theory on why it isn't working: + + + +Your theory here. From 4b00e80d1d72319c10b915ad737929a7da80323d Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sun, 8 Apr 2018 19:54:33 -0600 Subject: [PATCH 201/552] Update regex to actually match go versions --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f0845ec73a6..9867bd5ea11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,7 @@ after_success: env: global: - "PATH=$PATH:$HOME/local/bin" - - GO_VERSION_TO_DIFF_TEST="go version go1\.9\.[0-9]+ linux/amd64" + - GO_VERSION_TO_DIFF_TEST="go version go1\.9\.[0-9]\+ linux/amd64" matrix: - GATEWAY_PLUGIN_FLAGS= - GATEWAY_PLUGIN_FLAGS=request_context=false From faa6b37184983e853166816b2303416846b97d3c Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sat, 14 Apr 2018 11:39:00 -0600 Subject: [PATCH 202/552] Upgrade to go1.10 and regenerate Go 1.10 makes the move to the new context automatically on `go fix` so Fixes: #326 --- .travis.yml | 4 +- .../abe/a_bit_of_everything_service_api.go | 325 ++++++++---------- .../abe/camel_case_service_name_api.go | 110 ++++++ examples/clients/abe/echo_rpc_api.go | 265 ++++++++++++++ examples/clients/abe/echo_service_api.go | 265 ++++++++++++++ examples/examplepb/a_bit_of_everything.pb.go | 2 +- examples/examplepb/echo_service.pb.go | 2 +- examples/examplepb/flow_combination.pb.go | 2 +- examples/examplepb/stream.pb.go | 2 +- examples/examplepb/wrappers.pb.go | 2 +- examples/integration_test.go | 2 +- examples/main.go | 2 +- examples/server/a_bit_of_everything.go | 2 +- examples/server/echo.go | 2 +- examples/server/flow_combination.go | 2 +- runtime/context.go | 2 +- runtime/context_test.go | 2 +- runtime/errors.go | 2 +- runtime/errors_test.go | 2 +- runtime/handler.go | 2 +- runtime/handler_test.go | 2 +- runtime/mux.go | 2 +- runtime/proto_errors.go | 2 +- 23 files changed, 798 insertions(+), 207 deletions(-) create mode 100644 examples/clients/abe/camel_case_service_name_api.go create mode 100644 examples/clients/abe/echo_rpc_api.go create mode 100644 examples/clients/abe/echo_service_api.go diff --git a/.travis.yml b/.travis.yml index 9867bd5ea11..730f72a278b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: go sudo: false go: -- 1.8.x - 1.9.x +- 1.10.x - master go_import_path: github.com/grpc-ecosystem/grpc-gateway cache: @@ -35,7 +35,7 @@ after_success: env: global: - "PATH=$PATH:$HOME/local/bin" - - GO_VERSION_TO_DIFF_TEST="go version go1\.9\.[0-9]\+ linux/amd64" + - GO_VERSION_TO_DIFF_TEST="go version go1\.10\.[0-9]\+ linux/amd64" matrix: - GATEWAY_PLUGIN_FLAGS= - GATEWAY_PLUGIN_FLAGS=request_context=false diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index eec4725130c..19c6fdaa7dd 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -85,6 +85,19 @@ func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] @@ -145,6 +158,19 @@ func (a ABitOfEverythingServiceApi) CreateBody(body ExamplepbABitOfEverything) ( var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] @@ -209,6 +235,19 @@ func (a ABitOfEverythingServiceApi) DeepPathEcho(singleNestedName string, body E var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] @@ -272,6 +311,14 @@ func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIRes var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] @@ -314,193 +361,6 @@ func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIRes return successPayload, localVarAPIResponse, err } -/** - * Echo allows posting a StringMessage value. - * It also exposes multiple bindings. This makes it useful when validating that the OpenAPI v2 API description exposes documentation correctly on all paths defined as additional_bindings in the proto. - * - * @param value - * @return *SubStringMessage - */ -func (a ABitOfEverythingServiceApi) Echo(value string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" - localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Echo allows posting a StringMessage value. - * It also exposes multiple bindings. This makes it useful when validating that the OpenAPI v2 API description exposes documentation correctly on all paths defined as additional_bindings in the proto. - * - * @param body - * @return *SubStringMessage - */ -func (a ABitOfEverythingServiceApi) Echo2(body string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/echo" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Echo allows posting a StringMessage value. - * It also exposes multiple bindings. This makes it useful when validating that the OpenAPI v2 API description exposes documentation correctly on all paths defined as additional_bindings in the proto. - * - * @param value - * @return *SubStringMessage - */ -func (a ABitOfEverythingServiceApi) Echo3(value string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/echo" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo3", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - /** * * @@ -518,6 +378,19 @@ func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*ProtobufEmpty, *APIResp var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] @@ -580,6 +453,19 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] @@ -667,6 +553,19 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName strin var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] @@ -756,6 +655,19 @@ func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEveryth var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] @@ -818,6 +730,19 @@ func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body Examplep var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] @@ -879,6 +804,19 @@ func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, err var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] @@ -941,6 +879,19 @@ func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEver var localVarPostBody interface{} var localVarFileName string var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") // add default headers if any for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] diff --git a/examples/clients/abe/camel_case_service_name_api.go b/examples/clients/abe/camel_case_service_name_api.go new file mode 100644 index 00000000000..43c92f74152 --- /dev/null +++ b/examples/clients/abe/camel_case_service_name_api.go @@ -0,0 +1,110 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0 + * Contact: none@example.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "net/url" + "strings" + "encoding/json" +) + +type CamelCaseServiceNameApi struct { + Configuration *Configuration +} + +func NewCamelCaseServiceNameApi() *CamelCaseServiceNameApi { + configuration := NewConfiguration() + return &CamelCaseServiceNameApi{ + Configuration: configuration, + } +} + +func NewCamelCaseServiceNameApiWithBasePath(basePath string) *CamelCaseServiceNameApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &CamelCaseServiceNameApi{ + Configuration: configuration, + } +} + +/** + * + * + * @return *ProtobufEmpty + */ +func (a CamelCaseServiceNameApi) Empty() (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/empty" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Empty", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + diff --git a/examples/clients/abe/echo_rpc_api.go b/examples/clients/abe/echo_rpc_api.go new file mode 100644 index 00000000000..8afbbdd437f --- /dev/null +++ b/examples/clients/abe/echo_rpc_api.go @@ -0,0 +1,265 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0 + * Contact: none@example.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "net/url" + "strings" + "encoding/json" + "fmt" +) + +type EchoRpcApi struct { + Configuration *Configuration +} + +func NewEchoRpcApi() *EchoRpcApi { + configuration := NewConfiguration() + return &EchoRpcApi{ + Configuration: configuration, + } +} + +func NewEchoRpcApiWithBasePath(basePath string) *EchoRpcApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &EchoRpcApi{ + Configuration: configuration, + } +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param value + * @return *SubStringMessage + */ +func (a EchoRpcApi) Echo(value string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" + localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param body + * @return *SubStringMessage + */ +func (a EchoRpcApi) Echo2(body string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param value + * @return *SubStringMessage + */ +func (a EchoRpcApi) Echo3(value string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo3", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + diff --git a/examples/clients/abe/echo_service_api.go b/examples/clients/abe/echo_service_api.go new file mode 100644 index 00000000000..568177715d2 --- /dev/null +++ b/examples/clients/abe/echo_service_api.go @@ -0,0 +1,265 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0 + * Contact: none@example.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "net/url" + "strings" + "encoding/json" + "fmt" +) + +type EchoServiceApi struct { + Configuration *Configuration +} + +func NewEchoServiceApi() *EchoServiceApi { + configuration := NewConfiguration() + return &EchoServiceApi{ + Configuration: configuration, + } +} + +func NewEchoServiceApiWithBasePath(basePath string) *EchoServiceApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &EchoServiceApi{ + Configuration: configuration, + } +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param value + * @return *SubStringMessage + */ +func (a EchoServiceApi) Echo(value string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" + localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param body + * @return *SubStringMessage + */ +func (a EchoServiceApi) Echo2(body string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param value + * @return *SubStringMessage + */ +func (a EchoServiceApi) Echo3(value string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo3", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index a5b333230ff..cf4cd5b6ba5 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -15,7 +15,7 @@ import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp" import _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" import ( - context "golang.org/x/net/context" + context "context" grpc "google.golang.org/grpc" ) diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 8a600f8dcd3..3256eaa7646 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -36,7 +36,7 @@ import math "math" import _ "google.golang.org/genproto/googleapis/api/annotations" import ( - context "golang.org/x/net/context" + context "context" grpc "google.golang.org/grpc" ) diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index 421c9a87a20..83e0c579a24 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -9,7 +9,7 @@ import math "math" import _ "google.golang.org/genproto/googleapis/api/annotations" import ( - context "golang.org/x/net/context" + context "context" grpc "google.golang.org/grpc" ) diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index 71066ccd964..45137a28337 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -11,7 +11,7 @@ import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" import ( - context "golang.org/x/net/context" + context "context" grpc "google.golang.org/grpc" ) diff --git a/examples/examplepb/wrappers.pb.go b/examples/examplepb/wrappers.pb.go index 62268e17c2e..0bcb97805fa 100644 --- a/examples/examplepb/wrappers.pb.go +++ b/examples/examplepb/wrappers.pb.go @@ -10,7 +10,7 @@ import _ "google.golang.org/genproto/googleapis/api/annotations" import google_protobuf5 "github.com/golang/protobuf/ptypes/wrappers" import ( - context "golang.org/x/net/context" + context "context" grpc "google.golang.org/grpc" ) diff --git a/examples/integration_test.go b/examples/integration_test.go index 7a51868a99d..405726258fc 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -14,13 +14,13 @@ import ( "testing" "time" + "context" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" gw "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" "github.com/grpc-ecosystem/grpc-gateway/runtime" - "golang.org/x/net/context" "google.golang.org/grpc/codes" ) diff --git a/examples/main.go b/examples/main.go index f6a16a808ce..18942b3276c 100644 --- a/examples/main.go +++ b/examples/main.go @@ -6,10 +6,10 @@ import ( "path" "strings" + "context" "github.com/golang/glog" "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "github.com/grpc-ecosystem/grpc-gateway/runtime" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index e29e0fa1757..e0be51157b0 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -5,6 +5,7 @@ import ( "io" "sync" + "context" "github.com/golang/glog" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/duration" @@ -13,7 +14,6 @@ import ( sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" "github.com/rogpeppe/fastuuid" - "golang.org/x/net/context" "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/examples/server/echo.go b/examples/server/echo.go index e87db2d510b..e9658d418ed 100644 --- a/examples/server/echo.go +++ b/examples/server/echo.go @@ -1,9 +1,9 @@ package server import ( + "context" "github.com/golang/glog" examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/metadata" ) diff --git a/examples/server/flow_combination.go b/examples/server/flow_combination.go index f1a90fa2b85..cb054d3e43a 100644 --- a/examples/server/flow_combination.go +++ b/examples/server/flow_combination.go @@ -3,8 +3,8 @@ package server import ( "io" + "context" examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" - "golang.org/x/net/context" ) type flowCombinationServer struct{} diff --git a/runtime/context.go b/runtime/context.go index 6e0eb27e285..c492b9732c9 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "golang.org/x/net/context" + "context" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" diff --git a/runtime/context_test.go b/runtime/context_test.go index 955d6f13578..847fc6c747d 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" + "context" "github.com/grpc-ecosystem/grpc-gateway/runtime" - "golang.org/x/net/context" "google.golang.org/grpc/metadata" ) diff --git a/runtime/errors.go b/runtime/errors.go index 0276585a317..d82dc7f8d90 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -4,10 +4,10 @@ import ( "io" "net/http" + "context" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/any" - "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" diff --git a/runtime/errors_test.go b/runtime/errors_test.go index ee5dfb3c037..2c7ecf18656 100644 --- a/runtime/errors_test.go +++ b/runtime/errors_test.go @@ -8,8 +8,8 @@ import ( "strings" "testing" + "context" "github.com/grpc-ecosystem/grpc-gateway/runtime" - "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/runtime/handler.go b/runtime/handler.go index 50e9c88ca2e..1b3c65035a4 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -6,10 +6,10 @@ import ( "net/http" "net/textproto" + "context" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/any" "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" - "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" diff --git a/runtime/handler_test.go b/runtime/handler_test.go index 59838f2b04f..aeb1fdb6d47 100644 --- a/runtime/handler_test.go +++ b/runtime/handler_test.go @@ -7,11 +7,11 @@ import ( "net/http/httptest" "testing" + "context" "github.com/golang/protobuf/proto" pb "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/runtime/mux.go b/runtime/mux.go index 205bc430921..4ead83fc256 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -6,8 +6,8 @@ import ( "net/textproto" "strings" + "context" "github.com/golang/protobuf/proto" - "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" diff --git a/runtime/proto_errors.go b/runtime/proto_errors.go index b1b089273b6..059928c2847 100644 --- a/runtime/proto_errors.go +++ b/runtime/proto_errors.go @@ -4,7 +4,7 @@ import ( "io" "net/http" - "golang.org/x/net/context" + "context" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" From f99efc019c6c32156080e9fd7ec08cba286b80c5 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sat, 14 Apr 2018 11:58:29 -0600 Subject: [PATCH 203/552] Add basic docs section --- docs/background.md | 7 ++ docs/examples.md | 12 +++ docs/features.md | 25 ++++++ docs/index.md | 27 +++++++ docs/usage.md | 187 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 258 insertions(+) create mode 100644 docs/background.md create mode 100644 docs/examples.md create mode 100644 docs/features.md create mode 100644 docs/index.md create mode 100644 docs/usage.md diff --git a/docs/background.md b/docs/background.md new file mode 100644 index 00000000000..816e465755a --- /dev/null +++ b/docs/background.md @@ -0,0 +1,7 @@ +# Background + +gRPC is great -- it generates API clients and server stubs in many programming languages, it is fast, easy-to-use, bandwidth-efficient and its design is combat-proven by Google. +However, you might still want to provide a traditional RESTful API as well. Reasons can range from maintaining backwards-compatibility, supporting languages or clients not well supported by gRPC to simply maintaining the aesthetics and tooling involved with a RESTful architecture. + +This project aims to provide that HTTP+JSON interface to your gRPC service. A small amount of configuration in your service to attach HTTP semantics is all that's needed to generate a reverse-proxy with this library. + diff --git a/docs/examples.md b/docs/examples.md new file mode 100644 index 00000000000..4d2bb15de10 --- /dev/null +++ b/docs/examples.md @@ -0,0 +1,12 @@ +# Examples + +Examples are available under `examples` directory. +* `examplepb/echo_service.proto`, `examplepb/a_bit_of_everything.proto`: service definition + * `examplepb/echo_service.pb.go`, `examplepb/a_bit_of_everything.pb.go`: [generated] stub of the service + * `examplepb/echo_service.pb.gw.go`, `examplepb/a_bit_of_everything.pb.gw.go`: [generated] reverse proxy for the service +* `server/main.go`: service implementation +* `main.go`: entrypoint of the generated reverse proxy + +To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRPC-gateway, and a gRPC server, see [this code example by CoreOS](https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go) (and its accompanying [blog post](https://coreos.com/blog/gRPC-protobufs-swagger.html)) + + diff --git a/docs/features.md b/docs/features.md new file mode 100644 index 00000000000..1319512ff14 --- /dev/null +++ b/docs/features.md @@ -0,0 +1,25 @@ +# Features + +## Supported +* Generating JSON API handlers +* Method parameters in request body +* Method parameters in request path +* Method parameters in query string +* Enum fields in path parameter (including repeated enum fields). +* Mapping streaming APIs to newline-delimited JSON streams +* Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata (prefixed with `grpcgateway-`) +* Optionally emitting API definition for [Swagger](http://swagger.io). +* Setting [gRPC timeouts](http://www.grpc.io/docs/guides/wire.html) through inbound HTTP `Grpc-Timeout` header. + +## Want to support +But not yet. +* Optionally generating the entrypoint. #8 +* `import_path` parameter + +## No plan to support +But patch is welcome. +* Method parameters in HTTP headers +* Handling trailer metadata +* Encoding request/response body in XML +* True bi-directional streaming. (Probably impossible?) + diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000000..a828adcdbcf --- /dev/null +++ b/docs/index.md @@ -0,0 +1,27 @@ +# grpc-gateway + +[![Build Status](https://travis-ci.org/grpc-ecosystem/grpc-gateway.svg?branch=master)](https://travis-ci.org/grpc-ecosystem/grpc-gateway) + +grpc-gateway is a plugin of [protoc](http://github.com/google/protobuf). +It reads [gRPC](http://github.com/grpc/grpc-common) service definition, +and generates a reverse-proxy server which translates a RESTful JSON API into gRPC. +This server is generated according to [custom options](https://cloud.google.com/service-management/reference/rpc/google.api#http) in your gRPC definition. + +It helps you to provide your APIs in both gRPC and RESTful style at the same time. + +![architecture introduction diagram](https://docs.google.com/drawings/d/12hp4CPqrNPFhattL_cIoJptFvlAqm5wLQ0ggqI5mkCg/pub?w=749&h=370) + +To learn more about us check out our documentation on: + +* [Our background](background.md) +* [Installation and usage](usage.md) +* [Examples](examples.md) +* [Features](features.md) + + +# Contribution +See [CONTRIBUTING.md](http://github.com/grpc-ecosystem/grpc-gateway/blob/master/CONTRIBUTING.md). + +# License +grpc-gateway is licensed under the BSD 3-Clause License. +See [LICENSE.txt](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt) for more details. diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 00000000000..6c98a234582 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,187 @@ +# How do I use this? + +## Installation +First you need to install ProtocolBuffers 3.0.0-beta-3 or later. + +```sh +mkdir tmp +cd tmp +git clone https://github.com/google/protobuf +cd protobuf +./autogen.sh +./configure +make +make check +sudo make install +``` + +Then, `go get -u` as usual the following packages: + +```sh +go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway +go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +go get -u github.com/golang/protobuf/protoc-gen-go +``` + +## Usage +Make sure that your `$GOPATH/bin` is in your `$PATH`. + +1. Define your service in gRPC + + your_service.proto: + ```protobuf + syntax = "proto3"; + package example; + message StringMessage { + string value = 1; + } + + service YourService { + rpc Echo(StringMessage) returns (StringMessage) {} + } + ``` +2. Add a [custom option](https://cloud.google.com/service-management/reference/rpc/google.api#http) to the .proto file + + your_service.proto: + ```diff + syntax = "proto3"; + package example; + + + +import "google/api/annotations.proto"; + + + message StringMessage { + string value = 1; + } + + service YourService { + - rpc Echo(StringMessage) returns (StringMessage) {} + + rpc Echo(StringMessage) returns (StringMessage) { + + option (google.api.http) = { + + post: "/v1/example/echo" + + body: "*" + + }; + + } + } + ``` +3. Generate gRPC stub + + ```sh + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --go_out=plugins=grpc:. \ + path/to/your_service.proto + ``` + + It will generate a stub file `path/to/your_service.pb.go`. +4. Implement your service in gRPC as usual + 1. (Optional) Generate gRPC stub in the language you want. + + e.g. + ```sh + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --ruby_out=. \ + path/to/your/service_proto + + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --plugin=protoc-gen-grpc=grpc_ruby_plugin \ + --grpc-ruby_out=. \ + path/to/your/service.proto + ``` + 2. Add the googleapis-common-protos gem (or your language equivalent) as a dependency to your project. + 3. Implement your service + +5. Generate reverse-proxy + + ```sh + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --grpc-gateway_out=logtostderr=true:. \ + path/to/your_service.proto + ``` + + It will generate a reverse proxy `path/to/your_service.pb.gw.go`. + + Note: After generating the code for each of the stubs, in order to build the code, you will want to run ```go get .``` from the directory containing the stubs. + +6. Write an entrypoint + + Now you need to write an entrypoint of the proxy server. + ```go + package main + + import ( + "flag" + "net/http" + + "github.com/golang/glog" + "golang.org/x/net/context" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "google.golang.org/grpc" + + gw "path/to/your_service_package" + ) + + var ( + echoEndpoint = flag.String("echo_endpoint", "localhost:9090", "endpoint of YourService") + ) + + func run() error { + ctx := context.Background() + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + mux := runtime.NewServeMux() + opts := []grpc.DialOption{grpc.WithInsecure()} + err := gw.RegisterYourServiceHandlerFromEndpoint(ctx, mux, *echoEndpoint, opts) + if err != nil { + return err + } + + return http.ListenAndServe(":8080", mux) + } + + func main() { + flag.Parse() + defer glog.Flush() + + if err := run(); err != nil { + glog.Fatal(err) + } + } + ``` + +7. (Optional) Generate swagger definitions + + ```sh + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --swagger_out=logtostderr=true:. \ + path/to/your_service.proto + ``` + +## Parameters and flags +`protoc-gen-grpc-gateway` supports custom mapping from Protobuf `import` to Golang import path. +They are compatible to [the parameters with same names in `protoc-gen-go`](https://github.com/golang/protobuf#parameters). + +In addition we also support the `request_context` parameter in order to use the `http.Request`'s Context (only for Go 1.7 and above). +This parameter can be useful to pass request scoped context between the gateway and the gRPC service. + +`protoc-gen-grpc-gateway` also supports some more command line flags to control logging. You can give these flags together with parameters above. Run `protoc-gen-grpc-gateway --help` for more details about the flags. + +# Mapping gRPC to HTTP + +* [How gRPC error codes map to HTTP status codes in the response](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15) +* HTTP request source IP is added as `X-Forwarded-For` gRPC request header +* HTTP request host is added as `X-Forwarded-Host` gRPC request header +* HTTP `Authorization` header is added as `authorization` gRPC request header +* Remaining Permanent HTTP header keys (as specified by the IANA [here](http://www.iana.org/assignments/message-headers/message-headers.xhtml) are prefixed with `grpcgateway-` and added with their values to gRPC request header +* HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata (prefixed with `grpcgateway-`) +* While configurable, the default {un,}marshaling uses [jsonpb](https://godoc.org/github.com/golang/protobuf/jsonpb) with `OrigName: true`. + From ff8f51129e75d9e42aadd3e392587ac45523c4af Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sat, 14 Apr 2018 12:10:54 -0600 Subject: [PATCH 204/552] Set theme jekyll-theme-architect --- docs/_config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/_config.yml diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 00000000000..3397c9a4928 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-architect \ No newline at end of file From 28c70665e669826b4031bceaf4bbb2abf18b0320 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sat, 14 Apr 2018 12:34:22 -0600 Subject: [PATCH 205/552] Add a sidebar nav to the docs --- README.md | 2 + docs/_config.yml | 4 +- docs/{ => _docs}/background.md | 4 ++ docs/{ => _docs}/examples.md | 4 ++ docs/{ => _docs}/features.md | 4 ++ docs/{ => _docs}/usage.md | 4 ++ docs/_layouts/default.html | 88 ++++++++++++++++++++++++++++++++++ docs/index.md | 8 ++-- 8 files changed, 113 insertions(+), 5 deletions(-) rename docs/{ => _docs}/background.md (95%) rename docs/{ => _docs}/examples.md (96%) rename docs/{ => _docs}/features.md (96%) rename docs/{ => _docs}/usage.md (99%) create mode 100644 docs/_layouts/default.html diff --git a/README.md b/README.md index 5d86a5addc5..4f489132c5d 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ It helps you to provide your APIs in both gRPC and RESTful style at the same tim ![architecture introduction diagram](https://docs.google.com/drawings/d/12hp4CPqrNPFhattL_cIoJptFvlAqm5wLQ0ggqI5mkCg/pub?w=749&h=370) +## Check out our [documentation](https://grpc-ecosystem.github.io/grpc-gateway/)! + ## Background gRPC is great -- it generates API clients and server stubs in many programming languages, it is fast, easy-to-use, bandwidth-efficient and its design is combat-proven by Google. However, you might still want to provide a traditional RESTful API as well. Reasons can range from maintaining backwards-compatibility, supporting languages or clients not well supported by gRPC to simply maintaining the aesthetics and tooling involved with a RESTful architecture. diff --git a/docs/_config.yml b/docs/_config.yml index 3397c9a4928..e1eaa2950a2 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1 +1,3 @@ -theme: jekyll-theme-architect \ No newline at end of file +theme: jekyll-theme-architect +collections: +- docs diff --git a/docs/background.md b/docs/_docs/background.md similarity index 95% rename from docs/background.md rename to docs/_docs/background.md index 816e465755a..ba2a7c4d1ce 100644 --- a/docs/background.md +++ b/docs/_docs/background.md @@ -1,3 +1,7 @@ +-- +category: documentation +-- + # Background gRPC is great -- it generates API clients and server stubs in many programming languages, it is fast, easy-to-use, bandwidth-efficient and its design is combat-proven by Google. diff --git a/docs/examples.md b/docs/_docs/examples.md similarity index 96% rename from docs/examples.md rename to docs/_docs/examples.md index 4d2bb15de10..29d166b5899 100644 --- a/docs/examples.md +++ b/docs/_docs/examples.md @@ -1,3 +1,7 @@ +-- +category: documentation +-- + # Examples Examples are available under `examples` directory. diff --git a/docs/features.md b/docs/_docs/features.md similarity index 96% rename from docs/features.md rename to docs/_docs/features.md index 1319512ff14..805239ad74c 100644 --- a/docs/features.md +++ b/docs/_docs/features.md @@ -1,3 +1,7 @@ +-- +category: documentation +-- + # Features ## Supported diff --git a/docs/usage.md b/docs/_docs/usage.md similarity index 99% rename from docs/usage.md rename to docs/_docs/usage.md index 6c98a234582..dd4c1951b72 100644 --- a/docs/usage.md +++ b/docs/_docs/usage.md @@ -1,3 +1,7 @@ +-- +category: documentation +-- + # How do I use this? ## Installation diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html new file mode 100644 index 00000000000..017022c834b --- /dev/null +++ b/docs/_layouts/default.html @@ -0,0 +1,88 @@ + + + + + + + + + + + +{% seo %} + + + +
+
+ +

{{ site.title | default: site.github.repository_name }}

+
+

{{ site.description | default: site.github.project_tagline }}

+ {% if site.github.is_project_page %} + View project on GitHub + {% endif %} + {% if site.github.is_user_page %} + Follow me on GitHub + {% endif %} +
+
+ +
+
+
+ {{ content }} +
+ + +
+
+ + {% if site.google_analytics %} + + {% endif %} + + diff --git a/docs/index.md b/docs/index.md index a828adcdbcf..47b6ec026fc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,10 +13,10 @@ It helps you to provide your APIs in both gRPC and RESTful style at the same tim To learn more about us check out our documentation on: -* [Our background](background.md) -* [Installation and usage](usage.md) -* [Examples](examples.md) -* [Features](features.md) +* [Our background](_docs/background.md) +* [Installation and usage](_docs/usage.md) +* [Examples](_docs/examples.md) +* [Features](_docs/features.md) # Contribution From 66896a82e2fff98ae0402a0baf0965cf356edf54 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sat, 14 Apr 2018 12:51:12 -0600 Subject: [PATCH 206/552] Output the docs collection --- docs/_config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/_config.yml b/docs/_config.yml index e1eaa2950a2..a8b63ca7f28 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,3 +1,4 @@ theme: jekyll-theme-architect collections: -- docs + docs: + output: true From a53e15e872225959fe8fdf06a58dc6ba5cdf2cf7 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sat, 14 Apr 2018 12:51:12 -0600 Subject: [PATCH 207/552] Output the docs collection --- docs/_config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/_config.yml b/docs/_config.yml index a8b63ca7f28..87b7821bd1c 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,4 +1,3 @@ -theme: jekyll-theme-architect collections: docs: output: true From bdfb07fc3ed6070c32070f7b80bb8abab5f3b8a4 Mon Sep 17 00:00:00 2001 From: Thulio Ferraz Assis Date: Sun, 15 Apr 2018 10:37:42 -0700 Subject: [PATCH 208/552] Pulled out parseReq func into a generic package + tests (#600) --- codegenerator/doc.go | 4 ++ codegenerator/parse_req.go | 23 +++++++++++ codegenerator/parse_req_test.go | 69 +++++++++++++++++++++++++++++++++ protoc-gen-grpc-gateway/main.go | 24 ++---------- protoc-gen-swagger/main.go | 23 ++--------- 5 files changed, 104 insertions(+), 39 deletions(-) create mode 100644 codegenerator/doc.go create mode 100644 codegenerator/parse_req.go create mode 100644 codegenerator/parse_req_test.go diff --git a/codegenerator/doc.go b/codegenerator/doc.go new file mode 100644 index 00000000000..3645317175b --- /dev/null +++ b/codegenerator/doc.go @@ -0,0 +1,4 @@ +/* +Package codegenerator contains reusable functions used by the code generators. +*/ +package codegenerator diff --git a/codegenerator/parse_req.go b/codegenerator/parse_req.go new file mode 100644 index 00000000000..e74575bddcd --- /dev/null +++ b/codegenerator/parse_req.go @@ -0,0 +1,23 @@ +package codegenerator + +import ( + "fmt" + "io" + "io/ioutil" + + "github.com/golang/protobuf/proto" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" +) + +// ParseRequest parses a code generator request from a proto Message. +func ParseRequest(r io.Reader) (*plugin.CodeGeneratorRequest, error) { + input, err := ioutil.ReadAll(r) + if err != nil { + return nil, fmt.Errorf("failed to read code generator request: %v", err) + } + req := new(plugin.CodeGeneratorRequest) + if err = proto.Unmarshal(input, req); err != nil { + return nil, fmt.Errorf("failed to unmarshal code generator request: %v", err) + } + return req, nil +} diff --git a/codegenerator/parse_req_test.go b/codegenerator/parse_req_test.go new file mode 100644 index 00000000000..5f37aad9589 --- /dev/null +++ b/codegenerator/parse_req_test.go @@ -0,0 +1,69 @@ +package codegenerator_test + +import ( + "bytes" + "fmt" + "io" + "reflect" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/codegenerator" +) + +var parseReqTests = []struct { + name string + in io.Reader + out *plugin.CodeGeneratorRequest + err error +}{ + { + "Empty input should produce empty output", + mustGetReader(&plugin.CodeGeneratorRequest{}), + &plugin.CodeGeneratorRequest{}, + nil, + }, + { + "Invalid reader should produce error", + &invalidReader{}, + nil, + fmt.Errorf("failed to read code generator request: invalid reader"), + }, + { + "Invalid proto message should produce error", + strings.NewReader("{}"), + nil, + fmt.Errorf("failed to unmarshal code generator request: unexpected EOF"), + }, +} + +func TestParseRequest(t *testing.T) { + for _, tt := range parseReqTests { + t.Run(tt.name, func(t *testing.T) { + out, err := codegenerator.ParseRequest(tt.in) + if !reflect.DeepEqual(err, tt.err) { + t.Errorf("got %v, want %v", err, tt.err) + } + if err == nil && !reflect.DeepEqual(*out, *tt.out) { + t.Errorf("got %v, want %v", *out, *tt.out) + } + }) + } +} + +func mustGetReader(pb proto.Message) io.Reader { + b, err := proto.Marshal(pb) + if err != nil { + panic(err) + } + return bytes.NewBuffer(b) +} + +type invalidReader struct { +} + +func (*invalidReader) Read(p []byte) (int, error) { + return 0, fmt.Errorf("invalid reader") +} diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 4b875d51b36..d4569d2079b 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -10,14 +10,13 @@ package main import ( "flag" - "io" - "io/ioutil" "os" "strings" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/codegenerator" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway" ) @@ -29,33 +28,18 @@ var ( allowDeleteBody = flag.Bool("allow_delete_body", false, "unless set, HTTP DELETE methods may not have a body") ) -func parseReq(r io.Reader) (*plugin.CodeGeneratorRequest, error) { - glog.V(1).Info("Parsing code generator request") - input, err := ioutil.ReadAll(r) - if err != nil { - glog.Errorf("Failed to read code generator request: %v", err) - return nil, err - } - req := new(plugin.CodeGeneratorRequest) - if err = proto.Unmarshal(input, req); err != nil { - glog.Errorf("Failed to unmarshal code generator request: %v", err) - return nil, err - } - glog.V(1).Info("Parsed code generator request") - return req, nil -} - func main() { flag.Parse() defer glog.Flush() reg := descriptor.NewRegistry() - glog.V(1).Info("Processing code generator request") - req, err := parseReq(os.Stdin) + glog.V(1).Info("Parsing code generator request") + req, err := codegenerator.ParseRequest(os.Stdin) if err != nil { glog.Fatal(err) } + glog.V(1).Info("Parsed code generator request") if req.Parameter != nil { for _, p := range strings.Split(req.GetParameter(), ",") { spec := strings.SplitN(p, "=", 2) diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index ebbaecbd36f..3d7f1ab7580 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -3,14 +3,13 @@ package main import ( "flag" "fmt" - "io" - "io/ioutil" "os" "strings" "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/codegenerator" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger" ) @@ -21,22 +20,6 @@ var ( allowDeleteBody = flag.Bool("allow_delete_body", false, "unless set, HTTP DELETE methods may not have a body") ) -func parseReq(r io.Reader) (*plugin.CodeGeneratorRequest, error) { - glog.V(1).Info("Parsing code generator request") - input, err := ioutil.ReadAll(r) - if err != nil { - glog.Errorf("Failed to read code generator request: %v", err) - return nil, err - } - req := new(plugin.CodeGeneratorRequest) - if err = proto.Unmarshal(input, req); err != nil { - glog.Errorf("Failed to unmarshal code generator request: %v", err) - return nil, err - } - glog.V(1).Info("Parsed code generator request") - return req, nil -} - func main() { flag.Parse() defer glog.Flush() @@ -52,10 +35,12 @@ func main() { glog.Fatal(err) } } - req, err := parseReq(f) + glog.V(1).Info("Parsing code generator request") + req, err := codegenerator.ParseRequest(f) if err != nil { glog.Fatal(err) } + glog.V(1).Info("Parsed code generator request") pkgMap := make(map[string]string) if req.Parameter != nil { err := parseReqParam(req.GetParameter(), flag.CommandLine, pkgMap) From ec7cd6ef31c30e37bc26cc3aba31596ac6644d21 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Sun, 15 Apr 2018 10:51:45 -0700 Subject: [PATCH 209/552] Support multiple metadata annotators (#586) --- runtime/context.go | 4 ++-- runtime/context_test.go | 20 ++++++++++++++++++++ runtime/mux.go | 4 ++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/runtime/context.go b/runtime/context.go index c492b9732c9..a745074c961 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -91,8 +91,8 @@ func AnnotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (con return ctx, nil } md := metadata.Pairs(pairs...) - if mux.metadataAnnotator != nil { - md = metadata.Join(md, mux.metadataAnnotator(ctx, req)) + for _, mda := range mux.metadataAnnotators { + md = metadata.Join(md, mda(ctx, req)) } return metadata.NewOutgoingContext(ctx, md), nil } diff --git a/runtime/context_test.go b/runtime/context_test.go index 847fc6c747d..e78a037d033 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -170,3 +170,23 @@ func TestAnnotateContext_SupportsTimeouts(t *testing.T) { } } } +func TestAnnotateContext_SupportsCustomAnnotators(t *testing.T) { + md1 := func(context.Context, *http.Request) metadata.MD { return metadata.New(map[string]string{"foo": "bar"}) } + md2 := func(context.Context, *http.Request) metadata.MD { return metadata.New(map[string]string{"baz": "qux"}) } + expected := metadata.New(map[string]string{"foo": "bar", "baz": "qux"}) + request, err := http.NewRequest("GET", "http://example.com", nil) + if err != nil { + t.Fatalf(`http.NewRequest("GET", "http://example.com", nil failed with %v; want success`, err) + } + annotated, err := runtime.AnnotateContext(context.Background(), runtime.NewServeMux(runtime.WithMetadata(md1), runtime.WithMetadata(md2)), request) + if err != nil { + t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) + return + } + actual, _ := metadata.FromOutgoingContext(annotated) + for key, e := range expected { + if a, ok := actual[key]; !ok || !reflect.DeepEqual(e, a) { + t.Errorf("metadata.MD[%s] = %v; want %v", key, a, e) + } + } +} diff --git a/runtime/mux.go b/runtime/mux.go index 4ead83fc256..1d4c75760fe 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -25,7 +25,7 @@ type ServeMux struct { marshalers marshalerRegistry incomingHeaderMatcher HeaderMatcherFunc outgoingHeaderMatcher HeaderMatcherFunc - metadataAnnotator func(context.Context, *http.Request) metadata.MD + metadataAnnotators []func(context.Context, *http.Request) metadata.MD protoErrorHandler ProtoErrorHandlerFunc } @@ -87,7 +87,7 @@ func WithOutgoingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption { // is reading token from cookie and adding it in gRPC context. func WithMetadata(annotator func(context.Context, *http.Request) metadata.MD) ServeMuxOption { return func(serveMux *ServeMux) { - serveMux.metadataAnnotator = annotator + serveMux.metadataAnnotators = append(serveMux.metadataAnnotators, annotator) } } From 6b0e10f3dfab62a27c512c7f73855e21ec313588 Mon Sep 17 00:00:00 2001 From: Cyrille Hemidy Date: Mon, 16 Apr 2018 05:22:28 +0200 Subject: [PATCH 210/552] Fix some typos (#601) --- runtime/marshal_jsonpb.go | 2 +- runtime/marshaler_registry.go | 2 +- utilities/pattern.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index d42cc593e51..0a0d130bba6 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -50,7 +50,7 @@ func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error { } // marshalNonProto marshals a non-message field of a protobuf message. -// This function does not correctly marshals arbitary data structure into JSON, +// This function does not correctly marshals arbitrary data structure into JSON, // but it is only capable of marshaling non-message field values of protobuf, // i.e. primitive types, enums; pointers to primitives or enums; maps from // integer/string types to primitives/enums/pointers to messages. diff --git a/runtime/marshaler_registry.go b/runtime/marshaler_registry.go index 928f0733214..5cc53ae4f68 100644 --- a/runtime/marshaler_registry.go +++ b/runtime/marshaler_registry.go @@ -68,7 +68,7 @@ func (m marshalerRegistry) add(mime string, marshaler Marshaler) error { // It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces. // // For example, you could allow the client to specify the use of the runtime.JSONPb marshaler -// with a "applicaton/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler +// with a "application/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler // with a "application/json" Content-Type. // "*" can be used to match any Content-Type. // This can be attached to a ServerMux with the marshaler option. diff --git a/utilities/pattern.go b/utilities/pattern.go index 28ad9461f86..dfe7de4864a 100644 --- a/utilities/pattern.go +++ b/utilities/pattern.go @@ -17,6 +17,6 @@ const ( OpConcatN // OpCapture pops an item and binds it to the variable OpCapture - // OpEnd is the least postive invalid opcode. + // OpEnd is the least positive invalid opcode. OpEnd ) From 485afe2420c2f0b2b927dad850a55cec162c8cc3 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Sat, 17 Jun 2017 12:49:44 +0900 Subject: [PATCH 211/552] fix a typo in a method name resolveFiledPath -> resolveFieldPath --- protoc-gen-grpc-gateway/descriptor/services.go | 6 +++--- protoc-gen-grpc-gateway/descriptor/services_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index e054925efec..3f324d294a9 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -183,7 +183,7 @@ func extractAPIOptions(meth *descriptor.MethodDescriptorProto) (*options.HttpRul func (r *Registry) newParam(meth *Method, path string) (Parameter, error) { msg := meth.RequestType - fields, err := r.resolveFiledPath(msg, path) + fields, err := r.resolveFieldPath(msg, path) if err != nil { return Parameter{}, err } @@ -216,7 +216,7 @@ func (r *Registry) newBody(meth *Method, path string) (*Body, error) { case "*": return &Body{FieldPath: nil}, nil } - fields, err := r.resolveFiledPath(msg, path) + fields, err := r.resolveFieldPath(msg, path) if err != nil { return nil, err } @@ -235,7 +235,7 @@ func lookupField(msg *Message, name string) *Field { } // resolveFieldPath resolves "path" into a list of fieldDescriptor, starting from "msg". -func (r *Registry) resolveFiledPath(msg *Message, path string) ([]FieldPathComponent, error) { +func (r *Registry) resolveFieldPath(msg *Message, path string) ([]FieldPathComponent, error) { if path == "" { return nil, nil } diff --git a/protoc-gen-grpc-gateway/descriptor/services_test.go b/protoc-gen-grpc-gateway/descriptor/services_test.go index eda34d4141e..93a8f67ce05 100644 --- a/protoc-gen-grpc-gateway/descriptor/services_test.go +++ b/protoc-gen-grpc-gateway/descriptor/services_test.go @@ -1097,7 +1097,7 @@ func TestResolveFieldPath(t *testing.T) { if err != nil { t.Fatalf("reg.LookupFile(%q) failed with %v; want success; on file=%s", file.GetName(), err, spec.src) } - _, err = reg.resolveFiledPath(f.Messages[0], spec.path) + _, err = reg.resolveFieldPath(f.Messages[0], spec.path) if got, want := err != nil, spec.wantErr; got != want { if want { t.Errorf("reg.resolveFiledPath(%q, %q) succeeded; want an error", f.Messages[0].GetName(), spec.path) From a12076879f9d83a89dacdf25dfb024351ae95905 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Sat, 17 Jun 2017 12:57:51 +0900 Subject: [PATCH 212/552] Rename confusing method names LHS and RHS I confused left and right in f709571e38c297cd1ad86b16984688fbcb236489 somehow or other. --- protoc-gen-grpc-gateway/descriptor/types.go | 22 +++++++-------- .../descriptor/types_test.go | 28 +++++++++---------- .../gengateway/template.go | 4 +-- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index 88dff7bb902..bfdb2dc81d9 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -216,10 +216,10 @@ type Body struct { FieldPath FieldPath } -// RHS returns a right-hand-side expression in go to be used to initialize method request object. +// AssignableExpr returns an assignable expression in Go to be used to initialize method request object. // It starts with "msgExpr", which is the go expression of the method request object. -func (b Body) RHS(msgExpr string) string { - return b.FieldPath.RHS(msgExpr) +func (b Body) AssignableExpr(msgExpr string) string { + return b.FieldPath.AssignableExpr(msgExpr) } // FieldPath is a path to a field from a request message. @@ -242,9 +242,9 @@ func (p FieldPath) IsNestedProto3() bool { return false } -// RHS is a right-hand-side expression in go to be used to assign a value to the target field. +// AssignableExpr is an assignable expression in Go to be used to assign a value to the target field. // It starts with "msgExpr", which is the go expression of the method request object. -func (p FieldPath) RHS(msgExpr string) string { +func (p FieldPath) AssignableExpr(msgExpr string) string { l := len(p) if l == 0 { return msgExpr @@ -252,10 +252,10 @@ func (p FieldPath) RHS(msgExpr string) string { components := []string{msgExpr} for i, c := range p { if i == l-1 { - components = append(components, c.RHS()) + components = append(components, c.AssignableExpr()) continue } - components = append(components, c.LHS()) + components = append(components, c.ValueExpr()) } return strings.Join(components, ".") } @@ -269,13 +269,13 @@ type FieldPathComponent struct { Target *Field } -// RHS returns a right-hand-side expression in go for this field. -func (c FieldPathComponent) RHS() string { +// AssignableExpr returns an assignable expression in go for this field. +func (c FieldPathComponent) AssignableExpr() string { return gogen.CamelCase(c.Name) } -// LHS returns a left-hand-side expression in go for this field. -func (c FieldPathComponent) LHS() string { +// ValueExpr returns an expression in go for this field. +func (c FieldPathComponent) ValueExpr() string { if c.Target.Message.File.proto2() { return fmt.Sprintf("Get%s()", gogen.CamelCase(c.Name)) } diff --git a/protoc-gen-grpc-gateway/descriptor/types_test.go b/protoc-gen-grpc-gateway/descriptor/types_test.go index ef2162a61fb..1dcdb341ef6 100644 --- a/protoc-gen-grpc-gateway/descriptor/types_test.go +++ b/protoc-gen-grpc-gateway/descriptor/types_test.go @@ -161,22 +161,22 @@ func TestFieldPath(t *testing.T) { Name: "nest_field", Target: nest2.Fields[0], } - if got, want := c1.LHS(), "GetNestField()"; got != want { - t.Errorf("c1.LHS() = %q; want %q", got, want) + if got, want := c1.ValueExpr(), "GetNestField()"; got != want { + t.Errorf("c1.ValueExpr() = %q; want %q", got, want) } - if got, want := c1.RHS(), "NestField"; got != want { - t.Errorf("c1.RHS() = %q; want %q", got, want) + if got, want := c1.AssignableExpr(), "NestField"; got != want { + t.Errorf("c1.AssignableExpr() = %q; want %q", got, want) } c2 := FieldPathComponent{ Name: "nest2_field", Target: nest.Fields[0], } - if got, want := c2.LHS(), "Nest2Field"; got != want { - t.Errorf("c2.LHS() = %q; want %q", got, want) + if got, want := c2.ValueExpr(), "Nest2Field"; got != want { + t.Errorf("c2.ValueExpr() = %q; want %q", got, want) } - if got, want := c2.LHS(), "Nest2Field"; got != want { - t.Errorf("c2.LHS() = %q; want %q", got, want) + if got, want := c2.ValueExpr(), "Nest2Field"; got != want { + t.Errorf("c2.ValueExpr() = %q; want %q", got, want) } fp := FieldPath{ @@ -185,8 +185,8 @@ func TestFieldPath(t *testing.T) { Target: nest.Fields[1], }, } - if got, want := fp.RHS("resp"), "resp.GetNestField().Nest2Field.GetNestField().TerminalField"; got != want { - t.Errorf("fp.RHS(%q) = %q; want %q", "resp", got, want) + if got, want := fp.AssignableExpr("resp"), "resp.GetNestField().Nest2Field.GetNestField().TerminalField"; got != want { + t.Errorf("fp.AssignableExpr(%q) = %q; want %q", "resp", got, want) } fp2 := FieldPath{ @@ -195,12 +195,12 @@ func TestFieldPath(t *testing.T) { Target: nest2.Fields[1], }, } - if got, want := fp2.RHS("resp"), "resp.Nest2Field.GetNestField().Nest2Field.TerminalField"; got != want { - t.Errorf("fp2.RHS(%q) = %q; want %q", "resp", got, want) + if got, want := fp2.AssignableExpr("resp"), "resp.Nest2Field.GetNestField().Nest2Field.TerminalField"; got != want { + t.Errorf("fp2.AssignableExpr(%q) = %q; want %q", "resp", got, want) } var fpEmpty FieldPath - if got, want := fpEmpty.RHS("resp"), "resp"; got != want { - t.Errorf("fpEmpty.RHS(%q) = %q; want %q", "resp", got, want) + if got, want := fpEmpty.AssignableExpr("resp"), "resp"; got != want { + t.Errorf("fpEmpty.AssignableExpr(%q) = %q; want %q", "resp", got, want) } } diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index ef52049a625..b862e00fc3d 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -208,7 +208,7 @@ var ( var metadata runtime.ServerMetadata {{if .Body}} if req.ContentLength > 0 { - if err := marshaler.NewDecoder(req.Body).Decode(&{{.Body.RHS "protoReq"}}); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&{{.Body.AssignableExpr "protoReq"}}); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } } @@ -228,7 +228,7 @@ var ( {{if $param.IsNestedProto3 }} err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) {{else}} - {{$param.RHS "protoReq"}}, err = {{$param.ConvertFuncExpr}}(val) + {{$param.AssignableExpr "protoReq"}}, err = {{$param.ConvertFuncExpr}}(val) {{end}} if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) From 56fee8191dcb001a28fa8070de6e1e472ca23f83 Mon Sep 17 00:00:00 2001 From: Thulio Ferraz Assis Date: Mon, 16 Apr 2018 12:54:21 -0700 Subject: [PATCH 213/552] Added Bazel support (#599) Fixes: #66 --- .gitignore | 7 ++ .travis.yml | 60 ++++++++------ .travis/bazel-build.sh | 10 +++ .travis/bazel-test.sh | 12 +++ .travis/install-bazel.sh | 20 +++++ BUILD | 23 ++++++ WORKSPACE | 41 ++++++++++ codegenerator/BUILD.bazel | 26 ++++++ examples/BUILD.bazel | 45 ++++++++++ examples/clients/abe/BUILD.bazel | 26 ++++++ examples/clients/echo/BUILD.bazel | 16 ++++ examples/examplepb/BUILD.bazel | 51 ++++++++++++ examples/server/BUILD.bazel | 29 +++++++ .../server/cmd/example-server/BUILD.bazel | 18 ++++ examples/sub/BUILD.bazel | 21 +++++ examples/sub2/BUILD.bazel | 21 +++++ options/BUILD.bazel | 23 ++++++ protoc-gen-grpc-gateway/BUILD.bazel | 41 ++++++++++ .../descriptor/BUILD.bazel | 39 +++++++++ protoc-gen-grpc-gateway/generator/BUILD.bazel | 13 +++ .../gengateway/BUILD.bazel | 38 +++++++++ protoc-gen-grpc-gateway/httprule/BUILD.bazel | 32 ++++++++ protoc-gen-swagger/BUILD.bazel | 29 +++++++ protoc-gen-swagger/genswagger/BUILD.bazel | 37 +++++++++ protoc-gen-swagger/options/BUILD.bazel | 33 ++++++++ repositories.bzl | 49 +++++++++++ runtime/BUILD.bazel | 82 +++++++++++++++++++ runtime/internal/BUILD.bazel | 23 ++++++ utilities/BUILD.bazel | 20 +++++ 29 files changed, 859 insertions(+), 26 deletions(-) create mode 100755 .travis/bazel-build.sh create mode 100755 .travis/bazel-test.sh create mode 100755 .travis/install-bazel.sh create mode 100644 BUILD create mode 100644 WORKSPACE create mode 100644 codegenerator/BUILD.bazel create mode 100644 examples/BUILD.bazel create mode 100644 examples/clients/abe/BUILD.bazel create mode 100644 examples/clients/echo/BUILD.bazel create mode 100644 examples/examplepb/BUILD.bazel create mode 100644 examples/server/BUILD.bazel create mode 100644 examples/server/cmd/example-server/BUILD.bazel create mode 100644 examples/sub/BUILD.bazel create mode 100644 examples/sub2/BUILD.bazel create mode 100644 options/BUILD.bazel create mode 100644 protoc-gen-grpc-gateway/BUILD.bazel create mode 100644 protoc-gen-grpc-gateway/descriptor/BUILD.bazel create mode 100644 protoc-gen-grpc-gateway/generator/BUILD.bazel create mode 100644 protoc-gen-grpc-gateway/gengateway/BUILD.bazel create mode 100644 protoc-gen-grpc-gateway/httprule/BUILD.bazel create mode 100644 protoc-gen-swagger/BUILD.bazel create mode 100644 protoc-gen-swagger/genswagger/BUILD.bazel create mode 100644 protoc-gen-swagger/options/BUILD.bazel create mode 100644 repositories.bzl create mode 100644 runtime/BUILD.bazel create mode 100644 runtime/internal/BUILD.bazel create mode 100644 utilities/BUILD.bazel diff --git a/.gitignore b/.gitignore index eb15433281d..55e4918abeb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,9 @@ _output/ .idea + +# Bazel. +bazel-bin +bazel-genfiles +bazel-grpc-gateway +bazel-out +bazel-testlogs diff --git a/.travis.yml b/.travis.yml index 730f72a278b..2500db428d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,41 +1,49 @@ language: go sudo: false go: -- 1.9.x -- 1.10.x -- master + - 1.9.x + - 1.10.x + - master go_import_path: github.com/grpc-ecosystem/grpc-gateway cache: directories: - - $HOME/local - - ${TRAVIS_BUILD_DIR}/examples/browser/node_modules + - $HOME/local + - ${TRAVIS_BUILD_DIR}/examples/browser/node_modules + - $HOME/.cache/_grpc_gateway_bazel before_install: -- ./.travis/install-protoc.sh 3.1.0 -- ./.travis/install-swagger-codegen.sh 2.2.2 -- nvm install v6.1 && nvm use v6.1 && node --version -- go get github.com/golang/lint/golint -- go get github.com/dghubble/sling -- go get github.com/go-resty/resty + - if [ "${USE_BAZEL}" = true ]; then ./.travis/install-bazel.sh 0.12.0; fi + - if [ -z "${USE_BAZEL}" ]; then ./.travis/install-protoc.sh 3.1.0; fi + - if [ -z "${USE_BAZEL}" ]; then ./.travis/install-swagger-codegen.sh 2.2.2; fi + - if [ -z "${USE_BAZEL}" ]; then nvm install v6.1 && nvm use v6.1 && node --version; fi + - go get github.com/golang/lint/golint + - go get github.com/dghubble/sling + - go get github.com/go-resty/resty install: -- go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway -- go get github.com/grpc-ecosystem/grpc-gateway/runtime -- go get github.com/grpc-ecosystem/grpc-gateway/examples -- go get github.com/grpc-ecosystem/grpc-gateway/examples/server + - go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway + - go get github.com/grpc-ecosystem/grpc-gateway/runtime + - go get github.com/grpc-ecosystem/grpc-gateway/examples + - go get github.com/grpc-ecosystem/grpc-gateway/examples/server before_script: -- sh -c 'cd examples/browser && npm install' + - sh -c 'cd examples/browser && npm install' script: -- make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" -- if (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi -- env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... -- if (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then env GLOG_logtostderr=1 ./bin/coverage; fi -- make lint -- sh -c 'cd examples/browser && node ./node_modules/gulp/bin/gulp' + - if [ "${USE_BAZEL}" = true ]; then ./.travis/bazel-build.sh; fi + - if [ "${USE_BAZEL}" = true ]; then ./.travis/bazel-test.sh; fi + - if [ -z "${USE_BAZEL}" ]; then make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar"; fi + - if [ -z "${USE_BAZEL}" ] && (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi + - if [ -z "${USE_BAZEL}" ]; then env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/...; fi + - if [ -z "${USE_BAZEL}" ]; then make lint; fi + - if [ -z "${USE_BAZEL}" ]; then sh -c 'cd examples/browser && node ./node_modules/gulp/bin/gulp'; fi + - if (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then env GLOG_logtostderr=1 ./bin/coverage; fi after_success: - bash <(curl -s https://codecov.io/bash) env: global: - - "PATH=$PATH:$HOME/local/bin" - - GO_VERSION_TO_DIFF_TEST="go version go1\.10\.[0-9]\+ linux/amd64" + - "PATH=$PATH:$HOME/local/bin" + - GO_VERSION_TO_DIFF_TEST="go version go1\.10\.[0-9]\+ linux/amd64" matrix: - - GATEWAY_PLUGIN_FLAGS= - - GATEWAY_PLUGIN_FLAGS=request_context=false + - GATEWAY_PLUGIN_FLAGS= + - GATEWAY_PLUGIN_FLAGS=request_context=false +matrix: + include: + - go: master + env: USE_BAZEL=true diff --git a/.travis/bazel-build.sh b/.travis/bazel-build.sh new file mode 100755 index 00000000000..f46781d414b --- /dev/null +++ b/.travis/bazel-build.sh @@ -0,0 +1,10 @@ +#!/bin/sh -eu + +bazel \ + --batch \ + --output_base=$HOME/.cache/_grpc_gateway_bazel \ + --host_jvm_args=-Xmx500m \ + --host_jvm_args=-Xms500m \ + build \ + --local_resources=400,1,1.0 \ + //... diff --git a/.travis/bazel-test.sh b/.travis/bazel-test.sh new file mode 100755 index 00000000000..86dbbf3270a --- /dev/null +++ b/.travis/bazel-test.sh @@ -0,0 +1,12 @@ +#!/bin/sh -eu + +bazel \ + --batch \ + --output_base=$HOME/.cache/_grpc_gateway_bazel \ + --host_jvm_args=-Xmx500m \ + --host_jvm_args=-Xms500m \ + test \ + --local_resources=400,1,1.0 \ + --test_output=errors \ + --features=race \ + //... diff --git a/.travis/install-bazel.sh b/.travis/install-bazel.sh new file mode 100755 index 00000000000..9bebe44cdd2 --- /dev/null +++ b/.travis/install-bazel.sh @@ -0,0 +1,20 @@ +#!/bin/sh -eu + +bazel_version=$1 + +if test -z "${bazel_version}"; then + echo "Usage: .travis/install-bazel.sh bazel-version" + exit 1 +fi + +if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then + OS=darwin +else + OS=linux +fi + +filename=bazel-${bazel_version}-installer-${OS}-x86_64.sh +wget https://github.com/bazelbuild/bazel/releases/download/${bazel_version}/${filename} +chmod +x $filename +./$filename --user +rm -f $filename diff --git a/BUILD b/BUILD new file mode 100644 index 00000000000..0ab0afa13f7 --- /dev/null +++ b/BUILD @@ -0,0 +1,23 @@ +load("@bazel_gazelle//:def.bzl", "gazelle") + +# gazelle:exclude third_party + +gazelle( + name = "gazelle_diff", + mode = "diff", + prefix = "github.com/grpc-ecosystem/grpc-gateway", +) + +gazelle( + name = "gazelle_fix", + mode = "fix", + prefix = "github.com/grpc-ecosystem/grpc-gateway", +) + +package_group( + name = "generators", + packages = [ + "//protoc-gen-grpc-gateway/...", + "//protoc-gen-swagger/...", + ], +) diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 00000000000..5727c218261 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,41 @@ +workspace(name = "grpc_ecosystem_grpc_gateway") + +http_archive( + name = "io_bazel_rules_go", + url = "https://github.com/bazelbuild/rules_go/releases/download/0.10.3/rules_go-0.10.3.tar.gz", + sha256 = "feba3278c13cde8d67e341a837f69a029f698d7a27ddbb2a202be7a10b22142a", +) + +http_archive( + name = "bazel_gazelle", + url = "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.10.1/bazel-gazelle-0.10.1.tar.gz", + sha256 = "d03625db67e9fb0905bbd206fa97e32ae9da894fe234a493e7517fd25faec914", +) + +load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") + +go_rules_dependencies() + +go_register_toolchains() + +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") + +gazelle_dependencies() + +load("@io_bazel_rules_go//go:def.bzl", "go_repository") + +go_repository( + name = "com_github_rogpeppe_fastuuid", + commit = "6724a57986aff9bff1a1770e9347036def7c89f6", + importpath = "github.com/rogpeppe/fastuuid", +) + +go_repository( + name = "com_github_go_resty_resty", + commit = "f8815663de1e64d57cdd4ee9e2b2fa96977a030e", + importpath = "github.com/go-resty/resty", +) + +load("//:repositories.bzl", "repositories") + +repositories() diff --git a/codegenerator/BUILD.bazel b/codegenerator/BUILD.bazel new file mode 100644 index 00000000000..1eddaaf7395 --- /dev/null +++ b/codegenerator/BUILD.bazel @@ -0,0 +1,26 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//:generators"]) + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "parse_req.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/codegenerator", + deps = [ + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + ], +) + +go_test( + name = "go_default_xtest", + srcs = ["parse_req_test.go"], + deps = [ + ":go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + ], +) diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel new file mode 100644 index 00000000000..a6964471274 --- /dev/null +++ b/examples/BUILD.bazel @@ -0,0 +1,45 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") + +package(default_visibility = ["//visibility:private"]) + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples", + deps = [ + "//examples/examplepb:go_default_library", + "//runtime:go_default_library", + "@com_github_golang_glog//:go_default_library", + "@org_golang_google_grpc//:go_default_library", + ], +) + +go_binary( + name = "examples", + embed = [":go_default_library"], +) + +go_test( + name = "go_default_test", + size = "small", + srcs = [ + "client_test.go", + "integration_test.go", + "main_test.go", + "proto_error_test.go", + ], + embed = [":go_default_library"], + deps = [ + "//examples/clients/abe:go_default_library", + "//examples/clients/echo:go_default_library", + "//examples/examplepb:go_default_library", + "//examples/server:go_default_library", + "//examples/sub:go_default_library", + "//runtime:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//ptypes/empty:go_default_library", + "@org_golang_google_genproto//googleapis/rpc/status:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + ], +) diff --git a/examples/clients/abe/BUILD.bazel b/examples/clients/abe/BUILD.bazel new file mode 100644 index 00000000000..b09b173ecc1 --- /dev/null +++ b/examples/clients/abe/BUILD.bazel @@ -0,0 +1,26 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "go_default_library", + srcs = [ + "ProtobufDuration.go", + "a_bit_of_everything_nested.go", + "a_bit_of_everything_service_api.go", + "api_client.go", + "api_response.go", + "camel_case_service_name_api.go", + "configuration.go", + "echo_rpc_api.go", + "echo_service_api.go", + "examplepb_a_bit_of_everything.go", + "examplepb_body.go", + "examplepb_numeric_enum.go", + "nested_deep_enum.go", + "protobuf_empty.go", + "sub_string_message.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe", + deps = ["@com_github_go_resty_resty//:go_default_library"], +) diff --git a/examples/clients/echo/BUILD.bazel b/examples/clients/echo/BUILD.bazel new file mode 100644 index 00000000000..99243f3cded --- /dev/null +++ b/examples/clients/echo/BUILD.bazel @@ -0,0 +1,16 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "go_default_library", + srcs = [ + "api_client.go", + "api_response.go", + "configuration.go", + "echo_service_api.go", + "examplepb_simple_message.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo", + deps = ["@com_github_go_resty_resty//:go_default_library"], +) diff --git a/examples/examplepb/BUILD.bazel b/examples/examplepb/BUILD.bazel new file mode 100644 index 00000000000..e1617185067 --- /dev/null +++ b/examples/examplepb/BUILD.bazel @@ -0,0 +1,51 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "examplepb_proto", + srcs = [ + "a_bit_of_everything.proto", + "echo_service.proto", + "flow_combination.proto", + "stream.proto", + "wrappers.proto", + ], + deps = [ + "//examples/sub:sub_proto", + "//examples/sub2:sub2_proto", + "//protoc-gen-swagger/options:options_proto", + "@com_github_googleapis_googleapis//google/api:api_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:timestamp_proto", + "@com_google_protobuf//:wrappers_proto", + ], +) + +go_proto_library( + name = "examplepb_go_proto", + compilers = [ + "@io_bazel_rules_go//proto:go_grpc", + "//protoc-gen-grpc-gateway:go_gen_grpc_gateway", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb", + proto = ":examplepb_proto", + deps = [ + "//examples/sub:go_default_library", + "//examples/sub2:go_default_library", + "//protoc-gen-swagger/options:go_default_library", + "@com_github_golang_protobuf//ptypes/duration:go_default_library", + "@com_github_golang_protobuf//ptypes/empty:go_default_library", + "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", + "@com_github_golang_protobuf//ptypes/wrappers:go_default_library", + "@com_github_googleapis_googleapis//google/api:go_default_library", + ], +) + +go_library( + name = "go_default_library", + embed = [":examplepb_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb", +) diff --git a/examples/server/BUILD.bazel b/examples/server/BUILD.bazel new file mode 100644 index 00000000000..0982db9636f --- /dev/null +++ b/examples/server/BUILD.bazel @@ -0,0 +1,29 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "go_default_library", + srcs = [ + "a_bit_of_everything.go", + "echo.go", + "flow_combination.go", + "main.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/server", + deps = [ + "//examples/examplepb:go_default_library", + "//examples/sub:go_default_library", + "//examples/sub2:go_default_library", + "@com_github_golang_glog//:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//ptypes/duration:go_default_library", + "@com_github_golang_protobuf//ptypes/empty:go_default_library", + "@com_github_rogpeppe_fastuuid//:go_default_library", + "@org_golang_google_genproto//googleapis/rpc/errdetails:go_default_library", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//metadata:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + ], +) diff --git a/examples/server/cmd/example-server/BUILD.bazel b/examples/server/cmd/example-server/BUILD.bazel new file mode 100644 index 00000000000..bf03bdc5ee8 --- /dev/null +++ b/examples/server/cmd/example-server/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +package(default_visibility = ["//visibility:private"]) + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server", + deps = [ + "//examples/server:go_default_library", + "@com_github_golang_glog//:go_default_library", + ], +) + +go_binary( + name = "example-server", + embed = [":go_default_library"], +) diff --git a/examples/sub/BUILD.bazel b/examples/sub/BUILD.bazel new file mode 100644 index 00000000000..399c18f9bb0 --- /dev/null +++ b/examples/sub/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "sub_proto", + srcs = ["message.proto"], +) + +go_proto_library( + name = "sub_go_proto", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/sub", + proto = ":sub_proto", +) + +go_library( + name = "go_default_library", + embed = [":sub_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/sub", +) diff --git a/examples/sub2/BUILD.bazel b/examples/sub2/BUILD.bazel new file mode 100644 index 00000000000..08a67fa7e8d --- /dev/null +++ b/examples/sub2/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "sub2_proto", + srcs = ["message.proto"], +) + +go_proto_library( + name = "sub2_go_proto", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/sub2", + proto = ":sub2_proto", +) + +go_library( + name = "go_default_library", + embed = [":sub2_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/sub2", +) diff --git a/options/BUILD.bazel b/options/BUILD.bazel new file mode 100644 index 00000000000..cb544aaa283 --- /dev/null +++ b/options/BUILD.bazel @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "options_proto", + srcs = ["options.proto"], + deps = ["@com_google_protobuf//:descriptor_proto"], +) + +go_proto_library( + name = "options_go_proto", + importpath = "github.com/grpc-ecosystem/grpc-gateway/options", + proto = ":options_proto", + deps = ["@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library"], +) + +go_library( + name = "go_default_library", + embed = [":options_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/options", +) diff --git a/protoc-gen-grpc-gateway/BUILD.bazel b/protoc-gen-grpc-gateway/BUILD.bazel new file mode 100644 index 00000000000..fc4850fb695 --- /dev/null +++ b/protoc-gen-grpc-gateway/BUILD.bazel @@ -0,0 +1,41 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") +load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler") + +package(default_visibility = ["//visibility:private"]) + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway", + deps = [ + "//codegenerator:go_default_library", + "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/gengateway:go_default_library", + "@com_github_golang_glog//:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + ], +) + +go_binary( + name = "protoc-gen-grpc-gateway", + embed = [":go_default_library"], +) + +go_proto_compiler( + name = "go_gen_grpc_gateway", + options = ["logtostderr=true"], + plugin = ":protoc-gen-grpc-gateway", + suffix = ".pb.gw.go", + visibility = ["//visibility:public"], + deps = [ + "//runtime:go_default_library", + "//utilities:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//grpclog:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + "@org_golang_x_net//context:go_default_library", + ], +) diff --git a/protoc-gen-grpc-gateway/descriptor/BUILD.bazel b/protoc-gen-grpc-gateway/descriptor/BUILD.bazel new file mode 100644 index 00000000000..7c68fa88582 --- /dev/null +++ b/protoc-gen-grpc-gateway/descriptor/BUILD.bazel @@ -0,0 +1,39 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//:generators"]) + +go_library( + name = "go_default_library", + srcs = [ + "registry.go", + "services.go", + "types.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor", + deps = [ + "//protoc-gen-grpc-gateway/httprule:go_default_library", + "@com_github_golang_glog//:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + "@org_golang_google_genproto//googleapis/api/annotations:go_default_library", + ], +) + +go_test( + name = "go_default_test", + size = "small", + srcs = [ + "registry_test.go", + "services_test.go", + "types_test.go", + ], + embed = [":go_default_library"], + deps = [ + "//protoc-gen-grpc-gateway/httprule:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + ], +) diff --git a/protoc-gen-grpc-gateway/generator/BUILD.bazel b/protoc-gen-grpc-gateway/generator/BUILD.bazel new file mode 100644 index 00000000000..5995e5df888 --- /dev/null +++ b/protoc-gen-grpc-gateway/generator/BUILD.bazel @@ -0,0 +1,13 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +package(default_visibility = ["//:generators"]) + +go_library( + name = "go_default_library", + srcs = ["generator.go"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator", + deps = [ + "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + ], +) diff --git a/protoc-gen-grpc-gateway/gengateway/BUILD.bazel b/protoc-gen-grpc-gateway/gengateway/BUILD.bazel new file mode 100644 index 00000000000..517909b5046 --- /dev/null +++ b/protoc-gen-grpc-gateway/gengateway/BUILD.bazel @@ -0,0 +1,38 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//protoc-gen-grpc-gateway:__subpackages__"]) + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "generator.go", + "template.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway", + deps = [ + "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/generator:go_default_library", + "//utilities:go_default_library", + "@com_github_golang_glog//:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + "@org_golang_google_genproto//googleapis/api/annotations:go_default_library", + ], +) + +go_test( + name = "go_default_test", + size = "small", + srcs = [ + "generator_test.go", + "template_test.go", + ], + embed = [":go_default_library"], + deps = [ + "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/httprule:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", + ], +) diff --git a/protoc-gen-grpc-gateway/httprule/BUILD.bazel b/protoc-gen-grpc-gateway/httprule/BUILD.bazel new file mode 100644 index 00000000000..89f94a14b45 --- /dev/null +++ b/protoc-gen-grpc-gateway/httprule/BUILD.bazel @@ -0,0 +1,32 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//:generators"]) + +go_library( + name = "go_default_library", + srcs = [ + "compile.go", + "parse.go", + "types.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule", + deps = [ + "//utilities:go_default_library", + "@com_github_golang_glog//:go_default_library", + ], +) + +go_test( + name = "go_default_test", + size = "small", + srcs = [ + "compile_test.go", + "parse_test.go", + "types_test.go", + ], + embed = [":go_default_library"], + deps = [ + "//utilities:go_default_library", + "@com_github_golang_glog//:go_default_library", + ], +) diff --git a/protoc-gen-swagger/BUILD.bazel b/protoc-gen-swagger/BUILD.bazel new file mode 100644 index 00000000000..4a76d2f85c4 --- /dev/null +++ b/protoc-gen-swagger/BUILD.bazel @@ -0,0 +1,29 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") + +package(default_visibility = ["//visibility:private"]) + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger", + deps = [ + "//codegenerator:go_default_library", + "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//protoc-gen-swagger/genswagger:go_default_library", + "@com_github_golang_glog//:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + ], +) + +go_binary( + name = "protoc-gen-swagger", + embed = [":go_default_library"], +) + +go_test( + name = "go_default_test", + size = "small", + srcs = ["main_test.go"], + embed = [":go_default_library"], +) diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/genswagger/BUILD.bazel new file mode 100644 index 00000000000..7f34844a7a0 --- /dev/null +++ b/protoc-gen-swagger/genswagger/BUILD.bazel @@ -0,0 +1,37 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//protoc-gen-swagger:__subpackages__"]) + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "generator.go", + "template.go", + "types.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger", + deps = [ + "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/generator:go_default_library", + "//protoc-gen-swagger/options:go_default_library", + "@com_github_golang_glog//:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + ], +) + +go_test( + name = "go_default_test", + size = "small", + srcs = ["template_test.go"], + embed = [":go_default_library"], + deps = [ + "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/httprule:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + ], +) diff --git a/protoc-gen-swagger/options/BUILD.bazel b/protoc-gen-swagger/options/BUILD.bazel new file mode 100644 index 00000000000..476cb59db4b --- /dev/null +++ b/protoc-gen-swagger/options/BUILD.bazel @@ -0,0 +1,33 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "options_proto", + srcs = [ + "annotations.proto", + "openapiv2.proto", + ], + deps = [ + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:descriptor_proto", + ], +) + +go_proto_library( + name = "options_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options", + proto = ":options_proto", + deps = [ + "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", + "@com_github_golang_protobuf//ptypes/any:go_default_library", + ], +) + +go_library( + name = "go_default_library", + embed = [":options_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options", +) diff --git a/repositories.bzl b/repositories.bzl new file mode 100644 index 00000000000..959b20cfffa --- /dev/null +++ b/repositories.bzl @@ -0,0 +1,49 @@ +GOOGLEAPIS_GOOGLE_API_BUILD_CONTENTS = """ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "api_proto", + srcs = [ + "annotations.proto", + "http.proto", + ], + deps = ["@com_google_protobuf//:descriptor_proto"], +) + +go_proto_library( + name = "api_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/annotations", + proto = ":api_proto", + deps = ["@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library"], +) + +go_library( + name = "go_default_library", + embed = [":api_go_proto"], + importpath = "google.golang.org/genproto/googleapis/api/annotations", +) +""" + +def _googleapis_repository_impl(ctx): + googleapis_commit = "e1c0c726290a55065c0c46a62dacc9372939973b" + ctx.download_and_extract( + url = "https://github.com/googleapis/googleapis/archive/{commit}.tar.gz".format( + commit = googleapis_commit, + ), + sha256 = "9508971cb4a7c0fe03bc1bfafbd0abc9654c80b4c70e360a6c534938d06d8fb9", + stripPrefix = "googleapis-{}".format(googleapis_commit), + ) + + ctx.file("google/api/BUILD.bazel", GOOGLEAPIS_GOOGLE_API_BUILD_CONTENTS) + + +_googleapis_repository = repository_rule( + implementation = _googleapis_repository_impl, +) + + +def repositories(): + _googleapis_repository(name = "com_github_googleapis_googleapis") diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel new file mode 100644 index 00000000000..e8964f02426 --- /dev/null +++ b/runtime/BUILD.bazel @@ -0,0 +1,82 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "go_default_library", + srcs = [ + "context.go", + "convert.go", + "doc.go", + "errors.go", + "handler.go", + "marshal_json.go", + "marshal_jsonpb.go", + "marshal_proto.go", + "marshaler.go", + "marshaler_registry.go", + "mux.go", + "pattern.go", + "proto2_convert.go", + "proto_errors.go", + "query.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime", + deps = [ + "//runtime/internal:go_default_library", + "//utilities:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//ptypes:go_default_library", + "@com_github_golang_protobuf//ptypes/any:go_default_library", + "@com_github_golang_protobuf//ptypes/duration:go_default_library", + "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//grpclog:go_default_library", + "@org_golang_google_grpc//metadata:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + ], +) + +go_test( + name = "go_default_test", + size = "small", + srcs = ["pattern_test.go"], + embed = [":go_default_library"], + deps = ["//utilities:go_default_library"], +) + +go_test( + name = "go_default_xtest", + size = "small", + srcs = [ + "context_test.go", + "errors_test.go", + "handler_test.go", + "marshal_json_test.go", + "marshal_jsonpb_test.go", + "marshal_proto_test.go", + "marshaler_registry_test.go", + "mux_test.go", + "query_test.go", + ], + deps = [ + ":go_default_library", + "//examples/examplepb:go_default_library", + "//runtime/internal:go_default_library", + "//utilities:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//ptypes:go_default_library", + "@com_github_golang_protobuf//ptypes/duration:go_default_library", + "@com_github_golang_protobuf//ptypes/empty:go_default_library", + "@com_github_golang_protobuf//ptypes/struct:go_default_library", + "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", + "@com_github_golang_protobuf//ptypes/wrappers:go_default_library", + "@org_golang_google_genproto//protobuf/field_mask:go_default_library", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//metadata:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + ], +) diff --git a/runtime/internal/BUILD.bazel b/runtime/internal/BUILD.bazel new file mode 100644 index 00000000000..937e66089ee --- /dev/null +++ b/runtime/internal/BUILD.bazel @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +package(default_visibility = ["//runtime:__subpackages__"]) + +proto_library( + name = "internal_proto", + srcs = ["stream_chunk.proto"], + deps = ["@com_google_protobuf//:any_proto"], +) + +go_proto_library( + name = "internal_go_proto", + importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime/internal", + proto = ":internal_proto", + deps = ["@com_github_golang_protobuf//ptypes/any:go_default_library"], +) + +go_library( + name = "go_default_library", + embed = [":internal_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime/internal", +) diff --git a/utilities/BUILD.bazel b/utilities/BUILD.bazel new file mode 100644 index 00000000000..58d291c3738 --- /dev/null +++ b/utilities/BUILD.bazel @@ -0,0 +1,20 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "pattern.go", + "trie.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/utilities", +) + +go_test( + name = "go_default_xtest", + size = "small", + srcs = ["trie_test.go"], + deps = [":go_default_library"], +) From 0a0d9dedaa43aee7e37ecb9dea97abeff406141a Mon Sep 17 00:00:00 2001 From: Joshua Humphries Date: Mon, 16 Apr 2018 15:59:04 -0400 Subject: [PATCH 214/552] fix racy access of err variable (#575) Fixes: #583 --- examples/examplepb/flow_combination.pb.gw.go | 4 ++-- examples/examplepb/stream.pb.gw.go | 4 ++-- protoc-gen-grpc-gateway/gengateway/template.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/examplepb/flow_combination.pb.gw.go b/examples/examplepb/flow_combination.pb.gw.go index 11ae2e3c5bc..adca0fd727d 100644 --- a/examples/examplepb/flow_combination.pb.gw.go +++ b/examples/examplepb/flow_combination.pb.gw.go @@ -105,7 +105,7 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler dec := marshaler.NewDecoder(req.Body) handleSend := func() error { var protoReq EmptyProto - err = dec.Decode(&protoReq) + err := dec.Decode(&protoReq) if err == io.EOF { return err } @@ -113,7 +113,7 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler grpclog.Printf("Failed to decode request: %v", err) return err } - if err = stream.Send(&protoReq); err != nil { + if err := stream.Send(&protoReq); err != nil { grpclog.Printf("Failed to send request: %v", err) return err } diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index 3ef9faacd62..8a953a739e0 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -98,7 +98,7 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar dec := marshaler.NewDecoder(req.Body) handleSend := func() error { var protoReq sub.StringMessage - err = dec.Decode(&protoReq) + err := dec.Decode(&protoReq) if err == io.EOF { return err } @@ -106,7 +106,7 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar grpclog.Printf("Failed to decode request: %v", err) return err } - if err = stream.Send(&protoReq); err != nil { + if err := stream.Send(&protoReq); err != nil { grpclog.Printf("Failed to send request: %v", err) return err } diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index b862e00fc3d..c662e7b29fc 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -268,7 +268,7 @@ var ( dec := marshaler.NewDecoder(req.Body) handleSend := func() error { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} - err = dec.Decode(&protoReq) + err := dec.Decode(&protoReq) if err == io.EOF { return err } @@ -276,7 +276,7 @@ var ( grpclog.Printf("Failed to decode request: %v", err) return err } - if err = stream.Send(&protoReq); err != nil { + if err := stream.Send(&protoReq); err != nil { grpclog.Printf("Failed to send request: %v", err) return err } From 4d2a82f627aa08feb210a7bd6dcc8cbc226506af Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 16 Aug 2016 15:35:42 +0900 Subject: [PATCH 215/552] Remove an obsolete custom option It was used in an early prototype of grpc-gateway but no longer used for years. --- options/options.proto | 27 ------------------- .../descriptor/services.go | 2 +- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 options/options.proto diff --git a/options/options.proto b/options/options.proto deleted file mode 100644 index be81c963db5..00000000000 --- a/options/options.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto2"; -option go_package = "options"; - -package gengo.grpc.gateway; -import "google/protobuf/descriptor.proto"; - -message ApiMethodOptions { - // Use HttpRule instead. - option deprecated = true; - - extend google.protobuf.MethodOptions { - // Describes how the gRPC method should be exported as a RESTful API. - // - // The id is a globally unique id for this option, assigned by - // protobuf-global-extension-registry@google.com. - optional ApiMethodOptions api_options = 1022; - } - - // Path of the RESTful API method. - // Path components which start with colon is mapped to the corresponding fields in the request message. - required string path = 1; - // HTTP method of the RESTful API method - required string method = 2; - // Human-readable description of the method. - optional string description = 3; -} - diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index 3f324d294a9..d3020ff28f4 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -27,7 +27,7 @@ func (r *Registry) loadServices(file *File) error { glog.V(2).Infof("Processing %s.%s", sd.GetName(), md.GetName()) opts, err := extractAPIOptions(md) if err != nil { - glog.Errorf("Failed to extract ApiMethodOptions from %s.%s: %v", svc.GetName(), md.GetName(), err) + glog.Errorf("Failed to extract HttpRule from %s.%s: %v", svc.GetName(), md.GetName(), err) return err } if opts == nil { From 7a2d749018b04baa8a571a7194466db3077b34a1 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Mon, 16 Apr 2018 18:45:51 -0600 Subject: [PATCH 216/552] Add a local runner for the site --- docs/.gitignore | 1 + docs/Gemfile | 9 ++ docs/Gemfile.lock | 256 +++++++++++++++++++++++++++++++++++++ docs/_config.yaml | 13 ++ docs/_config.yml | 3 - docs/_docs/background.md | 4 +- docs/_docs/examples.md | 4 +- docs/_docs/features.md | 4 +- docs/_docs/usage.md | 4 +- docs/_layouts/default.html | 6 +- docs/run.sh | 28 ++++ 11 files changed, 320 insertions(+), 12 deletions(-) create mode 100644 docs/.gitignore create mode 100644 docs/Gemfile create mode 100644 docs/Gemfile.lock create mode 100644 docs/_config.yaml delete mode 100644 docs/_config.yml create mode 100755 docs/run.sh diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 00000000000..ca35be08d44 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +_site diff --git a/docs/Gemfile b/docs/Gemfile new file mode 100644 index 00000000000..5e3964ff666 --- /dev/null +++ b/docs/Gemfile @@ -0,0 +1,9 @@ +source 'https://rubygems.org' + +group :development, :test do + gem "github-pages", group: :jekyll_plugins + gem 'jekyll', '~> 3.7.0' + gem 'jekyll-redirect-from', '~> 0.13.0' + gem 'jekyll-sitemap', '~> 1.2.0' + gem 'jekyll-toc', '~> 0.5.1' +end diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock new file mode 100644 index 00000000000..6bc4cb1f8f7 --- /dev/null +++ b/docs/Gemfile.lock @@ -0,0 +1,256 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (4.2.9) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.11.1) + colorator (1.1.0) + commonmarker (0.17.9) + ruby-enum (~> 0.5) + concurrent-ruby (1.0.5) + em-websocket (0.5.1) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0.6.0) + ethon (0.11.0) + ffi (>= 1.3.0) + eventmachine (1.2.5) + execjs (2.7.0) + faraday (0.14.0) + multipart-post (>= 1.2, < 3) + ffi (1.9.23) + forwardable-extended (2.6.0) + gemoji (3.0.0) + github-pages (182) + activesupport (= 4.2.9) + github-pages-health-check (= 1.4.0) + jekyll (= 3.7.3) + jekyll-avatar (= 0.5.0) + jekyll-coffeescript (= 1.1.1) + jekyll-commonmark-ghpages (= 0.1.5) + jekyll-default-layout (= 0.1.4) + jekyll-feed (= 0.9.3) + jekyll-gist (= 1.5.0) + jekyll-github-metadata (= 2.9.4) + jekyll-mentions (= 1.3.0) + jekyll-optional-front-matter (= 0.3.0) + jekyll-paginate (= 1.1.0) + jekyll-readme-index (= 0.2.0) + jekyll-redirect-from (= 0.13.0) + jekyll-relative-links (= 0.5.3) + jekyll-remote-theme (= 0.2.3) + jekyll-sass-converter (= 1.5.2) + jekyll-seo-tag (= 2.4.0) + jekyll-sitemap (= 1.2.0) + jekyll-swiss (= 0.4.0) + jekyll-theme-architect (= 0.1.1) + jekyll-theme-cayman (= 0.1.1) + jekyll-theme-dinky (= 0.1.1) + jekyll-theme-hacker (= 0.1.1) + jekyll-theme-leap-day (= 0.1.1) + jekyll-theme-merlot (= 0.1.1) + jekyll-theme-midnight (= 0.1.1) + jekyll-theme-minimal (= 0.1.1) + jekyll-theme-modernist (= 0.1.1) + jekyll-theme-primer (= 0.5.3) + jekyll-theme-slate (= 0.1.1) + jekyll-theme-tactile (= 0.1.1) + jekyll-theme-time-machine (= 0.1.1) + jekyll-titles-from-headings (= 0.5.1) + jemoji (= 0.9.0) + kramdown (= 1.16.2) + liquid (= 4.0.0) + listen (= 3.1.5) + mercenary (~> 0.3) + minima (= 2.4.1) + nokogiri (>= 1.8.1, < 2.0) + rouge (= 2.2.1) + terminal-table (~> 1.4) + github-pages-health-check (1.4.0) + addressable (~> 2.3) + net-dns (~> 0.8) + octokit (~> 4.0) + public_suffix (~> 2.0) + typhoeus (~> 1.3) + html-pipeline (2.7.1) + activesupport (>= 2) + nokogiri (>= 1.4) + http_parser.rb (0.6.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + jekyll (3.7.3) + addressable (~> 2.4) + colorator (~> 1.0) + em-websocket (~> 0.5) + i18n (~> 0.7) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 2.0) + kramdown (~> 1.14) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 4) + safe_yaml (~> 1.0) + jekyll-avatar (0.5.0) + jekyll (~> 3.0) + jekyll-coffeescript (1.1.1) + coffee-script (~> 2.2) + coffee-script-source (~> 1.11.1) + jekyll-commonmark (1.2.0) + commonmarker (~> 0.14) + jekyll (>= 3.0, < 4.0) + jekyll-commonmark-ghpages (0.1.5) + commonmarker (~> 0.17.6) + jekyll-commonmark (~> 1) + rouge (~> 2) + jekyll-default-layout (0.1.4) + jekyll (~> 3.0) + jekyll-feed (0.9.3) + jekyll (~> 3.3) + jekyll-gist (1.5.0) + octokit (~> 4.2) + jekyll-github-metadata (2.9.4) + jekyll (~> 3.1) + octokit (~> 4.0, != 4.4.0) + jekyll-mentions (1.3.0) + activesupport (~> 4.0) + html-pipeline (~> 2.3) + jekyll (~> 3.0) + jekyll-optional-front-matter (0.3.0) + jekyll (~> 3.0) + jekyll-paginate (1.1.0) + jekyll-readme-index (0.2.0) + jekyll (~> 3.0) + jekyll-redirect-from (0.13.0) + jekyll (~> 3.3) + jekyll-relative-links (0.5.3) + jekyll (~> 3.3) + jekyll-remote-theme (0.2.3) + jekyll (~> 3.5) + rubyzip (>= 1.2.1, < 3.0) + typhoeus (>= 0.7, < 2.0) + jekyll-sass-converter (1.5.2) + sass (~> 3.4) + jekyll-seo-tag (2.4.0) + jekyll (~> 3.3) + jekyll-sitemap (1.2.0) + jekyll (~> 3.3) + jekyll-swiss (0.4.0) + jekyll-theme-architect (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-cayman (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-dinky (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-hacker (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-leap-day (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-merlot (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-midnight (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-minimal (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-modernist (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-primer (0.5.3) + jekyll (~> 3.5) + jekyll-github-metadata (~> 2.9) + jekyll-seo-tag (~> 2.0) + jekyll-theme-slate (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-tactile (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-time-machine (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-titles-from-headings (0.5.1) + jekyll (~> 3.3) + jekyll-toc (0.5.2) + nokogiri (~> 1.6) + jekyll-watch (2.0.0) + listen (~> 3.0) + jemoji (0.9.0) + activesupport (~> 4.0, >= 4.2.9) + gemoji (~> 3.0) + html-pipeline (~> 2.2) + jekyll (~> 3.0) + kramdown (1.16.2) + liquid (4.0.0) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + mercenary (0.3.6) + mini_portile2 (2.3.0) + minima (2.4.1) + jekyll (~> 3.5) + jekyll-feed (~> 0.9) + jekyll-seo-tag (~> 2.1) + minitest (5.11.3) + multipart-post (2.0.0) + net-dns (0.8.0) + nokogiri (1.8.2) + mini_portile2 (~> 2.3.0) + octokit (4.8.0) + sawyer (~> 0.8.0, >= 0.5.3) + pathutil (0.16.1) + forwardable-extended (~> 2.6) + public_suffix (2.0.5) + rb-fsevent (0.10.3) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rouge (2.2.1) + ruby-enum (0.7.2) + i18n + ruby_dep (1.5.0) + rubyzip (1.2.1) + safe_yaml (1.0.4) + sass (3.5.6) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + thread_safe (0.3.6) + typhoeus (1.3.0) + ethon (>= 0.9.0) + tzinfo (1.2.5) + thread_safe (~> 0.1) + unicode-display_width (1.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + github-pages + jekyll (~> 3.7.0) + jekyll-redirect-from (~> 0.13.0) + jekyll-sitemap (~> 1.2.0) + jekyll-toc (~> 0.5.1) + +BUNDLED WITH + 1.15.4 diff --git a/docs/_config.yaml b/docs/_config.yaml new file mode 100644 index 00000000000..e1dd48b56e7 --- /dev/null +++ b/docs/_config.yaml @@ -0,0 +1,13 @@ +theme: jekyll-theme-architect + +repository: grpc-ecosystem/grpc-gateway + +collections: + docs: + output: true + +plugins: + - jekyll-toc + +exclude: + - run.sh diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 87b7821bd1c..00000000000 --- a/docs/_config.yml +++ /dev/null @@ -1,3 +0,0 @@ -collections: - docs: - output: true diff --git a/docs/_docs/background.md b/docs/_docs/background.md index ba2a7c4d1ce..63463a1ba0f 100644 --- a/docs/_docs/background.md +++ b/docs/_docs/background.md @@ -1,6 +1,6 @@ --- +--- category: documentation --- +--- # Background diff --git a/docs/_docs/examples.md b/docs/_docs/examples.md index 29d166b5899..adbb49ad7a8 100644 --- a/docs/_docs/examples.md +++ b/docs/_docs/examples.md @@ -1,6 +1,6 @@ --- +--- category: documentation --- +--- # Examples diff --git a/docs/_docs/features.md b/docs/_docs/features.md index 805239ad74c..27fce3c8301 100644 --- a/docs/_docs/features.md +++ b/docs/_docs/features.md @@ -1,6 +1,6 @@ --- +--- category: documentation --- +--- # Features diff --git a/docs/_docs/usage.md b/docs/_docs/usage.md index dd4c1951b72..7ad6c26187d 100644 --- a/docs/_docs/usage.md +++ b/docs/_docs/usage.md @@ -1,6 +1,6 @@ --- +--- category: documentation --- +--- # How do I use this? diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index 017022c834b..72088fe0935 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -6,6 +6,10 @@ + +``` Your steps here. -What did you expect to happen instead: +### What did you expect to happen instead: +```html +``` Your answer here. -What's your theory on why it isn't working: +### What's your theory on why it isn't working: +```html +``` Your theory here. From 1e4b3b22dafeaab76fb119a305251173ecd65709 Mon Sep 17 00:00:00 2001 From: Sri Krishna Paritala Date: Mon, 10 Sep 2018 17:13:36 +0530 Subject: [PATCH 292/552] Added camelCase Example --- docs/_docs/customizingyourgateway.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/_docs/customizingyourgateway.md b/docs/_docs/customizingyourgateway.md index 20c747f2771..a8071cb1741 100644 --- a/docs/_docs/customizingyourgateway.md +++ b/docs/_docs/customizingyourgateway.md @@ -7,6 +7,7 @@ order: 101 # Customizing your gateway ## Message serialization +### Custom serializer You might want to serialize request/response messages in MessagePack instead of JSON, for example. @@ -20,6 +21,13 @@ You might want to serialize request/response messages in MessagePack instead of You can see [the default implementation for JSON](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/marshal_jsonpb.go) for reference. +### Using camelCase for JSON + +The protocol buffer compiler generates camelCase JSON tags that can be used with jsonpb package. By default jsonpb Marshaller uses `OrigName: true` which uses the exact case used in the proto files. To use camelCase for the JSON representation, + ```go + mux := runtime.NewServeMux(runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName:false})) + ``` + ## Mapping from HTTP request headers to gRPC client metadata You might not like [the default mapping rule](http://godoc.org/github.com/grpc-ecosystem/grpc-gateway/runtime#DefaultHeaderMatcher) and might want to pass through all the HTTP headers, for example. From b02b8c295fc8ce62a9a3729d2a4c7c912a616930 Mon Sep 17 00:00:00 2001 From: Hong Zhang Date: Sun, 23 Sep 2018 16:51:26 -0700 Subject: [PATCH 293/552] Update README.md Point users to the proto definition instead of Service Management API documentation. Latter is generated from former, and is more likely to be out of date. Rephrase "custom options" to "google.api.http" annotation to be more straight forward. --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ccb7d7409c4..445368e7118 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ grpc-gateway is a plugin of [protoc](http://github.com/google/protobuf). It reads [gRPC](http://github.com/grpc/grpc-common) service definition, and generates a reverse-proxy server which translates a RESTful JSON API into gRPC. -This server is generated according to [custom options](https://cloud.google.com/service-management/reference/rpc/google.api#http) in your gRPC definition. +This server is generated according to the +[`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) +annotation in your gRPC service definition. It helps you to provide your APIs in both gRPC and RESTful style at the same time. @@ -20,7 +22,7 @@ However, you might still want to provide a traditional RESTful API as well. Reas This project aims to provide that HTTP+JSON interface to your gRPC service. A small amount of configuration in your service to attach HTTP semantics is all that's needed to generate a reverse-proxy with this library. ## Installation -First you need to install ProtocolBuffers 3.0.0-beta-3 or later. +First you need to install ProtocolBuffers 3.0.0 or later. ```sh mkdir tmp @@ -59,7 +61,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. rpc Echo(StringMessage) returns (StringMessage) {} } ``` -2. Add a [custom option](https://cloud.google.com/service-management/reference/rpc/google.api#http) to the .proto file +2. Add a [`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) to your .proto file your_service.proto: ```diff @@ -83,7 +85,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. } ``` - If you do not want to modify the proto file for use with grpc-gateway you can alternatively use an external [gRPC API Configuration](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config) file. [Check our documentation](https://grpc-ecosystem.github.io/grpc-gateway/docs/grpcapiconfiguration.html) for more information. + If you do not want to modify the proto file for use with grpc-gateway you can alternatively use an external [gRPC Service Configuration](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config) file. [Check our documentation](https://grpc-ecosystem.github.io/grpc-gateway/docs/grpcapiconfiguration.html) for more information. 3. Generate gRPC stub From c58bd50367535b32686a08bdd72ab456b2b2c43b Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 1 Oct 2018 20:40:19 +0100 Subject: [PATCH 294/552] Revert #708 since it breaks backwards compatibility The solution for #224 turned out to break backwards compatibility, so we're going to have to find another solution for users who desire this behaviour. Also adds test cases from #760. --- runtime/mux.go | 2 +- runtime/mux_test.go | 16 +++------------- runtime/pattern.go | 11 +---------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/runtime/mux.go b/runtime/mux.go index 8f7dd36b700..463084a7022 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -1,10 +1,10 @@ package runtime import ( + "context" "fmt" "net/http" "strings" - "context" "github.com/golang/protobuf/proto" "google.golang.org/grpc/codes" diff --git a/runtime/mux_test.go b/runtime/mux_test.go index a0f15f7ae4e..894148d5692 100644 --- a/runtime/mux_test.go +++ b/runtime/mux_test.go @@ -183,30 +183,20 @@ func TestMuxServeHTTP(t *testing.T) { ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, }, - }, - reqMethod: "GET", - reqPath: "/foo/bar", - headers: map[string]string{ - "Content-Type": "application/json", - }, - respStatus: http.StatusOK, - respContent: "GET /foo/{id=*}", - }, - { - patterns: []stubPattern{ { method: "GET", ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, pool: []string{"foo", "id"}, + verb: "verb", }, }, reqMethod: "GET", - reqPath: "/foo/bar:123", + reqPath: "/foo/bar:verb", headers: map[string]string{ "Content-Type": "application/json", }, respStatus: http.StatusOK, - respContent: "GET /foo/{id=*}", + respContent: "GET /foo/{id=*}:verb", }, } { mux := runtime.NewServeMux() diff --git a/runtime/pattern.go b/runtime/pattern.go index 223a12ecc43..f16a84ad389 100644 --- a/runtime/pattern.go +++ b/runtime/pattern.go @@ -144,16 +144,7 @@ func MustPattern(p Pattern, err error) Pattern { // If otherwise, the function returns an error. func (p Pattern) Match(components []string, verb string) (map[string]string, error) { if p.verb != verb { - if p.verb != "" { - return nil, ErrNotMatch - } - if len(components) == 0 { - components = []string{":" + verb} - } else { - components = append([]string{}, components...) - components[len(components)-1] += ":" + verb - } - verb = "" + return nil, ErrNotMatch } var pos int From 4c69a500de4ae9f3320c6db6a2b0412e8bb9ecc5 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 1 Oct 2018 22:09:24 +0100 Subject: [PATCH 295/552] Generate changelog for release v1.5.1 --- CHANGELOG.md | 31 ++++++++++++++++++++++++++++++- Makefile | 2 +- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 997afe3f6d1..3d7184d2058 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,39 @@ # Change Log +## [v1.5.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.5.1) (2018-10-01) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.5.0...v1.5.1) + +**Implemented enhancements:** + +- protobuf well known types aren't represented in swagger output correctly [\#160](https://github.com/grpc-ecosystem/grpc-gateway/issues/160) + +**Fixed bugs:** + +- URLs using verb no longer work after upgrading to v1.5.0 [\#760](https://github.com/grpc-ecosystem/grpc-gateway/issues/760) +- protoc-gen-swagger doesn't generate any request objects for GET/DELETE [\#747](https://github.com/grpc-ecosystem/grpc-gateway/issues/747) + +**Closed issues:** + +- how to get proper fields name for method [\#745](https://github.com/grpc-ecosystem/grpc-gateway/issues/745) +- Make a new release [\#733](https://github.com/grpc-ecosystem/grpc-gateway/issues/733) +- how to provide interface type inside proto for grpc-gateway [\#723](https://github.com/grpc-ecosystem/grpc-gateway/issues/723) +- Is there any way we can remove fields from the response json in grpc-gateway? [\#710](https://github.com/grpc-ecosystem/grpc-gateway/issues/710) +- How to write tests for the gateway? [\#699](https://github.com/grpc-ecosystem/grpc-gateway/issues/699) +- protoc-gen-swagger: No comments for path parameters [\#694](https://github.com/grpc-ecosystem/grpc-gateway/issues/694) +- Can you differentiate between an empty map vs field not provided? [\#552](https://github.com/grpc-ecosystem/grpc-gateway/issues/552) + +**Merged pull requests:** + +- Revert \#708 since it breaks backwards compatibility [\#761](https://github.com/grpc-ecosystem/grpc-gateway/pull/761) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Update README.md [\#757](https://github.com/grpc-ecosystem/grpc-gateway/pull/757) ([wora](https://github.com/wora)) +- Added camelCase Example [\#751](https://github.com/grpc-ecosystem/grpc-gateway/pull/751) ([srikrsna](https://github.com/srikrsna)) +- Add more guidance to issue template [\#750](https://github.com/grpc-ecosystem/grpc-gateway/pull/750) ([johanbrandhorst](https://github.com/johanbrandhorst)) + ## [v1.5.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.5.0) (2018-09-09) [Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.4.1...v1.5.0) **Fixed bugs:** -- 404s using colons in the middle of the last path segment [\#224](https://github.com/grpc-ecosystem/grpc-gateway/issues/224) - forwarding binary metadata is broken [\#218](https://github.com/grpc-ecosystem/grpc-gateway/issues/218) **Closed issues:** @@ -42,6 +70,7 @@ **Merged pull requests:** +- Generate release notes for v1.5.0 [\#749](https://github.com/grpc-ecosystem/grpc-gateway/pull/749) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Add missing modules to browser example [\#743](https://github.com/grpc-ecosystem/grpc-gateway/pull/743) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Added support for path param repeated fields [\#742](https://github.com/grpc-ecosystem/grpc-gateway/pull/742) ([maros7](https://github.com/maros7)) - Add support for enum path parameters [\#738](https://github.com/grpc-ecosystem/grpc-gateway/pull/738) ([maros7](https://github.com/maros7)) diff --git a/Makefile b/Makefile index 1fcdb12698f..0d18c0131ca 100644 --- a/Makefile +++ b/Makefile @@ -199,7 +199,7 @@ changelog: --compare-link \ --github-site=https://grpc-ecosystem.github.io/grpc-gateway \ --unreleased-label "**Next release**" \ - --future-release=v1.5.0 + --future-release=v1.5.1 lint: golint --set_exit_status $(PKG)/runtime golint --set_exit_status $(PKG)/utilities/... From 7e21b75f4c6a6e9d97207d842ec3b3d2a2adf963 Mon Sep 17 00:00:00 2001 From: John Children Date: Tue, 2 Oct 2018 17:33:35 +0100 Subject: [PATCH 296/552] Add default value for swagger 200 response This commit adds a default value to the description field of 200 responses. This is needed to meet the swagger specification requirement of a short description for all response objects. --- protoc-gen-swagger/genswagger/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index e5d37492186..939c7b3730b 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -694,7 +694,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } methProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.ServiceDescriptorProto)(nil)), "Method") - desc := "" + desc := "A successful response." var responseSchema swaggerSchemaObject if b.ResponseBody == nil || len(b.ResponseBody.FieldPath) == 0 { From c746ab373162e748d716e585a02d4b11fd33b617 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 9 Oct 2018 22:37:10 +0100 Subject: [PATCH 297/552] Regenerate files with new CI setup --- .../proto/examplepb/a_bit_of_everything.pb.go | 196 +++++++++--------- .../a_bit_of_everything.swagger.json | 32 +-- examples/proto/examplepb/echo_service.pb.go | 104 +++++----- .../proto/examplepb/echo_service.swagger.json | 14 +- .../proto/examplepb/flow_combination.pb.go | 44 ++-- .../examplepb/response_body_service.pb.go | 16 +- examples/proto/examplepb/stream.pb.go | 14 +- .../examplepb/unannotated_echo_service.pb.go | 20 +- .../unannotated_echo_service.swagger.json | 8 +- examples/proto/examplepb/wrappers.pb.go | 28 +-- .../proto/examplepb/wrappers.swagger.json | 2 +- examples/proto/sub2/message.pb.go | 2 +- protoc-gen-swagger/options/openapiv2.pb.go | 146 ++++++------- runtime/internal/stream_chunk.pb.go | 10 +- 14 files changed, 312 insertions(+), 324 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index e53bcbd4fda..2609fd85f71 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -86,39 +86,39 @@ func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { // Intentionaly complicated message type to cover many features of Protobuf. // NEXT ID: 30 type ABitOfEverything struct { - SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested,proto3" json:"single_nested,omitempty"` - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` - Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested,proto3" json:"nested,omitempty"` - FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` - DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` - Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` - Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` - Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` - Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value,proto3" json:"fixed64_value,omitempty"` - Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value,proto3" json:"fixed32_value,omitempty"` - BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` - StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` + SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested" json:"single_nested,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` + Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested" json:"nested,omitempty"` + FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` + Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` + Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value" json:"fixed64_value,omitempty"` + Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value" json:"fixed32_value,omitempty"` + BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` BytesValue []byte `protobuf:"bytes,29,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` - Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` - EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` - PathEnumValue pathenum.PathEnum `protobuf:"varint,30,opt,name=path_enum_value,json=pathEnumValue,proto3,enum=grpc.gateway.examples.pathenum.PathEnum" json:"path_enum_value,omitempty"` - NestedPathEnumValue pathenum.MessagePathEnum_NestedPathEnum `protobuf:"varint,31,opt,name=nested_path_enum_value,json=nestedPathEnumValue,proto3,enum=grpc.gateway.examples.pathenum.MessagePathEnum_NestedPathEnum" json:"nested_path_enum_value,omitempty"` - Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value,proto3" json:"sfixed32_value,omitempty"` - Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value,proto3" json:"sfixed64_value,omitempty"` - Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value,proto3" json:"sint32_value,omitempty"` - Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value,proto3" json:"sint64_value,omitempty"` - RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue,proto3" json:"repeated_string_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` + EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` + PathEnumValue pathenum.PathEnum `protobuf:"varint,30,opt,name=path_enum_value,json=pathEnumValue,enum=grpc.gateway.examples.pathenum.PathEnum" json:"path_enum_value,omitempty"` + NestedPathEnumValue pathenum.MessagePathEnum_NestedPathEnum `protobuf:"varint,31,opt,name=nested_path_enum_value,json=nestedPathEnumValue,enum=grpc.gateway.examples.pathenum.MessagePathEnum_NestedPathEnum" json:"nested_path_enum_value,omitempty"` + Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` + Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` + Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` + Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` + RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` // Types that are valid to be assigned to OneofValue: // *ABitOfEverything_OneofEmpty // *ABitOfEverything_OneofString OneofValue isABitOfEverything_OneofValue `protobuf_oneof:"oneof_value"` - MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue,proto3" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum"` - MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue,proto3" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue,proto3" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue,proto3" json:"nonConventionalNameValue,omitempty"` - TimestampValue *timestamp.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue,proto3" json:"timestamp_value,omitempty"` + MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=grpc.gateway.examples.examplepb.NumericEnum"` + MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue" json:"nonConventionalNameValue,omitempty"` + TimestampValue *timestamp.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` // repeated enum value. it is comma-separated in query - RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` + RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -148,6 +148,27 @@ func (m *ABitOfEverything) XXX_DiscardUnknown() { var xxx_messageInfo_ABitOfEverything proto.InternalMessageInfo +type isABitOfEverything_OneofValue interface { + isABitOfEverything_OneofValue() +} + +type ABitOfEverything_OneofEmpty struct { + OneofEmpty *empty.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"` +} + +func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} +func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} + +func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { + if m != nil { + return m.OneofValue + } + return nil +} + func (m *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested { if m != nil { return m.SingleNested @@ -302,29 +323,6 @@ func (m *ABitOfEverything) GetRepeatedStringValue() []string { return nil } -type isABitOfEverything_OneofValue interface { - isABitOfEverything_OneofValue() -} - -type ABitOfEverything_OneofEmpty struct { - OneofEmpty *empty.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,proto3,oneof"` -} - -type ABitOfEverything_OneofString struct { - OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,proto3,oneof"` -} - -func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} - -func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} - -func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { - if m != nil { - return m.OneofValue - } - return nil -} - func (m *ABitOfEverything) GetOneofEmpty() *empty.Empty { if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok { return x.OneofEmpty @@ -454,9 +452,9 @@ func _ABitOfEverything_OneofSizer(msg proto.Message) (n int) { // Nested is nested type. type ABitOfEverything_Nested struct { // name is nested field. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Amount uint32 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` - Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,proto3,enum=grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` + 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=grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -510,22 +508,22 @@ func (m *ABitOfEverything_Nested) GetOk() ABitOfEverything_Nested_DeepEnum { // ABitOfEverythingRepeated is used to validate repeated path parameter functionality type ABitOfEverythingRepeated struct { // repeated values. they are comma-separated in path - PathRepeatedFloatValue []float32 `protobuf:"fixed32,1,rep,packed,name=path_repeated_float_value,json=pathRepeatedFloatValue,proto3" json:"path_repeated_float_value,omitempty"` - PathRepeatedDoubleValue []float64 `protobuf:"fixed64,2,rep,packed,name=path_repeated_double_value,json=pathRepeatedDoubleValue,proto3" json:"path_repeated_double_value,omitempty"` - PathRepeatedInt64Value []int64 `protobuf:"varint,3,rep,packed,name=path_repeated_int64_value,json=pathRepeatedInt64Value,proto3" json:"path_repeated_int64_value,omitempty"` - PathRepeatedUint64Value []uint64 `protobuf:"varint,4,rep,packed,name=path_repeated_uint64_value,json=pathRepeatedUint64Value,proto3" json:"path_repeated_uint64_value,omitempty"` - PathRepeatedInt32Value []int32 `protobuf:"varint,5,rep,packed,name=path_repeated_int32_value,json=pathRepeatedInt32Value,proto3" json:"path_repeated_int32_value,omitempty"` - PathRepeatedFixed64Value []uint64 `protobuf:"fixed64,6,rep,packed,name=path_repeated_fixed64_value,json=pathRepeatedFixed64Value,proto3" json:"path_repeated_fixed64_value,omitempty"` - PathRepeatedFixed32Value []uint32 `protobuf:"fixed32,7,rep,packed,name=path_repeated_fixed32_value,json=pathRepeatedFixed32Value,proto3" json:"path_repeated_fixed32_value,omitempty"` - PathRepeatedBoolValue []bool `protobuf:"varint,8,rep,packed,name=path_repeated_bool_value,json=pathRepeatedBoolValue,proto3" json:"path_repeated_bool_value,omitempty"` - PathRepeatedStringValue []string `protobuf:"bytes,9,rep,name=path_repeated_string_value,json=pathRepeatedStringValue,proto3" json:"path_repeated_string_value,omitempty"` + PathRepeatedFloatValue []float32 `protobuf:"fixed32,1,rep,packed,name=path_repeated_float_value,json=pathRepeatedFloatValue" json:"path_repeated_float_value,omitempty"` + PathRepeatedDoubleValue []float64 `protobuf:"fixed64,2,rep,packed,name=path_repeated_double_value,json=pathRepeatedDoubleValue" json:"path_repeated_double_value,omitempty"` + PathRepeatedInt64Value []int64 `protobuf:"varint,3,rep,packed,name=path_repeated_int64_value,json=pathRepeatedInt64Value" json:"path_repeated_int64_value,omitempty"` + PathRepeatedUint64Value []uint64 `protobuf:"varint,4,rep,packed,name=path_repeated_uint64_value,json=pathRepeatedUint64Value" json:"path_repeated_uint64_value,omitempty"` + PathRepeatedInt32Value []int32 `protobuf:"varint,5,rep,packed,name=path_repeated_int32_value,json=pathRepeatedInt32Value" json:"path_repeated_int32_value,omitempty"` + PathRepeatedFixed64Value []uint64 `protobuf:"fixed64,6,rep,packed,name=path_repeated_fixed64_value,json=pathRepeatedFixed64Value" json:"path_repeated_fixed64_value,omitempty"` + PathRepeatedFixed32Value []uint32 `protobuf:"fixed32,7,rep,packed,name=path_repeated_fixed32_value,json=pathRepeatedFixed32Value" json:"path_repeated_fixed32_value,omitempty"` + PathRepeatedBoolValue []bool `protobuf:"varint,8,rep,packed,name=path_repeated_bool_value,json=pathRepeatedBoolValue" json:"path_repeated_bool_value,omitempty"` + PathRepeatedStringValue []string `protobuf:"bytes,9,rep,name=path_repeated_string_value,json=pathRepeatedStringValue" json:"path_repeated_string_value,omitempty"` PathRepeatedBytesValue [][]byte `protobuf:"bytes,10,rep,name=path_repeated_bytes_value,json=pathRepeatedBytesValue,proto3" json:"path_repeated_bytes_value,omitempty"` - PathRepeatedUint32Value []uint32 `protobuf:"varint,11,rep,packed,name=path_repeated_uint32_value,json=pathRepeatedUint32Value,proto3" json:"path_repeated_uint32_value,omitempty"` - PathRepeatedEnumValue []NumericEnum `protobuf:"varint,12,rep,packed,name=path_repeated_enum_value,json=pathRepeatedEnumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"path_repeated_enum_value,omitempty"` - PathRepeatedSfixed32Value []int32 `protobuf:"fixed32,13,rep,packed,name=path_repeated_sfixed32_value,json=pathRepeatedSfixed32Value,proto3" json:"path_repeated_sfixed32_value,omitempty"` - PathRepeatedSfixed64Value []int64 `protobuf:"fixed64,14,rep,packed,name=path_repeated_sfixed64_value,json=pathRepeatedSfixed64Value,proto3" json:"path_repeated_sfixed64_value,omitempty"` - PathRepeatedSint32Value []int32 `protobuf:"zigzag32,15,rep,packed,name=path_repeated_sint32_value,json=pathRepeatedSint32Value,proto3" json:"path_repeated_sint32_value,omitempty"` - PathRepeatedSint64Value []int64 `protobuf:"zigzag64,16,rep,packed,name=path_repeated_sint64_value,json=pathRepeatedSint64Value,proto3" json:"path_repeated_sint64_value,omitempty"` + PathRepeatedUint32Value []uint32 `protobuf:"varint,11,rep,packed,name=path_repeated_uint32_value,json=pathRepeatedUint32Value" json:"path_repeated_uint32_value,omitempty"` + PathRepeatedEnumValue []NumericEnum `protobuf:"varint,12,rep,packed,name=path_repeated_enum_value,json=pathRepeatedEnumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"path_repeated_enum_value,omitempty"` + PathRepeatedSfixed32Value []int32 `protobuf:"fixed32,13,rep,packed,name=path_repeated_sfixed32_value,json=pathRepeatedSfixed32Value" json:"path_repeated_sfixed32_value,omitempty"` + PathRepeatedSfixed64Value []int64 `protobuf:"fixed64,14,rep,packed,name=path_repeated_sfixed64_value,json=pathRepeatedSfixed64Value" json:"path_repeated_sfixed64_value,omitempty"` + PathRepeatedSint32Value []int32 `protobuf:"zigzag32,15,rep,packed,name=path_repeated_sint32_value,json=pathRepeatedSint32Value" json:"path_repeated_sint32_value,omitempty"` + PathRepeatedSint64Value []int64 `protobuf:"zigzag64,16,rep,packed,name=path_repeated_sint64_value,json=pathRepeatedSint64Value" json:"path_repeated_sint64_value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -668,7 +666,7 @@ func (m *ABitOfEverythingRepeated) GetPathRepeatedSint64Value() []int64 { } type Body struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -706,8 +704,8 @@ func (m *Body) GetName() string { } type MessageWithBody struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Data *Body `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Data *Body `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -772,9 +770,8 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// ABitOfEverythingServiceClient is the client API for ABitOfEverythingService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for ABitOfEverythingService service + type ABitOfEverythingServiceClient interface { // Create a new ABitOfEverything // @@ -812,7 +809,7 @@ func NewABitOfEverythingServiceClient(cc *grpc.ClientConn) ABitOfEverythingServi func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -821,7 +818,7 @@ func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEv func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -830,7 +827,7 @@ func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABit func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -839,7 +836,7 @@ func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdM func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -848,7 +845,7 @@ func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEv func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -857,7 +854,7 @@ func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdM func (c *aBitOfEverythingServiceClient) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -866,7 +863,7 @@ func (c *aBitOfEverythingServiceClient) GetQuery(ctx context.Context, in *ABitOf func (c *aBitOfEverythingServiceClient) GetRepeatedQuery(ctx context.Context, in *ABitOfEverythingRepeated, opts ...grpc.CallOption) (*ABitOfEverythingRepeated, error) { out := new(ABitOfEverythingRepeated) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetRepeatedQuery", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetRepeatedQuery", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -875,7 +872,7 @@ func (c *aBitOfEverythingServiceClient) GetRepeatedQuery(ctx context.Context, in func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *sub.StringMessage, opts ...grpc.CallOption) (*sub.StringMessage, error) { out := new(sub.StringMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -884,7 +881,7 @@ func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *sub.String func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -893,7 +890,7 @@ func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *AB func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *duration.Duration, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -902,7 +899,7 @@ func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *dura func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -911,7 +908,7 @@ func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *empty.E func (c *aBitOfEverythingServiceClient) ErrorWithDetails(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/ErrorWithDetails", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/ErrorWithDetails", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -920,7 +917,7 @@ func (c *aBitOfEverythingServiceClient) ErrorWithDetails(ctx context.Context, in func (c *aBitOfEverythingServiceClient) GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetMessageWithBody", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetMessageWithBody", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -929,14 +926,15 @@ func (c *aBitOfEverythingServiceClient) GetMessageWithBody(ctx context.Context, func (c *aBitOfEverythingServiceClient) PostWithEmptyBody(ctx context.Context, in *Body, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PostWithEmptyBody", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PostWithEmptyBody", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// ABitOfEverythingServiceServer is the server API for ABitOfEverythingService service. +// Server API for ABitOfEverythingService service + type ABitOfEverythingServiceServer interface { // Create a new ABitOfEverything // @@ -1285,9 +1283,8 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ Metadata: "examples/proto/examplepb/a_bit_of_everything.proto", } -// CamelCaseServiceNameClient is the client API for CamelCaseServiceName service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for CamelCaseServiceName service + type CamelCaseServiceNameClient interface { Empty(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) } @@ -1302,14 +1299,15 @@ func NewCamelCaseServiceNameClient(cc *grpc.ClientConn) CamelCaseServiceNameClie func (c *camelCaseServiceNameClient) Empty(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.camelCaseServiceName/Empty", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.camelCaseServiceName/Empty", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// CamelCaseServiceNameServer is the server API for CamelCaseServiceName service. +// Server API for CamelCaseServiceName service + type CamelCaseServiceNameServer interface { Empty(context.Context, *empty.Empty) (*empty.Empty, error) } @@ -1349,9 +1347,8 @@ var _CamelCaseServiceName_serviceDesc = grpc.ServiceDesc{ Metadata: "examples/proto/examplepb/a_bit_of_everything.proto", } -// AnotherServiceWithNoBindingsClient is the client API for AnotherServiceWithNoBindings service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for AnotherServiceWithNoBindings service + type AnotherServiceWithNoBindingsClient interface { NoBindings(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) } @@ -1366,14 +1363,15 @@ func NewAnotherServiceWithNoBindingsClient(cc *grpc.ClientConn) AnotherServiceWi func (c *anotherServiceWithNoBindingsClient) NoBindings(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// AnotherServiceWithNoBindingsServer is the server API for AnotherServiceWithNoBindings service. +// Server API for AnotherServiceWithNoBindings service + type AnotherServiceWithNoBindingsServer interface { NoBindings(context.Context, *empty.Empty) (*empty.Empty, error) } diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 461028cb570..1495eb269f1 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -28,7 +28,7 @@ "operationId": "CreateBody", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } @@ -72,7 +72,7 @@ "operationId": "Echo", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/subStringMessage" } @@ -122,7 +122,7 @@ "operationId": "GetQuery", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/protobufEmpty" } @@ -376,7 +376,7 @@ "operationId": "Create", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } @@ -543,7 +543,7 @@ "operationId": "DeepPathEcho", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } @@ -592,7 +592,7 @@ "operationId": "Lookup", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } @@ -630,7 +630,7 @@ "operationId": "Delete", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/protobufEmpty" } @@ -677,7 +677,7 @@ "operationId": "Update", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/protobufEmpty" } @@ -725,7 +725,7 @@ "operationId": "GetRepeatedQuery", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbABitOfEverythingRepeated" } @@ -956,7 +956,7 @@ "operationId": "Echo3", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/subStringMessage" } @@ -1006,7 +1006,7 @@ "operationId": "Echo2", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/subStringMessage" } @@ -1060,7 +1060,7 @@ "operationId": "Empty", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/protobufEmpty" } @@ -1092,7 +1092,7 @@ "operationId": "ErrorWithDetails", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/protobufEmpty" } @@ -1124,7 +1124,7 @@ "operationId": "PostWithEmptyBody", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/protobufEmpty" } @@ -1172,7 +1172,7 @@ "operationId": "Timeout", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/protobufEmpty" } @@ -1204,7 +1204,7 @@ "operationId": "GetMessageWithBody", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/protobufEmpty" } diff --git a/examples/proto/examplepb/echo_service.pb.go b/examples/proto/examplepb/echo_service.pb.go index da8af13fbf9..905eaa93a44 100644 --- a/examples/proto/examplepb/echo_service.pb.go +++ b/examples/proto/examplepb/echo_service.pb.go @@ -71,16 +71,14 @@ type isEmbedded_Mark interface { } type Embedded_Progress struct { - Progress int64 `protobuf:"varint,1,opt,name=progress,proto3,oneof"` + Progress int64 `protobuf:"varint,1,opt,name=progress,oneof"` } - type Embedded_Note struct { - Note string `protobuf:"bytes,2,opt,name=note,proto3,oneof"` + Note string `protobuf:"bytes,2,opt,name=note,oneof"` } func (*Embedded_Progress) isEmbedded_Mark() {} - -func (*Embedded_Note) isEmbedded_Mark() {} +func (*Embedded_Note) isEmbedded_Mark() {} func (m *Embedded) GetMark() isEmbedded_Mark { if m != nil { @@ -171,13 +169,13 @@ func _Embedded_OneofSizer(msg proto.Message) (n int) { // SimpleMessage represents a simple message sent to the Echo service. type SimpleMessage struct { // Id represents the message identifier. - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Num int64 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Num int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` // Types that are valid to be assigned to Code: // *SimpleMessage_LineNum // *SimpleMessage_Lang Code isSimpleMessage_Code `protobuf_oneof:"code"` - Status *Embedded `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` + Status *Embedded `protobuf:"bytes,5,opt,name=status" json:"status,omitempty"` // Types that are valid to be assigned to Ext: // *SimpleMessage_En // *SimpleMessage_No @@ -211,35 +209,30 @@ func (m *SimpleMessage) XXX_DiscardUnknown() { var xxx_messageInfo_SimpleMessage proto.InternalMessageInfo -func (m *SimpleMessage) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *SimpleMessage) GetNum() int64 { - if m != nil { - return m.Num - } - return 0 -} - type isSimpleMessage_Code interface { isSimpleMessage_Code() } +type isSimpleMessage_Ext interface { + isSimpleMessage_Ext() +} type SimpleMessage_LineNum struct { - LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,proto3,oneof"` + LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,oneof"` } - type SimpleMessage_Lang struct { - Lang string `protobuf:"bytes,4,opt,name=lang,proto3,oneof"` + Lang string `protobuf:"bytes,4,opt,name=lang,oneof"` +} +type SimpleMessage_En struct { + En int64 `protobuf:"varint,6,opt,name=en,oneof"` +} +type SimpleMessage_No struct { + No *Embedded `protobuf:"bytes,7,opt,name=no,oneof"` } func (*SimpleMessage_LineNum) isSimpleMessage_Code() {} - -func (*SimpleMessage_Lang) isSimpleMessage_Code() {} +func (*SimpleMessage_Lang) isSimpleMessage_Code() {} +func (*SimpleMessage_En) isSimpleMessage_Ext() {} +func (*SimpleMessage_No) isSimpleMessage_Ext() {} func (m *SimpleMessage) GetCode() isSimpleMessage_Code { if m != nil { @@ -247,6 +240,26 @@ func (m *SimpleMessage) GetCode() isSimpleMessage_Code { } return nil } +func (m *SimpleMessage) GetExt() isSimpleMessage_Ext { + if m != nil { + return m.Ext + } + return nil +} + +func (m *SimpleMessage) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *SimpleMessage) GetNum() int64 { + if m != nil { + return m.Num + } + return 0 +} func (m *SimpleMessage) GetLineNum() int64 { if x, ok := m.GetCode().(*SimpleMessage_LineNum); ok { @@ -269,29 +282,6 @@ func (m *SimpleMessage) GetStatus() *Embedded { return nil } -type isSimpleMessage_Ext interface { - isSimpleMessage_Ext() -} - -type SimpleMessage_En struct { - En int64 `protobuf:"varint,6,opt,name=en,proto3,oneof"` -} - -type SimpleMessage_No struct { - No *Embedded `protobuf:"bytes,7,opt,name=no,proto3,oneof"` -} - -func (*SimpleMessage_En) isSimpleMessage_Ext() {} - -func (*SimpleMessage_No) isSimpleMessage_Ext() {} - -func (m *SimpleMessage) GetExt() isSimpleMessage_Ext { - if m != nil { - return m.Ext - } - return nil -} - func (m *SimpleMessage) GetEn() int64 { if x, ok := m.GetExt().(*SimpleMessage_En); ok { return x.En @@ -429,9 +419,8 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// EchoServiceClient is the client API for EchoService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for EchoService service + type EchoServiceClient interface { // Echo method receives a simple message and returns it. // @@ -454,7 +443,7 @@ func NewEchoServiceClient(cc *grpc.ClientConn) EchoServiceClient { func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/Echo", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/Echo", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -463,7 +452,7 @@ func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts .. func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoBody", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoBody", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -472,14 +461,15 @@ func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opt func (c *echoServiceClient) EchoDelete(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoDelete", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoDelete", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// EchoServiceServer is the server API for EchoService service. +// Server API for EchoService service + type EchoServiceServer interface { // Echo method receives a simple message and returns it. // diff --git a/examples/proto/examplepb/echo_service.swagger.json b/examples/proto/examplepb/echo_service.swagger.json index ddcf349261d..f1687bccf64 100644 --- a/examples/proto/examplepb/echo_service.swagger.json +++ b/examples/proto/examplepb/echo_service.swagger.json @@ -23,7 +23,7 @@ "operationId": "Echo", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } @@ -50,7 +50,7 @@ "operationId": "Echo2", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } @@ -130,7 +130,7 @@ "operationId": "Echo3", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } @@ -210,7 +210,7 @@ "operationId": "Echo4", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } @@ -284,7 +284,7 @@ "operationId": "Echo5", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } @@ -357,7 +357,7 @@ "operationId": "EchoBody", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } @@ -384,7 +384,7 @@ "operationId": "EchoDelete", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } diff --git a/examples/proto/examplepb/flow_combination.pb.go b/examples/proto/examplepb/flow_combination.pb.go index 25e2b775e50..20b2402f9d0 100644 --- a/examples/proto/examplepb/flow_combination.pb.go +++ b/examples/proto/examplepb/flow_combination.pb.go @@ -55,9 +55,9 @@ func (m *EmptyProto) XXX_DiscardUnknown() { var xxx_messageInfo_EmptyProto proto.InternalMessageInfo type NonEmptyProto struct { - A string `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` - B string `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` - C string `protobuf:"bytes,3,opt,name=c,proto3" json:"c,omitempty"` + A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` + B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"` + C string `protobuf:"bytes,3,opt,name=c" json:"c,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -109,7 +109,7 @@ func (m *NonEmptyProto) GetC() string { } type UnaryProto struct { - Str string `protobuf:"bytes,1,opt,name=str,proto3" json:"str,omitempty"` + Str string `protobuf:"bytes,1,opt,name=str" json:"str,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -147,9 +147,9 @@ func (m *UnaryProto) GetStr() string { } type NestedProto struct { - A *UnaryProto `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` - B string `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` - C string `protobuf:"bytes,3,opt,name=c,proto3" json:"c,omitempty"` + A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` + B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"` + C string `protobuf:"bytes,3,opt,name=c" json:"c,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -201,7 +201,7 @@ func (m *NestedProto) GetC() string { } type SingleNestedProto struct { - A *UnaryProto `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` + A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -254,9 +254,8 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// FlowCombinationClient is the client API for FlowCombination service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for FlowCombination service + type FlowCombinationClient interface { RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) @@ -280,7 +279,7 @@ func NewFlowCombinationClient(cc *grpc.ClientConn) FlowCombinationClient { func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -288,7 +287,7 @@ func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, } func (c *flowCombinationClient) RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[0], "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[0], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyStream", opts...) if err != nil { return nil, err } @@ -320,7 +319,7 @@ func (x *flowCombinationRpcEmptyStreamClient) Recv() (*EmptyProto, error) { } func (c *flowCombinationClient) StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[1], "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyRpc", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[1], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyRpc", opts...) if err != nil { return nil, err } @@ -354,7 +353,7 @@ func (x *flowCombinationStreamEmptyRpcClient) CloseAndRecv() (*EmptyProto, error } func (c *flowCombinationClient) StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[2], "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[2], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyStream", opts...) if err != nil { return nil, err } @@ -386,7 +385,7 @@ func (x *flowCombinationStreamEmptyStreamClient) Recv() (*EmptyProto, error) { func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -395,7 +394,7 @@ func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProt func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -404,7 +403,7 @@ func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in * func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -412,7 +411,7 @@ func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *Nested } func (c *flowCombinationClient) RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[3], "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[3], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyStream", opts...) if err != nil { return nil, err } @@ -444,7 +443,7 @@ func (x *flowCombinationRpcBodyStreamClient) Recv() (*EmptyProto, error) { } func (c *flowCombinationClient) RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[4], "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[4], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...) if err != nil { return nil, err } @@ -476,7 +475,7 @@ func (x *flowCombinationRpcPathSingleNestedStreamClient) Recv() (*EmptyProto, er } func (c *flowCombinationClient) RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[5], "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[5], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedStream", opts...) if err != nil { return nil, err } @@ -507,7 +506,8 @@ func (x *flowCombinationRpcPathNestedStreamClient) Recv() (*EmptyProto, error) { return m, nil } -// FlowCombinationServer is the server API for FlowCombination service. +// Server API for FlowCombination service + type FlowCombinationServer interface { RpcEmptyRpc(context.Context, *EmptyProto) (*EmptyProto, error) RpcEmptyStream(*EmptyProto, FlowCombination_RpcEmptyStreamServer) error diff --git a/examples/proto/examplepb/response_body_service.pb.go b/examples/proto/examplepb/response_body_service.pb.go index fcad76e5898..8c7123740d4 100644 --- a/examples/proto/examplepb/response_body_service.pb.go +++ b/examples/proto/examplepb/response_body_service.pb.go @@ -25,7 +25,7 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type ResponseBodyIn struct { - Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Data string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -63,7 +63,7 @@ func (m *ResponseBodyIn) GetData() string { } type ResponseBodyOut struct { - Response *ResponseBodyOut_Response `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"` + Response *ResponseBodyOut_Response `protobuf:"bytes,2,opt,name=response" json:"response,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -101,7 +101,7 @@ func (m *ResponseBodyOut) GetResponse() *ResponseBodyOut_Response { } type ResponseBodyOut_Response struct { - Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Data string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -152,9 +152,8 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// ResponseBodyServiceClient is the client API for ResponseBodyService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for ResponseBodyService service + type ResponseBodyServiceClient interface { GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) } @@ -169,14 +168,15 @@ func NewResponseBodyServiceClient(cc *grpc.ClientConn) ResponseBodyServiceClient func (c *responseBodyServiceClient) GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) { out := new(ResponseBodyOut) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ResponseBodyService/GetResponseBody", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ResponseBodyService/GetResponseBody", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// ResponseBodyServiceServer is the server API for ResponseBodyService service. +// Server API for ResponseBodyService service + type ResponseBodyServiceServer interface { GetResponseBody(context.Context, *ResponseBodyIn) (*ResponseBodyOut, error) } diff --git a/examples/proto/examplepb/stream.pb.go b/examples/proto/examplepb/stream.pb.go index cc0c274c8ea..c598d8a548b 100644 --- a/examples/proto/examplepb/stream.pb.go +++ b/examples/proto/examplepb/stream.pb.go @@ -34,9 +34,8 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// StreamServiceClient is the client API for StreamService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for StreamService service + type StreamServiceClient interface { BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) List(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error) @@ -52,7 +51,7 @@ func NewStreamServiceClient(cc *grpc.ClientConn) StreamServiceClient { } func (c *streamServiceClient) BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) { - stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[0], "/grpc.gateway.examples.examplepb.StreamService/BulkCreate", opts...) + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[0], c.cc, "/grpc.gateway.examples.examplepb.StreamService/BulkCreate", opts...) if err != nil { return nil, err } @@ -86,7 +85,7 @@ func (x *streamServiceBulkCreateClient) CloseAndRecv() (*empty.Empty, error) { } func (c *streamServiceClient) List(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error) { - stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[1], "/grpc.gateway.examples.examplepb.StreamService/List", opts...) + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[1], c.cc, "/grpc.gateway.examples.examplepb.StreamService/List", opts...) if err != nil { return nil, err } @@ -118,7 +117,7 @@ func (x *streamServiceListClient) Recv() (*ABitOfEverything, error) { } func (c *streamServiceClient) BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) { - stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[2], "/grpc.gateway.examples.examplepb.StreamService/BulkEcho", opts...) + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[2], c.cc, "/grpc.gateway.examples.examplepb.StreamService/BulkEcho", opts...) if err != nil { return nil, err } @@ -148,7 +147,8 @@ func (x *streamServiceBulkEchoClient) Recv() (*sub.StringMessage, error) { return m, nil } -// StreamServiceServer is the server API for StreamService service. +// Server API for StreamService service + type StreamServiceServer interface { BulkCreate(StreamService_BulkCreateServer) error List(*empty.Empty, StreamService_ListServer) error diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.go b/examples/proto/examplepb/unannotated_echo_service.pb.go index 28f0d7311d0..7e2dd22f1c7 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.go @@ -37,9 +37,9 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // UnannotatedSimpleMessage represents a simple message sent to the unannotated Echo service. type UnannotatedSimpleMessage struct { // Id represents the message identifier. - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Num int64 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` - Duration *duration.Duration `protobuf:"bytes,3,opt,name=duration,proto3" json:"duration,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Num int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` + Duration *duration.Duration `protobuf:"bytes,3,opt,name=duration" json:"duration,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -102,9 +102,8 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// UnannotatedEchoServiceClient is the client API for UnannotatedEchoService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for UnannotatedEchoService service + type UnannotatedEchoServiceClient interface { // Echo method receives a simple message and returns it. // @@ -127,7 +126,7 @@ func NewUnannotatedEchoServiceClient(cc *grpc.ClientConn) UnannotatedEchoService func (c *unannotatedEchoServiceClient) Echo(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/Echo", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/Echo", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -136,7 +135,7 @@ func (c *unannotatedEchoServiceClient) Echo(ctx context.Context, in *Unannotated func (c *unannotatedEchoServiceClient) EchoBody(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoBody", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoBody", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -145,14 +144,15 @@ func (c *unannotatedEchoServiceClient) EchoBody(ctx context.Context, in *Unannot func (c *unannotatedEchoServiceClient) EchoDelete(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoDelete", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoDelete", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// UnannotatedEchoServiceServer is the server API for UnannotatedEchoService service. +// Server API for UnannotatedEchoService service + type UnannotatedEchoServiceServer interface { // Echo method receives a simple message and returns it. // diff --git a/examples/proto/examplepb/unannotated_echo_service.swagger.json b/examples/proto/examplepb/unannotated_echo_service.swagger.json index fcbf16573ee..48825985057 100644 --- a/examples/proto/examplepb/unannotated_echo_service.swagger.json +++ b/examples/proto/examplepb/unannotated_echo_service.swagger.json @@ -23,7 +23,7 @@ "operationId": "Echo", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } @@ -50,7 +50,7 @@ "operationId": "Echo2", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } @@ -89,7 +89,7 @@ "operationId": "EchoBody", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } @@ -116,7 +116,7 @@ "operationId": "EchoDelete", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } diff --git a/examples/proto/examplepb/wrappers.pb.go b/examples/proto/examplepb/wrappers.pb.go index fb44ca7aba9..23fdd65a8b3 100644 --- a/examples/proto/examplepb/wrappers.pb.go +++ b/examples/proto/examplepb/wrappers.pb.go @@ -26,15 +26,15 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type Wrappers struct { - StringValue *wrappers.StringValue `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` - Int32Value *wrappers.Int32Value `protobuf:"bytes,2,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` - Int64Value *wrappers.Int64Value `protobuf:"bytes,3,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` - FloatValue *wrappers.FloatValue `protobuf:"bytes,4,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` - DoubleValue *wrappers.DoubleValue `protobuf:"bytes,5,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` - BoolValue *wrappers.BoolValue `protobuf:"bytes,6,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` - Uint32Value *wrappers.UInt32Value `protobuf:"bytes,7,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` - Uint64Value *wrappers.UInt64Value `protobuf:"bytes,8,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` - BytesValue *wrappers.BytesValue `protobuf:"bytes,9,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` + StringValue *wrappers.StringValue `protobuf:"bytes,1,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + Int32Value *wrappers.Int32Value `protobuf:"bytes,2,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` + Int64Value *wrappers.Int64Value `protobuf:"bytes,3,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` + FloatValue *wrappers.FloatValue `protobuf:"bytes,4,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` + DoubleValue *wrappers.DoubleValue `protobuf:"bytes,5,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + BoolValue *wrappers.BoolValue `protobuf:"bytes,6,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` + Uint32Value *wrappers.UInt32Value `protobuf:"bytes,7,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` + Uint64Value *wrappers.UInt64Value `protobuf:"bytes,8,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` + BytesValue *wrappers.BytesValue `protobuf:"bytes,9,opt,name=bytes_value,json=bytesValue" json:"bytes_value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -139,9 +139,8 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// WrappersServiceClient is the client API for WrappersService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for WrappersService service + type WrappersServiceClient interface { Create(ctx context.Context, in *Wrappers, opts ...grpc.CallOption) (*Wrappers, error) } @@ -156,14 +155,15 @@ func NewWrappersServiceClient(cc *grpc.ClientConn) WrappersServiceClient { func (c *wrappersServiceClient) Create(ctx context.Context, in *Wrappers, opts ...grpc.CallOption) (*Wrappers, error) { out := new(Wrappers) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/Create", in, out, opts...) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/Create", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// WrappersServiceServer is the server API for WrappersService service. +// Server API for WrappersService service + type WrappersServiceServer interface { Create(context.Context, *Wrappers) (*Wrappers, error) } diff --git a/examples/proto/examplepb/wrappers.swagger.json b/examples/proto/examplepb/wrappers.swagger.json index f30c5d4f0a6..8e2df83bb20 100644 --- a/examples/proto/examplepb/wrappers.swagger.json +++ b/examples/proto/examplepb/wrappers.swagger.json @@ -20,7 +20,7 @@ "operationId": "Create", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/examplepbWrappers" } diff --git a/examples/proto/sub2/message.pb.go b/examples/proto/sub2/message.pb.go index 6819b67ae3c..a0a812c7d0f 100644 --- a/examples/proto/sub2/message.pb.go +++ b/examples/proto/sub2/message.pb.go @@ -19,7 +19,7 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type IdMessage struct { - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index 931bc38f441..a5a31210c02 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -190,17 +190,17 @@ func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { // // TODO(ivucica): document fields type Swagger struct { - Swagger string `protobuf:"bytes,1,opt,name=swagger,proto3" json:"swagger,omitempty"` - Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` - Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` - BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` - Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,proto3,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` - Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` - Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` - Responses map[string]*Response `protobuf:"bytes,10,rep,name=responses,proto3" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,11,opt,name=security_definitions,json=securityDefinitions,proto3" json:"security_definitions,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + Swagger string `protobuf:"bytes,1,opt,name=swagger" json:"swagger,omitempty"` + Info *Info `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"` + Host string `protobuf:"bytes,3,opt,name=host" json:"host,omitempty"` + BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath" json:"base_path,omitempty"` + Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` + Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"` + Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` + Responses map[string]*Response `protobuf:"bytes,10,rep,name=responses" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,11,opt,name=security_definitions,json=securityDefinitions" json:"security_definitions,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security" json:"security,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -313,17 +313,17 @@ func (m *Swagger) GetExternalDocs() *ExternalDocumentation { // // TODO(ivucica): document fields type Operation struct { - Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` - Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` - Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` - Responses map[string]*Response `protobuf:"bytes,9,rep,name=responses,proto3" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Schemes []string `protobuf:"bytes,10,rep,name=schemes,proto3" json:"schemes,omitempty"` - Deprecated bool `protobuf:"varint,11,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` + Tags []string `protobuf:"bytes,1,rep,name=tags" json:"tags,omitempty"` + Summary string `protobuf:"bytes,2,opt,name=summary" json:"summary,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` + OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId" json:"operation_id,omitempty"` + Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"` + Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` + Responses map[string]*Response `protobuf:"bytes,9,rep,name=responses" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Schemes []string `protobuf:"bytes,10,rep,name=schemes" json:"schemes,omitempty"` + Deprecated bool `protobuf:"varint,11,opt,name=deprecated" json:"deprecated,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security" json:"security,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -437,10 +437,10 @@ func (m *Operation) GetSecurity() []*SecurityRequirement { type Response struct { // `Description` is a short description of the response. // GFM syntax can be used for rich text representation. - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"` // `Schema` optionally defines the structure of the response. // If `Schema` is not provided, it means there is no content to the response. - Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + Schema *Schema `protobuf:"bytes,2,opt,name=schema" json:"schema,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -490,11 +490,11 @@ func (m *Response) GetSchema() *Schema { // // TODO(ivucica): document fields type Info struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"` - Contact *Contact `protobuf:"bytes,4,opt,name=contact,proto3" json:"contact,omitempty"` - Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` + Title string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService" json:"terms_of_service,omitempty"` + Contact *Contact `protobuf:"bytes,4,opt,name=contact" json:"contact,omitempty"` + Version string `protobuf:"bytes,6,opt,name=version" json:"version,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -565,9 +565,9 @@ func (m *Info) GetVersion() string { // // TODO(ivucica): document fields type Contact struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` + Email string `protobuf:"bytes,3,opt,name=email" json:"email,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -625,8 +625,8 @@ func (m *Contact) GetEmail() string { // // TODO(ivucica): document fields type ExternalDocumentation struct { - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + Description string `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -676,11 +676,11 @@ func (m *ExternalDocumentation) GetUrl() string { // // TODO(ivucica): document fields type Schema struct { - JsonSchema *JSONSchema `protobuf:"bytes,1,opt,name=json_schema,json=jsonSchema,proto3" json:"json_schema,omitempty"` - Discriminator string `protobuf:"bytes,2,opt,name=discriminator,proto3" json:"discriminator,omitempty"` - ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,5,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - Example *any.Any `protobuf:"bytes,6,opt,name=example,proto3" json:"example,omitempty"` + JsonSchema *JSONSchema `protobuf:"bytes,1,opt,name=json_schema,json=jsonSchema" json:"json_schema,omitempty"` + Discriminator string `protobuf:"bytes,2,opt,name=discriminator" json:"discriminator,omitempty"` + ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly" json:"read_only,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,5,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` + Example *any.Any `protobuf:"bytes,6,opt,name=example" json:"example,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -763,27 +763,27 @@ type JSONSchema struct { // the output. // For example: // `ref: ".google.protobuf.Timestamp"`. - Ref string `protobuf:"bytes,3,opt,name=ref,proto3" json:"ref,omitempty"` - Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` - Default string `protobuf:"bytes,7,opt,name=default,proto3" json:"default,omitempty"` - MultipleOf float64 `protobuf:"fixed64,10,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength uint64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength uint64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems uint64 `protobuf:"varint,20,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems uint64 `protobuf:"varint,21,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,22,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - MaxProperties uint64 `protobuf:"varint,24,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"` - MinProperties uint64 `protobuf:"varint,25,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"` - Required []string `protobuf:"bytes,26,rep,name=required,proto3" json:"required,omitempty"` + Ref string `protobuf:"bytes,3,opt,name=ref" json:"ref,omitempty"` + Title string `protobuf:"bytes,5,opt,name=title" json:"title,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description" json:"description,omitempty"` + Default string `protobuf:"bytes,7,opt,name=default" json:"default,omitempty"` + MultipleOf float64 `protobuf:"fixed64,10,opt,name=multiple_of,json=multipleOf" json:"multiple_of,omitempty"` + Maximum float64 `protobuf:"fixed64,11,opt,name=maximum" json:"maximum,omitempty"` + ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum" json:"exclusive_maximum,omitempty"` + Minimum float64 `protobuf:"fixed64,13,opt,name=minimum" json:"minimum,omitempty"` + ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum" json:"exclusive_minimum,omitempty"` + MaxLength uint64 `protobuf:"varint,15,opt,name=max_length,json=maxLength" json:"max_length,omitempty"` + MinLength uint64 `protobuf:"varint,16,opt,name=min_length,json=minLength" json:"min_length,omitempty"` + Pattern string `protobuf:"bytes,17,opt,name=pattern" json:"pattern,omitempty"` + MaxItems uint64 `protobuf:"varint,20,opt,name=max_items,json=maxItems" json:"max_items,omitempty"` + MinItems uint64 `protobuf:"varint,21,opt,name=min_items,json=minItems" json:"min_items,omitempty"` + UniqueItems bool `protobuf:"varint,22,opt,name=unique_items,json=uniqueItems" json:"unique_items,omitempty"` + MaxProperties uint64 `protobuf:"varint,24,opt,name=max_properties,json=maxProperties" json:"max_properties,omitempty"` + MinProperties uint64 `protobuf:"varint,25,opt,name=min_properties,json=minProperties" json:"min_properties,omitempty"` + Required []string `protobuf:"bytes,26,rep,name=required" json:"required,omitempty"` // Items in 'array' must be unique. - Array []string `protobuf:"bytes,34,rep,name=array,proto3" json:"array,omitempty"` - Type []JSONSchema_JSONSchemaSimpleTypes `protobuf:"varint,35,rep,packed,name=type,proto3,enum=grpc.gateway.protoc_gen_swagger.options.JSONSchema_JSONSchemaSimpleTypes" json:"type,omitempty"` + Array []string `protobuf:"bytes,34,rep,name=array" json:"array,omitempty"` + Type []JSONSchema_JSONSchemaSimpleTypes `protobuf:"varint,35,rep,packed,name=type,enum=grpc.gateway.protoc_gen_swagger.options.JSONSchema_JSONSchemaSimpleTypes" json:"type,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -961,8 +961,8 @@ func (m *JSONSchema) GetType() []JSONSchema_JSONSchemaSimpleTypes { type Tag struct { // TODO(ivucica): Description should be extracted from comments on the proto // service object. - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1016,7 +1016,7 @@ func (m *Tag) GetExternalDocs() *ExternalDocumentation { // and only serves to provide the relevant details for each scheme. type SecurityDefinitions struct { // A single security scheme definition, mapping a "name" to the scheme it defines. - Security map[string]*SecurityScheme `protobuf:"bytes,1,rep,name=security,proto3" json:"security,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Security map[string]*SecurityScheme `protobuf:"bytes,1,rep,name=security" json:"security,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1065,36 +1065,36 @@ func (m *SecurityDefinitions) GetSecurity() map[string]*SecurityScheme { type SecurityScheme struct { // Required. The type of the security scheme. Valid values are "basic", // "apiKey" or "oauth2". - Type SecurityScheme_Type `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Type" json:"type,omitempty"` + Type SecurityScheme_Type `protobuf:"varint,1,opt,name=type,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Type" json:"type,omitempty"` // A short description for security scheme. - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` // Required. The name of the header or query parameter to be used. // // Valid for apiKey. - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` // Required. The location of the API key. Valid values are "query" or "header". // // Valid for apiKey. - In SecurityScheme_In `protobuf:"varint,4,opt,name=in,proto3,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_In" json:"in,omitempty"` + In SecurityScheme_In `protobuf:"varint,4,opt,name=in,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_In" json:"in,omitempty"` // Required. The flow used by the OAuth2 security scheme. Valid values are // "implicit", "password", "application" or "accessCode". // // Valid for oauth2. - Flow SecurityScheme_Flow `protobuf:"varint,5,opt,name=flow,proto3,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Flow" json:"flow,omitempty"` + Flow SecurityScheme_Flow `protobuf:"varint,5,opt,name=flow,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Flow" json:"flow,omitempty"` // Required. The authorization URL to be used for this flow. This SHOULD be in // the form of a URL. // // Valid for oauth2/implicit and oauth2/accessCode. - AuthorizationUrl string `protobuf:"bytes,6,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` + AuthorizationUrl string `protobuf:"bytes,6,opt,name=authorization_url,json=authorizationUrl" json:"authorization_url,omitempty"` // Required. The token URL to be used for this flow. This SHOULD be in the // form of a URL. // // Valid for oauth2/password, oauth2/application and oauth2/accessCode. - TokenUrl string `protobuf:"bytes,7,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` + TokenUrl string `protobuf:"bytes,7,opt,name=token_url,json=tokenUrl" json:"token_url,omitempty"` // Required. The available scopes for the OAuth2 security scheme. // // Valid for oauth2. - Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes,proto3" json:"scopes,omitempty"` + Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes" json:"scopes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1196,7 +1196,7 @@ type SecurityRequirement struct { // the Security Definitions. If the security scheme is of type "oauth2", // then the value is a list of scope names required for the execution. // For other security scheme types, the array MUST be empty. - SecurityRequirement map[string]*SecurityRequirement_SecurityRequirementValue `protobuf:"bytes,1,rep,name=security_requirement,json=securityRequirement,proto3" json:"security_requirement,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + SecurityRequirement map[string]*SecurityRequirement_SecurityRequirementValue `protobuf:"bytes,1,rep,name=security_requirement,json=securityRequirement" json:"security_requirement,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1237,7 +1237,7 @@ func (m *SecurityRequirement) GetSecurityRequirement() map[string]*SecurityRequi // scope names required for the execution. For other security scheme types, // the array MUST be empty. type SecurityRequirement_SecurityRequirementValue struct { - Scope []string `protobuf:"bytes,1,rep,name=scope,proto3" json:"scope,omitempty"` + Scope []string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1286,7 +1286,7 @@ func (m *SecurityRequirement_SecurityRequirementValue) GetScope() []string { type Scopes struct { // Maps between a name of a scope to a short description of it (as the value // of the property). - Scope map[string]string `protobuf:"bytes,1,rep,name=scope,proto3" json:"scope,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Scope map[string]string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` diff --git a/runtime/internal/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go index f4af074808b..a06c722c167 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -22,11 +22,11 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // StreamError is a response type which is returned when // streaming rpc returns an error. type StreamError struct { - GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode,proto3" json:"grpc_code,omitempty"` - HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode,proto3" json:"http_code,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` - HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus,proto3" json:"http_status,omitempty"` - Details []*any.Any `protobuf:"bytes,5,rep,name=details,proto3" json:"details,omitempty"` + GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode" json:"grpc_code,omitempty"` + HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode" json:"http_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` + HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus" json:"http_status,omitempty"` + Details []*any.Any `protobuf:"bytes,5,rep,name=details" json:"details,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` From 39930fdec0e540ac22cebfe3b1a967699be61100 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 9 Oct 2018 22:37:26 +0100 Subject: [PATCH 298/552] Replace travis with Circle-CI --- .circleci/Dockerfile | 36 +++++++++++ .circleci/README.md | 22 +++++++ .circleci/config.yml | 97 ++++++++++++++++++++++++++++++ .travis.yml | 82 ------------------------- .travis/bazel-build.sh | 10 --- .travis/bazel-test.sh | 12 ---- .travis/install-bazel.sh | 20 ------ .travis/install-protoc.sh | 19 ------ .travis/install-swagger-codegen.sh | 9 --- CONTRIBUTING.md | 13 ++++ Makefile | 3 +- bin/coverage | 17 ------ 12 files changed, 169 insertions(+), 171 deletions(-) create mode 100644 .circleci/Dockerfile create mode 100644 .circleci/README.md create mode 100644 .circleci/config.yml delete mode 100644 .travis.yml delete mode 100755 .travis/bazel-build.sh delete mode 100755 .travis/bazel-test.sh delete mode 100755 .travis/install-bazel.sh delete mode 100755 .travis/install-protoc.sh delete mode 100755 .travis/install-swagger-codegen.sh delete mode 100755 bin/coverage diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile new file mode 100644 index 00000000000..9285342ec0f --- /dev/null +++ b/.circleci/Dockerfile @@ -0,0 +1,36 @@ +FROM golang:latest + +## Warm apt cache +RUN apt-get update + +# Install swagger-codegen +ENV SWAGGER_CODEGEN_VERSION=2.2.2 +RUN apt-get install -y openjdk-8-jre wget && \ + wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${SWAGGER_CODEGEN_VERSION}/swagger-codegen-cli-${SWAGGER_CODEGEN_VERSION}.jar \ + -O /usr/local/bin/swagger-codegen-cli.jar && \ + apt-get remove -y wget +ENV SWAGGER_CODEGEN="java -jar /usr/local/bin/swagger-codegen-cli.jar" + +# Install protoc +ENV PROTOC_VERSION=3.1.0 +RUN apt-get install -y wget unzip && \ + wget https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \ + -O /protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ + unzip /protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local/ && \ + rm -f /protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ + apt-get remove -y unzip wget + +# Install node +ENV NODE_VERSION=v6.1 +RUN apt-get install -y wget bzip2 && \ + wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash && \ + apt-get remove -y wget + +# Install dep +RUN apt-get install -y wget && \ + wget -qO- https://raw.githubusercontent.com/golang/dep/master/install.sh | sh && \ + apt-get remove -y wget + +# Clean up +RUN apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* diff --git a/.circleci/README.md b/.circleci/README.md new file mode 100644 index 00000000000..6fe89053bbe --- /dev/null +++ b/.circleci/README.md @@ -0,0 +1,22 @@ +## gRPC-Gateway CI testing setup + +Contained within is the CI test setup for the Gateway. It runs on Circle CI. + +### I want to regenerate the files after making changes! + +Great, it should be as simple as thus (run from the root of the directory): + +```bash +$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env \ + /bin/bash -c 'cd /go/src/github.com/grpc-ecosystem/grpc-gateway && \ + make realclean && \ + make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' +``` + +If this has resulted in some file changes in the repo, please ensure you check those in with your merge request. + +### Whats up with the Dockerfile? + +The `Dockerfile` in this folder is used as the build environment when regenerating the files (see above). +The canonical repository for this Dockerfile is `jfbrandhorst/grpc-gateway-build-env`. Please request access +before attempting to make any changes to the Dockerfile. diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000000..a2ad7f9c4b7 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,97 @@ +version: 2 +jobs: + build: + docker: + - image: "golang:latest" + working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + steps: + - checkout + - run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + - run: dep ensure --vendor-only + - run: go build ./... + test: + docker: + - image: "golang:latest" + working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + environment: + GLOG_logtostderr: "1" + steps: + - checkout + - run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + - run: dep ensure --vendor-only + - run: go test -race -coverprofile=coverage.txt ./... + - run: bash <(curl -s https://codecov.io/bash) + node_test: + docker: + - image: "jfbrandhorst/grpc-gateway-build-env" + working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + steps: + - checkout + - run: > + . $HOME/.nvm/nvm.sh && + cd examples/browser && + npm install gulp-cli && + npm install && + ./node_modules/.bin/gulp + generate: + docker: + - image: "jfbrandhorst/grpc-gateway-build-env" + working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + steps: + - checkout + - run: make realclean + - run: make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}" # Set in Docker image + - run: git diff --exit-code + lint: + docker: + - image: "golang:latest" + working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + steps: + - checkout + - run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + - run: dep ensure --vendor-only + - run: go get github.com/golang/lint/golint + - run: make lint + bazel_build: + docker: + - image: "l.gcr.io/google/bazel:latest" + working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + steps: + - checkout + - run: > + bazel + --batch + --output_base=$HOME/.cache/_grpc_gateway_bazel + --host_jvm_args=-Xmx500m + --host_jvm_args=-Xms500m + build + --local_resources=400,1,1.0 + //... + bazel_test: + docker: + - image: "l.gcr.io/google/bazel:latest" + working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + steps: + - checkout + - run: > + bazel + --batch + --output_base=$HOME/.cache/_grpc_gateway_bazel + --host_jvm_args=-Xmx500m + --host_jvm_args=-Xms500m + test + --local_resources=400,1,1.0 + --test_output=errors + --features=race + //... +workflows: + version: 2 + all: + jobs: + - build + - test + - node_test + - generate + - lint + - bazel_build + - bazel_test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 76757804e00..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,82 +0,0 @@ -language: go -sudo: false -go: - - 1.9.x - - 1.10.x - - master -go_import_path: github.com/grpc-ecosystem/grpc-gateway -cache: - directories: - - $HOME/local - - ${TRAVIS_BUILD_DIR}/examples/browser/node_modules - - $HOME/.cache/_grpc_gateway_bazel -before_install: - - if [ "${USE_BAZEL}" = true ]; then ./.travis/install-bazel.sh $BAZEL_VERSION; fi - - test "${USE_BAZEL}" = true || ./.travis/install-protoc.sh $PROTOC_VERSION - - test "${USE_BAZEL}" = true || ./.travis/install-swagger-codegen.sh $SWAGGER_CODEGEN_VERSION - - test "${USE_BAZEL}" = true || (nvm install $NODE_VERSION && nvm use $NODE_VERSION && node --version) - - test "${USE_BAZEL}" = true || go get github.com/golang/lint/golint - - test "${USE_BAZEL}" = true || go get github.com/dghubble/sling - - test "${USE_BAZEL}" = true || go get github.com/go-resty/resty - - test "${USE_BAZEL}" = true || curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh -install: - # Make sure externally referenced packages are go-gettable. - - test "${USE_BAZEL}" = true || - go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway - - test "${USE_BAZEL}" = true || - go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger - - test "${USE_BAZEL}" = true || - go get github.com/grpc-ecosystem/grpc-gateway/runtime - - test "${USE_BAZEL}" = true || - go get github.com/grpc-ecosystem/grpc-gateway/examples/cmd/example-grpc-server - - test "${USE_BAZEL}" = true || - go get github.com/grpc-ecosystem/grpc-gateway/examples/cmd/example-gateway-server - - # Just build if USE_BAZEL - - if [ "${USE_BAZEL}" = true ]; then ./.travis/bazel-build.sh; fi -before_script: - - test "${USE_BAZEL}" = true || - (cd examples/browser && npm install) -script: - # Make sure examples of generated files are up-to-date - - test "${USE_BAZEL}" = true || - (make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar") - - if [ -z "${USE_BAZEL}" ] && - (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && - [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then - test -z "$(git status --porcelain)" || (git status; git diff; exit 1); - fi - - # Unit tests, integration tests and code health checks - - test "${USE_BAZEL}" = true || - env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... - - test "${USE_BAZEL}" = true || - make lint - - test "${USE_BAZEL}" = true || - sh -c 'cd examples/browser && node ./node_modules/gulp/bin/gulp' - - - if [ "${USE_BAZEL}" = true ]; then ./.travis/bazel-test.sh; fi - - # test coverage - - if (go version | grep -q "${GO_VERSION_TO_DIFF_TEST}") && - [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then - env GLOG_logtostderr=1 ./bin/coverage; - fi -after_success: - - bash <(curl -s https://codecov.io/bash) - -env: - global: - - "PATH=$PATH:$HOME/local/bin" - - GO_VERSION_TO_DIFF_TEST="go version go1\.10\.[0-9]\+ linux/amd64" - - BAZEL_VERSION=0.12.0 - - NODE_VERSION=v6.1 - - PROTOC_VERSION=3.1.0 - - SWAGGER_CODEGEN_VERSION=2.2.2 - matrix: - - GATEWAY_PLUGIN_FLAGS= - - GATEWAY_PLUGIN_FLAGS=request_context=false -matrix: - include: - - go: master - env: USE_BAZEL=true diff --git a/.travis/bazel-build.sh b/.travis/bazel-build.sh deleted file mode 100755 index f46781d414b..00000000000 --- a/.travis/bazel-build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -eu - -bazel \ - --batch \ - --output_base=$HOME/.cache/_grpc_gateway_bazel \ - --host_jvm_args=-Xmx500m \ - --host_jvm_args=-Xms500m \ - build \ - --local_resources=400,1,1.0 \ - //... diff --git a/.travis/bazel-test.sh b/.travis/bazel-test.sh deleted file mode 100755 index 86dbbf3270a..00000000000 --- a/.travis/bazel-test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -eu - -bazel \ - --batch \ - --output_base=$HOME/.cache/_grpc_gateway_bazel \ - --host_jvm_args=-Xmx500m \ - --host_jvm_args=-Xms500m \ - test \ - --local_resources=400,1,1.0 \ - --test_output=errors \ - --features=race \ - //... diff --git a/.travis/install-bazel.sh b/.travis/install-bazel.sh deleted file mode 100755 index 9bebe44cdd2..00000000000 --- a/.travis/install-bazel.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -eu - -bazel_version=$1 - -if test -z "${bazel_version}"; then - echo "Usage: .travis/install-bazel.sh bazel-version" - exit 1 -fi - -if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - OS=darwin -else - OS=linux -fi - -filename=bazel-${bazel_version}-installer-${OS}-x86_64.sh -wget https://github.com/bazelbuild/bazel/releases/download/${bazel_version}/${filename} -chmod +x $filename -./$filename --user -rm -f $filename diff --git a/.travis/install-protoc.sh b/.travis/install-protoc.sh deleted file mode 100755 index dee80d861b1..00000000000 --- a/.travis/install-protoc.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -eu -protoc_version=$1 -if test -z "${protoc_version}"; then - echo "Usage: .travis/install-protoc.sh protoc-version" - exit 1 -fi -if [ "`$HOME/local/bin/protoc --version 2>/dev/null | cut -d' ' -f 2`" != ${protoc_version} ]; then - rm -rf $HOME/local/bin $HOME/local/include - - mkdir -p $HOME/tmp $HOME/local - cd $HOME/tmp - wget https://github.com/google/protobuf/releases/download/v${protoc_version}/protoc-${protoc_version}-linux-x86_64.zip - unzip protoc-${protoc_version}-linux-x86_64.zip - mv bin $HOME/local/bin - mv include $HOME/local/include -fi - -echo \$ $HOME/local/bin/protoc --version -$HOME/local/bin/protoc --version diff --git a/.travis/install-swagger-codegen.sh b/.travis/install-swagger-codegen.sh deleted file mode 100755 index ad4c8b56815..00000000000 --- a/.travis/install-swagger-codegen.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -eu -codegen_version=$1 -if test -z "${codegen_version}"; then - echo "Usage: .travis/install-swagger-codegen.sh codegen-version" - exit 1 -fi - -wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${codegen_version}/swagger-codegen-cli-${codegen_version}.jar \ - -O $HOME/local/swagger-codegen-cli.jar diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4f0c59eea8d..8bcfb2794ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,3 +18,16 @@ with us through the issue tracker. ### Code reviews All submissions, including submissions by project members, require review. + +### I want to regenerate the files after making changes! + +Great, it should be as simple as thus (run from the root of the directory): + +```bash +$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env \ + /bin/bash -c 'cd /go/src/github.com/grpc-ecosystem/grpc-gateway && \ + make realclean && \ + make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' +``` + +If this has resulted in some file changes in the repo, please ensure you check those in with your merge request. diff --git a/Makefile b/Makefile index 0d18c0131ca..f2de987b047 100644 --- a/Makefile +++ b/Makefile @@ -127,8 +127,7 @@ generate: $(RUNTIME_GO) $(GO_PLUGIN): dep ensure -vendor-only - go install ./vendor/$(GO_PLUGIN_PKG) - go build -o $@ $(GO_PLUGIN_PKG) + go build -o $@ ./vendor/$(GO_PLUGIN_PKG) $(RUNTIME_GO): $(RUNTIME_PROTO) $(GO_PLUGIN) protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I $(GOPATH)/src/$(GO_PTYPES_ANY_PKG) -I. --go_out=$(PKGMAP):. $(RUNTIME_PROTO) diff --git a/bin/coverage b/bin/coverage deleted file mode 100755 index 65bbe95faa5..00000000000 --- a/bin/coverage +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -euo pipefail -USE_BAZEL=${USE_BAZEL:-false} -> coverage.txt - -if [ "${USE_BAZEL}" = true ]; then - # TODO(yugui) Support bazel - exit 0 -fi - -for d in $(go list ./... | grep -v vendor); do - go test -race -coverprofile=profile.out -covermode=atomic $d - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done From 098e55742e43407b0e8683117c836f77900a383b Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 16 Oct 2018 22:15:02 +0100 Subject: [PATCH 299/552] Fix CircleCI configuration (#777) * Fix CircleCI configuration The original configuration had never actually been run on CircleCI's servers. * Replace mentions of Travis with CircleCI --- .circleci/config.yml | 34 +++++++------------------------- Makefile | 12 ++++-------- README.md | 46 ++++++++++++++++++++++---------------------- docs/index.md | 2 +- 4 files changed, 35 insertions(+), 59 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a2ad7f9c4b7..2707fd7786e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,22 +2,20 @@ version: 2 jobs: build: docker: - - image: "golang:latest" + - image: "jfbrandhorst/grpc-gateway-build-env" working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - - run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - run: dep ensure --vendor-only - run: go build ./... test: docker: - - image: "golang:latest" + - image: "jfbrandhorst/grpc-gateway-build-env" working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway environment: GLOG_logtostderr: "1" steps: - checkout - - run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - run: dep ensure --vendor-only - run: go test -race -coverprofile=coverage.txt ./... - run: bash <(curl -s https://codecov.io/bash) @@ -27,6 +25,7 @@ jobs: working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout + - run: dep ensure --vendor-only - run: > . $HOME/.nvm/nvm.sh && cd examples/browser && @@ -44,13 +43,12 @@ jobs: - run: git diff --exit-code lint: docker: - - image: "golang:latest" + - image: "jfbrandhorst/grpc-gateway-build-env" working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - - run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - run: dep ensure --vendor-only - - run: go get github.com/golang/lint/golint + - run: go get golang.org/x/lint/golint - run: make lint bazel_build: docker: @@ -58,32 +56,14 @@ jobs: working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - - run: > - bazel - --batch - --output_base=$HOME/.cache/_grpc_gateway_bazel - --host_jvm_args=-Xmx500m - --host_jvm_args=-Xms500m - build - --local_resources=400,1,1.0 - //... + - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel --host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m build --local_resources=400,1,1.0 //... bazel_test: docker: - image: "l.gcr.io/google/bazel:latest" working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - - run: > - bazel - --batch - --output_base=$HOME/.cache/_grpc_gateway_bazel - --host_jvm_args=-Xmx500m - --host_jvm_args=-Xms500m - test - --local_resources=400,1,1.0 - --test_output=errors - --features=race - //... + - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel --host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m test --local_resources=400,1,1.0 --test_output=errors --features=race //... workflows: version: 2 all: diff --git a/Makefile b/Makefile index f2de987b047..5cd992cd635 100644 --- a/Makefile +++ b/Makefile @@ -160,26 +160,22 @@ $(ECHO_EXAMPLE_SRCS): $(ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ECHO_EXAMPLE_SPEC) \ -l go -o examples/clients/echo --additional-properties packageName=echo @rm -f $(EXAMPLE_CLIENT_DIR)/echo/README.md \ - $(EXAMPLE_CLIENT_DIR)/echo/git_push.sh \ - $(EXAMPLE_CLIENT_DIR)/echo/.travis.yml + $(EXAMPLE_CLIENT_DIR)/echo/git_push.sh $(ABE_EXAMPLE_SRCS): $(ABE_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ABE_EXAMPLE_SPEC) \ -l go -o examples/clients/abe --additional-properties packageName=abe @rm -f $(EXAMPLE_CLIENT_DIR)/abe/README.md \ - $(EXAMPLE_CLIENT_DIR)/abe/git_push.sh \ - $(EXAMPLE_CLIENT_DIR)/abe/.travis.yml + $(EXAMPLE_CLIENT_DIR)/abe/git_push.sh $(UNANNOTATED_ECHO_EXAMPLE_SRCS): $(UNANNOTATED_ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(UNANNOTATED_ECHO_EXAMPLE_SPEC) \ -l go -o examples/clients/unannotatedecho --additional-properties packageName=unannotatedecho @rm -f $(EXAMPLE_CLIENT_DIR)/unannotatedecho/README.md \ - $(EXAMPLE_CLIENT_DIR)/unannotatedecho/git_push.sh \ - $(EXAMPLE_CLIENT_DIR)/unannotatedecho/.travis.yml + $(EXAMPLE_CLIENT_DIR)/unannotatedecho/git_push.sh $(RESPONSE_BODY_EXAMPLE_SRCS): $(RESPONSE_BODY_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(RESPONSE_BODY_EXAMPLE_SPEC) \ -l go -o examples/clients/responsebody --additional-properties packageName=responsebody @rm -f $(EXAMPLE_CLIENT_DIR)/responsebody/README.md \ - $(EXAMPLE_CLIENT_DIR)/responsebody/git_push.sh \ - $(EXAMPLE_CLIENT_DIR)/responsebody/.travis.yml + $(EXAMPLE_CLIENT_DIR)/responsebody/git_push.sh examples: $(EXAMPLE_DEPSRCS) $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) test: examples diff --git a/README.md b/README.md index 445368e7118..e10f1b660a1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # grpc-gateway -[![Build Status](https://travis-ci.org/grpc-ecosystem/grpc-gateway.svg?branch=master)](https://travis-ci.org/grpc-ecosystem/grpc-gateway) +[![CircleCI](https://circleci.com/gh/grpc-ecosystem/grpc-gateway.svg?style=svg)](https://circleci.com/gh/grpc-ecosystem/grpc-gateway) grpc-gateway is a plugin of [protoc](http://github.com/google/protobuf). It reads [gRPC](http://github.com/grpc/grpc-common) service definition, @@ -43,12 +43,12 @@ go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger go get -u github.com/golang/protobuf/protoc-gen-go ``` - + ## Usage Make sure that your `$GOPATH/bin` is in your `$PATH`. 1. Define your service in gRPC - + your_service.proto: ```protobuf syntax = "proto3"; @@ -56,13 +56,13 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. message StringMessage { string value = 1; } - + service YourService { rpc Echo(StringMessage) returns (StringMessage) {} } ``` 2. Add a [`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) to your .proto file - + your_service.proto: ```diff syntax = "proto3"; @@ -73,7 +73,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. message StringMessage { string value = 1; } - + service YourService { - rpc Echo(StringMessage) returns (StringMessage) {} + rpc Echo(StringMessage) returns (StringMessage) { @@ -88,7 +88,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. If you do not want to modify the proto file for use with grpc-gateway you can alternatively use an external [gRPC Service Configuration](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config) file. [Check our documentation](https://grpc-ecosystem.github.io/grpc-gateway/docs/grpcapiconfiguration.html) for more information. 3. Generate gRPC stub - + ```sh protoc -I/usr/local/include -I. \ -I$GOPATH/src \ @@ -96,11 +96,11 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. --go_out=plugins=grpc:. \ path/to/your_service.proto ``` - + It will generate a stub file `path/to/your_service.pb.go`. 4. Implement your service in gRPC as usual 1. (Optional) Generate gRPC stub in the language you want. - + e.g. ```sh protoc -I/usr/local/include -I. \ @@ -108,7 +108,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --ruby_out=. \ path/to/your/service_proto - + protoc -I/usr/local/include -I. \ -I$GOPATH/src \ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ @@ -118,9 +118,9 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. ``` 2. Add the googleapis-common-protos gem (or your language equivalent) as a dependency to your project. 3. Implement your service - + 5. Generate reverse-proxy - + ```sh protoc -I/usr/local/include -I. \ -I$GOPATH/src \ @@ -128,13 +128,13 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. --grpc-gateway_out=logtostderr=true:. \ path/to/your_service.proto ``` - + It will generate a reverse proxy `path/to/your_service.pb.gw.go`. Note: After generating the code for each of the stubs, in order to build the code, you will want to run ```go get .``` from the directory containing the stubs. 6. Write an entrypoint - + Now you need to write an entrypoint of the proxy server. ```go package main @@ -142,38 +142,38 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. import ( "flag" "net/http" - + "github.com/golang/glog" "golang.org/x/net/context" "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc" - + gw "path/to/your_service_package" ) - + var ( echoEndpoint = flag.String("echo_endpoint", "localhost:9090", "endpoint of YourService") ) - + func run() error { ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() - + mux := runtime.NewServeMux() opts := []grpc.DialOption{grpc.WithInsecure()} err := gw.RegisterYourServiceHandlerFromEndpoint(ctx, mux, *echoEndpoint, opts) if err != nil { return err } - + return http.ListenAndServe(":8080", mux) } - + func main() { flag.Parse() defer glog.Flush() - + if err := run(); err != nil { glog.Fatal(err) } @@ -240,7 +240,7 @@ But patch is welcome. * [How gRPC error codes map to HTTP status codes in the response](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15) * HTTP request source IP is added as `X-Forwarded-For` gRPC request header * HTTP request host is added as `X-Forwarded-Host` gRPC request header -* HTTP `Authorization` header is added as `authorization` gRPC request header +* HTTP `Authorization` header is added as `authorization` gRPC request header * Remaining Permanent HTTP header keys (as specified by the IANA [here](http://www.iana.org/assignments/message-headers/message-headers.xhtml) are prefixed with `grpcgateway-` and added with their values to gRPC request header * HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata (prefixed with `grpcgateway-`) * While configurable, the default {un,}marshaling uses [jsonpb](https://godoc.org/github.com/golang/protobuf/jsonpb) with `OrigName: true`. diff --git a/docs/index.md b/docs/index.md index 47b6ec026fc..bb36263e758 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ # grpc-gateway -[![Build Status](https://travis-ci.org/grpc-ecosystem/grpc-gateway.svg?branch=master)](https://travis-ci.org/grpc-ecosystem/grpc-gateway) +[![CircleCI](https://circleci.com/gh/johanbrandhorst/grpc-gateway.svg?style=svg)](https://circleci.com/gh/johanbrandhorst/grpc-gateway) grpc-gateway is a plugin of [protoc](http://github.com/google/protobuf). It reads [gRPC](http://github.com/grpc/grpc-common) service definition, From 106de23b4c1aeb28533549b6ab07f8f2f8d650f0 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Thu, 11 Oct 2018 10:55:30 +0200 Subject: [PATCH 300/552] tests: s/iotuil/ioutil/ typo Signed-off-by: Stephan Renatus --- examples/integration/integration_test.go | 32 ++++++++++++------------ examples/integration/proto_error_test.go | 4 +-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index ea401ac7db0..b488be6ad2f 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -80,7 +80,7 @@ func testEcho(t *testing.T, port int, contentType string) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -113,7 +113,7 @@ func testEchoOneof(t *testing.T, port int, contentType string) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -146,7 +146,7 @@ func testEchoOneof1(t *testing.T, port int, contentType string) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -179,7 +179,7 @@ func testEchoOneof2(t *testing.T, port int, contentType string) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -219,7 +219,7 @@ func testEchoBody(t *testing.T, port int) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -301,7 +301,7 @@ func testABECreate(t *testing.T, port int) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -387,7 +387,7 @@ func testABECreateBody(t *testing.T, port int) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -473,7 +473,7 @@ func testABEBulkCreate(t *testing.T, port int) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -512,7 +512,7 @@ func testABELookup(t *testing.T, port int) { defer cresp.Body.Close() buf, err := ioutil.ReadAll(cresp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(cresp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(cresp.Body) failed with %v; want success", err) return } if got, want := cresp.StatusCode, http.StatusOK; got != want { @@ -818,7 +818,7 @@ func testAdditionalBindings(t *testing.T, port int) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success; i=%d", err, i) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success; i=%d", err, i) return } if got, want := resp.StatusCode, http.StatusOK; got != want { @@ -937,7 +937,7 @@ func testABERepeated(t *testing.T, port int) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -987,7 +987,7 @@ func TestErrorWithDetails(t *testing.T) { buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Fatalf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Fatalf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) } if got, want := resp.StatusCode, http.StatusInternalServerError; got != want { @@ -1062,7 +1062,7 @@ func TestUnknownPath(t *testing.T) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -1082,7 +1082,7 @@ func TestMethodNotAllowed(t *testing.T) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -1102,7 +1102,7 @@ func TestInvalidArgument(t *testing.T) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -1131,7 +1131,7 @@ func testResponseBody(t *testing.T, port int) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } diff --git a/examples/integration/proto_error_test.go b/examples/integration/proto_error_test.go index 84a631f9b1c..5aa263b3df4 100644 --- a/examples/integration/proto_error_test.go +++ b/examples/integration/proto_error_test.go @@ -133,7 +133,7 @@ func TestUnknownPathWithProtoError(t *testing.T) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } @@ -180,7 +180,7 @@ func TestMethodNotAllowedWithProtoError(t *testing.T) { defer resp.Body.Close() buf, err := ioutil.ReadAll(resp.Body) if err != nil { - t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) return } From 9cb61b9fe7cd66e3f13020677e95a2124add9a58 Mon Sep 17 00:00:00 2001 From: Joel Urraco Date: Wed, 17 Oct 2018 13:00:04 +0200 Subject: [PATCH 301/552] DefaultHeaderMatcher: use textproto.CanonicalMIMEHeaderKey ok received key --- runtime/mux.go | 2 ++ runtime/mux_test.go | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/runtime/mux.go b/runtime/mux.go index 463084a7022..3064c69ecbd 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "net/http" + "net/textproto" "strings" "github.com/golang/protobuf/proto" @@ -50,6 +51,7 @@ type HeaderMatcherFunc func(string) (string, bool) // keys (as specified by the IANA) to gRPC context with grpcgateway- prefix. HTTP headers that start with // 'Grpc-Metadata-' are mapped to gRPC metadata after removing prefix 'Grpc-Metadata-'. func DefaultHeaderMatcher(key string) (string, bool) { + key = textproto.CanonicalMIMEHeaderKey(key) if isPermanentHTTPHeader(key) { return MetadataPrefix + key, true } else if strings.HasPrefix(key, MetadataHeaderPrefix) { diff --git a/runtime/mux_test.go b/runtime/mux_test.go index 894148d5692..f3ecbf63388 100644 --- a/runtime/mux_test.go +++ b/runtime/mux_test.go @@ -233,3 +233,43 @@ func TestMuxServeHTTP(t *testing.T) { } } } + +var defaultHeaderMatcherTests = []struct { + name string + in string + outValue string + outValid bool +}{ + { + "permanent HTTP header should return prefixed", + "Accept", + "grpcgateway-Accept", + true, + }, + { + "key prefixed with MetadataHeaderPrefix should return without the prefix", + "Grpc-Metadata-Custom-Header", + "Custom-Header", + true, + }, + { + "non-permanent HTTP header key without prefix should not return", + "Custom-Header", + "", + false, + }, +} + +func TestDefaultHeaderMatcher(t *testing.T) { + for _, tt := range defaultHeaderMatcherTests { + t.Run(tt.name, func(t *testing.T) { + out, valid := runtime.DefaultHeaderMatcher(tt.in) + if out != tt.outValue { + t.Errorf("got %v, want %v", out, tt.outValue) + } + if valid != tt.outValid { + t.Errorf("got %v, want %v", valid, tt.outValid) + } + }) + } +} From eb4fd886d9e9ab4cb280657411e3a98a7c4d066d Mon Sep 17 00:00:00 2001 From: Ricardo Vegas Date: Tue, 30 Oct 2018 10:03:10 +0100 Subject: [PATCH 302/552] Add documentation to the rest of methods --- examples/gateway/handlers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/gateway/handlers.go b/examples/gateway/handlers.go index d52580f52df..3db3fc3bf2b 100644 --- a/examples/gateway/handlers.go +++ b/examples/gateway/handlers.go @@ -11,6 +11,7 @@ import ( "google.golang.org/grpc/connectivity" ) +// swaggerServer returns swagger specification files located under "/swagger/" func swaggerServer(dir string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if !strings.HasSuffix(r.URL.Path, ".swagger.json") { @@ -41,6 +42,9 @@ func allowCORS(h http.Handler) http.Handler { }) } +// preflightHandler adds the necessary headers in order to serve +// CORS from any origin using the methods "GET", "HEAD", "POST", "PUT", "DELETE" +// We insist, don't do this without consideration in production systems. func preflightHandler(w http.ResponseWriter, r *http.Request) { headers := []string{"Content-Type", "Accept"} w.Header().Set("Access-Control-Allow-Headers", strings.Join(headers, ",")) @@ -49,6 +53,7 @@ func preflightHandler(w http.ResponseWriter, r *http.Request) { glog.Infof("preflight request for %s", r.URL.Path) } +// healthzServer returns a simple health handler which returns ok. func healthzServer(conn *grpc.ClientConn) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") From 8bbf22f5c4b8d45b044f4cb16396c99f088ba305 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 30 Oct 2018 21:27:55 +0000 Subject: [PATCH 303/552] ci: add job for building binaries for releases This will trigger a build of a linux, darwin and windows build of protoc-gen-grpc-gateway and protoc-gen-swagger on every new tag matching the semver regex. --- .circleci/config.yml | 119 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 112 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2707fd7786e..4cead752fa4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: "jfbrandhorst/grpc-gateway-build-env" + - image: jfbrandhorst/grpc-gateway-build-env working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout @@ -10,7 +10,7 @@ jobs: - run: go build ./... test: docker: - - image: "jfbrandhorst/grpc-gateway-build-env" + - image: jfbrandhorst/grpc-gateway-build-env working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway environment: GLOG_logtostderr: "1" @@ -21,7 +21,7 @@ jobs: - run: bash <(curl -s https://codecov.io/bash) node_test: docker: - - image: "jfbrandhorst/grpc-gateway-build-env" + - image: jfbrandhorst/grpc-gateway-build-env working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout @@ -34,7 +34,7 @@ jobs: ./node_modules/.bin/gulp generate: docker: - - image: "jfbrandhorst/grpc-gateway-build-env" + - image: jfbrandhorst/grpc-gateway-build-env working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout @@ -43,7 +43,7 @@ jobs: - run: git diff --exit-code lint: docker: - - image: "jfbrandhorst/grpc-gateway-build-env" + - image: jfbrandhorst/grpc-gateway-build-env working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout @@ -52,18 +52,95 @@ jobs: - run: make lint bazel_build: docker: - - image: "l.gcr.io/google/bazel:latest" + - image: l.gcr.io/google/bazel:latest working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel --host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m build --local_resources=400,1,1.0 //... bazel_test: docker: - - image: "l.gcr.io/google/bazel:latest" + - image: l.gcr.io/google/bazel:latest working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel --host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m test --local_resources=400,1,1.0 --test_output=errors --features=race //... + build_linux_release: + docker: + - image: jfbrandhorst/grpc-gateway-build-env + working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + environment: + CGO_ENABLED: "0" + GOOS: "linux" + GOARCH: "amd64" + steps: + - checkout + - run: mkdir -p release + - run: dep ensure --vendor-only + - run: | + VERSION=$(git describe --tags --abbrev=0) + go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-linux-x86_64 ./protoc-gen-grpc-gateway/ + - run: | + VERSION=$(git describe --tags --abbrev=0) + go build -o ./release/protoc-gen-swagger-${VERSION}-linux-x86_64 ./protoc-gen-swagger/ + - persist_to_workspace: + root: ./ + paths: + - release + build_darwin_release: + docker: + - image: jfbrandhorst/grpc-gateway-build-env + working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + environment: + CGO_ENABLED: "0" + GOOS: "darwin" + GOARCH: "amd64" + steps: + - checkout + - run: mkdir -p release + - run: dep ensure --vendor-only + - run: | + VERSION=$(git describe --tags --abbrev=0) + go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-darwin-x86_64 ./protoc-gen-grpc-gateway/ + - run: | + VERSION=$(git describe --tags --abbrev=0) + go build -o ./release/protoc-gen-swagger-${VERSION}-darwin-x86_64 ./protoc-gen-swagger/ + - persist_to_workspace: + root: ./ + paths: + - release + build_windows_release: + docker: + - image: jfbrandhorst/grpc-gateway-build-env + working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + environment: + CGO_ENABLED: "0" + GOOS: "windows" + GOARCH: "amd64" + steps: + - checkout + - run: mkdir -p release + - run: dep ensure --vendor-only + - run: | + VERSION=$(git describe --tags --abbrev=0) + go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-windows-x86_64.exe ./protoc-gen-grpc-gateway/ + - run: | + VERSION=$(git describe --tags --abbrev=0) + go build -o ./release/protoc-gen-swagger-${VERSION}-windows-x86_64.exe ./protoc-gen-swagger/ + - persist_to_workspace: + root: ./ + paths: + - release + publish_github_release: + docker: + - image: cibuilds/github:0.10 + steps: + - attach_workspace: + at: ./release + - run: + name: "Publish Release on GitHub" + command: | + VERSION=$(git describe --tags --abbrev=0) + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} ./release/ workflows: version: 2 all: @@ -75,3 +152,31 @@ workflows: - lint - bazel_build - bazel_test + - build_linux_release: + filters: + branches: + ignore: /.*/ + tags: + only: /^v\d+\.\d+\.\d+$/ + - build_windows_release: + filters: + branches: + ignore: /.*/ + tags: + only: /^v\d+\.\d+\.\d+$/ + - build_darwin_release: + filters: + branches: + ignore: /.*/ + tags: + only: /^v\d+\.\d+\.\d+$/ + - publish_github_release: + requires: + - build_linux_release + - build_darwin_release + - build_windows_release + filters: + branches: + ignore: /.*/ + tags: + only: /^v\d+\.\d+\.\d+$/ From b03f44ef05b031ce92921e886e945373a5c080cb Mon Sep 17 00:00:00 2001 From: Wesley Spikes Date: Sat, 3 Nov 2018 13:07:43 -0700 Subject: [PATCH 304/552] Remove http.CloseNotifier code from Go >= 1.7 builds http.CloseNotifier is deprecated as of Go 1.11, with a note that "the CloseNotifier interface predates Go's context package. New code should use Request.Context instead." Seeing as Request.Context has been around since 1.7, it seems likely safe to adjust our template to omit this block whenever Request.Context is in use. --- .../examplepb/a_bit_of_everything.pb.gw.go | 144 ----------- .../proto/examplepb/echo_service.pb.gw.go | 63 ----- .../proto/examplepb/flow_combination.pb.gw.go | 234 ------------------ .../examplepb/response_body_service.pb.gw.go | 9 - examples/proto/examplepb/stream.pb.gw.go | 27 -- .../unannotated_echo_service.pb.gw.go | 36 --- examples/proto/examplepb/wrappers.pb.gw.go | 9 - .../gengateway/template.go | 9 - 8 files changed, 531 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index af771b2c31f..c506569c47d 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -811,15 +811,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -840,15 +831,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("POST", pattern_ABitOfEverythingService_CreateBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -869,15 +851,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("GET", pattern_ABitOfEverythingService_Lookup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -898,15 +871,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("PUT", pattern_ABitOfEverythingService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -927,15 +891,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("DELETE", pattern_ABitOfEverythingService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -956,15 +911,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("GET", pattern_ABitOfEverythingService_GetQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -985,15 +931,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("GET", pattern_ABitOfEverythingService_GetRepeatedQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1014,15 +951,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("GET", pattern_ABitOfEverythingService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1043,15 +971,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("POST", pattern_ABitOfEverythingService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1072,15 +991,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("GET", pattern_ABitOfEverythingService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1101,15 +1011,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("POST", pattern_ABitOfEverythingService_DeepPathEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1130,15 +1031,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("GET", pattern_ABitOfEverythingService_Timeout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1159,15 +1051,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("GET", pattern_ABitOfEverythingService_ErrorWithDetails_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1188,15 +1071,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("POST", pattern_ABitOfEverythingService_GetMessageWithBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1217,15 +1091,6 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt mux.Handle("POST", pattern_ABitOfEverythingService_PostWithEmptyBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1351,15 +1216,6 @@ func RegisterCamelCaseServiceNameHandlerClient(ctx context.Context, mux *runtime mux.Handle("GET", pattern_CamelCaseServiceName_Empty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index 4e7bbf8c6ca..ca6579265e0 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -339,15 +339,6 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -368,15 +359,6 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_EchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -397,15 +379,6 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_EchoService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -426,15 +399,6 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_EchoService_Echo_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -455,15 +419,6 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux mux.Handle("GET", pattern_EchoService_Echo_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -484,15 +439,6 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -513,15 +459,6 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux mux.Handle("DELETE", pattern_EchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index 3871cf618ca..a20cf605711 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -1026,15 +1026,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1055,15 +1046,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1084,15 +1066,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_StreamEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1113,15 +1086,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_StreamEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1142,15 +1106,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1171,15 +1126,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1200,15 +1146,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1229,15 +1166,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1258,15 +1186,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1287,15 +1206,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1316,15 +1226,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1345,15 +1246,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1374,15 +1266,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1403,15 +1286,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1432,15 +1306,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1461,15 +1326,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1490,15 +1346,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1519,15 +1366,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1548,15 +1386,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1577,15 +1406,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1606,15 +1426,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1635,15 +1446,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1664,15 +1466,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1693,15 +1486,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1722,15 +1506,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -1751,15 +1526,6 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index ac15844a045..41480f44bb9 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -96,15 +96,6 @@ func RegisterResponseBodyServiceHandlerClient(ctx context.Context, mux *runtime. mux.Handle("GET", pattern_ResponseBodyService_GetResponseBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index 1577db1aa86..a62da50e2a0 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -181,15 +181,6 @@ func RegisterStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeM mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -210,15 +201,6 @@ func RegisterStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeM mux.Handle("GET", pattern_StreamService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -239,15 +221,6 @@ func RegisterStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeM mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index cf0fc80c968..90bcbbd39f0 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -180,15 +180,6 @@ func RegisterUnannotatedEchoServiceHandlerClient(ctx context.Context, mux *runti mux.Handle("POST", pattern_UnannotatedEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -209,15 +200,6 @@ func RegisterUnannotatedEchoServiceHandlerClient(ctx context.Context, mux *runti mux.Handle("GET", pattern_UnannotatedEchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -238,15 +220,6 @@ func RegisterUnannotatedEchoServiceHandlerClient(ctx context.Context, mux *runti mux.Handle("POST", pattern_UnannotatedEchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { @@ -267,15 +240,6 @@ func RegisterUnannotatedEchoServiceHandlerClient(ctx context.Context, mux *runti mux.Handle("DELETE", pattern_UnannotatedEchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index 04452b5bf4c..f603e0283a2 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -82,15 +82,6 @@ func RegisterWrappersServiceHandlerClient(ctx context.Context, mux *runtime.Serv mux.Handle("POST", pattern_WrappersService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) 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, mux, req) if err != nil { diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index a8031068702..7db03cca64e 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -414,15 +414,6 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Client(ctx context.Context, ctx, cancel := context.WithCancel(ctx) {{- end }} 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, mux, req) if err != nil { From 4f81c557c59b5a18d6992d0e687fc1af53463305 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Tue, 8 May 2018 09:31:09 +0200 Subject: [PATCH 305/552] Add Handling of 'License' message to the annotation proto. This information is used by the default html doc generator and so it is nice to be able to provide it. Add the message to openapiv2.proto and extend template.go to handle it. Tested via: bazel build //examples/proto/examplepb:expamplepb_protoc_gen_swagger more bazel-bin/examples/proto/examplepb/a_bit_of_everything.swagger.json --- examples/proto/examplepb/a_bit_of_everything.proto | 4 ++++ protoc-gen-swagger/genswagger/template.go | 11 +++++++++++ protoc-gen-swagger/options/openapiv2.proto | 14 ++++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index a500bd397ad..d7a91bf4d8e 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -20,6 +20,10 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { url: "https://github.com/grpc-ecosystem/grpc-gateway"; email: "none@example.com"; }; + license: { + name: "BSD 3-Clause License"; + url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt"; + }; }; // Overwriting host entry breaks tests, so this is not done here. external_docs: { diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 939c7b3730b..a493c15fb3f 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -902,6 +902,17 @@ func applyTemplate(p param) (*swaggerObject, error) { s.Info.Contact.Email = spb.Info.Contact.Email } } + if spb.Info.License != nil { + if s.Info.License == nil { + s.Info.License = &swaggerLicenseObject{} + } + if spb.Info.License.Name != "" { + s.Info.License.Name = spb.Info.License.Name + } + if spb.Info.License.Url != "" { + s.Info.License.URL = spb.Info.License.Url + } + } } if spb.Host != "" { s.Host = spb.Host diff --git a/protoc-gen-swagger/options/openapiv2.proto b/protoc-gen-swagger/options/openapiv2.proto index c9f0386564c..d1d6d969d78 100644 --- a/protoc-gen-swagger/options/openapiv2.proto +++ b/protoc-gen-swagger/options/openapiv2.proto @@ -89,8 +89,7 @@ message Info { string description = 2; string terms_of_service = 3; Contact contact = 4; - // field 5 is reserved for 'license'. - reserved 5; + License license=5; string version = 6; } @@ -105,6 +104,17 @@ message Contact { string email = 3; } +// `License` is a representation of OpenAPI v2 specification's License object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject +// +message License { + // Required. The license name used for the API. + string name = 1; + // A URL to the license used for the API. + string url = 2; +} + // `ExternalDocumentation` is a representation of OpenAPI v2 specification's // ExternalDocumentation object. // From 50d1130c8703e0b0490dda567882acd27dbe8015 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Mon, 5 Nov 2018 16:30:14 +0100 Subject: [PATCH 306/552] Regenerate checked-in files for the Info.License addition. --- .../proto/examplepb/a_bit_of_everything.pb.go | 366 +++++++++--------- .../a_bit_of_everything.swagger.json | 4 + protoc-gen-swagger/options/openapiv2.pb.go | 322 ++++++++------- 3 files changed, 380 insertions(+), 312 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 2609fd85f71..788a346b8b8 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -54,7 +54,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_34defd096f52c726, []int{0} + return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{0} } // DeepEnum is one or zero. @@ -80,7 +80,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_34defd096f52c726, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -128,7 +128,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_34defd096f52c726, []int{0} + return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -464,7 +464,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_34defd096f52c726, []int{0, 0} + return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -533,7 +533,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_34defd096f52c726, []int{1} + return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -676,7 +676,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_34defd096f52c726, []int{2} + return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -715,7 +715,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_34defd096f52c726, []int{3} + return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -1412,179 +1412,181 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_34defd096f52c726) -} - -var fileDescriptor_a_bit_of_everything_34defd096f52c726 = []byte{ - // 2708 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0x5f, 0x73, 0x1b, 0x57, - 0x15, 0xf7, 0x6a, 0x65, 0xc5, 0x3e, 0xb6, 0x6c, 0xf9, 0x3a, 0x71, 0x6c, 0xc5, 0xad, 0x6f, 0xd4, - 0x94, 0x6e, 0xdd, 0x6a, 0x37, 0x51, 0x4c, 0x49, 0xdc, 0x69, 0x83, 0x1c, 0x3b, 0x89, 0x9b, 0xd6, - 0x71, 0x36, 0x69, 0xe9, 0x84, 0x14, 0xcf, 0x4a, 0xba, 0x92, 0xb6, 0xd1, 0xee, 0x5d, 0x76, 0xef, - 0x3a, 0x11, 0x46, 0x50, 0x60, 0x06, 0x06, 0xfa, 0xc0, 0x8c, 0xe1, 0x89, 0x07, 0x9e, 0xf9, 0x02, - 0x3c, 0xf1, 0xc0, 0xf0, 0x50, 0x5e, 0xfa, 0x06, 0x33, 0x7d, 0x80, 0x19, 0x5e, 0x80, 0x19, 0x3e, - 0x01, 0x0c, 0x6f, 0xcc, 0xde, 0xfd, 0xe3, 0xdd, 0x95, 0x14, 0x47, 0x0e, 0xd3, 0x97, 0x44, 0xf7, - 0xde, 0xf3, 0xff, 0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 0x43, 0xf6, 0x4c, 0xe2, 0x30, 0xd2, - 0x58, 0x5c, 0xc2, 0x82, 0x34, 0x55, 0xb9, 0x22, 0x1f, 0x13, 0x65, 0x39, 0x2d, 0x49, 0xde, 0xe1, - 0xfc, 0xea, 0xb4, 0x2f, 0xce, 0x5f, 0xa1, 0x36, 0x64, 0x5d, 0x57, 0x6f, 0x2c, 0x0a, 0x58, 0x90, - 0x26, 0x37, 0xee, 0x1f, 0x56, 0xef, 0x7e, 0x22, 0x08, 0x3f, 0x13, 0x6e, 0x7f, 0x53, 0x2b, 0x37, - 0xab, 0xe5, 0x1b, 0x17, 0xcb, 0x57, 0x3f, 0x3a, 0xb8, 0xd2, 0x2b, 0xc7, 0x97, 0x6b, 0xa3, 0x2c, - 0x2f, 0x55, 0x7a, 0x2a, 0xd7, 0x80, 0x76, 0x21, 0x17, 0x78, 0x90, 0xc1, 0xe2, 0x73, 0x79, 0x10, - 0xc8, 0x41, 0x2b, 0x30, 0xd5, 0xec, 0x50, 0x8d, 0xed, 0xed, 0x6b, 0x1d, 0x97, 0x2c, 0x8a, 0x58, - 0x90, 0x32, 0x2a, 0xf0, 0xad, 0x0f, 0xbc, 0x1d, 0x74, 0x1e, 0xa6, 0x1b, 0xd4, 0xad, 0x75, 0x48, - 0x40, 0x91, 0xc5, 0x82, 0x24, 0xa8, 0x53, 0xfe, 0x9e, 0x4f, 0xb2, 0x02, 0x53, 0xba, 0xc9, 0xde, - 0x58, 0x0b, 0x28, 0xc6, 0xb1, 0x20, 0x89, 0x2a, 0xf0, 0xad, 0x48, 0x86, 0x1b, 0xa7, 0xc8, 0x61, - 0x41, 0xca, 0xaa, 0x53, 0x6e, 0x8c, 0xc4, 0x97, 0x71, 0xb9, 0x12, 0x50, 0x9c, 0xc2, 0x82, 0x34, - 0xce, 0x65, 0x5c, 0xae, 0xf8, 0x04, 0x2f, 0x41, 0xbe, 0xa9, 0x3f, 0x21, 0x8d, 0x48, 0xc8, 0x04, - 0x16, 0xa4, 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0xf4, 0x26, 0x10, 0x51, 0x16, 0x8b, - 0x52, 0x36, 0xa9, 0xf7, 0xfd, 0xd8, 0x10, 0x1a, 0xa4, 0x37, 0x9a, 0x6b, 0xe3, 0x58, 0x94, 0xc6, - 0xfb, 0xf4, 0x86, 0x23, 0xee, 0x2d, 0x38, 0x97, 0x0a, 0x55, 0x62, 0x72, 0xe6, 0xb0, 0x28, 0xe5, - 0xd4, 0xc5, 0x44, 0xb0, 0xe2, 0x43, 0x74, 0x30, 0x7b, 0x0c, 0xa7, 0x89, 0xd2, 0xa9, 0x01, 0xec, - 0xa1, 0xf6, 0xaf, 0xc1, 0x62, 0x92, 0x3d, 0x86, 0xbc, 0x26, 0xb0, 0x28, 0x4d, 0xa8, 0x67, 0xe2, - 0xbc, 0x1b, 0x11, 0x0a, 0xeb, 0x0b, 0x57, 0x62, 0x16, 0x4d, 0xf2, 0xd9, 0x9b, 0x08, 0x57, 0x72, - 0xfe, 0xa6, 0xc2, 0x15, 0x47, 0x6b, 0x80, 0x45, 0x69, 0x3a, 0x19, 0xae, 0x8d, 0x23, 0xe4, 0x36, - 0x30, 0x4d, 0x91, 0xbb, 0x53, 0x58, 0x94, 0xf2, 0xfd, 0x69, 0x0a, 0xbd, 0x25, 0x69, 0x6f, 0x63, - 0x9d, 0x7c, 0xfa, 0x04, 0x9d, 0x3c, 0x11, 0x9b, 0x23, 0x98, 0x74, 0x0d, 0x96, 0x53, 0xb1, 0x49, - 0x26, 0x25, 0x8f, 0x45, 0x69, 0x56, 0x5d, 0x4a, 0x44, 0x27, 0x01, 0xa0, 0x86, 0x08, 0x88, 0x8a, - 0x62, 0x06, 0x8b, 0x52, 0x61, 0x90, 0x80, 0xa1, 0xc5, 0x9c, 0x00, 0x5a, 0xb3, 0x58, 0x94, 0xe6, - 0x52, 0xd9, 0x89, 0x45, 0x69, 0x20, 0x73, 0x0c, 0xca, 0x89, 0x12, 0xea, 0x67, 0x0e, 0x34, 0x97, - 0x8a, 0x90, 0xdd, 0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, 0x6f, 0x97, 0x34, 0xa9, - 0xbd, 0x0d, 0x67, 0xdf, 0x3b, 0x6a, 0x0e, 0xf1, 0x9a, 0x1f, 0xb5, 0xd6, 0x1f, 0x4c, 0x46, 0x99, - 0xab, 0xe5, 0xf8, 0x75, 0xbb, 0xfc, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9d, 0xee, 0xfd, 0x43, - 0x14, 0x21, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_dc9cebfa7968115c) +} + +var fileDescriptor_a_bit_of_everything_dc9cebfa7968115c = []byte{ + // 2750 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x19, 0xcd, 0x73, 0x1b, 0x57, + 0xdd, 0xab, 0x95, 0x65, 0xfb, 0xe7, 0x2f, 0xf9, 0x39, 0x71, 0x6c, 0xc5, 0xad, 0x5f, 0xd4, 0x94, + 0x6e, 0xdd, 0x6a, 0x37, 0x51, 0x4c, 0x49, 0xdc, 0x69, 0x83, 0xfc, 0x91, 0xc4, 0x4d, 0xea, 0x38, + 0x9b, 0xb4, 0x74, 0x42, 0x5a, 0xcf, 0x4a, 0x7a, 0x96, 0xb6, 0xd1, 0xee, 0x5b, 0x76, 0xdf, 0x3a, + 0x16, 0x46, 0x50, 0x60, 0x06, 0x06, 0x7a, 0x60, 0xc6, 0x70, 0xe2, 0xc0, 0x99, 0x03, 0x57, 0x4e, + 0x3d, 0x30, 0x1c, 0xca, 0x85, 0x1b, 0x30, 0xbd, 0x30, 0xc3, 0x05, 0x98, 0xe1, 0x2f, 0x80, 0xe1, + 0xc6, 0xec, 0xdb, 0x0f, 0xef, 0xae, 0xa4, 0x38, 0x72, 0x98, 0x5e, 0xec, 0x7d, 0xef, 0xfd, 0xbe, + 0xbf, 0xdf, 0x13, 0x94, 0xc9, 0x81, 0x66, 0x58, 0x2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2c, 0x48, 0x23, 0x01, 0x50, 0x48, 0xe9, 0x05, 0x80, 0x2a, + 0xa5, 0xad, 0x00, 0x02, 0xb0, 0x20, 0x8d, 0xaa, 0x63, 0xde, 0x4e, 0x24, 0xac, 0xc3, 0x6c, 0xdd, + 0x6c, 0x04, 0x00, 0xe3, 0x9e, 0x57, 0xd5, 0x71, 0x7f, 0x2f, 0x12, 0xb6, 0xda, 0x66, 0xc4, 0x09, + 0x20, 0x5e, 0xc0, 0x82, 0x34, 0xa1, 0x02, 0xdf, 0x4a, 0x28, 0x1c, 0x89, 0x31, 0x89, 0x05, 0x69, + 0xd2, 0x57, 0x38, 0x94, 0xe2, 0x36, 0x80, 0x97, 0x4a, 0x01, 0xc0, 0x14, 0x16, 0xa4, 0xa9, 0xf2, + 0xeb, 0x27, 0xba, 0x73, 0xdb, 0x35, 0x88, 0xad, 0xd7, 0x36, 0x4d, 0xd7, 0x50, 0xc7, 0x3c, 0x7c, + 0x9f, 0xd8, 0x0e, 0x4c, 0x47, 0xc9, 0x19, 0x50, 0x7c, 0x91, 0x53, 0x94, 0xfa, 0x50, 0x0c, 0x73, + 0x5a, 0xde, 0xd1, 0x58, 0x93, 0x53, 0x9b, 0xb4, 0x82, 0x2f, 0x9f, 0xa2, 0x03, 0x73, 0x7e, 0x84, + 0xec, 0xa6, 0x09, 0x2f, 0x71, 0xc2, 0x6f, 0x9f, 0x44, 0xf8, 0x5d, 0x3f, 0xcb, 0x43, 0xfa, 0x41, + 0xdc, 0x45, 0xec, 0x66, 0xcd, 0xc4, 0xda, 0x67, 0xfa, 0x32, 0x4c, 0x39, 0x49, 0xff, 0x4d, 0x63, + 0x41, 0x9a, 0x56, 0x27, 0x9d, 0x84, 0x03, 0x23, 0xb0, 0x28, 0x16, 0xf2, 0x58, 0x90, 0xf2, 0x21, + 0x58, 0x2c, 0xea, 0x9c, 0xb8, 0x13, 0x66, 0xb0, 0x20, 0xcd, 0xa8, 0xe3, 0x4e, 0xcc, 0x09, 0x01,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x6e, 0xa2, 0xd5, 0x04, 0xaa, 0x59, 0x4f, 0x80, 0x71, 0x67, 0x78, 0x60, 0xba, 0xc3, 0xbc, 0x4e, + 0xb4, 0x4f, 0xb0, 0x6e, 0xee, 0x51, 0xdb, 0xe0, 0xfe, 0xae, 0x2e, 0xc1, 0x64, 0xdc, 0x14, 0x43, + 0xe9, 0xab, 0x51, 0xf5, 0xd5, 0xbe, 0x97, 0xa3, 0x34, 0xa8, 0xbd, 0x05, 0xe7, 0xde, 0x3d, 0xae, + 0x3e, 0xf1, 0x9c, 0x1a, 0x34, 0x97, 0x1e, 0x8e, 0x45, 0x9e, 0xab, 0xe6, 0x78, 0x3e, 0x5f, 0xf9, + 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x16, 0x9f, 0xcc, 0xe3, 0x75, 0x21, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 1495eb269f1..61c1023786e 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -7,6 +7,10 @@ "name": "gRPC-Gateway project", "url": "https://github.com/grpc-ecosystem/grpc-gateway", "email": "none@example.com" + }, + "license": { + "name": "BSD 3-Clause License", + "url": "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt" } }, "schemes": [ diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index a5a31210c02..fa72484e3a8 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -48,7 +48,7 @@ func (x Swagger_SwaggerScheme) String() string { return proto.EnumName(Swagger_SwaggerScheme_name, int32(x)) } func (Swagger_SwaggerScheme) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{0, 0} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{0, 0} } type JSONSchema_JSONSchemaSimpleTypes int32 @@ -89,7 +89,7 @@ func (x JSONSchema_JSONSchemaSimpleTypes) String() string { return proto.EnumName(JSONSchema_JSONSchemaSimpleTypes_name, int32(x)) } func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{7, 0} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{8, 0} } // Required. The type of the security scheme. Valid values are "basic", @@ -120,7 +120,7 @@ func (x SecurityScheme_Type) String() string { return proto.EnumName(SecurityScheme_Type_name, int32(x)) } func (SecurityScheme_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{10, 0} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{11, 0} } // Required. The location of the API key. Valid values are "query" or "header". @@ -147,7 +147,7 @@ func (x SecurityScheme_In) String() string { return proto.EnumName(SecurityScheme_In_name, int32(x)) } func (SecurityScheme_In) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{10, 1} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{11, 1} } // Required. The flow used by the OAuth2 security scheme. Valid values are @@ -181,7 +181,7 @@ func (x SecurityScheme_Flow) String() string { return proto.EnumName(SecurityScheme_Flow_name, int32(x)) } func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{10, 2} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{11, 2} } // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. @@ -210,7 +210,7 @@ func (m *Swagger) Reset() { *m = Swagger{} } func (m *Swagger) String() string { return proto.CompactTextString(m) } func (*Swagger) ProtoMessage() {} func (*Swagger) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{0} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{0} } func (m *Swagger) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Swagger.Unmarshal(m, b) @@ -333,7 +333,7 @@ func (m *Operation) Reset() { *m = Operation{} } func (m *Operation) String() string { return proto.CompactTextString(m) } func (*Operation) ProtoMessage() {} func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{1} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{1} } func (m *Operation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Operation.Unmarshal(m, b) @@ -450,7 +450,7 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{2} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{2} } func (m *Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Response.Unmarshal(m, b) @@ -494,6 +494,7 @@ type Info struct { Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService" json:"terms_of_service,omitempty"` Contact *Contact `protobuf:"bytes,4,opt,name=contact" json:"contact,omitempty"` + License *License `protobuf:"bytes,5,opt,name=license" json:"license,omitempty"` Version string `protobuf:"bytes,6,opt,name=version" json:"version,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -504,7 +505,7 @@ func (m *Info) Reset() { *m = Info{} } func (m *Info) String() string { return proto.CompactTextString(m) } func (*Info) ProtoMessage() {} func (*Info) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{3} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{3} } func (m *Info) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Info.Unmarshal(m, b) @@ -552,6 +553,13 @@ func (m *Info) GetContact() *Contact { return nil } +func (m *Info) GetLicense() *License { + if m != nil { + return m.License + } + return nil +} + func (m *Info) GetVersion() string { if m != nil { return m.Version @@ -577,7 +585,7 @@ func (m *Contact) Reset() { *m = Contact{} } func (m *Contact) String() string { return proto.CompactTextString(m) } func (*Contact) ProtoMessage() {} func (*Contact) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{4} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{4} } func (m *Contact) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Contact.Unmarshal(m, b) @@ -618,6 +626,58 @@ func (m *Contact) GetEmail() string { return "" } +// `License` is a representation of OpenAPI v2 specification's License object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject +// +type License struct { + // Required. The license name used for the API. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // A URL to the license used for the API. + Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *License) Reset() { *m = License{} } +func (m *License) String() string { return proto.CompactTextString(m) } +func (*License) ProtoMessage() {} +func (*License) Descriptor() ([]byte, []int) { + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{5} +} +func (m *License) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_License.Unmarshal(m, b) +} +func (m *License) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_License.Marshal(b, m, deterministic) +} +func (dst *License) XXX_Merge(src proto.Message) { + xxx_messageInfo_License.Merge(dst, src) +} +func (m *License) XXX_Size() int { + return xxx_messageInfo_License.Size(m) +} +func (m *License) XXX_DiscardUnknown() { + xxx_messageInfo_License.DiscardUnknown(m) +} + +var xxx_messageInfo_License proto.InternalMessageInfo + +func (m *License) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *License) GetUrl() string { + if m != nil { + return m.Url + } + return "" +} + // `ExternalDocumentation` is a representation of OpenAPI v2 specification's // ExternalDocumentation object. // @@ -636,7 +696,7 @@ func (m *ExternalDocumentation) Reset() { *m = ExternalDocumentation{} } func (m *ExternalDocumentation) String() string { return proto.CompactTextString(m) } func (*ExternalDocumentation) ProtoMessage() {} func (*ExternalDocumentation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{5} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{6} } func (m *ExternalDocumentation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExternalDocumentation.Unmarshal(m, b) @@ -690,7 +750,7 @@ func (m *Schema) Reset() { *m = Schema{} } func (m *Schema) String() string { return proto.CompactTextString(m) } func (*Schema) ProtoMessage() {} func (*Schema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{6} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{7} } func (m *Schema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Schema.Unmarshal(m, b) @@ -793,7 +853,7 @@ func (m *JSONSchema) Reset() { *m = JSONSchema{} } func (m *JSONSchema) String() string { return proto.CompactTextString(m) } func (*JSONSchema) ProtoMessage() {} func (*JSONSchema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{7} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{8} } func (m *JSONSchema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JSONSchema.Unmarshal(m, b) @@ -972,7 +1032,7 @@ func (m *Tag) Reset() { *m = Tag{} } func (m *Tag) String() string { return proto.CompactTextString(m) } func (*Tag) ProtoMessage() {} func (*Tag) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{8} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{9} } func (m *Tag) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Tag.Unmarshal(m, b) @@ -1026,7 +1086,7 @@ func (m *SecurityDefinitions) Reset() { *m = SecurityDefinitions{} } func (m *SecurityDefinitions) String() string { return proto.CompactTextString(m) } func (*SecurityDefinitions) ProtoMessage() {} func (*SecurityDefinitions) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{9} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{10} } func (m *SecurityDefinitions) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityDefinitions.Unmarshal(m, b) @@ -1104,7 +1164,7 @@ func (m *SecurityScheme) Reset() { *m = SecurityScheme{} } func (m *SecurityScheme) String() string { return proto.CompactTextString(m) } func (*SecurityScheme) ProtoMessage() {} func (*SecurityScheme) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{10} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{11} } func (m *SecurityScheme) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityScheme.Unmarshal(m, b) @@ -1206,7 +1266,7 @@ func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} } func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) } func (*SecurityRequirement) ProtoMessage() {} func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{11} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{12} } func (m *SecurityRequirement) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement.Unmarshal(m, b) @@ -1251,7 +1311,7 @@ func (m *SecurityRequirement_SecurityRequirementValue) String() string { } func (*SecurityRequirement_SecurityRequirementValue) ProtoMessage() {} func (*SecurityRequirement_SecurityRequirementValue) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{11, 0} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{12, 0} } func (m *SecurityRequirement_SecurityRequirementValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Unmarshal(m, b) @@ -1296,7 +1356,7 @@ func (m *Scopes) Reset() { *m = Scopes{} } func (m *Scopes) String() string { return proto.CompactTextString(m) } func (*Scopes) ProtoMessage() {} func (*Scopes) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_5363312922dcb572, []int{12} + return fileDescriptor_openapiv2_b1201f239ab2f555, []int{13} } func (m *Scopes) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Scopes.Unmarshal(m, b) @@ -1331,6 +1391,7 @@ func init() { proto.RegisterType((*Response)(nil), "grpc.gateway.protoc_gen_swagger.options.Response") proto.RegisterType((*Info)(nil), "grpc.gateway.protoc_gen_swagger.options.Info") proto.RegisterType((*Contact)(nil), "grpc.gateway.protoc_gen_swagger.options.Contact") + proto.RegisterType((*License)(nil), "grpc.gateway.protoc_gen_swagger.options.License") proto.RegisterType((*ExternalDocumentation)(nil), "grpc.gateway.protoc_gen_swagger.options.ExternalDocumentation") proto.RegisterType((*Schema)(nil), "grpc.gateway.protoc_gen_swagger.options.Schema") proto.RegisterType((*JSONSchema)(nil), "grpc.gateway.protoc_gen_swagger.options.JSONSchema") @@ -1351,119 +1412,120 @@ func init() { } func init() { - proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_5363312922dcb572) + proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_b1201f239ab2f555) } -var fileDescriptor_openapiv2_5363312922dcb572 = []byte{ - // 1753 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5f, 0x73, 0xdb, 0xc6, +var fileDescriptor_openapiv2_b1201f239ab2f555 = []byte{ + // 1773 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x73, 0xdb, 0xc6, 0x11, 0x0f, 0x48, 0x90, 0x04, 0x97, 0x22, 0x73, 0x3e, 0xcb, 0x2d, 0xa2, 0xc4, 0xae, 0xc2, 0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e, 0x91, 0x7d, 0xd1, 0xe2, 0xfc, 0xc1, 0x74, 0x24, 0xb8, 0xd8, 0x84, + 0x9a, 0x1b, 0xd2, 0xd4, 0x71, 0x53, 0xd9, 0x14, 0x9f, 0x6e, 0x1c, 0xc0, 0x91, 0xb0, 0xb3, 0x72, + 0x00, 0x86, 0xe5, 0x7b, 0x2e, 0xa1, 0x09, 0xe1, 0xc5, 0x7f, 0x1b, 0xac, 0x13, 0x61, 0x67, 0xe5, + 0x00, 0xac, 0x22, 0x2f, 0x48, 0x9c, 0xb0, 0xf8, 0xaa, 0xa2, 0xdd, 0x25, 0xd9, 0xee, 0x41, 0x4d, + 0xee, 0xcc, 0xee, 0x09, 0xea, 0x04, 0x79, 0x76, 0xf8, 0x9a, 0x15, 0x49, 0x16, 0xfb, 0x32, 0x29, + 0x6c, 0xc9, 0x92, 0x48, 0x02, 0xc7, 0xf3, 0x65, 0x06, 0x04, 0xd1, 0xde, 0x87, 0x9a, 0xdc, 0x74, + 0x33, 0x98, 0xf6, 0x33, 0xb8, 0xb7, 0xf6, 0x1a, 0xd8, 0xa0, 0x48, 0x6e, 0x82, 0xfd, 0xab, 0x04, + 0x55, 0x51, 0x00, 0x78, 0x0c, 0x8d, 0xef, 0x92, 0x90, 0xda, 0xb2, 0x8c, 0x14, 0x9e, 0xb9, 0xcf, + 0x37, 0xce, 0x9c, 0x39, 0x1a, 0xf4, 0x65, 0x29, 0x01, 0xc3, 0x91, 0xa8, 0x9f, 0x40, 0x73, 0xe2, + 0x31, 0x0f, 0x02, 0x8f, 0x3a, 0x69, 0x18, 0xcb, 0xcd, 0x57, 0x99, 0x6c, 0xf6, 0x88, 0x89, 0x33, + 0xb1, 0x43, 0xea, 0xcf, 0x79, 0x7a, 0x34, 0x4b, 0x63, 0x8c, 0x01, 0xf5, 0xd7, 0xbc, 0x5f, 0x95, + 0x77, 0x70, 0x6b, 0x76, 0xa0, 0x46, 0xae, 0x9c, 0x20, 0xf2, 0x09, 0x3f, 0xe7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= Date: Tue, 6 Nov 2018 16:56:53 +0000 Subject: [PATCH 307/552] protoc-gen-swagger: Fix formatting of license field definition. --- protoc-gen-swagger/options/openapiv2.pb.go | 44 +++++++++++----------- protoc-gen-swagger/options/openapiv2.proto | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index fa72484e3a8..8acf78d147e 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -48,7 +48,7 @@ func (x Swagger_SwaggerScheme) String() string { return proto.EnumName(Swagger_SwaggerScheme_name, int32(x)) } func (Swagger_SwaggerScheme) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{0, 0} + return fileDescriptor_openapiv2_ae281b352364822e, []int{0, 0} } type JSONSchema_JSONSchemaSimpleTypes int32 @@ -89,7 +89,7 @@ func (x JSONSchema_JSONSchemaSimpleTypes) String() string { return proto.EnumName(JSONSchema_JSONSchemaSimpleTypes_name, int32(x)) } func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{8, 0} + return fileDescriptor_openapiv2_ae281b352364822e, []int{8, 0} } // Required. The type of the security scheme. Valid values are "basic", @@ -120,7 +120,7 @@ func (x SecurityScheme_Type) String() string { return proto.EnumName(SecurityScheme_Type_name, int32(x)) } func (SecurityScheme_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{11, 0} + return fileDescriptor_openapiv2_ae281b352364822e, []int{11, 0} } // Required. The location of the API key. Valid values are "query" or "header". @@ -147,7 +147,7 @@ func (x SecurityScheme_In) String() string { return proto.EnumName(SecurityScheme_In_name, int32(x)) } func (SecurityScheme_In) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{11, 1} + return fileDescriptor_openapiv2_ae281b352364822e, []int{11, 1} } // Required. The flow used by the OAuth2 security scheme. Valid values are @@ -181,7 +181,7 @@ func (x SecurityScheme_Flow) String() string { return proto.EnumName(SecurityScheme_Flow_name, int32(x)) } func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{11, 2} + return fileDescriptor_openapiv2_ae281b352364822e, []int{11, 2} } // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. @@ -210,7 +210,7 @@ func (m *Swagger) Reset() { *m = Swagger{} } func (m *Swagger) String() string { return proto.CompactTextString(m) } func (*Swagger) ProtoMessage() {} func (*Swagger) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{0} + return fileDescriptor_openapiv2_ae281b352364822e, []int{0} } func (m *Swagger) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Swagger.Unmarshal(m, b) @@ -333,7 +333,7 @@ func (m *Operation) Reset() { *m = Operation{} } func (m *Operation) String() string { return proto.CompactTextString(m) } func (*Operation) ProtoMessage() {} func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{1} + return fileDescriptor_openapiv2_ae281b352364822e, []int{1} } func (m *Operation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Operation.Unmarshal(m, b) @@ -450,7 +450,7 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{2} + return fileDescriptor_openapiv2_ae281b352364822e, []int{2} } func (m *Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Response.Unmarshal(m, b) @@ -505,7 +505,7 @@ func (m *Info) Reset() { *m = Info{} } func (m *Info) String() string { return proto.CompactTextString(m) } func (*Info) ProtoMessage() {} func (*Info) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{3} + return fileDescriptor_openapiv2_ae281b352364822e, []int{3} } func (m *Info) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Info.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *Contact) Reset() { *m = Contact{} } func (m *Contact) String() string { return proto.CompactTextString(m) } func (*Contact) ProtoMessage() {} func (*Contact) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{4} + return fileDescriptor_openapiv2_ae281b352364822e, []int{4} } func (m *Contact) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Contact.Unmarshal(m, b) @@ -644,7 +644,7 @@ func (m *License) Reset() { *m = License{} } func (m *License) String() string { return proto.CompactTextString(m) } func (*License) ProtoMessage() {} func (*License) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{5} + return fileDescriptor_openapiv2_ae281b352364822e, []int{5} } func (m *License) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_License.Unmarshal(m, b) @@ -696,7 +696,7 @@ func (m *ExternalDocumentation) Reset() { *m = ExternalDocumentation{} } func (m *ExternalDocumentation) String() string { return proto.CompactTextString(m) } func (*ExternalDocumentation) ProtoMessage() {} func (*ExternalDocumentation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{6} + return fileDescriptor_openapiv2_ae281b352364822e, []int{6} } func (m *ExternalDocumentation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExternalDocumentation.Unmarshal(m, b) @@ -750,7 +750,7 @@ func (m *Schema) Reset() { *m = Schema{} } func (m *Schema) String() string { return proto.CompactTextString(m) } func (*Schema) ProtoMessage() {} func (*Schema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{7} + return fileDescriptor_openapiv2_ae281b352364822e, []int{7} } func (m *Schema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Schema.Unmarshal(m, b) @@ -853,7 +853,7 @@ func (m *JSONSchema) Reset() { *m = JSONSchema{} } func (m *JSONSchema) String() string { return proto.CompactTextString(m) } func (*JSONSchema) ProtoMessage() {} func (*JSONSchema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{8} + return fileDescriptor_openapiv2_ae281b352364822e, []int{8} } func (m *JSONSchema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JSONSchema.Unmarshal(m, b) @@ -1032,7 +1032,7 @@ func (m *Tag) Reset() { *m = Tag{} } func (m *Tag) String() string { return proto.CompactTextString(m) } func (*Tag) ProtoMessage() {} func (*Tag) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{9} + return fileDescriptor_openapiv2_ae281b352364822e, []int{9} } func (m *Tag) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Tag.Unmarshal(m, b) @@ -1086,7 +1086,7 @@ func (m *SecurityDefinitions) Reset() { *m = SecurityDefinitions{} } func (m *SecurityDefinitions) String() string { return proto.CompactTextString(m) } func (*SecurityDefinitions) ProtoMessage() {} func (*SecurityDefinitions) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{10} + return fileDescriptor_openapiv2_ae281b352364822e, []int{10} } func (m *SecurityDefinitions) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityDefinitions.Unmarshal(m, b) @@ -1164,7 +1164,7 @@ func (m *SecurityScheme) Reset() { *m = SecurityScheme{} } func (m *SecurityScheme) String() string { return proto.CompactTextString(m) } func (*SecurityScheme) ProtoMessage() {} func (*SecurityScheme) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{11} + return fileDescriptor_openapiv2_ae281b352364822e, []int{11} } func (m *SecurityScheme) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityScheme.Unmarshal(m, b) @@ -1266,7 +1266,7 @@ func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} } func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) } func (*SecurityRequirement) ProtoMessage() {} func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{12} + return fileDescriptor_openapiv2_ae281b352364822e, []int{12} } func (m *SecurityRequirement) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement.Unmarshal(m, b) @@ -1311,7 +1311,7 @@ func (m *SecurityRequirement_SecurityRequirementValue) String() string { } func (*SecurityRequirement_SecurityRequirementValue) ProtoMessage() {} func (*SecurityRequirement_SecurityRequirementValue) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{12, 0} + return fileDescriptor_openapiv2_ae281b352364822e, []int{12, 0} } func (m *SecurityRequirement_SecurityRequirementValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Unmarshal(m, b) @@ -1356,7 +1356,7 @@ func (m *Scopes) Reset() { *m = Scopes{} } func (m *Scopes) String() string { return proto.CompactTextString(m) } func (*Scopes) ProtoMessage() {} func (*Scopes) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_b1201f239ab2f555, []int{13} + return fileDescriptor_openapiv2_ae281b352364822e, []int{13} } func (m *Scopes) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Scopes.Unmarshal(m, b) @@ -1412,10 +1412,10 @@ func init() { } func init() { - proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_b1201f239ab2f555) + proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_ae281b352364822e) } -var fileDescriptor_openapiv2_b1201f239ab2f555 = []byte{ +var fileDescriptor_openapiv2_ae281b352364822e = []byte{ // 1773 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x73, 0xdb, 0xc6, 0x11, 0x0f, 0x48, 0x90, 0x04, 0x97, 0x22, 0x73, 0x3e, 0xcb, 0x2d, 0xa2, 0xc4, 0xae, 0xc2, 0xa6, diff --git a/protoc-gen-swagger/options/openapiv2.proto b/protoc-gen-swagger/options/openapiv2.proto index d1d6d969d78..18b6c89dae0 100644 --- a/protoc-gen-swagger/options/openapiv2.proto +++ b/protoc-gen-swagger/options/openapiv2.proto @@ -89,7 +89,7 @@ message Info { string description = 2; string terms_of_service = 3; Contact contact = 4; - License license=5; + License license = 5; string version = 6; } From 4364250a8f1f766d837b12a698ca6719753df0d7 Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Wed, 7 Nov 2018 13:28:27 +0100 Subject: [PATCH 308/552] Use newer Bazel repo rules (#798) This uses the new go_repository and http_archive rules. Using the former avoids a warning: DEPRECATED: the rules_go version of go_repository is deprecated. Migrate to the new version in @bazel_gazelle//def.bzl instead. The latter will avoid breakage when the native http_archive rule is disabled by default in a future version of Bazel. --- WORKSPACE | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index bf8cb212f33..32c20f962c1 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,5 +1,7 @@ workspace(name = "grpc_ecosystem_grpc_gateway") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + http_archive( name = "io_bazel_rules_go", url = "https://github.com/bazelbuild/rules_go/releases/download/0.12.1/rules_go-0.12.1.tar.gz", @@ -12,7 +14,11 @@ http_archive( sha256 = "d03625db67e9fb0905bbd206fa97e32ae9da894fe234a493e7517fd25faec914", ) -load("@io_bazel_rules_go//go:def.bzl", "go_repository") +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") + +gazelle_dependencies() + +load("@bazel_gazelle//:def.bzl", "go_repository") load("//:repositories.bzl", "repositories") load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") @@ -56,7 +62,3 @@ repositories() go_rules_dependencies() go_register_toolchains() - -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") - -gazelle_dependencies() From 88208483e1da3f5cd84078e64aac67825c8c7a2d Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Wed, 7 Nov 2018 12:28:38 +0000 Subject: [PATCH 309/552] Run //:gazelle_diff in the CI --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4cead752fa4..39e326fafa8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,14 +56,15 @@ jobs: working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel --host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m build --local_resources=400,1,1.0 //... + - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel run //:gazelle_diff + - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel build //... bazel_test: docker: - image: l.gcr.io/google/bazel:latest working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel --host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m test --local_resources=400,1,1.0 --test_output=errors --features=race //... + - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel test --test_output=errors --features=race //... build_linux_release: docker: - image: jfbrandhorst/grpc-gateway-build-env From 06771dce9f4cc165356c720dd5b547ebae5a6bd8 Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Thu, 8 Nov 2018 23:58:24 +0100 Subject: [PATCH 310/552] Run buildifer on Bazel files (#797) buildifier autoformats the files to give a consistent style. This makes edits easier for contributors that have their editor set to autoformat-on-save. buildifier has been added to the Bazel workspace so that the same version can be used by contributors and CI. You can run `bazel run :buildifier_check` to check for necessary changes and `bazel run :buildifier` to apply them. `bazel test //...` also builds all targets. These changes should make the CI steps run a little faster. --- .circleci/config.yml | 11 +++--- BUILD | 10 +++++ WORKSPACE | 29 +++++++++----- examples/clients/abe/BUILD.bazel | 2 +- examples/proto/examplepb/BUILD.bazel | 2 +- examples/server/BUILD.bazel | 2 +- protoc-gen-swagger/defs.bzl | 58 ++++++++++++++-------------- repositories.bzl | 2 - runtime/BUILD.bazel | 2 +- 9 files changed, 69 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 39e326fafa8..30d20053a19 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -50,21 +50,22 @@ jobs: - run: dep ensure --vendor-only - run: go get golang.org/x/lint/golint - run: make lint - bazel_build: + bazel_lint: docker: - image: l.gcr.io/google/bazel:latest working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel run //:gazelle_diff - - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel build //... + - run: 'bazel --output_base=$HOME/.cache/_grpc_gateway_bazel run //:buildifier_check || + (echo "Bazel files not formatted, please run \`bazel run :buildifier\`"; exit 1)' + - run: bazel --output_base=$HOME/.cache/_grpc_gateway_bazel run //:gazelle_diff bazel_test: docker: - image: l.gcr.io/google/bazel:latest working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - - run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel test --test_output=errors --features=race //... + - run: bazel --output_base=$HOME/.cache/_grpc_gateway_bazel test --test_output=errors --features=race //... build_linux_release: docker: - image: jfbrandhorst/grpc-gateway-build-env @@ -151,7 +152,7 @@ workflows: - node_test - generate - lint - - bazel_build + - bazel_lint - bazel_test - build_linux_release: filters: diff --git a/BUILD b/BUILD index 0ab0afa13f7..b72e9743bd8 100644 --- a/BUILD +++ b/BUILD @@ -1,4 +1,14 @@ load("@bazel_gazelle//:def.bzl", "gazelle") +load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") + +buildifier( + name = "buildifier", +) + +buildifier( + name = "buildifier_check", + mode = "check", +) # gazelle:exclude third_party diff --git a/WORKSPACE b/WORKSPACE index 32c20f962c1..5a6545f1103 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,14 +4,21 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - url = "https://github.com/bazelbuild/rules_go/releases/download/0.12.1/rules_go-0.12.1.tar.gz", sha256 = "8b68d0630d63d95dacc0016c3bb4b76154fe34fca93efd65d1c366de3fcb4294", + url = "https://github.com/bazelbuild/rules_go/releases/download/0.12.1/rules_go-0.12.1.tar.gz", ) http_archive( name = "bazel_gazelle", - url = "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.10.1/bazel-gazelle-0.10.1.tar.gz", sha256 = "d03625db67e9fb0905bbd206fa97e32ae9da894fe234a493e7517fd25faec914", + url = "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.10.1/bazel-gazelle-0.10.1.tar.gz", +) + +http_archive( + name = "com_github_bazelbuild_buildtools", + sha256 = "e4c83a7a5d0712e2cea2077112a5eb6bb1af75a84e34c8c9b77330e322966b8b", + strip_prefix = "buildtools-e90e7cc6ef3e6d08d4ca8a982935c3eed638e058", + url = "https://github.com/bazelbuild/buildtools/archive/e90e7cc6ef3e6d08d4ca8a982935c3eed638e058.tar.gz", ) load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") @@ -20,7 +27,7 @@ gazelle_dependencies() load("@bazel_gazelle//:def.bzl", "go_repository") load("//:repositories.bzl", "repositories") -load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") +load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies") # Also define in Gopkg.toml go_repository( @@ -45,16 +52,16 @@ go_repository( # Also define in Gopkg.toml go_repository( - name = "com_github_ghodss_yaml", - commit = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7", - importpath = "github.com/ghodss/yaml", + name = "com_github_ghodss_yaml", + commit = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7", + importpath = "github.com/ghodss/yaml", ) # Also define in Gopkg.toml go_repository( - name = "in_gopkg_yaml_v2", - commit = "eb3733d160e74a9c7e442f435eb3bea458e1d19f", - importpath = "gopkg.in/yaml.v2", + name = "in_gopkg_yaml_v2", + commit = "eb3733d160e74a9c7e442f435eb3bea458e1d19f", + importpath = "gopkg.in/yaml.v2", ) repositories() @@ -62,3 +69,7 @@ repositories() go_rules_dependencies() go_register_toolchains() + +load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies") + +buildifier_dependencies() diff --git a/examples/clients/abe/BUILD.bazel b/examples/clients/abe/BUILD.bazel index 8603ce20e7f..6b61fa1b3fa 100644 --- a/examples/clients/abe/BUILD.bazel +++ b/examples/clients/abe/BUILD.bazel @@ -29,6 +29,6 @@ go_library( "//examples/proto/examplepb:go_default_library", "//examples/proto/pathenum:go_default_library", "//runtime:go_default_library", - "@com_github_go_resty_resty//:go_default_library" + "@com_github_go_resty_resty//:go_default_library", ], ) diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index 7ec13fbe279..0e0c79d38ca 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -17,10 +17,10 @@ proto_library( "a_bit_of_everything.proto", "echo_service.proto", "flow_combination.proto", + "response_body_service.proto", "stream.proto", "unannotated_echo_service.proto", "wrappers.proto", - "response_body_service.proto", ], deps = [ "//examples/proto/pathenum:pathenum_proto", diff --git a/examples/server/BUILD.bazel b/examples/server/BUILD.bazel index afd74848a09..10bb44d0641 100644 --- a/examples/server/BUILD.bazel +++ b/examples/server/BUILD.bazel @@ -9,8 +9,8 @@ go_library( "echo.go", "flow_combination.go", "main.go", - "unannotatedecho.go", "responsebody.go", + "unannotatedecho.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/server", deps = [ diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index ada033139c6..a2933cdbeaa 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -33,34 +33,34 @@ def _collect_includes(gen_dir, srcs): def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, actions, protoc, protoc_gen_swagger, grpc_api_configuration): swagger_files = [] for proto in direct_proto_srcs: - swagger_file = actions.declare_file( - "%s.swagger.json" % proto.basename[:-len(".proto")], - sibling = proto, - ) + swagger_file = actions.declare_file( + "%s.swagger.json" % proto.basename[:-len(".proto")], + sibling = proto, + ) - inputs = direct_proto_srcs + transitive_proto_srcs + [protoc_gen_swagger] + inputs = direct_proto_srcs + transitive_proto_srcs + [protoc_gen_swagger] - options=["logtostderr=true"] - if grpc_api_configuration: - options.append("grpc_api_configuration=%s" % grpc_api_configuration.path) - inputs.append(grpc_api_configuration) + options = ["logtostderr=true"] + if grpc_api_configuration: + options.append("grpc_api_configuration=%s" % grpc_api_configuration.path) + inputs.append(grpc_api_configuration) - includes = _collect_includes(ctx.genfiles_dir.path, direct_proto_srcs + transitive_proto_srcs) + includes = _collect_includes(ctx.genfiles_dir.path, direct_proto_srcs + transitive_proto_srcs) - args = actions.args() - args.add("--plugin=%s" % protoc_gen_swagger.path) - args.add("--swagger_out=%s:%s" % (",".join(options), ctx.bin_dir.path)) - args.add(["-I%s" % include for include in includes]) - args.add(proto.path) + args = actions.args() + args.add("--plugin=%s" % protoc_gen_swagger.path) + args.add("--swagger_out=%s:%s" % (",".join(options), ctx.bin_dir.path)) + args.add(["-I%s" % include for include in includes]) + args.add(proto.path) - actions.run( - executable = protoc, - inputs = inputs, - outputs = [swagger_file], - arguments = [args], - ) + actions.run( + executable = protoc, + inputs = inputs, + outputs = [swagger_file], + arguments = [args], + ) - swagger_files.append(swagger_file) + swagger_files.append(swagger_file) return swagger_files @@ -69,7 +69,7 @@ def _proto_gen_swagger_impl(ctx): grpc_api_configuration = ctx.file.grpc_api_configuration return struct( - files=depset( + files = depset( _run_proto_gen_swagger( ctx, direct_proto_srcs = proto.direct_sources, @@ -77,9 +77,9 @@ def _proto_gen_swagger_impl(ctx): actions = ctx.actions, protoc = ctx.executable._protoc, protoc_gen_swagger = ctx.executable._protoc_gen_swagger, - grpc_api_configuration = grpc_api_configuration - ) - ) + grpc_api_configuration = grpc_api_configuration, + ), + ), ) protoc_gen_swagger = rule( @@ -87,11 +87,11 @@ protoc_gen_swagger = rule( "proto": attr.label( allow_rules = ["proto_library"], mandatory = True, - providers = ['proto'], + providers = ["proto"], ), "grpc_api_configuration": attr.label( - allow_single_file=True, - mandatory=False + allow_single_file = True, + mandatory = False, ), "_protoc": attr.label( default = "@com_google_protobuf//:protoc", diff --git a/repositories.bzl b/repositories.bzl index dc49d60eeee..4133986239d 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -39,11 +39,9 @@ def _googleapis_repository_impl(ctx): ctx.file("google/api/BUILD.bazel", GOOGLEAPIS_GOOGLE_API_BUILD_CONTENTS) - _googleapis_repository = repository_rule( implementation = _googleapis_repository_impl, ) - def repositories(): _googleapis_repository(name = "com_github_googleapis_googleapis") diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index 9fce0447165..60c1fec31d9 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -73,8 +73,8 @@ go_test( "@com_github_golang_protobuf//ptypes/struct:go_default_library", "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", "@com_github_golang_protobuf//ptypes/wrappers:go_default_library", - "@org_golang_google_genproto//protobuf/field_mask:go_default_library", "@org_golang_google_genproto//googleapis/rpc/errdetails:go_default_library", + "@org_golang_google_genproto//protobuf/field_mask:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", From 25eec8ee335c115ba6d349c7beb8131baec4e09e Mon Sep 17 00:00:00 2001 From: ch3rub1m Date: Tue, 13 Nov 2018 16:57:13 +0800 Subject: [PATCH 311/552] fix bug: the resource name of custom method doesn't be retained --- protoc-gen-swagger/genswagger/template.go | 2 ++ protoc-gen-swagger/genswagger/template_test.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index a493c15fb3f..f2f9a8e354a 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -570,6 +570,8 @@ func isResourceName(prefix string) bool { words := strings.Split(prefix, ".") l := len(words) field := words[l-1] + words = strings.Split(field, ":") + field = words[0] return field == "parent" || field == "name" } diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 67f449432d6..5dcb33756ed 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -702,6 +702,11 @@ func TestTemplateToSwaggerPath(t *testing.T) { {"/{user.name=prefix/*}", "/{user.name=prefix/*}"}, {"/{user.name=prefix1/*/prefix2/*}", "/{user.name=prefix1/*/prefix2/*}"}, {"/{parent=prefix/*}/children", "/{parent=prefix/*}/children"}, + {"/{name=prefix/*}:customMethod", "/{name=prefix/*}:customMethod"}, + {"/{name=prefix1/*/prefix2/*}:customMethod", "/{name=prefix1/*/prefix2/*}:customMethod"}, + {"/{user.name=prefix/*}:customMethod", "/{user.name=prefix/*}:customMethod"}, + {"/{user.name=prefix1/*/prefix2/*}:customMethod", "/{user.name=prefix1/*/prefix2/*}:customMethod"}, + {"/{parent=prefix/*}/children:customMethod", "/{parent=prefix/*}/children:customMethod"}, } for _, data := range tests { From fe35e075a1baf15412658eeb5ac39605ad0152b3 Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Tue, 13 Nov 2018 16:42:54 +0100 Subject: [PATCH 312/552] Update rules_go and gazelle (#802) * Update rules_go and gazelle This requires/allows the following changes: - rerun Gazelle to regenerate the build files - fix marshal_jsonpb_test to assert correct behavior when EnumsAsInts == false - remove `repositories.bzl` (replaced by @go_googleapis) Also, enforce up-to-date build files in the CI check. Note: this version of the commit includes an out-of-date BUILD file to test the CI check. * Update Gopkg.toml and Gopkg.lock * Update generated proto code The generated code changed with the updated dependencies. * Fix node_test Enum values inside maps are now supported. --- .circleci/config.yml | 3 +- Gopkg.lock | 26 ++- Gopkg.toml | 18 +- WORKSPACE | 22 +- codegenerator/BUILD.bazel | 8 +- .../a_bit_of_everything_service.spec.js | 3 +- examples/clients/responsebody/BUILD.bazel | 19 ++ examples/integration/BUILD.bazel | 8 +- examples/proto/examplepb/BUILD.bazel | 19 +- .../proto/examplepb/a_bit_of_everything.pb.go | 196 +++++++++--------- examples/proto/examplepb/echo_service.pb.go | 104 +++++----- .../proto/examplepb/flow_combination.pb.go | 44 ++-- .../examplepb/response_body_service.pb.go | 16 +- examples/proto/examplepb/stream.pb.go | 14 +- .../examplepb/unannotated_echo_service.pb.go | 20 +- examples/proto/examplepb/wrappers.pb.go | 28 +-- examples/proto/sub2/message.pb.go | 2 +- examples/server/BUILD.bazel | 6 +- protoc-gen-grpc-gateway/BUILD.bazel | 2 +- .../descriptor/BUILD.bazel | 14 +- protoc-gen-grpc-gateway/generator/BUILD.bazel | 2 +- .../gengateway/BUILD.bazel | 6 +- protoc-gen-swagger/BUILD.bazel | 2 +- protoc-gen-swagger/genswagger/BUILD.bazel | 8 +- protoc-gen-swagger/options/BUILD.bazel | 4 - protoc-gen-swagger/options/openapiv2.pb.go | 152 +++++++------- repositories.bzl | 47 ----- runtime/BUILD.bazel | 38 ++-- runtime/internal/BUILD.bazel | 1 - runtime/internal/stream_chunk.pb.go | 10 +- runtime/marshal_jsonpb_test.go | 4 +- utilities/BUILD.bazel | 4 +- 32 files changed, 420 insertions(+), 430 deletions(-) create mode 100644 examples/clients/responsebody/BUILD.bazel delete mode 100644 repositories.bzl diff --git a/.circleci/config.yml b/.circleci/config.yml index 30d20053a19..150455b5c21 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -58,7 +58,8 @@ jobs: - checkout - run: 'bazel --output_base=$HOME/.cache/_grpc_gateway_bazel run //:buildifier_check || (echo "Bazel files not formatted, please run \`bazel run :buildifier\`"; exit 1)' - - run: bazel --output_base=$HOME/.cache/_grpc_gateway_bazel run //:gazelle_diff + - run: 'test -z "$(bazel --output_base=$HOME/.cache/_grpc_gateway_bazel run //:gazelle_diff)" || + (echo "Bazel files out-of-date, please run \`bazel run :gazelle_diff\`"; exit 1)' bazel_test: docker: - image: l.gcr.io/google/bazel:latest diff --git a/Gopkg.lock b/Gopkg.lock index 94cc9cc5d11..ca212aeaa81 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -35,7 +35,7 @@ "ptypes/timestamp", "ptypes/wrappers" ] - revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265" + revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" [[projects]] name = "github.com/rogpeppe/fastuuid" @@ -51,11 +51,16 @@ "http2/hpack", "idna", "internal/timeseries", - "lex/httplex", "publicsuffix", "trace" ] - revision = "640f4622ab692b87c2f3a94265e6f579fe38263d" + revision = "4dfa2610cdf3b287375bbba5b8f2a14d3b01d8de" + +[[projects]] + branch = "master" + name = "golang.org/x/sys" + packages = ["unix"] + revision = "66b7b1311ac80bbafcd2daeef9a5e6e2cd1e2399" [[projects]] name = "golang.org/x/text" @@ -76,6 +81,7 @@ "unicode/rangetable" ] revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" + version = "v0.3.0" [[projects]] name = "google.golang.org/genproto" @@ -99,9 +105,13 @@ "credentials", "encoding", "encoding/proto", - "grpclb/grpc_lb_v1/messages", "grpclog", "internal", + "internal/backoff", + "internal/channelz", + "internal/envconfig", + "internal/grpcrand", + "internal/transport", "keepalive", "metadata", "naming", @@ -111,10 +121,10 @@ "resolver/passthrough", "stats", "status", - "tap", - "transport" + "tap" ] - revision = "d11072e7ca9811b1100b80ca0269ac831f06d024" + revision = "2e463a05d100327ca47ac218281906921038fd95" + version = "v1.16.0" [[projects]] name = "gopkg.in/yaml.v2" @@ -124,6 +134,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "e3a3d005ebf93db02b6c7ddc886adc39342b492105fc1b6c4d0c362a43e6adf6" + inputs-digest = "869b43d6e47c7434098120dae9352bde379feae8504ece065ee51b78c6aca0fa" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index cf3660628ae..e4c78e94a90 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -37,30 +37,30 @@ required = [ [[constraint]] # Also defined in bazelbuild/rules_go - # https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L75 - version = "1.1.0" + # https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L52 + revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" name = "github.com/golang/protobuf" [[constraint]] # Also defined in bazelbuild/rules_go - # https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L110 - revision = "640f4622ab692b87c2f3a94265e6f579fe38263d" + # https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L96 + revision = "4dfa2610cdf3b287375bbba5b8f2a14d3b01d8de" name = "golang.org/x/net" [[constraint]] # Also defined in bazelbuild/rules_go - # https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L123 - version = "1.10.3" + # https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L123 + version = "1.15.0" name = "google.golang.org/grpc" [[constraint]] # Also defined in bazelbuild/rules_go - # https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L138 + # https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L160 revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" name = "github.com/golang/glog" [[override]] # Also defined in bazelbuild/rules_go - # https://github.com/bazelbuild/rules_go/blob/436452edc29a2f1e0edc22d180fbb57c27e6d0af/go/private/repositories.bzl#L117 - revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" + # https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L117 + version = "0.3.0" name = "golang.org/x/text" diff --git a/WORKSPACE b/WORKSPACE index 5a6545f1103..6dc67684db1 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,16 +2,24 @@ workspace(name = "grpc_ecosystem_grpc_gateway") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +# master as of 2018-11-09. This should be updated when a new release is tagged. http_archive( name = "io_bazel_rules_go", - sha256 = "8b68d0630d63d95dacc0016c3bb4b76154fe34fca93efd65d1c366de3fcb4294", - url = "https://github.com/bazelbuild/rules_go/releases/download/0.12.1/rules_go-0.12.1.tar.gz", + sha256 = "c23db3b50b8822e153bc5accfea75baeecedb481a162391c4f3b9aec451e34b4", + strip_prefix = "rules_go-109c520465fcb418f2c4be967f3744d959ad66d3", + urls = [ + "https://github.com/bazelbuild/rules_go/archive/109c520465fcb418f2c4be967f3744d959ad66d3.tar.gz", + ], ) +# master as of 2018-11-09. This should be updated when a new release is tagged. http_archive( name = "bazel_gazelle", - sha256 = "d03625db67e9fb0905bbd206fa97e32ae9da894fe234a493e7517fd25faec914", - url = "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.10.1/bazel-gazelle-0.10.1.tar.gz", + sha256 = "a3af4a61d7b2f2c5386761f94a21f474871a32f0e94b13f08824248c4df25229", + strip_prefix = "bazel-gazelle-7b1e3c6eb5447c6647955fc93c012635f274f0f0", + urls = [ + "https://github.com/bazelbuild/bazel-gazelle/archive/7b1e3c6eb5447c6647955fc93c012635f274f0f0.tar.gz", + ], ) http_archive( @@ -21,12 +29,10 @@ http_archive( url = "https://github.com/bazelbuild/buildtools/archive/e90e7cc6ef3e6d08d4ca8a982935c3eed638e058.tar.gz", ) -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") gazelle_dependencies() -load("@bazel_gazelle//:def.bzl", "go_repository") -load("//:repositories.bzl", "repositories") load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies") # Also define in Gopkg.toml @@ -64,8 +70,6 @@ go_repository( importpath = "gopkg.in/yaml.v2", ) -repositories() - go_rules_dependencies() go_register_toolchains() diff --git a/codegenerator/BUILD.bazel b/codegenerator/BUILD.bazel index 1eddaaf7395..651177fa157 100644 --- a/codegenerator/BUILD.bazel +++ b/codegenerator/BUILD.bazel @@ -11,16 +11,16 @@ go_library( importpath = "github.com/grpc-ecosystem/grpc-gateway/codegenerator", deps = [ "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", ], ) go_test( - name = "go_default_xtest", + name = "go_default_test", srcs = ["parse_req_test.go"], + embed = [":go_default_library"], deps = [ - ":go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", ], ) diff --git a/examples/browser/a_bit_of_everything_service.spec.js b/examples/browser/a_bit_of_everything_service.spec.js index c67d56de9fb..5d8e792fda9 100644 --- a/examples/browser/a_bit_of_everything_service.spec.js +++ b/examples/browser/a_bit_of_everything_service.spec.js @@ -85,8 +85,7 @@ describe('ABitOfEverythingService', function() { ], repeated_string_value: ["a", "b", "c"], oneof_string: "x", - // TODO(yugui) Support enum by name - map_value: { a: 1, b: 2 }, + map_value: { a: "ONE", b: 2 }, mapped_string_value: { a: "x", b: "y" }, mapped_nested_value: { a: { name: "x", amount: 1 }, diff --git a/examples/clients/responsebody/BUILD.bazel b/examples/clients/responsebody/BUILD.bazel new file mode 100644 index 00000000000..bdbc237a815 --- /dev/null +++ b/examples/clients/responsebody/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "api_client.go", + "api_response.go", + "configuration.go", + "examplepb_response_body_message.go", + "examplepb_response_body_message_response.go", + "examplepb_response_body_out.go", + "examplepb_response_body_out_response.go", + "examplepb_response_body_req.go", + "response_body_service_api.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/responsebody", + visibility = ["//visibility:public"], + deps = ["@com_github_go_resty_resty//:go_default_library"], +) diff --git a/examples/integration/BUILD.bazel b/examples/integration/BUILD.bazel index 80e0df6227e..287de4b324a 100644 --- a/examples/integration/BUILD.bazel +++ b/examples/integration/BUILD.bazel @@ -1,7 +1,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_test") go_test( - name = "go_default_xtest", + name = "go_default_test", srcs = [ "client_test.go", "integration_test.go", @@ -19,10 +19,10 @@ go_test( "//examples/server:go_default_library", "//runtime:go_default_library", "@com_github_golang_glog//:go_default_library", - "@com_github_golang_protobuf//jsonpb:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//ptypes/empty:go_default_library", - "@org_golang_google_genproto//googleapis/rpc/status:go_default_library", + "@go_googleapis//google/rpc:status_go_proto", + "@io_bazel_rules_go//proto/wkt:empty_go_proto", "@org_golang_google_grpc//codes:go_default_library", ], ) diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index 0e0c79d38ca..20009954efc 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -27,11 +27,11 @@ proto_library( "//examples/proto/sub:sub_proto", "//examples/proto/sub2:sub2_proto", "//protoc-gen-swagger/options:options_proto", - "@com_github_googleapis_googleapis//google/api:api_proto", "@com_google_protobuf//:duration_proto", "@com_google_protobuf//:empty_proto", "@com_google_protobuf//:timestamp_proto", "@com_google_protobuf//:wrappers_proto", + "@go_googleapis//google/api:annotations_proto", ], ) @@ -48,18 +48,25 @@ go_proto_library( "//examples/proto/sub:go_default_library", "//examples/proto/sub2:go_default_library", "//protoc-gen-swagger/options:go_default_library", - "@com_github_golang_protobuf//ptypes/duration:go_default_library", - "@com_github_golang_protobuf//ptypes/empty:go_default_library", - "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", - "@com_github_golang_protobuf//ptypes/wrappers:go_default_library", - "@com_github_googleapis_googleapis//google/api:go_default_library", + "@go_googleapis//google/api:annotations_go_proto", ], ) go_library( name = "go_default_library", + srcs = ["unannotated_echo_service.pb.gw.go"], embed = [":examplepb_go_proto"], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb", + deps = [ + "//runtime:go_default_library", + "//utilities:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//grpclog:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + "@org_golang_x_net//context:go_default_library", + ], ) protoc_gen_swagger( diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 788a346b8b8..4ba9b36f349 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -86,39 +86,39 @@ func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { // Intentionaly complicated message type to cover many features of Protobuf. // NEXT ID: 30 type ABitOfEverything struct { - SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested" json:"single_nested,omitempty"` - Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` - Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested" json:"nested,omitempty"` - FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` - DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` - Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` - Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` - Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` - Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value" json:"fixed64_value,omitempty"` - Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value" json:"fixed32_value,omitempty"` - BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` - StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested,proto3" json:"single_nested,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested,proto3" json:"nested,omitempty"` + FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` + Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` + Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value,proto3" json:"fixed64_value,omitempty"` + Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value,proto3" json:"fixed32_value,omitempty"` + BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` BytesValue []byte `protobuf:"bytes,29,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` - Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` - EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` - PathEnumValue pathenum.PathEnum `protobuf:"varint,30,opt,name=path_enum_value,json=pathEnumValue,enum=grpc.gateway.examples.pathenum.PathEnum" json:"path_enum_value,omitempty"` - NestedPathEnumValue pathenum.MessagePathEnum_NestedPathEnum `protobuf:"varint,31,opt,name=nested_path_enum_value,json=nestedPathEnumValue,enum=grpc.gateway.examples.pathenum.MessagePathEnum_NestedPathEnum" json:"nested_path_enum_value,omitempty"` - Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` - Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` - Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` - Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` - RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` + EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` + PathEnumValue pathenum.PathEnum `protobuf:"varint,30,opt,name=path_enum_value,json=pathEnumValue,proto3,enum=grpc.gateway.examples.pathenum.PathEnum" json:"path_enum_value,omitempty"` + NestedPathEnumValue pathenum.MessagePathEnum_NestedPathEnum `protobuf:"varint,31,opt,name=nested_path_enum_value,json=nestedPathEnumValue,proto3,enum=grpc.gateway.examples.pathenum.MessagePathEnum_NestedPathEnum" json:"nested_path_enum_value,omitempty"` + Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value,proto3" json:"sfixed32_value,omitempty"` + Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value,proto3" json:"sfixed64_value,omitempty"` + Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value,proto3" json:"sint32_value,omitempty"` + Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value,proto3" json:"sint64_value,omitempty"` + RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue,proto3" json:"repeated_string_value,omitempty"` // Types that are valid to be assigned to OneofValue: // *ABitOfEverything_OneofEmpty // *ABitOfEverything_OneofString OneofValue isABitOfEverything_OneofValue `protobuf_oneof:"oneof_value"` - MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=grpc.gateway.examples.examplepb.NumericEnum"` - MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue" json:"nonConventionalNameValue,omitempty"` - TimestampValue *timestamp.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` + MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue,proto3" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum"` + MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue,proto3" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue,proto3" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue,proto3" json:"nonConventionalNameValue,omitempty"` + TimestampValue *timestamp.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue,proto3" json:"timestamp_value,omitempty"` // repeated enum value. it is comma-separated in query - RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` + RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -148,27 +148,6 @@ func (m *ABitOfEverything) XXX_DiscardUnknown() { var xxx_messageInfo_ABitOfEverything proto.InternalMessageInfo -type isABitOfEverything_OneofValue interface { - isABitOfEverything_OneofValue() -} - -type ABitOfEverything_OneofEmpty struct { - OneofEmpty *empty.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"` -} - -func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} -func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} - -func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { - if m != nil { - return m.OneofValue - } - return nil -} - func (m *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested { if m != nil { return m.SingleNested @@ -323,6 +302,29 @@ func (m *ABitOfEverything) GetRepeatedStringValue() []string { return nil } +type isABitOfEverything_OneofValue interface { + isABitOfEverything_OneofValue() +} + +type ABitOfEverything_OneofEmpty struct { + OneofEmpty *empty.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,proto3,oneof"` +} + +type ABitOfEverything_OneofString struct { + OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,proto3,oneof"` +} + +func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} + +func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} + +func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { + if m != nil { + return m.OneofValue + } + return nil +} + func (m *ABitOfEverything) GetOneofEmpty() *empty.Empty { if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok { return x.OneofEmpty @@ -452,9 +454,9 @@ func _ABitOfEverything_OneofSizer(msg proto.Message) (n int) { // 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=grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Amount uint32 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,proto3,enum=grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -508,22 +510,22 @@ func (m *ABitOfEverything_Nested) GetOk() ABitOfEverything_Nested_DeepEnum { // ABitOfEverythingRepeated is used to validate repeated path parameter functionality type ABitOfEverythingRepeated struct { // repeated values. they are comma-separated in path - PathRepeatedFloatValue []float32 `protobuf:"fixed32,1,rep,packed,name=path_repeated_float_value,json=pathRepeatedFloatValue" json:"path_repeated_float_value,omitempty"` - PathRepeatedDoubleValue []float64 `protobuf:"fixed64,2,rep,packed,name=path_repeated_double_value,json=pathRepeatedDoubleValue" json:"path_repeated_double_value,omitempty"` - PathRepeatedInt64Value []int64 `protobuf:"varint,3,rep,packed,name=path_repeated_int64_value,json=pathRepeatedInt64Value" json:"path_repeated_int64_value,omitempty"` - PathRepeatedUint64Value []uint64 `protobuf:"varint,4,rep,packed,name=path_repeated_uint64_value,json=pathRepeatedUint64Value" json:"path_repeated_uint64_value,omitempty"` - PathRepeatedInt32Value []int32 `protobuf:"varint,5,rep,packed,name=path_repeated_int32_value,json=pathRepeatedInt32Value" json:"path_repeated_int32_value,omitempty"` - PathRepeatedFixed64Value []uint64 `protobuf:"fixed64,6,rep,packed,name=path_repeated_fixed64_value,json=pathRepeatedFixed64Value" json:"path_repeated_fixed64_value,omitempty"` - PathRepeatedFixed32Value []uint32 `protobuf:"fixed32,7,rep,packed,name=path_repeated_fixed32_value,json=pathRepeatedFixed32Value" json:"path_repeated_fixed32_value,omitempty"` - PathRepeatedBoolValue []bool `protobuf:"varint,8,rep,packed,name=path_repeated_bool_value,json=pathRepeatedBoolValue" json:"path_repeated_bool_value,omitempty"` - PathRepeatedStringValue []string `protobuf:"bytes,9,rep,name=path_repeated_string_value,json=pathRepeatedStringValue" json:"path_repeated_string_value,omitempty"` + PathRepeatedFloatValue []float32 `protobuf:"fixed32,1,rep,packed,name=path_repeated_float_value,json=pathRepeatedFloatValue,proto3" json:"path_repeated_float_value,omitempty"` + PathRepeatedDoubleValue []float64 `protobuf:"fixed64,2,rep,packed,name=path_repeated_double_value,json=pathRepeatedDoubleValue,proto3" json:"path_repeated_double_value,omitempty"` + PathRepeatedInt64Value []int64 `protobuf:"varint,3,rep,packed,name=path_repeated_int64_value,json=pathRepeatedInt64Value,proto3" json:"path_repeated_int64_value,omitempty"` + PathRepeatedUint64Value []uint64 `protobuf:"varint,4,rep,packed,name=path_repeated_uint64_value,json=pathRepeatedUint64Value,proto3" json:"path_repeated_uint64_value,omitempty"` + PathRepeatedInt32Value []int32 `protobuf:"varint,5,rep,packed,name=path_repeated_int32_value,json=pathRepeatedInt32Value,proto3" json:"path_repeated_int32_value,omitempty"` + PathRepeatedFixed64Value []uint64 `protobuf:"fixed64,6,rep,packed,name=path_repeated_fixed64_value,json=pathRepeatedFixed64Value,proto3" json:"path_repeated_fixed64_value,omitempty"` + PathRepeatedFixed32Value []uint32 `protobuf:"fixed32,7,rep,packed,name=path_repeated_fixed32_value,json=pathRepeatedFixed32Value,proto3" json:"path_repeated_fixed32_value,omitempty"` + PathRepeatedBoolValue []bool `protobuf:"varint,8,rep,packed,name=path_repeated_bool_value,json=pathRepeatedBoolValue,proto3" json:"path_repeated_bool_value,omitempty"` + PathRepeatedStringValue []string `protobuf:"bytes,9,rep,name=path_repeated_string_value,json=pathRepeatedStringValue,proto3" json:"path_repeated_string_value,omitempty"` PathRepeatedBytesValue [][]byte `protobuf:"bytes,10,rep,name=path_repeated_bytes_value,json=pathRepeatedBytesValue,proto3" json:"path_repeated_bytes_value,omitempty"` - PathRepeatedUint32Value []uint32 `protobuf:"varint,11,rep,packed,name=path_repeated_uint32_value,json=pathRepeatedUint32Value" json:"path_repeated_uint32_value,omitempty"` - PathRepeatedEnumValue []NumericEnum `protobuf:"varint,12,rep,packed,name=path_repeated_enum_value,json=pathRepeatedEnumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"path_repeated_enum_value,omitempty"` - PathRepeatedSfixed32Value []int32 `protobuf:"fixed32,13,rep,packed,name=path_repeated_sfixed32_value,json=pathRepeatedSfixed32Value" json:"path_repeated_sfixed32_value,omitempty"` - PathRepeatedSfixed64Value []int64 `protobuf:"fixed64,14,rep,packed,name=path_repeated_sfixed64_value,json=pathRepeatedSfixed64Value" json:"path_repeated_sfixed64_value,omitempty"` - PathRepeatedSint32Value []int32 `protobuf:"zigzag32,15,rep,packed,name=path_repeated_sint32_value,json=pathRepeatedSint32Value" json:"path_repeated_sint32_value,omitempty"` - PathRepeatedSint64Value []int64 `protobuf:"zigzag64,16,rep,packed,name=path_repeated_sint64_value,json=pathRepeatedSint64Value" json:"path_repeated_sint64_value,omitempty"` + PathRepeatedUint32Value []uint32 `protobuf:"varint,11,rep,packed,name=path_repeated_uint32_value,json=pathRepeatedUint32Value,proto3" json:"path_repeated_uint32_value,omitempty"` + PathRepeatedEnumValue []NumericEnum `protobuf:"varint,12,rep,packed,name=path_repeated_enum_value,json=pathRepeatedEnumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"path_repeated_enum_value,omitempty"` + PathRepeatedSfixed32Value []int32 `protobuf:"fixed32,13,rep,packed,name=path_repeated_sfixed32_value,json=pathRepeatedSfixed32Value,proto3" json:"path_repeated_sfixed32_value,omitempty"` + PathRepeatedSfixed64Value []int64 `protobuf:"fixed64,14,rep,packed,name=path_repeated_sfixed64_value,json=pathRepeatedSfixed64Value,proto3" json:"path_repeated_sfixed64_value,omitempty"` + PathRepeatedSint32Value []int32 `protobuf:"zigzag32,15,rep,packed,name=path_repeated_sint32_value,json=pathRepeatedSint32Value,proto3" json:"path_repeated_sint32_value,omitempty"` + PathRepeatedSint64Value []int64 `protobuf:"zigzag64,16,rep,packed,name=path_repeated_sint64_value,json=pathRepeatedSint64Value,proto3" json:"path_repeated_sint64_value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -666,7 +668,7 @@ func (m *ABitOfEverythingRepeated) GetPathRepeatedSint64Value() []int64 { } type Body struct { - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -704,8 +706,8 @@ func (m *Body) GetName() string { } type MessageWithBody struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Data *Body `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Data *Body `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -770,8 +772,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for ABitOfEverythingService service - +// ABitOfEverythingServiceClient is the client API for ABitOfEverythingService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ABitOfEverythingServiceClient interface { // Create a new ABitOfEverything // @@ -809,7 +812,7 @@ func NewABitOfEverythingServiceClient(cc *grpc.ClientConn) ABitOfEverythingServi func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", in, out, opts...) if err != nil { return nil, err } @@ -818,7 +821,7 @@ func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEv func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", in, out, opts...) if err != nil { return nil, err } @@ -827,7 +830,7 @@ func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABit func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", in, out, opts...) if err != nil { return nil, err } @@ -836,7 +839,7 @@ func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdM func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", in, out, opts...) if err != nil { return nil, err } @@ -845,7 +848,7 @@ func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEv func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, opts...) if err != nil { return nil, err } @@ -854,7 +857,7 @@ func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdM func (c *aBitOfEverythingServiceClient) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", in, out, opts...) if err != nil { return nil, err } @@ -863,7 +866,7 @@ func (c *aBitOfEverythingServiceClient) GetQuery(ctx context.Context, in *ABitOf func (c *aBitOfEverythingServiceClient) GetRepeatedQuery(ctx context.Context, in *ABitOfEverythingRepeated, opts ...grpc.CallOption) (*ABitOfEverythingRepeated, error) { out := new(ABitOfEverythingRepeated) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetRepeatedQuery", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetRepeatedQuery", in, out, opts...) if err != nil { return nil, err } @@ -872,7 +875,7 @@ func (c *aBitOfEverythingServiceClient) GetRepeatedQuery(ctx context.Context, in func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *sub.StringMessage, opts ...grpc.CallOption) (*sub.StringMessage, error) { out := new(sub.StringMessage) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", in, out, opts...) if err != nil { return nil, err } @@ -881,7 +884,7 @@ func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *sub.String func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, opts...) if err != nil { return nil, err } @@ -890,7 +893,7 @@ func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *AB func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *duration.Duration, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", in, out, opts...) if err != nil { return nil, err } @@ -899,7 +902,7 @@ func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *dura func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", in, out, opts...) if err != nil { return nil, err } @@ -908,7 +911,7 @@ func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *empty.E func (c *aBitOfEverythingServiceClient) ErrorWithDetails(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/ErrorWithDetails", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/ErrorWithDetails", in, out, opts...) if err != nil { return nil, err } @@ -917,7 +920,7 @@ func (c *aBitOfEverythingServiceClient) ErrorWithDetails(ctx context.Context, in func (c *aBitOfEverythingServiceClient) GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetMessageWithBody", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetMessageWithBody", in, out, opts...) if err != nil { return nil, err } @@ -926,15 +929,14 @@ func (c *aBitOfEverythingServiceClient) GetMessageWithBody(ctx context.Context, func (c *aBitOfEverythingServiceClient) PostWithEmptyBody(ctx context.Context, in *Body, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PostWithEmptyBody", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PostWithEmptyBody", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for ABitOfEverythingService service - +// ABitOfEverythingServiceServer is the server API for ABitOfEverythingService service. type ABitOfEverythingServiceServer interface { // Create a new ABitOfEverything // @@ -1283,8 +1285,9 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ Metadata: "examples/proto/examplepb/a_bit_of_everything.proto", } -// Client API for CamelCaseServiceName service - +// CamelCaseServiceNameClient is the client API for CamelCaseServiceName service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type CamelCaseServiceNameClient interface { Empty(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) } @@ -1299,15 +1302,14 @@ func NewCamelCaseServiceNameClient(cc *grpc.ClientConn) CamelCaseServiceNameClie func (c *camelCaseServiceNameClient) Empty(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.camelCaseServiceName/Empty", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.camelCaseServiceName/Empty", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for CamelCaseServiceName service - +// CamelCaseServiceNameServer is the server API for CamelCaseServiceName service. type CamelCaseServiceNameServer interface { Empty(context.Context, *empty.Empty) (*empty.Empty, error) } @@ -1347,8 +1349,9 @@ var _CamelCaseServiceName_serviceDesc = grpc.ServiceDesc{ Metadata: "examples/proto/examplepb/a_bit_of_everything.proto", } -// Client API for AnotherServiceWithNoBindings service - +// AnotherServiceWithNoBindingsClient is the client API for AnotherServiceWithNoBindings service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type AnotherServiceWithNoBindingsClient interface { NoBindings(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) } @@ -1363,15 +1366,14 @@ func NewAnotherServiceWithNoBindingsClient(cc *grpc.ClientConn) AnotherServiceWi func (c *anotherServiceWithNoBindingsClient) NoBindings(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for AnotherServiceWithNoBindings service - +// AnotherServiceWithNoBindingsServer is the server API for AnotherServiceWithNoBindings service. type AnotherServiceWithNoBindingsServer interface { NoBindings(context.Context, *empty.Empty) (*empty.Empty, error) } diff --git a/examples/proto/examplepb/echo_service.pb.go b/examples/proto/examplepb/echo_service.pb.go index 905eaa93a44..da8af13fbf9 100644 --- a/examples/proto/examplepb/echo_service.pb.go +++ b/examples/proto/examplepb/echo_service.pb.go @@ -71,14 +71,16 @@ type isEmbedded_Mark interface { } type Embedded_Progress struct { - Progress int64 `protobuf:"varint,1,opt,name=progress,oneof"` + Progress int64 `protobuf:"varint,1,opt,name=progress,proto3,oneof"` } + type Embedded_Note struct { - Note string `protobuf:"bytes,2,opt,name=note,oneof"` + Note string `protobuf:"bytes,2,opt,name=note,proto3,oneof"` } func (*Embedded_Progress) isEmbedded_Mark() {} -func (*Embedded_Note) isEmbedded_Mark() {} + +func (*Embedded_Note) isEmbedded_Mark() {} func (m *Embedded) GetMark() isEmbedded_Mark { if m != nil { @@ -169,13 +171,13 @@ func _Embedded_OneofSizer(msg proto.Message) (n int) { // SimpleMessage represents a simple message sent to the Echo service. type SimpleMessage struct { // Id represents the message identifier. - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Num int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Num int64 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` // Types that are valid to be assigned to Code: // *SimpleMessage_LineNum // *SimpleMessage_Lang Code isSimpleMessage_Code `protobuf_oneof:"code"` - Status *Embedded `protobuf:"bytes,5,opt,name=status" json:"status,omitempty"` + Status *Embedded `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` // Types that are valid to be assigned to Ext: // *SimpleMessage_En // *SimpleMessage_No @@ -209,30 +211,35 @@ func (m *SimpleMessage) XXX_DiscardUnknown() { var xxx_messageInfo_SimpleMessage proto.InternalMessageInfo +func (m *SimpleMessage) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *SimpleMessage) GetNum() int64 { + if m != nil { + return m.Num + } + return 0 +} + type isSimpleMessage_Code interface { isSimpleMessage_Code() } -type isSimpleMessage_Ext interface { - isSimpleMessage_Ext() -} type SimpleMessage_LineNum struct { - LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,oneof"` + LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,proto3,oneof"` } + type SimpleMessage_Lang struct { - Lang string `protobuf:"bytes,4,opt,name=lang,oneof"` -} -type SimpleMessage_En struct { - En int64 `protobuf:"varint,6,opt,name=en,oneof"` -} -type SimpleMessage_No struct { - No *Embedded `protobuf:"bytes,7,opt,name=no,oneof"` + Lang string `protobuf:"bytes,4,opt,name=lang,proto3,oneof"` } func (*SimpleMessage_LineNum) isSimpleMessage_Code() {} -func (*SimpleMessage_Lang) isSimpleMessage_Code() {} -func (*SimpleMessage_En) isSimpleMessage_Ext() {} -func (*SimpleMessage_No) isSimpleMessage_Ext() {} + +func (*SimpleMessage_Lang) isSimpleMessage_Code() {} func (m *SimpleMessage) GetCode() isSimpleMessage_Code { if m != nil { @@ -240,26 +247,6 @@ func (m *SimpleMessage) GetCode() isSimpleMessage_Code { } return nil } -func (m *SimpleMessage) GetExt() isSimpleMessage_Ext { - if m != nil { - return m.Ext - } - return nil -} - -func (m *SimpleMessage) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *SimpleMessage) GetNum() int64 { - if m != nil { - return m.Num - } - return 0 -} func (m *SimpleMessage) GetLineNum() int64 { if x, ok := m.GetCode().(*SimpleMessage_LineNum); ok { @@ -282,6 +269,29 @@ func (m *SimpleMessage) GetStatus() *Embedded { return nil } +type isSimpleMessage_Ext interface { + isSimpleMessage_Ext() +} + +type SimpleMessage_En struct { + En int64 `protobuf:"varint,6,opt,name=en,proto3,oneof"` +} + +type SimpleMessage_No struct { + No *Embedded `protobuf:"bytes,7,opt,name=no,proto3,oneof"` +} + +func (*SimpleMessage_En) isSimpleMessage_Ext() {} + +func (*SimpleMessage_No) isSimpleMessage_Ext() {} + +func (m *SimpleMessage) GetExt() isSimpleMessage_Ext { + if m != nil { + return m.Ext + } + return nil +} + func (m *SimpleMessage) GetEn() int64 { if x, ok := m.GetExt().(*SimpleMessage_En); ok { return x.En @@ -419,8 +429,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for EchoService service - +// EchoServiceClient is the client API for EchoService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type EchoServiceClient interface { // Echo method receives a simple message and returns it. // @@ -443,7 +454,7 @@ func NewEchoServiceClient(cc *grpc.ClientConn) EchoServiceClient { func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/Echo", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/Echo", in, out, opts...) if err != nil { return nil, err } @@ -452,7 +463,7 @@ func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts .. func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoBody", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoBody", in, out, opts...) if err != nil { return nil, err } @@ -461,15 +472,14 @@ func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opt func (c *echoServiceClient) EchoDelete(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoDelete", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoDelete", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for EchoService service - +// EchoServiceServer is the server API for EchoService service. type EchoServiceServer interface { // Echo method receives a simple message and returns it. // diff --git a/examples/proto/examplepb/flow_combination.pb.go b/examples/proto/examplepb/flow_combination.pb.go index 20b2402f9d0..25e2b775e50 100644 --- a/examples/proto/examplepb/flow_combination.pb.go +++ b/examples/proto/examplepb/flow_combination.pb.go @@ -55,9 +55,9 @@ func (m *EmptyProto) XXX_DiscardUnknown() { var xxx_messageInfo_EmptyProto proto.InternalMessageInfo type NonEmptyProto struct { - A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` - B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"` - C string `protobuf:"bytes,3,opt,name=c" json:"c,omitempty"` + A string `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` + B string `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` + C string `protobuf:"bytes,3,opt,name=c,proto3" json:"c,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -109,7 +109,7 @@ func (m *NonEmptyProto) GetC() string { } type UnaryProto struct { - Str string `protobuf:"bytes,1,opt,name=str" json:"str,omitempty"` + Str string `protobuf:"bytes,1,opt,name=str,proto3" json:"str,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -147,9 +147,9 @@ func (m *UnaryProto) GetStr() string { } type NestedProto struct { - A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` - B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"` - C string `protobuf:"bytes,3,opt,name=c" json:"c,omitempty"` + A *UnaryProto `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` + B string `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` + C string `protobuf:"bytes,3,opt,name=c,proto3" json:"c,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -201,7 +201,7 @@ func (m *NestedProto) GetC() string { } type SingleNestedProto struct { - A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` + A *UnaryProto `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -254,8 +254,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for FlowCombination service - +// FlowCombinationClient is the client API for FlowCombination service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type FlowCombinationClient interface { RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) @@ -279,7 +280,7 @@ func NewFlowCombinationClient(cc *grpc.ClientConn) FlowCombinationClient { func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", in, out, opts...) if err != nil { return nil, err } @@ -287,7 +288,7 @@ func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, } func (c *flowCombinationClient) RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[0], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyStream", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[0], "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyStream", opts...) if err != nil { return nil, err } @@ -319,7 +320,7 @@ func (x *flowCombinationRpcEmptyStreamClient) Recv() (*EmptyProto, error) { } func (c *flowCombinationClient) StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[1], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyRpc", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[1], "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyRpc", opts...) if err != nil { return nil, err } @@ -353,7 +354,7 @@ func (x *flowCombinationStreamEmptyRpcClient) CloseAndRecv() (*EmptyProto, error } func (c *flowCombinationClient) StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[2], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyStream", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[2], "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyStream", opts...) if err != nil { return nil, err } @@ -385,7 +386,7 @@ func (x *flowCombinationStreamEmptyStreamClient) Recv() (*EmptyProto, error) { func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", in, out, opts...) if err != nil { return nil, err } @@ -394,7 +395,7 @@ func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProt func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, opts...) if err != nil { return nil, err } @@ -403,7 +404,7 @@ func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in * func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", in, out, opts...) if err != nil { return nil, err } @@ -411,7 +412,7 @@ func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *Nested } func (c *flowCombinationClient) RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[3], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyStream", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[3], "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyStream", opts...) if err != nil { return nil, err } @@ -443,7 +444,7 @@ func (x *flowCombinationRpcBodyStreamClient) Recv() (*EmptyProto, error) { } func (c *flowCombinationClient) RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[4], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[4], "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...) if err != nil { return nil, err } @@ -475,7 +476,7 @@ func (x *flowCombinationRpcPathSingleNestedStreamClient) Recv() (*EmptyProto, er } func (c *flowCombinationClient) RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[5], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedStream", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[5], "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedStream", opts...) if err != nil { return nil, err } @@ -506,8 +507,7 @@ func (x *flowCombinationRpcPathNestedStreamClient) Recv() (*EmptyProto, error) { return m, nil } -// Server API for FlowCombination service - +// FlowCombinationServer is the server API for FlowCombination service. type FlowCombinationServer interface { RpcEmptyRpc(context.Context, *EmptyProto) (*EmptyProto, error) RpcEmptyStream(*EmptyProto, FlowCombination_RpcEmptyStreamServer) error diff --git a/examples/proto/examplepb/response_body_service.pb.go b/examples/proto/examplepb/response_body_service.pb.go index 8c7123740d4..fcad76e5898 100644 --- a/examples/proto/examplepb/response_body_service.pb.go +++ b/examples/proto/examplepb/response_body_service.pb.go @@ -25,7 +25,7 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type ResponseBodyIn struct { - Data string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` + Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -63,7 +63,7 @@ func (m *ResponseBodyIn) GetData() string { } type ResponseBodyOut struct { - Response *ResponseBodyOut_Response `protobuf:"bytes,2,opt,name=response" json:"response,omitempty"` + Response *ResponseBodyOut_Response `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -101,7 +101,7 @@ func (m *ResponseBodyOut) GetResponse() *ResponseBodyOut_Response { } type ResponseBodyOut_Response struct { - Data string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` + Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -152,8 +152,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for ResponseBodyService service - +// ResponseBodyServiceClient is the client API for ResponseBodyService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ResponseBodyServiceClient interface { GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) } @@ -168,15 +169,14 @@ func NewResponseBodyServiceClient(cc *grpc.ClientConn) ResponseBodyServiceClient func (c *responseBodyServiceClient) GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) { out := new(ResponseBodyOut) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ResponseBodyService/GetResponseBody", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ResponseBodyService/GetResponseBody", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for ResponseBodyService service - +// ResponseBodyServiceServer is the server API for ResponseBodyService service. type ResponseBodyServiceServer interface { GetResponseBody(context.Context, *ResponseBodyIn) (*ResponseBodyOut, error) } diff --git a/examples/proto/examplepb/stream.pb.go b/examples/proto/examplepb/stream.pb.go index c598d8a548b..cc0c274c8ea 100644 --- a/examples/proto/examplepb/stream.pb.go +++ b/examples/proto/examplepb/stream.pb.go @@ -34,8 +34,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for StreamService service - +// StreamServiceClient is the client API for StreamService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type StreamServiceClient interface { BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) List(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error) @@ -51,7 +52,7 @@ func NewStreamServiceClient(cc *grpc.ClientConn) StreamServiceClient { } func (c *streamServiceClient) BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) { - stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[0], c.cc, "/grpc.gateway.examples.examplepb.StreamService/BulkCreate", opts...) + stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[0], "/grpc.gateway.examples.examplepb.StreamService/BulkCreate", opts...) if err != nil { return nil, err } @@ -85,7 +86,7 @@ func (x *streamServiceBulkCreateClient) CloseAndRecv() (*empty.Empty, error) { } func (c *streamServiceClient) List(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error) { - stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[1], c.cc, "/grpc.gateway.examples.examplepb.StreamService/List", opts...) + stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[1], "/grpc.gateway.examples.examplepb.StreamService/List", opts...) if err != nil { return nil, err } @@ -117,7 +118,7 @@ func (x *streamServiceListClient) Recv() (*ABitOfEverything, error) { } func (c *streamServiceClient) BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) { - stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[2], c.cc, "/grpc.gateway.examples.examplepb.StreamService/BulkEcho", opts...) + stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[2], "/grpc.gateway.examples.examplepb.StreamService/BulkEcho", opts...) if err != nil { return nil, err } @@ -147,8 +148,7 @@ func (x *streamServiceBulkEchoClient) Recv() (*sub.StringMessage, error) { return m, nil } -// Server API for StreamService service - +// StreamServiceServer is the server API for StreamService service. type StreamServiceServer interface { BulkCreate(StreamService_BulkCreateServer) error List(*empty.Empty, StreamService_ListServer) error diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.go b/examples/proto/examplepb/unannotated_echo_service.pb.go index 7e2dd22f1c7..28f0d7311d0 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.go @@ -37,9 +37,9 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // UnannotatedSimpleMessage represents a simple message sent to the unannotated Echo service. type UnannotatedSimpleMessage struct { // Id represents the message identifier. - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Num int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` - Duration *duration.Duration `protobuf:"bytes,3,opt,name=duration" json:"duration,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Num int64 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` + Duration *duration.Duration `protobuf:"bytes,3,opt,name=duration,proto3" json:"duration,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -102,8 +102,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for UnannotatedEchoService service - +// UnannotatedEchoServiceClient is the client API for UnannotatedEchoService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type UnannotatedEchoServiceClient interface { // Echo method receives a simple message and returns it. // @@ -126,7 +127,7 @@ func NewUnannotatedEchoServiceClient(cc *grpc.ClientConn) UnannotatedEchoService func (c *unannotatedEchoServiceClient) Echo(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/Echo", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/Echo", in, out, opts...) if err != nil { return nil, err } @@ -135,7 +136,7 @@ func (c *unannotatedEchoServiceClient) Echo(ctx context.Context, in *Unannotated func (c *unannotatedEchoServiceClient) EchoBody(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoBody", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoBody", in, out, opts...) if err != nil { return nil, err } @@ -144,15 +145,14 @@ func (c *unannotatedEchoServiceClient) EchoBody(ctx context.Context, in *Unannot func (c *unannotatedEchoServiceClient) EchoDelete(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoDelete", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoDelete", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for UnannotatedEchoService service - +// UnannotatedEchoServiceServer is the server API for UnannotatedEchoService service. type UnannotatedEchoServiceServer interface { // Echo method receives a simple message and returns it. // diff --git a/examples/proto/examplepb/wrappers.pb.go b/examples/proto/examplepb/wrappers.pb.go index 23fdd65a8b3..fb44ca7aba9 100644 --- a/examples/proto/examplepb/wrappers.pb.go +++ b/examples/proto/examplepb/wrappers.pb.go @@ -26,15 +26,15 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type Wrappers struct { - StringValue *wrappers.StringValue `protobuf:"bytes,1,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - Int32Value *wrappers.Int32Value `protobuf:"bytes,2,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` - Int64Value *wrappers.Int64Value `protobuf:"bytes,3,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` - FloatValue *wrappers.FloatValue `protobuf:"bytes,4,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` - DoubleValue *wrappers.DoubleValue `protobuf:"bytes,5,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` - BoolValue *wrappers.BoolValue `protobuf:"bytes,6,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` - Uint32Value *wrappers.UInt32Value `protobuf:"bytes,7,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` - Uint64Value *wrappers.UInt64Value `protobuf:"bytes,8,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` - BytesValue *wrappers.BytesValue `protobuf:"bytes,9,opt,name=bytes_value,json=bytesValue" json:"bytes_value,omitempty"` + StringValue *wrappers.StringValue `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` + Int32Value *wrappers.Int32Value `protobuf:"bytes,2,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` + Int64Value *wrappers.Int64Value `protobuf:"bytes,3,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` + FloatValue *wrappers.FloatValue `protobuf:"bytes,4,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` + DoubleValue *wrappers.DoubleValue `protobuf:"bytes,5,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` + BoolValue *wrappers.BoolValue `protobuf:"bytes,6,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` + Uint32Value *wrappers.UInt32Value `protobuf:"bytes,7,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` + Uint64Value *wrappers.UInt64Value `protobuf:"bytes,8,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` + BytesValue *wrappers.BytesValue `protobuf:"bytes,9,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -139,8 +139,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for WrappersService service - +// WrappersServiceClient is the client API for WrappersService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type WrappersServiceClient interface { Create(ctx context.Context, in *Wrappers, opts ...grpc.CallOption) (*Wrappers, error) } @@ -155,15 +156,14 @@ func NewWrappersServiceClient(cc *grpc.ClientConn) WrappersServiceClient { func (c *wrappersServiceClient) Create(ctx context.Context, in *Wrappers, opts ...grpc.CallOption) (*Wrappers, error) { out := new(Wrappers) - err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/Create", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/Create", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for WrappersService service - +// WrappersServiceServer is the server API for WrappersService service. type WrappersServiceServer interface { Create(context.Context, *Wrappers) (*Wrappers, error) } diff --git a/examples/proto/sub2/message.pb.go b/examples/proto/sub2/message.pb.go index a0a812c7d0f..6819b67ae3c 100644 --- a/examples/proto/sub2/message.pb.go +++ b/examples/proto/sub2/message.pb.go @@ -19,7 +19,7 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type IdMessage struct { - Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` diff --git a/examples/server/BUILD.bazel b/examples/server/BUILD.bazel index 10bb44d0641..29d44cfb4d1 100644 --- a/examples/server/BUILD.bazel +++ b/examples/server/BUILD.bazel @@ -19,10 +19,10 @@ go_library( "//examples/proto/sub2:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//ptypes/duration:go_default_library", - "@com_github_golang_protobuf//ptypes/empty:go_default_library", "@com_github_rogpeppe_fastuuid//:go_default_library", - "@org_golang_google_genproto//googleapis/rpc/errdetails:go_default_library", + "@go_googleapis//google/rpc:errdetails_go_proto", + "@io_bazel_rules_go//proto/wkt:duration_go_proto", + "@io_bazel_rules_go//proto/wkt:empty_go_proto", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", diff --git a/protoc-gen-grpc-gateway/BUILD.bazel b/protoc-gen-grpc-gateway/BUILD.bazel index 8ca170d3da5..1af07f27f79 100644 --- a/protoc-gen-grpc-gateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/BUILD.bazel @@ -13,7 +13,7 @@ go_library( "//protoc-gen-grpc-gateway/gengateway:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", ], ) diff --git a/protoc-gen-grpc-gateway/descriptor/BUILD.bazel b/protoc-gen-grpc-gateway/descriptor/BUILD.bazel index 93670c52729..cfbdc277a8c 100644 --- a/protoc-gen-grpc-gateway/descriptor/BUILD.bazel +++ b/protoc-gen-grpc-gateway/descriptor/BUILD.bazel @@ -16,12 +16,12 @@ go_library( "//protoc-gen-grpc-gateway/httprule:go_default_library", "@com_github_ghodss_yaml//:go_default_library", "@com_github_golang_glog//:go_default_library", - "@com_github_golang_protobuf//jsonpb:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", - "@org_golang_google_genproto//googleapis/api/annotations:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", + "@go_googleapis//google/api:annotations_go_proto", + "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], ) @@ -38,7 +38,7 @@ go_test( deps = [ "//protoc-gen-grpc-gateway/httprule:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], ) diff --git a/protoc-gen-grpc-gateway/generator/BUILD.bazel b/protoc-gen-grpc-gateway/generator/BUILD.bazel index 5995e5df888..6cb2162d847 100644 --- a/protoc-gen-grpc-gateway/generator/BUILD.bazel +++ b/protoc-gen-grpc-gateway/generator/BUILD.bazel @@ -8,6 +8,6 @@ go_library( importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator", deps = [ "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", ], ) diff --git a/protoc-gen-grpc-gateway/gengateway/BUILD.bazel b/protoc-gen-grpc-gateway/gengateway/BUILD.bazel index 3ab955c1fea..fcd9cfc3209 100644 --- a/protoc-gen-grpc-gateway/gengateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/gengateway/BUILD.bazel @@ -16,9 +16,7 @@ go_library( "//utilities:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", - "@org_golang_google_genproto//googleapis/api/annotations:go_default_library", + "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", ], ) @@ -34,6 +32,6 @@ go_test( "//protoc-gen-grpc-gateway/descriptor:go_default_library", "//protoc-gen-grpc-gateway/httprule:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], ) diff --git a/protoc-gen-swagger/BUILD.bazel b/protoc-gen-swagger/BUILD.bazel index 62384ef3496..d5a1d05fcc7 100644 --- a/protoc-gen-swagger/BUILD.bazel +++ b/protoc-gen-swagger/BUILD.bazel @@ -12,7 +12,7 @@ go_library( "//protoc-gen-swagger/genswagger:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", ], ) diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/genswagger/BUILD.bazel index 7f34844a7a0..172330ad88f 100644 --- a/protoc-gen-swagger/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/genswagger/BUILD.bazel @@ -17,8 +17,8 @@ go_library( "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], ) @@ -31,7 +31,7 @@ go_test( "//protoc-gen-grpc-gateway/descriptor:go_default_library", "//protoc-gen-grpc-gateway/httprule:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", + "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], ) diff --git a/protoc-gen-swagger/options/BUILD.bazel b/protoc-gen-swagger/options/BUILD.bazel index 476cb59db4b..0a91a7bbc68 100644 --- a/protoc-gen-swagger/options/BUILD.bazel +++ b/protoc-gen-swagger/options/BUILD.bazel @@ -20,10 +20,6 @@ go_proto_library( compilers = ["@io_bazel_rules_go//proto:go_grpc"], importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options", proto = ":options_proto", - deps = [ - "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", - "@com_github_golang_protobuf//ptypes/any:go_default_library", - ], ) go_library( diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index 8acf78d147e..ccdb18fe08b 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -190,17 +190,17 @@ func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { // // TODO(ivucica): document fields type Swagger struct { - Swagger string `protobuf:"bytes,1,opt,name=swagger" json:"swagger,omitempty"` - Info *Info `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"` - Host string `protobuf:"bytes,3,opt,name=host" json:"host,omitempty"` - BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath" json:"base_path,omitempty"` - Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` - Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"` - Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` - Responses map[string]*Response `protobuf:"bytes,10,rep,name=responses" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,11,opt,name=security_definitions,json=securityDefinitions" json:"security_definitions,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security" json:"security,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` + Swagger string `protobuf:"bytes,1,opt,name=swagger,proto3" json:"swagger,omitempty"` + Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` + BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` + Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,proto3,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` + Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` + Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` + Responses map[string]*Response `protobuf:"bytes,10,rep,name=responses,proto3" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,11,opt,name=security_definitions,json=securityDefinitions,proto3" json:"security_definitions,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -313,17 +313,17 @@ func (m *Swagger) GetExternalDocs() *ExternalDocumentation { // // TODO(ivucica): document fields type Operation struct { - Tags []string `protobuf:"bytes,1,rep,name=tags" json:"tags,omitempty"` - Summary string `protobuf:"bytes,2,opt,name=summary" json:"summary,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` - OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId" json:"operation_id,omitempty"` - Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"` - Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` - Responses map[string]*Response `protobuf:"bytes,9,rep,name=responses" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Schemes []string `protobuf:"bytes,10,rep,name=schemes" json:"schemes,omitempty"` - Deprecated bool `protobuf:"varint,11,opt,name=deprecated" json:"deprecated,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security" json:"security,omitempty"` + Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` + Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` + Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` + Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` + Responses map[string]*Response `protobuf:"bytes,9,rep,name=responses,proto3" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Schemes []string `protobuf:"bytes,10,rep,name=schemes,proto3" json:"schemes,omitempty"` + Deprecated bool `protobuf:"varint,11,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -437,10 +437,10 @@ func (m *Operation) GetSecurity() []*SecurityRequirement { type Response struct { // `Description` is a short description of the response. // GFM syntax can be used for rich text representation. - Description string `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"` + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` // `Schema` optionally defines the structure of the response. // If `Schema` is not provided, it means there is no content to the response. - Schema *Schema `protobuf:"bytes,2,opt,name=schema" json:"schema,omitempty"` + Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -490,12 +490,12 @@ func (m *Response) GetSchema() *Schema { // // TODO(ivucica): document fields type Info struct { - Title string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` - TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService" json:"terms_of_service,omitempty"` - Contact *Contact `protobuf:"bytes,4,opt,name=contact" json:"contact,omitempty"` - License *License `protobuf:"bytes,5,opt,name=license" json:"license,omitempty"` - Version string `protobuf:"bytes,6,opt,name=version" json:"version,omitempty"` + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"` + Contact *Contact `protobuf:"bytes,4,opt,name=contact,proto3" json:"contact,omitempty"` + License *License `protobuf:"bytes,5,opt,name=license,proto3" json:"license,omitempty"` + Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -573,9 +573,9 @@ func (m *Info) GetVersion() string { // // TODO(ivucica): document fields type Contact struct { - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` - Email string `protobuf:"bytes,3,opt,name=email" json:"email,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -632,9 +632,9 @@ func (m *Contact) GetEmail() string { // type License struct { // Required. The license name used for the API. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // A URL to the license used for the API. - Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -685,8 +685,8 @@ func (m *License) GetUrl() string { // // TODO(ivucica): document fields type ExternalDocumentation struct { - Description string `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -736,11 +736,11 @@ func (m *ExternalDocumentation) GetUrl() string { // // TODO(ivucica): document fields type Schema struct { - JsonSchema *JSONSchema `protobuf:"bytes,1,opt,name=json_schema,json=jsonSchema" json:"json_schema,omitempty"` - Discriminator string `protobuf:"bytes,2,opt,name=discriminator" json:"discriminator,omitempty"` - ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly" json:"read_only,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,5,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` - Example *any.Any `protobuf:"bytes,6,opt,name=example" json:"example,omitempty"` + JsonSchema *JSONSchema `protobuf:"bytes,1,opt,name=json_schema,json=jsonSchema,proto3" json:"json_schema,omitempty"` + Discriminator string `protobuf:"bytes,2,opt,name=discriminator,proto3" json:"discriminator,omitempty"` + ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,5,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + Example *any.Any `protobuf:"bytes,6,opt,name=example,proto3" json:"example,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -823,27 +823,27 @@ type JSONSchema struct { // the output. // For example: // `ref: ".google.protobuf.Timestamp"`. - Ref string `protobuf:"bytes,3,opt,name=ref" json:"ref,omitempty"` - Title string `protobuf:"bytes,5,opt,name=title" json:"title,omitempty"` - Description string `protobuf:"bytes,6,opt,name=description" json:"description,omitempty"` - Default string `protobuf:"bytes,7,opt,name=default" json:"default,omitempty"` - MultipleOf float64 `protobuf:"fixed64,10,opt,name=multiple_of,json=multipleOf" json:"multiple_of,omitempty"` - Maximum float64 `protobuf:"fixed64,11,opt,name=maximum" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,13,opt,name=minimum" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum" json:"exclusive_minimum,omitempty"` - MaxLength uint64 `protobuf:"varint,15,opt,name=max_length,json=maxLength" json:"max_length,omitempty"` - MinLength uint64 `protobuf:"varint,16,opt,name=min_length,json=minLength" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,17,opt,name=pattern" json:"pattern,omitempty"` - MaxItems uint64 `protobuf:"varint,20,opt,name=max_items,json=maxItems" json:"max_items,omitempty"` - MinItems uint64 `protobuf:"varint,21,opt,name=min_items,json=minItems" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,22,opt,name=unique_items,json=uniqueItems" json:"unique_items,omitempty"` - MaxProperties uint64 `protobuf:"varint,24,opt,name=max_properties,json=maxProperties" json:"max_properties,omitempty"` - MinProperties uint64 `protobuf:"varint,25,opt,name=min_properties,json=minProperties" json:"min_properties,omitempty"` - Required []string `protobuf:"bytes,26,rep,name=required" json:"required,omitempty"` + Ref string `protobuf:"bytes,3,opt,name=ref,proto3" json:"ref,omitempty"` + Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + Default string `protobuf:"bytes,7,opt,name=default,proto3" json:"default,omitempty"` + MultipleOf float64 `protobuf:"fixed64,10,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` + Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` + ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` + Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` + ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` + MaxLength uint64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` + MinLength uint64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` + Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` + MaxItems uint64 `protobuf:"varint,20,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` + MinItems uint64 `protobuf:"varint,21,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` + UniqueItems bool `protobuf:"varint,22,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` + MaxProperties uint64 `protobuf:"varint,24,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"` + MinProperties uint64 `protobuf:"varint,25,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"` + Required []string `protobuf:"bytes,26,rep,name=required,proto3" json:"required,omitempty"` // Items in 'array' must be unique. - Array []string `protobuf:"bytes,34,rep,name=array" json:"array,omitempty"` - Type []JSONSchema_JSONSchemaSimpleTypes `protobuf:"varint,35,rep,packed,name=type,enum=grpc.gateway.protoc_gen_swagger.options.JSONSchema_JSONSchemaSimpleTypes" json:"type,omitempty"` + Array []string `protobuf:"bytes,34,rep,name=array,proto3" json:"array,omitempty"` + Type []JSONSchema_JSONSchemaSimpleTypes `protobuf:"varint,35,rep,packed,name=type,proto3,enum=grpc.gateway.protoc_gen_swagger.options.JSONSchema_JSONSchemaSimpleTypes" json:"type,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1021,8 +1021,8 @@ func (m *JSONSchema) GetType() []JSONSchema_JSONSchemaSimpleTypes { type Tag struct { // TODO(ivucica): Description should be extracted from comments on the proto // service object. - Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1076,7 +1076,7 @@ func (m *Tag) GetExternalDocs() *ExternalDocumentation { // and only serves to provide the relevant details for each scheme. type SecurityDefinitions struct { // A single security scheme definition, mapping a "name" to the scheme it defines. - Security map[string]*SecurityScheme `protobuf:"bytes,1,rep,name=security" json:"security,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Security map[string]*SecurityScheme `protobuf:"bytes,1,rep,name=security,proto3" json:"security,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1125,36 +1125,36 @@ func (m *SecurityDefinitions) GetSecurity() map[string]*SecurityScheme { type SecurityScheme struct { // Required. The type of the security scheme. Valid values are "basic", // "apiKey" or "oauth2". - Type SecurityScheme_Type `protobuf:"varint,1,opt,name=type,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Type" json:"type,omitempty"` + Type SecurityScheme_Type `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Type" json:"type,omitempty"` // A short description for security scheme. - Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // Required. The name of the header or query parameter to be used. // // Valid for apiKey. - Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // Required. The location of the API key. Valid values are "query" or "header". // // Valid for apiKey. - In SecurityScheme_In `protobuf:"varint,4,opt,name=in,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_In" json:"in,omitempty"` + In SecurityScheme_In `protobuf:"varint,4,opt,name=in,proto3,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_In" json:"in,omitempty"` // Required. The flow used by the OAuth2 security scheme. Valid values are // "implicit", "password", "application" or "accessCode". // // Valid for oauth2. - Flow SecurityScheme_Flow `protobuf:"varint,5,opt,name=flow,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Flow" json:"flow,omitempty"` + Flow SecurityScheme_Flow `protobuf:"varint,5,opt,name=flow,proto3,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Flow" json:"flow,omitempty"` // Required. The authorization URL to be used for this flow. This SHOULD be in // the form of a URL. // // Valid for oauth2/implicit and oauth2/accessCode. - AuthorizationUrl string `protobuf:"bytes,6,opt,name=authorization_url,json=authorizationUrl" json:"authorization_url,omitempty"` + AuthorizationUrl string `protobuf:"bytes,6,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` // Required. The token URL to be used for this flow. This SHOULD be in the // form of a URL. // // Valid for oauth2/password, oauth2/application and oauth2/accessCode. - TokenUrl string `protobuf:"bytes,7,opt,name=token_url,json=tokenUrl" json:"token_url,omitempty"` + TokenUrl string `protobuf:"bytes,7,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` // Required. The available scopes for the OAuth2 security scheme. // // Valid for oauth2. - Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes" json:"scopes,omitempty"` + Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes,proto3" json:"scopes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1256,7 +1256,7 @@ type SecurityRequirement struct { // the Security Definitions. If the security scheme is of type "oauth2", // then the value is a list of scope names required for the execution. // For other security scheme types, the array MUST be empty. - SecurityRequirement map[string]*SecurityRequirement_SecurityRequirementValue `protobuf:"bytes,1,rep,name=security_requirement,json=securityRequirement" json:"security_requirement,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + SecurityRequirement map[string]*SecurityRequirement_SecurityRequirementValue `protobuf:"bytes,1,rep,name=security_requirement,json=securityRequirement,proto3" json:"security_requirement,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1297,7 +1297,7 @@ func (m *SecurityRequirement) GetSecurityRequirement() map[string]*SecurityRequi // scope names required for the execution. For other security scheme types, // the array MUST be empty. type SecurityRequirement_SecurityRequirementValue struct { - Scope []string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty"` + Scope []string `protobuf:"bytes,1,rep,name=scope,proto3" json:"scope,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1346,7 +1346,7 @@ func (m *SecurityRequirement_SecurityRequirementValue) GetScope() []string { type Scopes struct { // Maps between a name of a scope to a short description of it (as the value // of the property). - Scope map[string]string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Scope map[string]string `protobuf:"bytes,1,rep,name=scope,proto3" json:"scope,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` diff --git a/repositories.bzl b/repositories.bzl deleted file mode 100644 index 4133986239d..00000000000 --- a/repositories.bzl +++ /dev/null @@ -1,47 +0,0 @@ -GOOGLEAPIS_GOOGLE_API_BUILD_CONTENTS = """ -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -package(default_visibility = ["//visibility:public"]) - -proto_library( - name = "api_proto", - srcs = [ - "annotations.proto", - "http.proto", - ], - deps = ["@com_google_protobuf//:descriptor_proto"], -) - -go_proto_library( - name = "api_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/annotations", - proto = ":api_proto", - deps = ["@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library"], -) - -go_library( - name = "go_default_library", - embed = [":api_go_proto"], - importpath = "google.golang.org/genproto/googleapis/api/annotations", -) -""" - -def _googleapis_repository_impl(ctx): - googleapis_commit = "3e68e19410baa7d78cdacc45b034eafe7467b439" - ctx.download_and_extract( - url = "https://github.com/googleapis/googleapis/archive/{commit}.tar.gz".format( - commit = googleapis_commit, - ), - sha256 = "eb98f16b037a27fd5fa6b3420a1e344014396d8ffbbab83c1adfe1296ea8572e", - stripPrefix = "googleapis-{}".format(googleapis_commit), - ) - - ctx.file("google/api/BUILD.bazel", GOOGLEAPIS_GOOGLE_API_BUILD_CONTENTS) - -_googleapis_repository = repository_rule( - implementation = _googleapis_repository_impl, -) - -def repositories(): - _googleapis_repository(name = "com_github_googleapis_googleapis") diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index 60c1fec31d9..66a8999f2a2 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -25,12 +25,11 @@ go_library( deps = [ "//runtime/internal:go_default_library", "//utilities:go_default_library", - "@com_github_golang_protobuf//jsonpb:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//ptypes:go_default_library", - "@com_github_golang_protobuf//ptypes/any:go_default_library", - "@com_github_golang_protobuf//ptypes/duration:go_default_library", - "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", + "@io_bazel_rules_go//proto/wkt:any_go_proto", + "@io_bazel_rules_go//proto/wkt:duration_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//grpclog:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", @@ -41,14 +40,6 @@ go_library( go_test( name = "go_default_test", size = "small", - srcs = ["pattern_test.go"], - embed = [":go_default_library"], - deps = ["//utilities:go_default_library"], -) - -go_test( - name = "go_default_xtest", - size = "small", srcs = [ "context_test.go", "errors_test.go", @@ -58,23 +49,24 @@ go_test( "marshal_proto_test.go", "marshaler_registry_test.go", "mux_test.go", + "pattern_test.go", "query_test.go", ], + embed = [":go_default_library"], deps = [ - ":go_default_library", "//examples/proto/examplepb:go_default_library", "//runtime/internal:go_default_library", "//utilities:go_default_library", - "@com_github_golang_protobuf//jsonpb:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//ptypes:go_default_library", - "@com_github_golang_protobuf//ptypes/duration:go_default_library", - "@com_github_golang_protobuf//ptypes/empty:go_default_library", - "@com_github_golang_protobuf//ptypes/struct:go_default_library", - "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", - "@com_github_golang_protobuf//ptypes/wrappers:go_default_library", - "@org_golang_google_genproto//googleapis/rpc/errdetails:go_default_library", - "@org_golang_google_genproto//protobuf/field_mask:go_default_library", + "@com_github_golang_protobuf//ptypes:go_default_library_gen", + "@go_googleapis//google/rpc:errdetails_go_proto", + "@io_bazel_rules_go//proto/wkt:duration_go_proto", + "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", + "@io_bazel_rules_go//proto/wkt:struct_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", + "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", diff --git a/runtime/internal/BUILD.bazel b/runtime/internal/BUILD.bazel index 937e66089ee..63565730423 100644 --- a/runtime/internal/BUILD.bazel +++ b/runtime/internal/BUILD.bazel @@ -13,7 +13,6 @@ go_proto_library( name = "internal_go_proto", importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime/internal", proto = ":internal_proto", - deps = ["@com_github_golang_protobuf//ptypes/any:go_default_library"], ) go_library( diff --git a/runtime/internal/stream_chunk.pb.go b/runtime/internal/stream_chunk.pb.go index a06c722c167..f4af074808b 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/runtime/internal/stream_chunk.pb.go @@ -22,11 +22,11 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // StreamError is a response type which is returned when // streaming rpc returns an error. type StreamError struct { - GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode" json:"grpc_code,omitempty"` - HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode" json:"http_code,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` - HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus" json:"http_status,omitempty"` - Details []*any.Any `protobuf:"bytes,5,rep,name=details" json:"details,omitempty"` + GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode,proto3" json:"grpc_code,omitempty"` + HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode,proto3" json:"http_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus,proto3" json:"http_status,omitempty"` + Details []*any.Any `protobuf:"bytes,5,rep,name=details,proto3" json:"details,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index 0c3d01bfeba..00dcfd99c5e 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -270,8 +270,8 @@ func TestJSONPbEncoder(t *testing.T) { if strings.ContainsAny(json, " \t\r\n") { t.Errorf("strings.ContainsAny(%q, %q) = true; want false", json, " \t\r\n") } - if strings.Contains(json, "ONE") { - t.Errorf(`strings.Contains(%q, "ONE") = true; want false`, json) + if !strings.Contains(json, "ONE") { + t.Errorf(`strings.Contains(%q, "ONE") = false; want true`, json) } if want := "uint64Value"; !strings.Contains(json, want) { t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) diff --git a/utilities/BUILD.bazel b/utilities/BUILD.bazel index 58d291c3738..151f6864d92 100644 --- a/utilities/BUILD.bazel +++ b/utilities/BUILD.bazel @@ -13,8 +13,8 @@ go_library( ) go_test( - name = "go_default_xtest", + name = "go_default_test", size = "small", srcs = ["trie_test.go"], - deps = [":go_default_library"], + embed = [":go_default_library"], ) From 1ff66182fe0d44bda8287cfb9c52b0a95a397afd Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Wed, 14 Nov 2018 14:51:26 +0100 Subject: [PATCH 313/552] Make Bazel CI failures clearer (#807) * Make Bazel CI failures clearer - don't try to run tests if the BUILD files are out-of-date - run buildifier even if the tests fail, as it may still be useful - use a parameter to hold Bazel config to simplify config.yml - ignore the vendor/ directory when running Gazelle (otherwise it will fail if you've used `dep` to create vendor/) * Add Bazel invocation to CONTRIBUTING.md --- .circleci/config.yml | 36 ++++++++++++++++++++++-------------- BUILD | 1 + CONTRIBUTING.md | 4 +++- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 150455b5c21..b4189cd4638 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -50,23 +50,32 @@ jobs: - run: dep ensure --vendor-only - run: go get golang.org/x/lint/golint - run: make lint - bazel_lint: + bazel: docker: - image: l.gcr.io/google/bazel:latest working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway steps: - checkout - - run: 'bazel --output_base=$HOME/.cache/_grpc_gateway_bazel run //:buildifier_check || - (echo "Bazel files not formatted, please run \`bazel run :buildifier\`"; exit 1)' - - run: 'test -z "$(bazel --output_base=$HOME/.cache/_grpc_gateway_bazel run //:gazelle_diff)" || - (echo "Bazel files out-of-date, please run \`bazel run :gazelle_diff\`"; exit 1)' - bazel_test: - docker: - - image: l.gcr.io/google/bazel:latest - working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway - steps: - - checkout - - run: bazel --output_base=$HOME/.cache/_grpc_gateway_bazel test --test_output=errors --features=race //... + - run: + name: Create Bazel config file (.bazelrc) + command: | + cat > .bazelrc << EOF + startup --output_base $HOME/.cache/_grpc_gateway_bazel + build --test_output errors + build --features race + EOF + - run: + name: Check that Bazel BUILD files are up-to-date + command: 'test -z "$(bazel run //:gazelle_diff)" || + (echo "ERROR: Bazel files out-of-date, please run \`bazel run :gazelle_fix\`" >&2; exit 1)' + - run: + name: Run tests with Bazel + command: bazel test //... + - run: + name: Check formatting of Bazel BUILD files + command: 'bazel run //:buildifier_check || + (echo "ERROR: Bazel files not formatted, please run \`bazel run :buildifier\`" >&2; exit 1)' + when: always build_linux_release: docker: - image: jfbrandhorst/grpc-gateway-build-env @@ -153,8 +162,7 @@ workflows: - node_test - generate - lint - - bazel_lint - - bazel_test + - bazel - build_linux_release: filters: branches: diff --git a/BUILD b/BUILD index b72e9743bd8..a9997cb5a0e 100644 --- a/BUILD +++ b/BUILD @@ -11,6 +11,7 @@ buildifier( ) # gazelle:exclude third_party +# gazelle:exclude vendor gazelle( name = "gazelle_diff", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8bcfb2794ca..a7d09ce6cb0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,10 +24,12 @@ All submissions, including submissions by project members, require review. Great, it should be as simple as thus (run from the root of the directory): ```bash -$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env \ +docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env \ /bin/bash -c 'cd /go/src/github.com/grpc-ecosystem/grpc-gateway && \ make realclean && \ make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' +docker run -itv $(pwd):/grpc-gateway -w /grpc-gateway --entrypoint /bin/bash --rm \ + l.gcr.io/google/bazel -c 'bazel run :gazelle_fix; bazel run :buildifier' ``` If this has resulted in some file changes in the repo, please ensure you check those in with your merge request. From 6bf7a0204083692ab358b810c69af6fbf6e8a2d5 Mon Sep 17 00:00:00 2001 From: Mayank Date: Wed, 14 Nov 2018 19:23:00 +0530 Subject: [PATCH 314/552] Adding support for more well known types in descriptor (#809) --- protoc-gen-grpc-gateway/descriptor/types.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index 5cf9d597fb0..ada554b53a8 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -451,7 +451,16 @@ var ( } wellKnownTypeConv = map[string]string{ - ".google.protobuf.Timestamp": "runtime.Timestamp", - ".google.protobuf.Duration": "runtime.Duration", + ".google.protobuf.Timestamp": "runtime.Timestamp", + ".google.protobuf.Duration": "runtime.Duration", + ".google.protobuf.StringValue": "runtime.StringValue", + ".google.protobuf.BytesValue": "runtime.BytesValue", + ".google.protobuf.Int32Value": "runtime.Int32Value", + ".google.protobuf.UInt32Value": "runtime.UInt32Value", + ".google.protobuf.Int64Value": "runtime.Int64Value", + ".google.protobuf.UInt64Value": "runtime.UInt64Value", + ".google.protobuf.FloatValue": "runtime.FloatValue", + ".google.protobuf.DoubleValue": "runtime.DoubleValue", + ".google.protobuf.BoolValue": "runtime.BoolValue", } ) From 9aa2ebfa2a8c86ebba4248360a25934882449ed2 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Thu, 15 Nov 2018 17:25:10 +0000 Subject: [PATCH 315/552] Corret wellKnownTypeConv function references Fixes #808 --- protoc-gen-grpc-gateway/descriptor/types.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index ada554b53a8..c9b4a561b78 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -453,14 +453,14 @@ var ( wellKnownTypeConv = map[string]string{ ".google.protobuf.Timestamp": "runtime.Timestamp", ".google.protobuf.Duration": "runtime.Duration", - ".google.protobuf.StringValue": "runtime.StringValue", - ".google.protobuf.BytesValue": "runtime.BytesValue", - ".google.protobuf.Int32Value": "runtime.Int32Value", - ".google.protobuf.UInt32Value": "runtime.UInt32Value", - ".google.protobuf.Int64Value": "runtime.Int64Value", - ".google.protobuf.UInt64Value": "runtime.UInt64Value", - ".google.protobuf.FloatValue": "runtime.FloatValue", - ".google.protobuf.DoubleValue": "runtime.DoubleValue", - ".google.protobuf.BoolValue": "runtime.BoolValue", + ".google.protobuf.StringValue": "runtime.String", + ".google.protobuf.BytesValue": "runtime.Bytes", + ".google.protobuf.Int32Value": "runtime.Int32", + ".google.protobuf.UInt32Value": "runtime.UInt32", + ".google.protobuf.Int64Value": "runtime.Int64", + ".google.protobuf.UInt64Value": "runtime.UInt64", + ".google.protobuf.FloatValue": "runtime.Float", + ".google.protobuf.DoubleValue": "runtime.Double", + ".google.protobuf.BoolValue": "runtime.Bool", } ) From 8773161050efb04ed14f5ef238fcb29b4df13eaa Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 16 Nov 2018 10:33:30 +0000 Subject: [PATCH 316/552] Revert "Adding support for more well known types in descriptor" (#813) * Revert "Adding support for more well known types in descriptor (#809)" This reverts commit 165983158a39a3d3f7518f633e6260caba5194e8. --- protoc-gen-grpc-gateway/descriptor/types.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index c9b4a561b78..a412b2bcf67 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -453,14 +453,5 @@ var ( wellKnownTypeConv = map[string]string{ ".google.protobuf.Timestamp": "runtime.Timestamp", ".google.protobuf.Duration": "runtime.Duration", - ".google.protobuf.StringValue": "runtime.String", - ".google.protobuf.BytesValue": "runtime.Bytes", - ".google.protobuf.Int32Value": "runtime.Int32", - ".google.protobuf.UInt32Value": "runtime.UInt32", - ".google.protobuf.Int64Value": "runtime.Int64", - ".google.protobuf.UInt64Value": "runtime.UInt64", - ".google.protobuf.FloatValue": "runtime.Float", - ".google.protobuf.DoubleValue": "runtime.Double", - ".google.protobuf.BoolValue": "runtime.Bool", } ) From dd4ffb0c635239379835f92fa9aeba18e63d2d77 Mon Sep 17 00:00:00 2001 From: micnncim Date: Sat, 17 Nov 2018 09:47:53 +0900 Subject: [PATCH 317/552] Fix protobuf repository's owner name on README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e10f1b660a1..b32b0e76213 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ First you need to install ProtocolBuffers 3.0.0 or later. ```sh mkdir tmp cd tmp -git clone https://github.com/google/protobuf +git clone https://github.com/protocolbuffers/protobuf cd protobuf ./autogen.sh ./configure From 063f96e3cfad9dc5c47cb6bf6bc17e8c087452d4 Mon Sep 17 00:00:00 2001 From: Mayank Date: Mon, 19 Nov 2018 16:39:37 +0530 Subject: [PATCH 318/552] Added support for more WKT (#816) * Added support for more WKT * Lint fix: added comments on exported functions * Lint fix: added comments on exported functions * Added end to end example to show support of StringValue in url option template * updated more example protos; removed server and proxy for now * Updated convert.go to fix float and other wkt * brazel build fix --- examples/pbwrappers/helloworld/BUILD.bazel | 39 + .../pbwrappers/helloworld/helloworld.pb.go | 288 ++++++++ .../pbwrappers/helloworld/helloworld.pb.gw.go | 664 ++++++++++++++++++ .../pbwrappers/helloworld/helloworld.proto | 58 ++ protoc-gen-grpc-gateway/descriptor/types.go | 9 + runtime/BUILD.bazel | 1 + runtime/convert.go | 58 ++ 7 files changed, 1117 insertions(+) create mode 100644 examples/pbwrappers/helloworld/BUILD.bazel create mode 100644 examples/pbwrappers/helloworld/helloworld.pb.go create mode 100644 examples/pbwrappers/helloworld/helloworld.pb.gw.go create mode 100644 examples/pbwrappers/helloworld/helloworld.proto diff --git a/examples/pbwrappers/helloworld/BUILD.bazel b/examples/pbwrappers/helloworld/BUILD.bazel new file mode 100644 index 00000000000..0b6c67f8074 --- /dev/null +++ b/examples/pbwrappers/helloworld/BUILD.bazel @@ -0,0 +1,39 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +proto_library( + name = "helloworld_proto", + srcs = ["helloworld.proto"], + visibility = ["//visibility:public"], + deps = [ + "@com_google_protobuf//:wrappers_proto", + "@go_googleapis//google/api:annotations_proto", + ], +) + +go_proto_library( + name = "helloworld_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/pbwrappers/helloworld", + proto = ":helloworld_proto", + visibility = ["//visibility:public"], + deps = ["@go_googleapis//google/api:annotations_go_proto"], +) + +go_library( + name = "go_default_library", + srcs = ["helloworld.pb.gw.go"], + embed = [":helloworld_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/pbwrappers/helloworld", + visibility = ["//visibility:public"], + deps = [ + "//runtime:go_default_library", + "//utilities:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//grpclog:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + "@org_golang_x_net//context:go_default_library", + ], +) diff --git a/examples/pbwrappers/helloworld/helloworld.pb.go b/examples/pbwrappers/helloworld/helloworld.pb.go new file mode 100644 index 00000000000..9225dfd1f88 --- /dev/null +++ b/examples/pbwrappers/helloworld/helloworld.pb.go @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: helloworld.proto + +package helloworld + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + wrappers "github.com/golang/protobuf/ptypes/wrappers" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type HelloRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + StrVal *wrappers.StringValue `protobuf:"bytes,2,opt,name=strVal,proto3" json:"strVal,omitempty"` + FloatVal *wrappers.FloatValue `protobuf:"bytes,3,opt,name=floatVal,proto3" json:"floatVal,omitempty"` + DoubleVal *wrappers.DoubleValue `protobuf:"bytes,4,opt,name=doubleVal,proto3" json:"doubleVal,omitempty"` + BoolVal *wrappers.BoolValue `protobuf:"bytes,5,opt,name=boolVal,proto3" json:"boolVal,omitempty"` + BytesVal *wrappers.BytesValue `protobuf:"bytes,6,opt,name=bytesVal,proto3" json:"bytesVal,omitempty"` + Int32Val *wrappers.Int32Value `protobuf:"bytes,7,opt,name=int32Val,proto3" json:"int32Val,omitempty"` + Uint32Val *wrappers.UInt32Value `protobuf:"bytes,8,opt,name=uint32Val,proto3" json:"uint32Val,omitempty"` + Int64Val *wrappers.Int64Value `protobuf:"bytes,9,opt,name=int64Val,proto3" json:"int64Val,omitempty"` + Uint64Val *wrappers.UInt64Value `protobuf:"bytes,10,opt,name=uint64Val,proto3" json:"uint64Val,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HelloRequest) Reset() { *m = HelloRequest{} } +func (m *HelloRequest) String() string { return proto.CompactTextString(m) } +func (*HelloRequest) ProtoMessage() {} +func (*HelloRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_17b8c58d586b62f2, []int{0} +} + +func (m *HelloRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HelloRequest.Unmarshal(m, b) +} +func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HelloRequest.Marshal(b, m, deterministic) +} +func (m *HelloRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HelloRequest.Merge(m, src) +} +func (m *HelloRequest) XXX_Size() int { + return xxx_messageInfo_HelloRequest.Size(m) +} +func (m *HelloRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HelloRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_HelloRequest proto.InternalMessageInfo + +func (m *HelloRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *HelloRequest) GetStrVal() *wrappers.StringValue { + if m != nil { + return m.StrVal + } + return nil +} + +func (m *HelloRequest) GetFloatVal() *wrappers.FloatValue { + if m != nil { + return m.FloatVal + } + return nil +} + +func (m *HelloRequest) GetDoubleVal() *wrappers.DoubleValue { + if m != nil { + return m.DoubleVal + } + return nil +} + +func (m *HelloRequest) GetBoolVal() *wrappers.BoolValue { + if m != nil { + return m.BoolVal + } + return nil +} + +func (m *HelloRequest) GetBytesVal() *wrappers.BytesValue { + if m != nil { + return m.BytesVal + } + return nil +} + +func (m *HelloRequest) GetInt32Val() *wrappers.Int32Value { + if m != nil { + return m.Int32Val + } + return nil +} + +func (m *HelloRequest) GetUint32Val() *wrappers.UInt32Value { + if m != nil { + return m.Uint32Val + } + return nil +} + +func (m *HelloRequest) GetInt64Val() *wrappers.Int64Value { + if m != nil { + return m.Int64Val + } + return nil +} + +func (m *HelloRequest) GetUint64Val() *wrappers.UInt64Value { + if m != nil { + return m.Uint64Val + } + return nil +} + +type HelloReply struct { + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HelloReply) Reset() { *m = HelloReply{} } +func (m *HelloReply) String() string { return proto.CompactTextString(m) } +func (*HelloReply) ProtoMessage() {} +func (*HelloReply) Descriptor() ([]byte, []int) { + return fileDescriptor_17b8c58d586b62f2, []int{1} +} + +func (m *HelloReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HelloReply.Unmarshal(m, b) +} +func (m *HelloReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HelloReply.Marshal(b, m, deterministic) +} +func (m *HelloReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_HelloReply.Merge(m, src) +} +func (m *HelloReply) XXX_Size() int { + return xxx_messageInfo_HelloReply.Size(m) +} +func (m *HelloReply) XXX_DiscardUnknown() { + xxx_messageInfo_HelloReply.DiscardUnknown(m) +} + +var xxx_messageInfo_HelloReply proto.InternalMessageInfo + +func (m *HelloReply) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func init() { + proto.RegisterType((*HelloRequest)(nil), "helloworld.HelloRequest") + proto.RegisterType((*HelloReply)(nil), "helloworld.HelloReply") +} + +func init() { proto.RegisterFile("helloworld.proto", fileDescriptor_17b8c58d586b62f2) } + +var fileDescriptor_17b8c58d586b62f2 = []byte{ + // 468 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xcd, 0x8a, 0xd4, 0x40, + 0x14, 0x85, 0xe9, 0xd8, 0xf6, 0x4f, 0x8d, 0x0b, 0x29, 0xa4, 0x09, 0xb1, 0x91, 0xa1, 0x17, 0x32, + 0xab, 0x04, 0x7a, 0x9a, 0x11, 0x5c, 0x0e, 0xe2, 0xcf, 0x36, 0x83, 0xb3, 0xe8, 0x5d, 0x85, 0xb9, + 0xd3, 0x06, 0x6a, 0x52, 0xb1, 0x7e, 0x1c, 0xc2, 0x90, 0x8d, 0x3b, 0x77, 0x82, 0xef, 0xe0, 0xeb, + 0xb8, 0x70, 0xe9, 0xd6, 0x07, 0x91, 0xba, 0xa9, 0x4a, 0x45, 0xc6, 0xb8, 0x4b, 0xe5, 0x9c, 0xef, + 0x9e, 0x4a, 0xee, 0x21, 0x8f, 0x3f, 0x00, 0xe7, 0xe2, 0x56, 0x48, 0x7e, 0x95, 0xd6, 0x52, 0x68, + 0x41, 0x49, 0x78, 0x93, 0xac, 0x0f, 0x42, 0x1c, 0x38, 0x64, 0xac, 0x2e, 0x33, 0x56, 0x55, 0x42, + 0x33, 0x5d, 0x8a, 0x4a, 0x75, 0xce, 0xe4, 0x99, 0x53, 0xf1, 0x54, 0x98, 0xeb, 0xec, 0x56, 0xb2, + 0xba, 0x06, 0xe9, 0xf4, 0xcd, 0xf7, 0x29, 0x79, 0xf4, 0xd6, 0x0e, 0xcb, 0xe1, 0xa3, 0x01, 0xa5, + 0x29, 0x25, 0xd3, 0x8a, 0xdd, 0x40, 0x3c, 0x39, 0x9e, 0x9c, 0x2c, 0x73, 0x7c, 0xa6, 0x3b, 0x32, + 0x53, 0x5a,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0e, 0x6a, 0x3c, 0xac, 0x5c, 0xb2, 0xfa, 0x87, 0x52, + 0xf3, 0x66, 0xf3, 0x35, 0xfa, 0xfc, 0xf3, 0xf7, 0xb7, 0xe8, 0x4b, 0x44, 0x8f, 0x32, 0xc5, 0x9a, + 0xec, 0xce, 0x96, 0xb1, 0xdd, 0xaf, 0xe8, 0x13, 0x3c, 0x2a, 0x2d, 0x3f, 0x31, 0x9e, 0xdd, 0x75, + 0x75, 0x6b, 0xf7, 0x09, 0x8d, 0xf1, 0x3d, 0xf6, 0x08, 0x15, 0xdf, 0xa8, 0x76, 0xbf, 0xa6, 0x09, + 0x6a, 0x5d, 0x51, 0x50, 0xec, 0x3b, 0xd3, 0xee, 0x63, 0xba, 0x42, 0xd5, 0xd6, 0x01, 0x35, 0xd7, + 0x8b, 0x30, 0x13, 0x17, 0xde, 0x49, 0x6e, 0xf5, 0x41, 0xc3, 0xbd, 0xa0, 0xe6, 0x37, 0x14, 0xf2, + 0x4c, 0x10, 0x4d, 0x50, 0x07, 0xe4, 0xd9, 0xce, 0x93, 0xf8, 0x9b, 0xff, 0x26, 0x9d, 0xd8, 0x2f, + 0xa1, 0x2d, 0x66, 0xb8, 0xa6, 0xd3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x65, 0xa5, 0x95, 0xa8, + 0x13, 0x04, 0x00, 0x00, +} + +// 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.SupportPackageIsVersion4 + +// GreeterClient is the client API for Greeter service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type GreeterClient interface { + SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) +} + +type greeterClient struct { + cc *grpc.ClientConn +} + +func NewGreeterClient(cc *grpc.ClientConn) GreeterClient { + return &greeterClient{cc} +} + +func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) { + out := new(HelloReply) + err := c.cc.Invoke(ctx, "/helloworld.Greeter/SayHello", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// GreeterServer is the server API for Greeter service. +type GreeterServer interface { + SayHello(context.Context, *HelloRequest) (*HelloReply, error) +} + +func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) { + s.RegisterService(&_Greeter_serviceDesc, srv) +} + +func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HelloRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GreeterServer).SayHello(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/helloworld.Greeter/SayHello", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Greeter_serviceDesc = grpc.ServiceDesc{ + ServiceName: "helloworld.Greeter", + HandlerType: (*GreeterServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SayHello", + Handler: _Greeter_SayHello_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "helloworld.proto", +} diff --git a/examples/pbwrappers/helloworld/helloworld.pb.gw.go b/examples/pbwrappers/helloworld/helloworld.pb.gw.go new file mode 100644 index 00000000000..c09fe741ece --- /dev/null +++ b/examples/pbwrappers/helloworld/helloworld.pb.gw.go @@ -0,0 +1,664 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: helloworld.proto + +/* +Package helloworld is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package helloworld + +import ( + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray + +var ( + filter_Greeter_SayHello_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Greeter_SayHello_0(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HelloRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Greeter_SayHello_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_Greeter_SayHello_1 = &utilities.DoubleArray{Encoding: map[string]int{"strVal": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Greeter_SayHello_1(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HelloRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["strVal"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "strVal") + } + + protoReq.StrVal, err = runtime.StringValue(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "strVal", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Greeter_SayHello_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_Greeter_SayHello_2 = &utilities.DoubleArray{Encoding: map[string]int{"floatVal": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Greeter_SayHello_2(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HelloRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["floatVal"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "floatVal") + } + + protoReq.FloatVal, err = runtime.FloatValue(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "floatVal", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Greeter_SayHello_2); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_Greeter_SayHello_3 = &utilities.DoubleArray{Encoding: map[string]int{"doubleVal": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Greeter_SayHello_3(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HelloRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["doubleVal"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "doubleVal") + } + + protoReq.DoubleVal, err = runtime.DoubleValue(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "doubleVal", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Greeter_SayHello_3); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_Greeter_SayHello_4 = &utilities.DoubleArray{Encoding: map[string]int{"boolVal": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Greeter_SayHello_4(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HelloRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["boolVal"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "boolVal") + } + + protoReq.BoolVal, err = runtime.BoolValue(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "boolVal", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Greeter_SayHello_4); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_Greeter_SayHello_5 = &utilities.DoubleArray{Encoding: map[string]int{"bytesVal": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Greeter_SayHello_5(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HelloRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["bytesVal"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bytesVal") + } + + protoReq.BytesVal, err = runtime.BytesValue(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bytesVal", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Greeter_SayHello_5); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_Greeter_SayHello_6 = &utilities.DoubleArray{Encoding: map[string]int{"int32Val": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Greeter_SayHello_6(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HelloRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["int32Val"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int32Val") + } + + protoReq.Int32Val, err = runtime.Int32Value(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int32Val", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Greeter_SayHello_6); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_Greeter_SayHello_7 = &utilities.DoubleArray{Encoding: map[string]int{"uint32Val": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Greeter_SayHello_7(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HelloRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uint32Val"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32Val") + } + + protoReq.Uint32Val, err = runtime.UInt32Value(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint32Val", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Greeter_SayHello_7); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_Greeter_SayHello_8 = &utilities.DoubleArray{Encoding: map[string]int{"int64Val": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Greeter_SayHello_8(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HelloRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["int64Val"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int64Val") + } + + protoReq.Int64Val, err = runtime.Int64Value(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int64Val", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Greeter_SayHello_8); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_Greeter_SayHello_9 = &utilities.DoubleArray{Encoding: map[string]int{"uint64Val": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Greeter_SayHello_9(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HelloRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uint64Val"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64Val") + } + + protoReq.Uint64Val, err = runtime.UInt64Value(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint64Val", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Greeter_SayHello_9); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +// RegisterGreeterHandlerFromEndpoint is same as RegisterGreeterHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterGreeterHandlerFromEndpoint(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.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterGreeterHandler(ctx, mux, conn) +} + +// RegisterGreeterHandler registers the http handlers for service Greeter to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterGreeterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterGreeterHandlerClient(ctx, mux, NewGreeterClient(conn)) +} + +// RegisterGreeterHandlerClient registers the http handlers for service Greeter +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "GreeterClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "GreeterClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "GreeterClient" to call the correct interceptors. +func RegisterGreeterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreeterClient) error { + + mux.Handle("GET", pattern_Greeter_SayHello_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Greeter_SayHello_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Greeter_SayHello_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Greeter_SayHello_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Greeter_SayHello_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Greeter_SayHello_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Greeter_SayHello_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Greeter_SayHello_2(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Greeter_SayHello_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Greeter_SayHello_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Greeter_SayHello_3(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Greeter_SayHello_3(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Greeter_SayHello_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Greeter_SayHello_4(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Greeter_SayHello_4(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Greeter_SayHello_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Greeter_SayHello_5(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Greeter_SayHello_5(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Greeter_SayHello_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Greeter_SayHello_6(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Greeter_SayHello_6(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Greeter_SayHello_7, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Greeter_SayHello_7(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Greeter_SayHello_7(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Greeter_SayHello_8, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Greeter_SayHello_8(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Greeter_SayHello_8(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Greeter_SayHello_9, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Greeter_SayHello_9(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Greeter_SayHello_9(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Greeter_SayHello_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"say", "name"}, "")) + + pattern_Greeter_SayHello_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "strval", "strVal"}, "")) + + pattern_Greeter_SayHello_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "floatval", "floatVal"}, "")) + + pattern_Greeter_SayHello_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "doubleval", "doubleVal"}, "")) + + pattern_Greeter_SayHello_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "boolval", "boolVal"}, "")) + + pattern_Greeter_SayHello_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "bytesval", "bytesVal"}, "")) + + pattern_Greeter_SayHello_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "int32val", "int32Val"}, "")) + + pattern_Greeter_SayHello_7 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "uint32val", "uint32Val"}, "")) + + pattern_Greeter_SayHello_8 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "int64val", "int64Val"}, "")) + + pattern_Greeter_SayHello_9 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"say", "uint64val", "uint64Val"}, "")) +) + +var ( + forward_Greeter_SayHello_0 = runtime.ForwardResponseMessage + + forward_Greeter_SayHello_1 = runtime.ForwardResponseMessage + + forward_Greeter_SayHello_2 = runtime.ForwardResponseMessage + + forward_Greeter_SayHello_3 = runtime.ForwardResponseMessage + + forward_Greeter_SayHello_4 = runtime.ForwardResponseMessage + + forward_Greeter_SayHello_5 = runtime.ForwardResponseMessage + + forward_Greeter_SayHello_6 = runtime.ForwardResponseMessage + + forward_Greeter_SayHello_7 = runtime.ForwardResponseMessage + + forward_Greeter_SayHello_8 = runtime.ForwardResponseMessage + + forward_Greeter_SayHello_9 = runtime.ForwardResponseMessage +) diff --git a/examples/pbwrappers/helloworld/helloworld.proto b/examples/pbwrappers/helloworld/helloworld.proto new file mode 100644 index 00000000000..a685c65b8bc --- /dev/null +++ b/examples/pbwrappers/helloworld/helloworld.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; + +package helloworld; + +import "google/api/annotations.proto"; +import "google/protobuf/wrappers.proto"; + +service Greeter { + rpc SayHello (HelloRequest) returns (HelloReply) { + option (google.api.http) = { + get: "/say/{name}" + additional_bindings: { + get: "/say/strval/{strVal}", + } + additional_bindings: { + get: "/say/floatval/{floatVal}", + } + additional_bindings: { + get: "/say/doubleval/{doubleVal}", + } + additional_bindings: { + get: "/say/boolval/{boolVal}", + } + additional_bindings: { + get: "/say/bytesval/{bytesVal}", + } + additional_bindings: { + get: "/say/int32val/{int32Val}", + } + additional_bindings: { + get: "/say/uint32val/{uint32Val}", + } + additional_bindings: { + get: "/say/int64val/{int64Val}", + } + additional_bindings: { + get: "/say/uint64val/{uint64Val}", + } + }; + } +} + +message HelloRequest { + string name = 1; + google.protobuf.StringValue strVal = 2; + google.protobuf.FloatValue floatVal = 3; + google.protobuf.DoubleValue doubleVal = 4; + google.protobuf.BoolValue boolVal = 5; + google.protobuf.BytesValue bytesVal = 6; + google.protobuf.Int32Value int32Val = 7; + google.protobuf.UInt32Value uint32Val = 8; + google.protobuf.Int64Value int64Val = 9; + google.protobuf.UInt64Value uint64Val = 10; +} + +message HelloReply { + string message = 1; +} diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index a412b2bcf67..4aa75f85dbf 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -453,5 +453,14 @@ var ( wellKnownTypeConv = map[string]string{ ".google.protobuf.Timestamp": "runtime.Timestamp", ".google.protobuf.Duration": "runtime.Duration", + ".google.protobuf.StringValue": "runtime.StringValue", + ".google.protobuf.FloatValue": "runtime.FloatValue", + ".google.protobuf.DoubleValue": "runtime.DoubleValue", + ".google.protobuf.BoolValue": "runtime.BoolValue", + ".google.protobuf.BytesValue": "runtime.BytesValue", + ".google.protobuf.Int32Value": "runtime.Int32Value", + ".google.protobuf.UInt32Value": "runtime.UInt32Value", + ".google.protobuf.Int64Value": "runtime.Int64Value", + ".google.protobuf.UInt64Value": "runtime.UInt64Value", } ) diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index 66a8999f2a2..252c4527853 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -30,6 +30,7 @@ go_library( "@io_bazel_rules_go//proto/wkt:any_go_proto", "@io_bazel_rules_go//proto/wkt:duration_go_proto", "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", + "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//grpclog:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", diff --git a/runtime/convert.go b/runtime/convert.go index bd54ba12bec..a5b3bd6a792 100644 --- a/runtime/convert.go +++ b/runtime/convert.go @@ -9,6 +9,7 @@ import ( "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/timestamp" + "github.com/golang/protobuf/ptypes/wrappers" ) // String just returns the given string. @@ -252,3 +253,60 @@ func EnumSlice(val, sep string, enumValMap map[string]int32) ([]int32, error) { } return values, nil } + +/* + Support fot google.protobuf.wrappers on top of primitive types +*/ + +// StringValue well-known type support as wrapper around string type +func StringValue(val string) (*wrappers.StringValue, error) { + return &wrappers.StringValue{Value: val}, nil +} + +// FloatValue well-known type support as wrapper around float32 type +func FloatValue(val string) (*wrappers.FloatValue, error) { + parsedVal, err := Float32(val) + return &wrappers.FloatValue{Value: parsedVal}, err +} + +// DoubleValue well-known type support as wrapper around float64 type +func DoubleValue(val string) (*wrappers.DoubleValue, error) { + parsedVal, err := Float64(val) + return &wrappers.DoubleValue{Value: parsedVal}, err +} + +// BoolValue well-known type support as wrapper around bool type +func BoolValue(val string) (*wrappers.BoolValue, error) { + parsedVal, err := Bool(val) + return &wrappers.BoolValue{Value: parsedVal}, err +} + +// Int32Value well-known type support as wrapper around int32 type +func Int32Value(val string) (*wrappers.Int32Value, error) { + parsedVal, err := Int32(val) + return &wrappers.Int32Value{Value: parsedVal}, err +} + +// UInt32Value well-known type support as wrapper around uint32 type +func UInt32Value(val string) (*wrappers.UInt32Value, error) { + parsedVal, err := Uint32(val) + return &wrappers.UInt32Value{Value: parsedVal}, err +} + +// Int64Value well-known type support as wrapper around int64 type +func Int64Value(val string) (*wrappers.Int64Value, error) { + parsedVal, err := Int64(val) + return &wrappers.Int64Value{Value: parsedVal}, err +} + +// UInt64Value well-known type support as wrapper around uint64 type +func UInt64Value(val string) (*wrappers.UInt64Value, error) { + parsedVal, err := Uint64(val) + return &wrappers.UInt64Value{Value: parsedVal}, err +} + +// BytesValue well-known type support as wrapper around bytes[] type +func BytesValue(val string) (*wrappers.BytesValue, error) { + parsedVal, err := Bytes(val) + return &wrappers.BytesValue{Value: parsedVal}, err +} From 7e951c2e93817fb0777155cbdf29bfb27a073075 Mon Sep 17 00:00:00 2001 From: Roman Azami Date: Mon, 19 Nov 2018 10:46:39 -0800 Subject: [PATCH 319/552] Feature/patch2 rebased (#812) * Updated Patch behavior * Patch update with regenerated BUILD files * Added documentation for PATCH usage * Added some curl examples for PATCH --- Gopkg.lock | 63 ++- Makefile | 2 +- docs/_docs/patch.md | 66 +++ examples/clients/abe/BUILD.bazel | 2 + .../abe/a_bit_of_everything_service_api.go | 231 ++++++++ .../abe/examplepb_update_v2_request.go | 18 + examples/clients/abe/protobuf_field_mask.go | 18 + examples/integration/BUILD.bazel | 1 + examples/integration/integration_test.go | 188 +++++++ examples/proto/examplepb/BUILD.bazel | 1 + .../proto/examplepb/a_bit_of_everything.pb.go | 493 +++++++++++------- .../examplepb/a_bit_of_everything.pb.gw.go | 241 ++++++++- .../proto/examplepb/a_bit_of_everything.proto | 23 + .../a_bit_of_everything.swagger.json | 168 ++++++ .../proto/examplepb/echo_service.pb.gw.go | 6 +- .../proto/examplepb/flow_combination.pb.gw.go | 84 ++- examples/proto/examplepb/stream.pb.gw.go | 12 +- .../unannotated_echo_service.pb.gw.go | 6 +- examples/proto/examplepb/wrappers.pb.gw.go | 6 +- examples/server/BUILD.bazel | 11 +- examples/server/a_bit_of_everything.go | 38 +- examples/server/fieldmask_helper.go | 55 ++ examples/server/fieldmask_helper_test.go | 92 ++++ .../gengateway/BUILD.bazel | 1 + .../gengateway/template.go | 58 ++- .../gengateway/template_test.go | 4 +- runtime/BUILD.bazel | 4 + runtime/fieldmask.go | 70 +++ runtime/fieldmask_test.go | 87 ++++ utilities/BUILD.bazel | 1 + utilities/readerfactory.go | 20 + 31 files changed, 1846 insertions(+), 224 deletions(-) create mode 100644 docs/_docs/patch.md create mode 100644 examples/clients/abe/examplepb_update_v2_request.go create mode 100644 examples/clients/abe/protobuf_field_mask.go create mode 100644 examples/server/fieldmask_helper.go create mode 100644 examples/server/fieldmask_helper_test.go create mode 100644 runtime/fieldmask.go create mode 100644 runtime/fieldmask_test.go create mode 100644 utilities/readerfactory.go diff --git a/Gopkg.lock b/Gopkg.lock index ca212aeaa81..1bbc8d61516 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -2,21 +2,28 @@ [[projects]] + digest = "1:2cd7915ab26ede7d95b8749e6b1f933f1c6d5398030684e6505940a10f31cfda" name = "github.com/ghodss/yaml" packages = ["."] + pruneopts = "UT" revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7" [[projects]] + digest = "1:5cae6c173646d9230aecf8074c171edb4fb9a37f074c5c89ba2fece20b6703b6" name = "github.com/go-resty/resty" packages = ["."] + pruneopts = "UT" revision = "f8815663de1e64d57cdd4ee9e2b2fa96977a030e" [[projects]] + digest = "1:1ba1d79f2810270045c328ae5d674321db34e3aae468eb4233883b473c5c0467" name = "github.com/golang/glog" packages = ["."] + pruneopts = "UT" revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" [[projects]] + digest = "1:77303a120dcd145972685b3465e58e1a0910544fcb323ca24755e073c1ea6d2c" name = "github.com/golang/protobuf" packages = [ "jsonpb", @@ -33,16 +40,20 @@ "ptypes/empty", "ptypes/struct", "ptypes/timestamp", - "ptypes/wrappers" + "ptypes/wrappers", ] + pruneopts = "UT" revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" [[projects]] + digest = "1:d673e95129a1107bfd04e093751a5e1267faabc27d218d824fb013f57ac08f55" name = "github.com/rogpeppe/fastuuid" packages = ["."] + pruneopts = "UT" revision = "6724a57986aff9bff1a1770e9347036def7c89f6" [[projects]] + digest = "1:c0b7af9789502fec69b7ab40035a2180e43b9663c32101084ba51c844ea416e9" name = "golang.org/x/net" packages = [ "context", @@ -52,17 +63,21 @@ "idna", "internal/timeseries", "publicsuffix", - "trace" + "trace", ] + pruneopts = "UT" revision = "4dfa2610cdf3b287375bbba5b8f2a14d3b01d8de" [[projects]] branch = "master" + digest = "1:7ba061af4131fb44b30448572acd0d6fefbf63a61b97b7ef1dea0be5871c2742" name = "golang.org/x/sys" packages = ["unix"] + pruneopts = "UT" revision = "66b7b1311ac80bbafcd2daeef9a5e6e2cd1e2399" [[projects]] + digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18" name = "golang.org/x/text" packages = [ "collate", @@ -78,22 +93,26 @@ "unicode/bidi", "unicode/cldr", "unicode/norm", - "unicode/rangetable" + "unicode/rangetable", ] + pruneopts = "UT" revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" version = "v0.3.0" [[projects]] + digest = "1:46be2f6b4d4e4b89f8102668902e68013234da1684fc78da602da95e745f285d" name = "google.golang.org/genproto" packages = [ "googleapis/api/annotations", "googleapis/rpc/errdetails", "googleapis/rpc/status", - "protobuf/field_mask" + "protobuf/field_mask", ] + pruneopts = "UT" revision = "383e8b2c3b9e36c4076b235b32537292176bae20" [[projects]] + digest = "1:c3ad9841823db6da420a5625b367913b4ff54bbe60e8e3c98bd20e243e62e2d2" name = "google.golang.org/grpc" packages = [ ".", @@ -121,19 +140,51 @@ "resolver/passthrough", "stats", "status", - "tap" + "tap", ] + pruneopts = "UT" revision = "2e463a05d100327ca47ac218281906921038fd95" version = "v1.16.0" [[projects]] + digest = "1:6570992c02a2137a20be83990a979b6fe892e20ecdc6b756449989b2a7efb8ae" name = "gopkg.in/yaml.v2" packages = ["."] + pruneopts = "UT" revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "869b43d6e47c7434098120dae9352bde379feae8504ece065ee51b78c6aca0fa" + input-imports = [ + "github.com/ghodss/yaml", + "github.com/go-resty/resty", + "github.com/golang/glog", + "github.com/golang/protobuf/jsonpb", + "github.com/golang/protobuf/proto", + "github.com/golang/protobuf/protoc-gen-go", + "github.com/golang/protobuf/protoc-gen-go/descriptor", + "github.com/golang/protobuf/protoc-gen-go/generator", + "github.com/golang/protobuf/protoc-gen-go/plugin", + "github.com/golang/protobuf/ptypes", + "github.com/golang/protobuf/ptypes/any", + "github.com/golang/protobuf/ptypes/duration", + "github.com/golang/protobuf/ptypes/empty", + "github.com/golang/protobuf/ptypes/struct", + "github.com/golang/protobuf/ptypes/timestamp", + "github.com/golang/protobuf/ptypes/wrappers", + "github.com/rogpeppe/fastuuid", + "golang.org/x/net/context", + "google.golang.org/genproto/googleapis/api/annotations", + "google.golang.org/genproto/googleapis/rpc/errdetails", + "google.golang.org/genproto/googleapis/rpc/status", + "google.golang.org/genproto/protobuf/field_mask", + "google.golang.org/grpc", + "google.golang.org/grpc/codes", + "google.golang.org/grpc/connectivity", + "google.golang.org/grpc/grpclog", + "google.golang.org/grpc/metadata", + "google.golang.org/grpc/status", + ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/Makefile b/Makefile index 5cd992cd635..865058628ef 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ RUNTIME_GO=$(RUNTIME_PROTO:.proto=.pb.go) OPENAPIV2_PROTO=protoc-gen-swagger/options/openapiv2.proto protoc-gen-swagger/options/annotations.proto OPENAPIV2_GO=$(OPENAPIV2_PROTO:.proto=.pb.go) -PKGMAP=Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mexamples/proto/sub/message.proto=$(PKG)/examples/proto/sub +PKGMAP=Mgoogle/protobuf/field_mask.proto=google.golang.org/genproto/protobuf/field_mask,Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mexamples/proto/sub/message.proto=$(PKG)/examples/proto/sub ADDITIONAL_GW_FLAGS= ifneq "$(GATEWAY_PLUGIN_FLAGS)" "" ADDITIONAL_GW_FLAGS=,$(GATEWAY_PLUGIN_FLAGS) diff --git a/docs/_docs/patch.md b/docs/_docs/patch.md new file mode 100644 index 00000000000..c395b7f61c2 --- /dev/null +++ b/docs/_docs/patch.md @@ -0,0 +1,66 @@ +--- +category: documentation +--- + +# Patch Feature +The HTTP PATCH method allows a resource to be partially updated. + +The idea, If a binding is mapped to patch and the request message has exactly one FieldMask message in it, additional code is rendered for the gateway handler that will populate the FieldMask based on the request body. +This handles two scenarios: +- The FieldMask is hidden from the REST request (as in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto#L286) example). In this case, the FieldMask is updated from the request body and set in the gRPC request message. +- The FieldMask is exposed to the REST request (as in the [PatchWithFieldMaskInBody](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto#L295) example). For this case, a check is made as to whether the FieldMask is nil/empty prior to populating with the request body. + +If it's not nil, then it converts the FieldMask paths from the REST (snake_case) to gRPC (PascalCase) format. Otherwise, it acts like the previous case. + +## Example Usage +1. Create PATCH request. + + The PATCH request needs to include the message and the update mask. +```golang +// UpdateV2Request request for update includes the message and the update mask +message UpdateV2Request { + ABitOfEverything abe = 1; + google.protobuf.FieldMask update_mask = 2; +} +``` +2. Define your service in gRPC + +If you want to use PATCH with fieldmask hidden from REST request only include the request message in the body. + +```golang +rpc UpdateV2(UpdateV2Request) returns (google.protobuf.Empty) { + option (google.api.http) = { + put: "/v2/example/a_bit_of_everything/{abe.uuid}" + body: "abe" + additional_bindings { + patch: "/v2/example/a_bit_of_everything/{abe.uuid}" + body: "abe" + } + }; +} +``` + +If you want to use PATCH wtih fieldmask exposed to the REST request then include the entire request message. + +```golang +rpc PatchWithFieldMaskInBody(UpdateV2Request) returns (google.protobuf.Empty) { + option (google.api.http) = { + patch: "/v2a/example/a_bit_of_everything/{abe.uuid}" + body: "*" + }; +} +``` + +3. Generate gRPC and reverse-proxy stubs and implement your service. + +## Curl examples + +In the example below we will partially update our ABitOfEverything resource by passing only the field we want to change. Since we are using the endpoint with field mask hidden we only need to pass the field we want to change ("string_value") and it will keep everything else in our resource the same. +``` +curl --data '{"string_value": "strprefix/foo"}' -X PATCH http://address:port/v2/example/a_bit_of_everything/1 +``` + +If we know what fields we want to update then we can use PATCH with field mask approach. For this we need to pass the resource and the update_mask. Below only the "single_nested" will get updated because that is what we specify in the field_mask. +``` +curl --data '{"abe":{"single_nested":{"amount":457},"string_value":"some value that won't get updated because not in the field mask"},"update_mask":{"paths":["single_nested"]}}' -X PATCH http://address:port/v2a/example/a_bit_of_everything/1 +``` \ No newline at end of file diff --git a/examples/clients/abe/BUILD.bazel b/examples/clients/abe/BUILD.bazel index 6b61fa1b3fa..5df684b7f31 100644 --- a/examples/clients/abe/BUILD.bazel +++ b/examples/clients/abe/BUILD.bazel @@ -18,10 +18,12 @@ go_library( "examplepb_a_bit_of_everything_repeated.go", "examplepb_body.go", "examplepb_numeric_enum.go", + "examplepb_update_v2_request.go", "message_path_enum_nested_path_enum.go", "nested_deep_enum.go", "pathenum_path_enum.go", "protobuf_empty.go", + "protobuf_field_mask.go", "sub_string_message.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe", diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index d1f2a1f95e9..5e8d72779c3 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -812,6 +812,83 @@ func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEveryth return successPayload, localVarAPIResponse, err } +/** + * + * + * @param abeUuid + * @param body + * @return *ProtobufEmpty + */ +func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, body ExamplepbUpdateV2Request) (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Patch") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2a/example/a_bit_of_everything/{abe.uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "PatchWithFieldMaskInBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + /** * * @@ -1038,3 +1115,157 @@ func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEver return successPayload, localVarAPIResponse, err } +/** + * + * + * @param abeUuid + * @param body + * @return *ProtobufEmpty + */ +func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Put") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/a_bit_of_everything/{abe.uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "UpdateV2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param abeUuid + * @param body + * @return *ProtobufEmpty + */ +func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Patch") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/a_bit_of_everything/{abe.uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ProtobufEmpty) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "UpdateV22", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + diff --git a/examples/clients/abe/examplepb_update_v2_request.go b/examples/clients/abe/examplepb_update_v2_request.go new file mode 100644 index 00000000000..9d021f8241c --- /dev/null +++ b/examples/clients/abe/examplepb_update_v2_request.go @@ -0,0 +1,18 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0 + * Contact: none@example.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +type ExamplepbUpdateV2Request struct { + + Abe ExamplepbABitOfEverything `json:"abe,omitempty"` + + UpdateMask ProtobufFieldMask `json:"update_mask,omitempty"` +} diff --git a/examples/clients/abe/protobuf_field_mask.go b/examples/clients/abe/protobuf_field_mask.go new file mode 100644 index 00000000000..f30f2531765 --- /dev/null +++ b/examples/clients/abe/protobuf_field_mask.go @@ -0,0 +1,18 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0 + * Contact: none@example.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +// paths: \"f.a\" paths: \"f.b.d\" Here `f` represents a field in some root message, `a` and `b` fields in the message found in `f`, and `d` a field found in the message in `f.b`. Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below). # Field Masks in Projections When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows: f { a : 22 b { d : 1 x : 2 } y : 13 } z: 8 The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output): f { a : 22 b { d : 1 } } A repeated field is not allowed except at the last position of a paths string. If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified). Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs. # Field Masks in Update Operations A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask. If a repeated field is specified for an update operation, the existing repeated values in the target resource will be overwritten by the new values. Note that a repeated field is only allowed in the last position of a `paths` string. If a sub-message is specified in the last position of the field mask for an update operation, then the existing sub-message in the target resource is overwritten. Given the target message: f { b { d : 1 x : 2 } c : 1 } And an update message: f { b { d : 10 } } then if the field mask is: paths: \"f.b\" then the result will be: f { b { d : 10 } c : 1 } However, if the update mask was: paths: \"f.b.d\" then the result would be: f { b { d : 10 x : 2 } c : 1 } In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below. If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not. As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API. ## Considerations for HTTP REST The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates). # JSON Encoding of Field Masks In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions. As an example, consider the following message declarations: message Profile { User user = 1; Photo photo = 2; } message User { string display_name = 1; string address = 2; } In proto a field mask for `Profile` may look as such: mask { paths: \"user.display_name\" paths: \"photo\" } In JSON, the same mask is represented as below: { mask: \"user.displayName,photo\" } # Field Masks and Oneof Fields Field masks treat fields in oneofs just as regular fields. Consider the following message: message SampleMessage { oneof test_oneof { string name = 4; SubMessage sub_message = 9; } } The field mask can be: mask { paths: \"name\" } Or: mask { paths: \"sub_message\" } Note that oneof type names (\"test_oneof\" in this case) cannot be used in paths. +type ProtobufFieldMask struct { + + // The set of field mask paths. + Paths []string `json:"paths,omitempty"` +} diff --git a/examples/integration/BUILD.bazel b/examples/integration/BUILD.bazel index 287de4b324a..b37ad78ec78 100644 --- a/examples/integration/BUILD.bazel +++ b/examples/integration/BUILD.bazel @@ -23,6 +23,7 @@ go_test( "@com_github_golang_protobuf//proto:go_default_library", "@go_googleapis//google/rpc:status_go_proto", "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", "@org_golang_google_grpc//codes:go_default_library", ], ) diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index b488be6ad2f..96b36d04b58 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -22,6 +22,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/runtime" + "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/grpc/codes" ) @@ -555,6 +556,193 @@ func testABELookup(t *testing.T, port int) { } } +// TestABEPatch demonstrates partially updating a resource. +// First, we'll create an ABE resource with known values for string_value and int32_value +// Then, issue a PATCH request updating only the string_value +// Then, GET the resource and verify that string_value is changed, but int32_value isn't +func TestABEPatch(t *testing.T) { + port := 8080 + + // create a record with a known string_value and int32_value + uuid := postABE(t, port, gw.ABitOfEverything{StringValue: "strprefix/bar", Int32Value: 32}) + + // issue PATCH request, only updating string_value + req, err := http.NewRequest( + http.MethodPatch, + fmt.Sprintf("http://localhost:%d/v2/example/a_bit_of_everything/%s", port, uuid), + strings.NewReader(`{"string_value": "strprefix/foo"}`), + ) + if err != nil { + t.Fatalf("http.NewRequest(PATCH) failed with %v; want success", err) + } + patchResp, err := http.DefaultClient.Do(req) + if err != nil { + t.Fatalf("failed to issue PATCH request: %v", err) + } + if got, want := patchResp.StatusCode, http.StatusOK; got != want { + if body, err := ioutil.ReadAll(patchResp.Body); err != nil { + t.Errorf("patchResp body couldn't be read: %v", err) + } else { + t.Errorf("patchResp.StatusCode= %d; want %d resp: %v", got, want, string(body)) + } + } + + // issue GET request, verifying that string_value is changed and int32_value is not + getRespBody := getABE(t, port, uuid) + if got, want := getRespBody.StringValue, "strprefix/foo"; got != want { + t.Errorf("string_value= %q; want %q", got, want) + } + if got, want := getRespBody.Int32Value, int32(32); got != want { + t.Errorf("int_32_value= %d; want %d", got, want) + } +} + +// TestABEPatchBody demonstrates the ability to specify an update mask within the request body. +func TestABEPatchBody(t *testing.T) { + port := 8080 + + for _, tc := range []struct { + name string + originalValue gw.ABitOfEverything + input gw.UpdateV2Request + want gw.ABitOfEverything + }{ + { + name: "with fieldmask provided", + originalValue: gw.ABitOfEverything{ + StringValue: "rabbit", + SingleNested: &gw.ABitOfEverything_Nested{Name: "some value that will get overwritten", Amount: 345}, + }, + input: gw.UpdateV2Request{Abe: &gw.ABitOfEverything{ + StringValue: "some value that won't get updated because it's not in the field mask", + SingleNested: &gw.ABitOfEverything_Nested{Amount: 456}, + }, UpdateMask: &field_mask.FieldMask{Paths: []string{"single_nested"}}}, + want: gw.ABitOfEverything{StringValue: "rabbit", SingleNested: &gw.ABitOfEverything_Nested{Amount: 456}}, + }, + { + name: "with empty fieldmask", + originalValue: gw.ABitOfEverything{ + StringValue: "some value that will get overwritten", + SingleNested: &gw.ABitOfEverything_Nested{Name: "value that will get empty", Amount: 345}, + }, + input: gw.UpdateV2Request{Abe: &gw.ABitOfEverything{ + StringValue: "some updated value because the fieldMask is nil", + SingleNested: &gw.ABitOfEverything_Nested{Amount: 456}, + }, UpdateMask: &field_mask.FieldMask{}}, + want: gw.ABitOfEverything{ + StringValue: "some updated value because the fieldMask is nil", + SingleNested: &gw.ABitOfEverything_Nested{Amount: 456}, + }, + }, + { + name: "with nil fieldmask", + originalValue: gw.ABitOfEverything{ + StringValue: "some value that will get overwritten", + SingleNested: &gw.ABitOfEverything_Nested{Name: "value that will get empty", Amount: 123}, + }, + input: gw.UpdateV2Request{Abe: &gw.ABitOfEverything{ + StringValue: "some updated value because the fieldMask is nil", + SingleNested: &gw.ABitOfEverything_Nested{Amount: 657}, + }, UpdateMask: nil}, + want: gw.ABitOfEverything{ + StringValue: "some updated value because the fieldMask is nil", + SingleNested: &gw.ABitOfEverything_Nested{Amount: 657}, + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + originalABE := tc.originalValue + uuid := postABE(t, port, originalABE) + + patchBody := tc.input + patchReq, err := http.NewRequest( + http.MethodPatch, + fmt.Sprintf("http://localhost:%d/v2a/example/a_bit_of_everything/%s", port, uuid), + strings.NewReader(mustMarshal(t, patchBody)), + ) + if err != nil { + t.Fatalf("http.NewRequest(PATCH) failed with %v; want success", err) + } + patchResp, err := http.DefaultClient.Do(patchReq) + if err != nil { + t.Fatalf("failed to issue PATCH request: %v", err) + } + if got, want := patchResp.StatusCode, http.StatusOK; got != want { + if body, err := ioutil.ReadAll(patchResp.Body); err != nil { + t.Errorf("patchResp body couldn't be read: %v", err) + } else { + t.Errorf("patchResp.StatusCode= %d; want %d resp: %v", got, want, string(body)) + } + } + + want, got := tc.want, getABE(t, port, uuid) + got.Uuid = "" // empty out uuid so we don't need to worry about it in comparisons + if !reflect.DeepEqual(want, got) { + t.Errorf("want %v\ngot %v", want, got) + } + }) + } +} + +// mustMarshal marshals the given object into a json string, calling t.Fatal if an error occurs. Useful in testing to +// inline marshalling whenever you don't expect the marshalling to return an error +func mustMarshal(t *testing.T, i interface{}) string { + b, err := json.Marshal(i) + if err != nil { + t.Fatalf("failed to marshal %#v: %v", i, err) + } + + return string(b) +} + +// postABE conveniently creates a new ABE record for ease in testing +func postABE(t *testing.T, port int, abe gw.ABitOfEverything) (uuid string) { + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) + postResp, err := http.Post(url, "application/json", strings.NewReader(mustMarshal(t, abe))) + if err != nil { + t.Fatalf("http.Post(%q) failed with %v; want success", url, err) + return + } + body, err := ioutil.ReadAll(postResp.Body) + if err != nil { + t.Fatalf("postResp body couldn't be read: %v", err) + } + var f struct { + UUID string `json:"uuid"` + } + if err := json.Unmarshal(body, &f); err != nil { + t.Fatalf("postResp body couldn't be unmarshalled: %v. body: %s", err, string(body)) + } + if f.UUID == "" { + t.Fatalf("want uuid from postResp, but got none. body: %s", string(body)) + } + return f.UUID +} + +// getABE conveniently fetches an ABE record for ease in testing +func getABE(t *testing.T, port int, uuid string) gw.ABitOfEverything { + gURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/%s", port, uuid) + getResp, err := http.Get(gURL) + if err != nil { + t.Fatalf("http.Get(%s) failed with %v; want success", gURL, err) + } + defer getResp.Body.Close() + + if got, want := getResp.StatusCode, http.StatusOK; got != want { + t.Fatalf("getResp.StatusCode= %d, want %d. resp: %v", got, want, getResp) + } + var getRespBody gw.ABitOfEverything + body, err := ioutil.ReadAll(getResp.Body) + if err != nil { + t.Fatalf("getResp body couldn't be read: %v", err) + } + if err := json.Unmarshal(body, &getRespBody); err != nil { + t.Fatalf("getResp body couldn't be unmarshalled: %v body: %s", err, string(body)) + } + + return getRespBody +} + func testABELookupNotFound(t *testing.T, port int) { url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) uuid := "not_exist" diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index 20009954efc..f819a9472dd 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -29,6 +29,7 @@ proto_library( "//protoc-gen-swagger/options:options_proto", "@com_google_protobuf//:duration_proto", "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:field_mask_proto", "@com_google_protobuf//:timestamp_proto", "@com_google_protobuf//:wrappers_proto", "@go_googleapis//google/api:annotations_proto", diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 4ba9b36f349..4f29c98d99c 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -14,6 +14,7 @@ import sub "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" import sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" import _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" import _ "google.golang.org/genproto/googleapis/api/annotations" +import field_mask "google.golang.org/genproto/protobuf/field_mask" import ( context "golang.org/x/net/context" @@ -54,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{0} + return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{0} } // DeepEnum is one or zero. @@ -80,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -128,7 +129,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{0} + return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -466,7 +467,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{0, 0} + return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -535,7 +536,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{1} + return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -678,7 +679,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{2} + return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -717,7 +718,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_dc9cebfa7968115c, []int{3} + return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -751,6 +752,53 @@ func (m *MessageWithBody) GetData() *Body { return nil } +// UpdateV2Request request for update includes the message and the update mask +type UpdateV2Request struct { + Abe *ABitOfEverything `protobuf:"bytes,1,opt,name=abe,proto3" json:"abe,omitempty"` + UpdateMask *field_mask.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } +func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } +func (*UpdateV2Request) ProtoMessage() {} +func (*UpdateV2Request) Descriptor() ([]byte, []int) { + return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{4} +} +func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) +} +func (m *UpdateV2Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UpdateV2Request.Marshal(b, m, deterministic) +} +func (dst *UpdateV2Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateV2Request.Merge(dst, src) +} +func (m *UpdateV2Request) XXX_Size() int { + return xxx_messageInfo_UpdateV2Request.Size(m) +} +func (m *UpdateV2Request) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateV2Request.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateV2Request proto.InternalMessageInfo + +func (m *UpdateV2Request) GetAbe() *ABitOfEverything { + if m != nil { + return m.Abe + } + return nil +} + +func (m *UpdateV2Request) GetUpdateMask() *field_mask.FieldMask { + if m != nil { + return m.UpdateMask + } + return nil +} + func init() { proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything") proto.RegisterMapType((map[string]NumericEnum)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.MapValueEntry") @@ -760,6 +808,7 @@ func init() { proto.RegisterType((*ABitOfEverythingRepeated)(nil), "grpc.gateway.examples.examplepb.ABitOfEverythingRepeated") proto.RegisterType((*Body)(nil), "grpc.gateway.examples.examplepb.Body") proto.RegisterType((*MessageWithBody)(nil), "grpc.gateway.examples.examplepb.MessageWithBody") + proto.RegisterType((*UpdateV2Request)(nil), "grpc.gateway.examples.examplepb.UpdateV2Request") proto.RegisterEnum("grpc.gateway.examples.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) proto.RegisterEnum("grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value) } @@ -783,6 +832,8 @@ type ABitOfEverythingServiceClient interface { 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) (*empty.Empty, error) + UpdateV2(ctx context.Context, in *UpdateV2Request, opts ...grpc.CallOption) (*empty.Empty, error) + PatchWithFieldMaskInBody(ctx context.Context, in *UpdateV2Request, opts ...grpc.CallOption) (*empty.Empty, error) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*empty.Empty, error) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*empty.Empty, error) GetRepeatedQuery(ctx context.Context, in *ABitOfEverythingRepeated, opts ...grpc.CallOption) (*ABitOfEverythingRepeated, error) @@ -846,6 +897,24 @@ func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEv return out, nil } +func (c *aBitOfEverythingServiceClient) UpdateV2(ctx context.Context, in *UpdateV2Request, opts ...grpc.CallOption) (*empty.Empty, error) { + out := new(empty.Empty) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/UpdateV2", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) PatchWithFieldMaskInBody(ctx context.Context, in *UpdateV2Request, opts ...grpc.CallOption) (*empty.Empty, error) { + out := new(empty.Empty) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PatchWithFieldMaskInBody", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, opts...) @@ -945,6 +1014,8 @@ type ABitOfEverythingServiceServer interface { CreateBody(context.Context, *ABitOfEverything) (*ABitOfEverything, error) Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, error) Update(context.Context, *ABitOfEverything) (*empty.Empty, error) + UpdateV2(context.Context, *UpdateV2Request) (*empty.Empty, error) + PatchWithFieldMaskInBody(context.Context, *UpdateV2Request) (*empty.Empty, error) Delete(context.Context, *sub2.IdMessage) (*empty.Empty, error) GetQuery(context.Context, *ABitOfEverything) (*empty.Empty, error) GetRepeatedQuery(context.Context, *ABitOfEverythingRepeated) (*ABitOfEverythingRepeated, error) @@ -1040,6 +1111,42 @@ func _ABitOfEverythingService_Update_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_UpdateV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateV2Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).UpdateV2(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/UpdateV2", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).UpdateV2(ctx, req.(*UpdateV2Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_PatchWithFieldMaskInBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateV2Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).PatchWithFieldMaskInBody(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PatchWithFieldMaskInBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).PatchWithFieldMaskInBody(ctx, req.(*UpdateV2Request)) + } + return interceptor(ctx, in, info, handler) +} + func _ABitOfEverythingService_Delete_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 { @@ -1240,6 +1347,14 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "Update", Handler: _ABitOfEverythingService_Update_Handler, }, + { + MethodName: "UpdateV2", + Handler: _ABitOfEverythingService_UpdateV2_Handler, + }, + { + MethodName: "PatchWithFieldMaskInBody", + Handler: _ABitOfEverythingService_PatchWithFieldMaskInBody_Handler, + }, { MethodName: "Delete", Handler: _ABitOfEverythingService_Delete_Handler, @@ -1414,181 +1529,191 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_dc9cebfa7968115c) -} - -var fileDescriptor_a_bit_of_everything_dc9cebfa7968115c = []byte{ - // 2750 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x19, 0xcd, 0x73, 0x1b, 0x57, - 0xdd, 0xab, 0x95, 0x65, 0xfb, 0xe7, 0x2f, 0xf9, 0x39, 0x71, 0x6c, 0xc5, 0xad, 0x5f, 0xd4, 0x94, - 0x6e, 0xdd, 0x6a, 0x37, 0x51, 0x4c, 0x49, 0xdc, 0x69, 0x83, 0xfc, 0x91, 0xc4, 0x4d, 0xea, 0x38, - 0x9b, 0xb4, 0x74, 0x42, 0x5a, 0xcf, 0x4a, 0x7a, 0x96, 0xb6, 0xd1, 0xee, 0x5b, 0x76, 0xdf, 0x3a, - 0x16, 0x46, 0x50, 0x60, 0x06, 0x06, 0x7a, 0x60, 0xc6, 0x70, 0xe2, 0xc0, 0x99, 0x03, 0x57, 0x4e, - 0x3d, 0x30, 0x1c, 0xca, 0x85, 0x1b, 0x30, 0xbd, 0x30, 0xc3, 0x05, 0x98, 0xe1, 0x2f, 0x80, 0xe1, - 0xc6, 0xec, 0xdb, 0x0f, 0xef, 0xae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b9, 0xa7, 0x1f, 0x90, 0x7a, 0x44, 0x64, 0x14, 0x0b, 0x52, 0x4e, 0x9d, 0x08, - 0x36, 0x93, 0x40, 0x11, 0x9d, 0x31, 0x2c, 0x48, 0x23, 0x01, 0x50, 0x48, 0xe9, 0x05, 0x80, 0x2a, - 0xa5, 0xad, 0x00, 0x02, 0xb0, 0x20, 0x8d, 0xaa, 0x63, 0xde, 0x4e, 0x24, 0xac, 0xc3, 0x6c, 0xdd, - 0x6c, 0x04, 0x00, 0xe3, 0x9e, 0x57, 0xd5, 0x71, 0x7f, 0x2f, 0x12, 0xb6, 0xda, 0x66, 0xc4, 0x09, - 0x20, 0x5e, 0xc0, 0x82, 0x34, 0xa1, 0x02, 0xdf, 0x4a, 0x28, 0x1c, 0x89, 0x31, 0x89, 0x05, 0x69, - 0xd2, 0x57, 0x38, 0x94, 0xe2, 0x36, 0x80, 0x97, 0x4a, 0x01, 0xc0, 0x14, 0x16, 0xa4, 0xa9, 0xf2, - 0xeb, 0x27, 0xba, 0x73, 0xdb, 0x35, 0x88, 0xad, 0xd7, 0x36, 0x4d, 0xd7, 0x50, 0xc7, 0x3c, 0x7c, - 0x9f, 0xd8, 0x0e, 0x4c, 0x47, 0xc9, 0x19, 0x50, 0x7c, 0x91, 0x53, 0x94, 0xfa, 0x50, 0x0c, 0x73, - 0x5a, 0xde, 0xd1, 0x58, 0x93, 0x53, 0x9b, 0xb4, 0x82, 0x2f, 0x9f, 0xa2, 0x03, 0x73, 0x7e, 0x84, - 0xec, 0xa6, 0x09, 0x2f, 0x71, 0xc2, 0x6f, 0x9f, 0x44, 0xf8, 0x5d, 0x3f, 0xcb, 0x43, 0xfa, 0x41, - 0xdc, 0x45, 0xec, 0x66, 0xcd, 0xc4, 0xda, 0x67, 0xfa, 0x32, 0x4c, 0x39, 0x49, 0xff, 0x4d, 0x63, - 0x41, 0x9a, 0x56, 0x27, 0x9d, 0x84, 0x03, 0x23, 0xb0, 0x28, 0x16, 0xf2, 0x58, 0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, 0x81, 0xf5, - 0x60, 0x31, 0xb8, 0x86, 0xa0, 0xd9, 0xe0, 0x90, 0xaf, 0xc2, 0xd3, 0x75, 0x18, 0xd6, 0xea, 0x86, - 0x6e, 0xa2, 0xd5, 0x04, 0xaa, 0x59, 0x4f, 0x80, 0x71, 0x67, 0x78, 0x60, 0xba, 0xc3, 0xbc, 0x4e, - 0xb4, 0x4f, 0xb0, 0x6e, 0xee, 0x51, 0xdb, 0xe0, 0xfe, 0xae, 0x2e, 0xc1, 0x64, 0xdc, 0x14, 0x43, - 0xe9, 0xab, 0x51, 0xf5, 0xd5, 0xbe, 0x97, 0xa3, 0x34, 0xa8, 0xbd, 0x05, 0xe7, 0xde, 0x3d, 0xae, - 0x3e, 0xf1, 0x9c, 0x1a, 0x34, 0x97, 0x1e, 0x8e, 0x45, 0x9e, 0xab, 0xe6, 0x78, 0x3e, 0x5f, 0xf9, - 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x16, 0x9f, 0xcc, 0xe3, 0x75, 0x21, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_7494e8194e1b43f3) +} + +var fileDescriptor_a_bit_of_everything_7494e8194e1b43f3 = []byte{ + // 2901 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xcd, 0x6f, 0x1b, 0xd7, + 0xb5, 0xd7, 0x70, 0xa8, 0xaf, 0xa3, 0x2f, 0xea, 0xca, 0x1f, 0x32, 0xad, 0x44, 0xd7, 0x8c, 0xf3, + 0x32, 0x51, 0x42, 0x8e, 0x4d, 0xfb, 0xe5, 0xd9, 0x0a, 0x12, 0x3f, 0xea, 0xc3, 0xb6, 0x62, 0x5b, + 0x96, 0xc7, 0x8e, 0x5f, 0xe0, 0xe7, 0x44, 0xb8, 0x24, 0xaf, 0xc8, 0xb1, 0x39, 0x73, 0x27, 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0x62, 0x74, 0xa6, 0x4b, 0x5b, 0x44, 0x34, 0x25, 0xda, 0x94, 0x13, 0x3e, 0x05, + 0x88, 0x1c, 0x8e, 0x05, 0x19, 0xb2, 0x9d, 0x06, 0x5e, 0x94, 0xc0, 0xef, 0x1e, 0x06, 0x7c, 0x23, + 0x38, 0xe5, 0x11, 0x7e, 0x98, 0x77, 0x1d, 0x71, 0x73, 0x76, 0x62, 0x1d, 0x08, 0x7d, 0x15, 0xa6, + 0x79, 0x32, 0x7e, 0x33, 0x58, 0xd1, 0x66, 0x8c, 0x29, 0x9e, 0x08, 0x60, 0x87, 0xac, 0x93, 0x0b, + 0x39, 0xac, 0x68, 0xb9, 0x88, 0x2c, 0x96, 0x75, 0x3c, 0x1e, 0x84, 0x59, 0xac, 0x68, 0xb3, 0xc6, + 0x04, 0x8f, 0x05, 0x21, 0x24, 0xe9, 0xe0, 0x20, 0xac, 0x68, 0x28, 0x20, 0x89, 0x50, 0xca, 0x70, + 0xd4, 0xa5, 0x0e, 0x25, 0xbe, 0x2b, 0x12, 0x79, 0x31, 0x87, 0x55, 0x6d, 0xdc, 0x98, 0x8b, 0x36, + 0x6f, 0xc7, 0xf2, 0xe3, 0x22, 0x4c, 0x30, 0x9b, 0xfa, 0x95, 0xdf, 0x2f, 0xbb, 0xf3, 0x47, 0x64, + 0xb5, 0x39, 0x56, 0x0a, 0x2a, 0x5d, 0x29, 0xaa, 0x74, 0xa5, 0x75, 0x7f, 0xf7, 0xea, 0x90, 0x01, + 0x92, 0x58, 0xae, 0xd0, 0x2b, 0x30, 0x19, 0xb0, 0x06, 0xb2, 0xe6, 0x8f, 0xfa, 0xd9, 0x77, 0x75, + 0xc8, 0x08, 0x00, 0x03, 0x21, 0xe8, 0x3e, 0x8c, 0x5b, 0xc4, 0x09, 0xf5, 0x38, 0x26, 0x2b, 0xc1, + 0xa5, 0xc1, 0x2b, 0xc1, 0x0d, 0xe2, 0x48, 0x75, 0xd7, 0x6d, 0xe1, 0xb6, 0x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1b, 0xab, 0xe4, 0x93, 0xcf, 0x51, 0xc9, 0x13, 0xbe, 0x39, 0x18, 0x93, 0x2e, 0xc1, 0x42, 0xca, + 0x37, 0xc9, 0xa0, 0x4c, 0x61, 0x55, 0x9b, 0x31, 0x4e, 0x24, 0xbc, 0x93, 0x18, 0xa0, 0xfa, 0x00, + 0x74, 0x92, 0x62, 0x1a, 0xab, 0x5a, 0xae, 0x17, 0x40, 0xdf, 0x64, 0x4e, 0x0c, 0x5a, 0x33, 0x58, + 0xd5, 0x66, 0x53, 0xd1, 0x89, 0x79, 0xa9, 0x27, 0x73, 0x6c, 0x94, 0x53, 0x35, 0xd4, 0xcd, 0x1c, + 0x4a, 0x2e, 0xe4, 0x21, 0xbb, 0xc2, 0xea, 0xed, 0x5e, 0x6d, 0xac, 0x70, 0x1f, 0x66, 0xc2, 0xa9, + 0xf3, 0xff, 0x4c, 0xd1, 0x94, 0x64, 0xd3, 0x90, 0x89, 0x2e, 0x66, 0x46, 0xc6, 0xf4, 0x0b, 0x47, + 0xb6, 0x4e, 0x04, 0x09, 0xeb, 0xef, 0xab, 0x87, 0x46, 0xc3, 0x07, 0x31, 0x24, 0x4b, 0xe1, 0x33, + 0x05, 0x66, 0xde, 0x77, 0xea, 0x44, 0xd0, 0xbb, 0x65, 0x83, 0x7e, 0xec, 0x51, 0x2e, 0xd0, 0x2a, + 0xa8, 0xa4, 0x1a, 0x28, 0x31, 0x51, 0x3e, 0x3b, 0x70, 0x35, 0x37, 0x7c, 0x6e, 0xf4, 0x36, 0x4c, + 0x78, 0x12, 0x57, 0xde, 0xe0, 0x43, 0xd5, 0xba, 0x67, 0x87, 0xcb, 0xfe, 0x25, 0xff, 0x06, 0xe1, + 0x0f, 0x0d, 0x08, 0xc8, 0xfd, 0xe7, 0x25, 0x0c, 0x13, 0xb1, 0x8c, 0xf1, 0xfb, 0xe8, 0xbd, 0x75, + 0xe3, 0x66, 0x6e, 0x08, 0x8d, 0x82, 0x7a, 0x73, 0x73, 0x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xb8, + 0xc4, 0x16, 0x1c, 0xfb, 0x8b, 0xd0, 0x7b, 0xb0, 0x10, 0x5e, 0x43, 0xd0, 0x5c, 0xb8, 0x29, 0x57, + 0xd1, 0xee, 0x2a, 0x0c, 0x93, 0xba, 0x65, 0xda, 0x68, 0x39, 0xc1, 0x6a, 0xd7, 0x13, 0x64, 0x32, + 0x18, 0x3e, 0x99, 0xc9, 0x85, 0xdf, 0x89, 0x76, 0x29, 0x36, 0xed, 0x1d, 0xe6, 0x5a, 0x32, 0xde, + 0xd5, 0x45, 0x98, 0x8a, 0xbb, 0x62, 0x28, 0x7d, 0x35, 0xaa, 0xbe, 0xde, 0xf7, 0x72, 0x94, 0x26, + 0x75, 0x37, 0xe0, 0xf8, 0x8d, 0x83, 0xea, 0x13, 0x3f, 0x53, 0x83, 0x9e, 0xa5, 0x7b, 0xe3, 0x9d, + 0xc8, 0x55, 0x47, 0xe4, 0x79, 0x3e, 0xf7, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x52, 0x42, 0x5e, + 0xa6, 0x8f, 0x23, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index c506569c47d..2d9070eef8d 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -265,7 +265,11 @@ func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler var protoReq ABitOfEverything var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -305,7 +309,11 @@ func request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler run var protoReq ABitOfEverything var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -332,6 +340,139 @@ func request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler run } +var ( + filter_ABitOfEverythingService_UpdateV2_0 = &utilities.DoubleArray{Encoding: map[string]int{"abe": 0, "uuid": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} +) + +func request_ABitOfEverythingService_UpdateV2_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateV2Request + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["abe.uuid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_UpdateV2_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateV2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_ABitOfEverythingService_UpdateV2_1 = &utilities.DoubleArray{Encoding: map[string]int{"abe": 0, "uuid": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} +) + +func request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateV2Request + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { + runtime.CamelCaseFieldMask(protoReq.UpdateMask) + } else { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["abe.uuid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_UpdateV2_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateV2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateV2Request + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { + runtime.CamelCaseFieldMask(protoReq.UpdateMask) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["abe.uuid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) + } + + msg, err := client.PatchWithFieldMaskInBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + func request_ABitOfEverythingService_Delete_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 @@ -624,7 +765,11 @@ func request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runti var protoReq sub.StringMessage var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Value); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Value); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -654,7 +799,11 @@ func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshal var protoReq ABitOfEverything var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -703,7 +852,11 @@ func request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, m var protoReq MessageWithBody var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Data); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Data); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -734,7 +887,11 @@ func request_ABitOfEverythingService_PostWithEmptyBody_0(ctx context.Context, ma var protoReq Body var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -888,6 +1045,66 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) + mux.Handle("PUT", pattern_ABitOfEverythingService_UpdateV2_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_UpdateV2_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_UpdateV2_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_ABitOfEverythingService_UpdateV2_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_UpdateV2_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_UpdateV2_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_ABitOfEverythingService_PatchWithFieldMaskInBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("DELETE", pattern_ABitOfEverythingService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1120,6 +1337,12 @@ var ( 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_UpdateV2_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "a_bit_of_everything", "abe.uuid"}, "")) + + pattern_ABitOfEverythingService_UpdateV2_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "a_bit_of_everything", "abe.uuid"}, "")) + + pattern_ABitOfEverythingService_PatchWithFieldMaskInBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2a", "example", "a_bit_of_everything", "abe.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"}, "")) pattern_ABitOfEverythingService_GetQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "query", "uuid"}, "")) @@ -1152,6 +1375,12 @@ var ( forward_ABitOfEverythingService_Update_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_UpdateV2_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_UpdateV2_1 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_PatchWithFieldMaskInBody_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_Delete_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_GetQuery_0 = runtime.ForwardResponseMessage diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index d7a91bf4d8e..e07b09789d5 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -3,6 +3,7 @@ option go_package = "examplepb"; package grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/duration.proto"; import "examples/proto/pathenum/path_enum.proto"; @@ -239,6 +240,12 @@ enum NumericEnum { ONE = 1; } +// UpdateV2Request request for update includes the message and the update mask +message UpdateV2Request { + ABitOfEverything abe = 1; + google.protobuf.FieldMask update_mask = 2; +} + // ABitOfEverything service is used to validate that APIs with complicated // proto messages and URL templates are still processed correctly. service ABitOfEverythingService { @@ -276,6 +283,22 @@ service ABitOfEverythingService { body: "*" }; } + rpc UpdateV2(UpdateV2Request) returns (google.protobuf.Empty) { + option (google.api.http) = { + put: "/v2/example/a_bit_of_everything/{abe.uuid}" + body: "abe" + additional_bindings { + patch: "/v2/example/a_bit_of_everything/{abe.uuid}" + body: "abe" + } + }; + } + rpc PatchWithFieldMaskInBody(UpdateV2Request) returns (google.protobuf.Empty) { + option (google.api.http) = { + patch: "/v2a/example/a_bit_of_everything/{abe.uuid}" + body: "*" + }; + } rpc Delete(sub2.IdMessage) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/example/a_bit_of_everything/{uuid}" diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 61c1023786e..b3249e62612 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -953,6 +953,100 @@ ] } }, + "/v2/example/a_bit_of_everything/{abe.uuid}": { + "put": { + "operationId": "UpdateV2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + }, + "403": { + "description": "Returned when the user does not have permission to access the resource.", + "schema": {} + }, + "404": { + "description": "Returned when the resource does not exist.", + "schema": { + "format": "string" + } + }, + "418": { + "description": "I'm a teapot.", + "schema": { + "$ref": "#/definitions/examplepbNumericEnum" + } + } + }, + "parameters": [ + { + "name": "abe.uuid", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + }, + "patch": { + "operationId": "UpdateV22", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + }, + "403": { + "description": "Returned when the user does not have permission to access the resource.", + "schema": {} + }, + "404": { + "description": "Returned when the resource does not exist.", + "schema": { + "format": "string" + } + }, + "418": { + "description": "I'm a teapot.", + "schema": { + "$ref": "#/definitions/examplepbNumericEnum" + } + } + }, + "parameters": [ + { + "name": "abe.uuid", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, "/v2/example/echo": { "get": { "summary": "Summary: Echo rpc", @@ -1250,6 +1344,54 @@ "ABitOfEverythingService" ] } + }, + "/v2a/example/a_bit_of_everything/{abe.uuid}": { + "patch": { + "operationId": "PatchWithFieldMaskInBody", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + }, + "403": { + "description": "Returned when the user does not have permission to access the resource.", + "schema": {} + }, + "404": { + "description": "Returned when the resource does not exist.", + "schema": { + "format": "string" + } + }, + "418": { + "description": "I'm a teapot.", + "schema": { + "$ref": "#/definitions/examplepbNumericEnum" + } + } + }, + "parameters": [ + { + "name": "abe.uuid", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbUpdateV2Request" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } } }, "definitions": { @@ -1561,6 +1703,18 @@ "default": "ZERO", "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" }, + "examplepbUpdateV2Request": { + "type": "object", + "properties": { + "abe": { + "$ref": "#/definitions/examplepbABitOfEverything" + }, + "update_mask": { + "$ref": "#/definitions/protobufFieldMask" + } + }, + "title": "UpdateV2Request request for update includes the message and the update mask" + }, "pathenumPathEnum": { "type": "string", "enum": [ @@ -1574,6 +1728,20 @@ "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:" }, + "protobufFieldMask": { + "type": "object", + "properties": { + "paths": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The set of field mask paths." + } + }, + "description": "paths: \"f.a\"\n paths: \"f.b.d\"\n\nHere `f` represents a field in some root message, `a` and `b`\nfields in the message found in `f`, and `d` a field found in the\nmessage in `f.b`.\n\nField masks are used to specify a subset of fields that should be\nreturned by a get operation or modified by an update operation.\nField masks also have a custom JSON encoding (see below).\n\n# Field Masks in Projections\n\nWhen used in the context of a projection, a response message or\nsub-message is filtered by the API to only contain those fields as\nspecified in the mask. For example, if the mask in the previous\nexample is applied to a response message as follows:\n\n f {\n a : 22\n b {\n d : 1\n x : 2\n }\n y : 13\n }\n z: 8\n\nThe result will not contain specific values for fields x,y and z\n(their value will be set to the default, and omitted in proto text\noutput):\n\n\n f {\n a : 22\n b {\n d : 1\n }\n }\n\nA repeated field is not allowed except at the last position of a\npaths string.\n\nIf a FieldMask object is not present in a get operation, the\noperation applies to all fields (as if a FieldMask of all fields\nhad been specified).\n\nNote that a field mask does not necessarily apply to the\ntop-level response message. In case of a REST get operation, the\nfield mask applies directly to the response, but in case of a REST\nlist operation, the mask instead applies to each individual message\nin the returned resource list. In case of a REST custom method,\nother definitions may be used. Where the mask applies will be\nclearly documented together with its declaration in the API. In\nany case, the effect on the returned resource/resources is required\nbehavior for APIs.\n\n# Field Masks in Update Operations\n\nA field mask in update operations specifies which fields of the\ntargeted resource are going to be updated. The API is required\nto only change the values of the fields as specified in the mask\nand leave the others untouched. If a resource is passed in to\ndescribe the updated values, the API ignores the values of all\nfields not covered by the mask.\n\nIf a repeated field is specified for an update operation, the existing\nrepeated values in the target resource will be overwritten by the new values.\nNote that a repeated field is only allowed in the last position of a `paths`\nstring.\n\nIf a sub-message is specified in the last position of the field mask for an\nupdate operation, then the existing sub-message in the target resource is\noverwritten. Given the target message:\n\n f {\n b {\n d : 1\n x : 2\n }\n c : 1\n }\n\nAnd an update message:\n\n f {\n b {\n d : 10\n }\n }\n\nthen if the field mask is:\n\n paths: \"f.b\"\n\nthen the result will be:\n\n f {\n b {\n d : 10\n }\n c : 1\n }\n\nHowever, if the update mask was:\n\n paths: \"f.b.d\"\n\nthen the result would be:\n\n f {\n b {\n d : 10\n x : 2\n }\n c : 1\n }\n\nIn order to reset a field's value to the default, the field must\nbe in the mask and set to the default value in the provided resource.\nHence, in order to reset all fields of a resource, provide a default\ninstance of the resource and set all fields in the mask, or do\nnot provide a mask as described below.\n\nIf a field mask is not present on update, the operation applies to\nall fields (as if a field mask of all fields has been specified).\nNote that in the presence of schema evolution, this may mean that\nfields the client does not know and has therefore not filled into\nthe request will be reset to their default. If this is unwanted\nbehavior, a specific service may require a client to always specify\na field mask, producing an error if not.\n\nAs with get operations, the location of the resource which\ndescribes the updated values in the request message depends on the\noperation kind. In any case, the effect of the field mask is\nrequired to be honored by the API.\n\n## Considerations for HTTP REST\n\nThe HTTP kind of an update operation which uses a field mask must\nbe set to PATCH instead of PUT in order to satisfy HTTP semantics\n(PUT must only be used for full updates).\n\n# JSON Encoding of Field Masks\n\nIn JSON, a field mask is encoded as a single string where paths are\nseparated by a comma. Fields name in each path are converted\nto/from lower-camel naming conventions.\n\nAs an example, consider the following message declarations:\n\n message Profile {\n User user = 1;\n Photo photo = 2;\n }\n message User {\n string display_name = 1;\n string address = 2;\n }\n\nIn proto a field mask for `Profile` may look as such:\n\n mask {\n paths: \"user.display_name\"\n paths: \"photo\"\n }\n\nIn JSON, the same mask is represented as below:\n\n {\n mask: \"user.displayName,photo\"\n }\n\n# Field Masks and Oneof Fields\n\nField masks treat fields in oneofs just as regular fields. Consider the\nfollowing message:\n\n message SampleMessage {\n oneof test_oneof {\n string name = 4;\n SubMessage sub_message = 9;\n }\n }\n\nThe field mask can be:\n\n mask {\n paths: \"name\"\n }\n\nOr:\n\n mask {\n paths: \"sub_message\"\n }\n\nNote that oneof type names (\"test_oneof\" in this case) cannot be used in\npaths.", + "title": "`FieldMask` represents a set of symbolic field paths, for example:" + }, "subStringMessage": { "type": "object", "properties": { diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index ca6579265e0..5e9efc9beac 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -272,7 +272,11 @@ func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marsh var protoReq SimpleMessage var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index a20cf605711..b4ae06a19d7 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -61,7 +61,11 @@ func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler run grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - dec := marshaler.NewDecoder(req.Body) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + dec := marshaler.NewDecoder(newReader()) for { var protoReq EmptyProto err = dec.Decode(&protoReq) @@ -102,7 +106,11 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - dec := marshaler.NewDecoder(req.Body) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, berr + } + dec := marshaler.NewDecoder(newReader()) handleSend := func() error { var protoReq EmptyProto err := dec.Decode(&protoReq) @@ -151,7 +159,11 @@ func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -230,7 +242,11 @@ func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -276,7 +292,11 @@ func request_FlowCombination_RpcBodyRpc_4(ctx context.Context, marshaler runtime var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -297,7 +317,11 @@ func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -406,7 +430,11 @@ func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler r var protoReq NestedProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -491,7 +519,11 @@ func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler r var protoReq NestedProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -526,7 +558,11 @@ func request_FlowCombination_RpcBodyStream_0(ctx context.Context, marshaler runt var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -629,7 +665,11 @@ func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runt var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -683,7 +723,11 @@ func request_FlowCombination_RpcBodyStream_4(ctx context.Context, marshaler runt var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -712,7 +756,11 @@ func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runt var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -845,7 +893,11 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale var protoReq NestedProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -946,7 +998,11 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale var protoReq NestedProto var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index a62da50e2a0..f43c517b17e 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -37,7 +37,11 @@ func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.M grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - dec := marshaler.NewDecoder(req.Body) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + dec := marshaler.NewDecoder(newReader()) for { var protoReq ABitOfEverything err = dec.Decode(&protoReq) @@ -95,7 +99,11 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - dec := marshaler.NewDecoder(req.Body) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, berr + } + dec := marshaler.NewDecoder(newReader()) handleSend := func() error { var protoReq sub.StringMessage err := dec.Decode(&protoReq) diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index 90bcbbd39f0..01764c0f9e6 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -113,7 +113,11 @@ func request_UnannotatedEchoService_EchoBody_0(ctx context.Context, marshaler ru var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index f603e0283a2..7e95a4c6163 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -32,7 +32,11 @@ func request_WrappersService_Create_0(ctx context.Context, marshaler runtime.Mar var protoReq Wrappers var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/examples/server/BUILD.bazel b/examples/server/BUILD.bazel index 29d44cfb4d1..6a35faff50c 100644 --- a/examples/server/BUILD.bazel +++ b/examples/server/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") package(default_visibility = ["//visibility:public"]) @@ -7,6 +7,7 @@ go_library( srcs = [ "a_bit_of_everything.go", "echo.go", + "fieldmask_helper.go", "flow_combination.go", "main.go", "responsebody.go", @@ -23,9 +24,17 @@ go_library( "@go_googleapis//google/rpc:errdetails_go_proto", "@io_bazel_rules_go//proto/wkt:duration_go_proto", "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_grpc//status:go_default_library", ], ) + +go_test( + name = "go_default_test", + srcs = ["fieldmask_helper_test.go"], + embed = [":go_default_library"], + deps = ["@io_bazel_rules_go//proto/wkt:field_mask_go_proto"], +) diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 4f433654749..384638cab31 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "strings" "sync" "github.com/golang/glog" @@ -11,8 +12,8 @@ import ( "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/empty" examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" - sub "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" - sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" + "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" + "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" "github.com/rogpeppe/fastuuid" "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc" @@ -161,6 +162,39 @@ func (s *_ABitOfEverythingServer) Update(ctx context.Context, msg *examples.ABit return new(empty.Empty), nil } +func (s *_ABitOfEverythingServer) UpdateV2(ctx context.Context, msg *examples.UpdateV2Request) (*empty.Empty, error) { + glog.Info(msg) + // If there is no update mask do a regular update + if msg.UpdateMask == nil || len(msg.UpdateMask.GetPaths()) == 0 { + return s.Update(ctx, msg.Abe) + } + + s.m.Lock() + defer s.m.Unlock() + if a, ok := s.v[msg.Abe.Uuid]; ok { + applyFieldMask(a, msg.Abe, msg.UpdateMask) + } else { + return nil, status.Errorf(codes.NotFound, "not found") + } + return new(empty.Empty), nil +} + +// PatchWithFieldMaskInBody differs from UpdateV2 only in that this method exposes the field mask in the request body, +// so that clients can specify their mask explicitly +func (s *_ABitOfEverythingServer) PatchWithFieldMaskInBody(ctx context.Context, request *examples.UpdateV2Request) (*empty.Empty, error) { + // low-effort attempt to modify the field mask to only include paths for the ABE struct. Since this is only for the + // integration tests, this narrow implementaion is fine. + if request.UpdateMask != nil { + var shifted []string + for _, path := range request.UpdateMask.GetPaths() { + shifted = append(shifted, strings.TrimPrefix(path, "Abe.")) + } + request.UpdateMask.Paths = shifted + } + + return s.UpdateV2(ctx, request) +} + func (s *_ABitOfEverythingServer) Delete(ctx context.Context, msg *sub2.IdMessage) (*empty.Empty, error) { s.m.Lock() defer s.m.Unlock() diff --git a/examples/server/fieldmask_helper.go b/examples/server/fieldmask_helper.go new file mode 100644 index 00000000000..d0cac43c58f --- /dev/null +++ b/examples/server/fieldmask_helper.go @@ -0,0 +1,55 @@ +package server + +import ( + "log" + "reflect" + "strings" + + "google.golang.org/genproto/protobuf/field_mask" +) + +func applyFieldMask(patchee, patcher interface{}, mask *field_mask.FieldMask) { + if mask == nil { + return + } + + for _, path := range mask.GetPaths() { + val := getField(patcher, path) + if val.IsValid() { + setValue(patchee, val, path) + } + } +} + +func getField(obj interface{}, path string) (val reflect.Value) { + // this func is lazy -- if anything bad happens just return nil + defer func() { + if r := recover(); r != nil { + log.Printf("failed to get field:\npath: %q\nobj: %#v\nerr: %v", path, obj, r) + val = reflect.Value{} + } + }() + + v := reflect.ValueOf(obj) + if len(path) == 0 { + return v + } + + for _, s := range strings.Split(path, ".") { + if v.Kind() == reflect.Ptr { + v = reflect.Indirect(v) + } + v = v.FieldByName(s) + } + + return v +} + +func setValue(obj interface{}, newValue reflect.Value, path string) { + defer func() { + if r := recover(); r != nil { + log.Printf("failed to set value:\nnewValue: %#v\npath: %q\nobj: %#v\nerr: %v", newValue, path, obj, r) + } + }() + getField(obj, path).Set(newValue) +} diff --git a/examples/server/fieldmask_helper_test.go b/examples/server/fieldmask_helper_test.go new file mode 100644 index 00000000000..c735fdd7aca --- /dev/null +++ b/examples/server/fieldmask_helper_test.go @@ -0,0 +1,92 @@ +package server + +import ( + "reflect" + "testing" + + "google.golang.org/genproto/protobuf/field_mask" +) + +func TestApplyFieldMask(t *testing.T) { + for _, test := range []struct { + name string + patchee interface{} + patcher interface{} + fieldMask *field_mask.FieldMask + expected interface{} + }{ + {"nil fieldMask", &a{E: 64}, &a{E: 42}, nil, &a{E: 64}}, + {"empty paths", &a{E: 63}, &a{E: 42}, &field_mask.FieldMask{}, &a{E: 63}}, + {"simple path", &a{E: 23, F: "test"}, &a{B: &b{}, E: 42}, &field_mask.FieldMask{Paths: []string{"E"}}, &a{E: 42, F: "test"}}, + {"nested", &a{B: &b{C: 85}}, &a{B: &b{C: 58, D: nil}}, &field_mask.FieldMask{Paths: []string{"B.C"}}, &a{B: &b{C: 58}}}, + {"multiple paths", &a{B: &b{C: 40, D: []int{1, 2, 3}}, E: 34, F: "catapult"}, &a{B: &b{C: 56}, F: "lettuce"}, &field_mask.FieldMask{Paths: []string{"B.C", "F"}}, &a{B: &b{C: 56, D: []int{1, 2, 3}}, E: 34, F: "lettuce"}}, + } { + t.Run(test.name, func(t *testing.T) { + applyFieldMask(test.patchee, test.patcher, test.fieldMask) + if !reflect.DeepEqual(test.patchee, test.expected) { + t.Errorf("expected %v, but was %v", test.expected, test.patchee) + } + }) + } +} + +func TestGetValue(t *testing.T) { + for _, test := range []struct { + name string + input interface{} + path string + expected interface{} + }{ + {"empty", &a{E: 45, F: "test"}, "", &a{E: 45, F: "test"}}, + {"pointer-simple", &a{E: 45}, "E", 45}, + {"pointer-nested", &a{B: &b{C: 42}}, "B.C", 42}, + {"pointer-complex type", &a{B: &b{D: []int{1, 2}}}, "B.D", []int{1, 2}}, + {"pointer-invalid path", &a{F: "test"}, "X.Y", nil}, + {"simple", a{E: 45}, "E", 45}, + {"nested", a{B: &b{C: 42}}, "B.C", 42}, + {"complex type", a{B: &b{D: []int{1, 2}}}, "B.D", []int{1, 2}}, + {"invalid path", a{F: "test"}, "X.Y", nil}, + } { + t.Run(test.name, func(t *testing.T) { + if actual := getField(test.input, test.path); actual.IsValid() { + if !reflect.DeepEqual(test.expected, actual.Interface()) { + t.Errorf("expected %v, but got %v", test.expected, actual) + } + } else if test.expected != nil { + t.Errorf("expected nil, but was %v", actual) + } + }) + } +} + +func TestSetValue(t *testing.T) { + for _, test := range []struct { + name string + obj interface{} + newValue interface{} + path string + expected interface{} + }{ + {"simple", &a{E: 45}, 34, "E", 34}, + {"nested", &a{B: &b{C: 54}}, 43, "B.C", 43}, + {"complex type", &a{B: &b{D: []int{1, 2}}}, []int{3, 4}, "B.D", []int{3, 4}}, + } { + t.Run(test.name, func(t *testing.T) { + setValue(test.obj, reflect.ValueOf(test.newValue), test.path) + if actual := getField(test.obj, test.path).Interface(); !reflect.DeepEqual(actual, test.expected) { + t.Errorf("expected %v, but got %v", test.newValue, actual) + } + }) + } +} + +type a struct { + B *b + E int + F string +} + +type b struct { + C int + D []int +} diff --git a/protoc-gen-grpc-gateway/gengateway/BUILD.bazel b/protoc-gen-grpc-gateway/gengateway/BUILD.bazel index fcd9cfc3209..316010f500d 100644 --- a/protoc-gen-grpc-gateway/gengateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/gengateway/BUILD.bazel @@ -16,6 +16,7 @@ go_library( "//utilities:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", ], ) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 7db03cca64e..fad1392c0c0 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -7,6 +7,7 @@ import ( "text/template" "github.com/golang/glog" + generator2 "github.com/golang/protobuf/protoc-gen-go/generator" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/utilities" ) @@ -23,6 +24,14 @@ type binding struct { Registry *descriptor.Registry } +// GetBodyFieldPath returns the binding body's fieldpath. +func (b binding) GetBodyFieldPath() string { + if b.Body != nil && len(b.Body.FieldPath) != 0 { + return b.Body.FieldPath.String() + } + return "*" +} + // HasQueryParam determines if the binding needs parameters in query string. // // It sometimes returns true even though actually the binding does not need. @@ -88,6 +97,26 @@ func (b binding) LookupEnum(p descriptor.Parameter) *descriptor.Enum { return e } +// FieldMaskField returns the golang-style name of the variable for a FieldMask, if there is exactly one of that type in +// the message. Otherwise, it returns an empty string. +func (b binding) FieldMaskField() string { + var fieldMaskField *descriptor.Field + for _, f := range b.Method.RequestType.Fields { + if f.GetTypeName() == ".google.protobuf.FieldMask" { + // if there is more than 1 FieldMask for this request, then return none + if fieldMaskField != nil { + return "" + } + fieldMaskField = f + } + } + + if fieldMaskField != nil { + return generator2.CamelCase(fieldMaskField.GetName()) + } + return "" +} + // queryParamFilter is a wrapper of utilities.DoubleArray which provides String() to output DoubleArray.Encoding in a stable and predictable format. type queryParamFilter struct { *utilities.DoubleArray @@ -197,7 +226,11 @@ func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx cont grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - dec := marshaler.NewDecoder(req.Body) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + dec := marshaler.NewDecoder(newReader()) for { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} err = dec.Decode(&protoReq) @@ -244,9 +277,24 @@ var ( var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} var metadata runtime.ServerMetadata {{if .Body}} - if err := marshaler.NewDecoder(req.Body).Decode(&{{.Body.AssignableExpr "protoReq"}}); err != nil && err != io.EOF { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&{{.Body.AssignableExpr "protoReq"}}); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } + {{- if and (eq (.HTTPMethod) "PATCH") (.FieldMaskField)}} + if protoReq.{{.FieldMaskField}} != nil && len(protoReq.{{.FieldMaskField}}.GetPaths()) > 0 { + runtime.CamelCaseFieldMask(protoReq.{{.FieldMaskField}}) + } {{if not (eq "*" .GetBodyFieldPath)}} else { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.{{.FieldMaskField}} = fieldMask + } + } {{end}} + {{end}} {{end}} {{if .PathParams}} var ( @@ -319,7 +367,11 @@ var ( grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - dec := marshaler.NewDecoder(req.Body) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, berr + } + dec := marshaler.NewDecoder(newReader()) handleSend := func() error { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} err := dec.Decode(&protoReq) diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index 3f1313a7ddc..ca9e587a69d 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -230,7 +230,7 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { if want := spec.sigWant; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `marshaler.NewDecoder(req.Body).Decode(&protoReq.GetNested().Bool)`; !strings.Contains(got, want) { + if want := `marshaler.NewDecoder(newReader()).Decode(&protoReq.GetNested().Bool)`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `val, ok = pathParams["nested.int32"]`; !strings.Contains(got, want) { @@ -391,7 +391,7 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { if want := spec.sigWant; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `marshaler.NewDecoder(req.Body)`; !strings.Contains(got, want) { + if want := `marshaler.NewDecoder(newReader()`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index 252c4527853..059e2033535 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -9,6 +9,7 @@ go_library( "convert.go", "doc.go", "errors.go", + "fieldmask.go", "handler.go", "marshal_json.go", "marshal_jsonpb.go", @@ -27,8 +28,10 @@ go_library( "//utilities:go_default_library", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", "@io_bazel_rules_go//proto/wkt:any_go_proto", "@io_bazel_rules_go//proto/wkt:duration_go_proto", + "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", "@org_golang_google_grpc//codes:go_default_library", @@ -44,6 +47,7 @@ go_test( srcs = [ "context_test.go", "errors_test.go", + "fieldmask_test.go", "handler_test.go", "marshal_json_test.go", "marshal_jsonpb_test.go", diff --git a/runtime/fieldmask.go b/runtime/fieldmask.go new file mode 100644 index 00000000000..e1cf7a91461 --- /dev/null +++ b/runtime/fieldmask.go @@ -0,0 +1,70 @@ +package runtime + +import ( + "encoding/json" + "io" + "strings" + + "github.com/golang/protobuf/protoc-gen-go/generator" + "google.golang.org/genproto/protobuf/field_mask" +) + +// FieldMaskFromRequestBody creates a FieldMask printing all complete paths from the JSON body. +func FieldMaskFromRequestBody(r io.Reader) (*field_mask.FieldMask, error) { + fm := &field_mask.FieldMask{} + var root interface{} + if err := json.NewDecoder(r).Decode(&root); err != nil { + if err == io.EOF { + return fm, nil + } + return nil, err + } + + queue := []fieldMaskPathItem{{node: root}} + for len(queue) > 0 { + // dequeue an item + item := queue[0] + queue = queue[1:] + + if m, ok := item.node.(map[string]interface{}); ok { + // if the item is an object, then enqueue all of its children + for k, v := range m { + queue = append(queue, fieldMaskPathItem{path: append(item.path, generator.CamelCase(k)), node: v}) + } + } else if len(item.path) > 0 { + // otherwise, it's a leaf node so print its path + fm.Paths = append(fm.Paths, strings.Join(item.path, ".")) + } + } + + return fm, nil +} + +// fieldMaskPathItem stores a in-progress deconstruction of a path for a fieldmask +type fieldMaskPathItem struct { + // the list of prior fields leading up to node + path []string + + // a generic decoded json object the current item to inspect for further path extraction + node interface{} +} + +// CamelCaseFieldMask updates the given FieldMask by converting all of its paths to CamelCase, using the same heuristic +// that's used for naming protobuf fields in Go. +func CamelCaseFieldMask(mask *field_mask.FieldMask) { + if mask == nil || mask.Paths == nil { + return + } + + var newPaths []string + for _, path := range mask.Paths { + lowerCasedParts := strings.Split(path, ".") + var camelCasedParts []string + for _, part := range lowerCasedParts { + camelCasedParts = append(camelCasedParts, generator.CamelCase(part)) + } + newPaths = append(newPaths, strings.Join(camelCasedParts, ".")) + } + + mask.Paths = newPaths +} diff --git a/runtime/fieldmask_test.go b/runtime/fieldmask_test.go new file mode 100644 index 00000000000..3c097878aa0 --- /dev/null +++ b/runtime/fieldmask_test.go @@ -0,0 +1,87 @@ +package runtime + +import ( + "bytes" + "fmt" + "testing" + + "google.golang.org/genproto/protobuf/field_mask" +) + +func fieldMasksEqual(fm1, fm2 *field_mask.FieldMask) bool { + if fm1 == nil && fm2 == nil { + return true + } + if fm1 == nil || fm2 == nil { + return false + } + if len(fm1.GetPaths()) != len(fm2.GetPaths()) { + return false + } + + paths := make(map[string]bool) + for _, path := range fm1.GetPaths() { + paths[path] = true + } + for _, path := range fm2.GetPaths() { + if _, ok := paths[path]; !ok { + return false + } + } + + return true +} + +func newFieldMask(paths ...string) *field_mask.FieldMask { + return &field_mask.FieldMask{Paths: paths} +} + +func fieldMaskString(fm *field_mask.FieldMask) string { + if fm == nil { + return "" + } + return fmt.Sprintf("%v", fm.GetPaths()) +} + +func TestFieldMaskFromRequestBody(t *testing.T) { + for _, tc := range []struct { + name string + input string + expected *field_mask.FieldMask + expectedErr error + }{ + {name: "empty", expected: newFieldMask()}, + {name: "simple", input: `{"foo":1, "bar":"baz"}`, expected: newFieldMask("Foo", "Bar")}, + {name: "nested", input: `{"foo": {"bar":1, "baz": 2}, "qux": 3}`, expected: newFieldMask("Foo.Bar", "Foo.Baz", "Qux")}, + {name: "canonical", input: `{"f": {"b": {"d": 1, "x": 2}, "c": 1}}`, expected: newFieldMask("F.B.D", "F.B.X", "F.C")}, + } { + t.Run(tc.name, func(t *testing.T) { + actual, err := FieldMaskFromRequestBody(bytes.NewReader([]byte(tc.input))) + if !fieldMasksEqual(actual, tc.expected) { + t.Errorf("want %v; got %v", fieldMaskString(tc.expected), fieldMaskString(actual)) + } + if err != tc.expectedErr { + t.Errorf("want %v; got %v", tc.expectedErr, err) + } + }) + } +} + +func TestCamelCaseFieldMask(t *testing.T) { + for _, tc := range []struct { + name string + input *field_mask.FieldMask + expected *field_mask.FieldMask + }{ + {"nil", nil, nil}, + {"empty", &field_mask.FieldMask{Paths: nil}, &field_mask.FieldMask{Paths: nil}}, + {"main usage", newFieldMask("a", "a.b", "some_field.some_sub_field"), newFieldMask("A", "A.B", "SomeField.SomeSubField")}, + } { + t.Run(tc.name, func(t *testing.T) { + CamelCaseFieldMask(tc.input) + if expected, actual := tc.expected, tc.input; !fieldMasksEqual(expected, actual) { + t.Errorf("want %v; got %v", fieldMaskString(expected), fieldMaskString(actual)) + } + }) + } +} diff --git a/utilities/BUILD.bazel b/utilities/BUILD.bazel index 151f6864d92..7109d793231 100644 --- a/utilities/BUILD.bazel +++ b/utilities/BUILD.bazel @@ -7,6 +7,7 @@ go_library( srcs = [ "doc.go", "pattern.go", + "readerfactory.go", "trie.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/utilities", diff --git a/utilities/readerfactory.go b/utilities/readerfactory.go new file mode 100644 index 00000000000..6dd3854665f --- /dev/null +++ b/utilities/readerfactory.go @@ -0,0 +1,20 @@ +package utilities + +import ( + "bytes" + "io" + "io/ioutil" +) + +// IOReaderFactory takes in an io.Reader and returns a function that will allow you to create a new reader that begins +// at the start of the stream +func IOReaderFactory(r io.Reader) (func() io.Reader, error) { + b, err := ioutil.ReadAll(r) + if err != nil { + return nil, err + } + + return func() io.Reader { + return bytes.NewReader(b) + }, nil +} From 7a8292c7d6d35013f96c34886a288ee3866e91d1 Mon Sep 17 00:00:00 2001 From: Kelly Campbell Date: Wed, 5 Dec 2018 14:20:19 -0500 Subject: [PATCH 320/552] Add filegroup for options proto files This allows other projects to generate proto code for other languages, e.g. py_proto_library --- protoc-gen-swagger/options/BUILD.bazel | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/protoc-gen-swagger/options/BUILD.bazel b/protoc-gen-swagger/options/BUILD.bazel index 0a91a7bbc68..7a51fd7c7f4 100644 --- a/protoc-gen-swagger/options/BUILD.bazel +++ b/protoc-gen-swagger/options/BUILD.bazel @@ -3,6 +3,20 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") package(default_visibility = ["//visibility:public"]) +filegroup( + name = "options_proto_files", + srcs = [ + "annotations.proto", + "openapiv2.proto", + ], +) + +go_library( + name = "go_default_library", + embed = [":options_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options", +) + proto_library( name = "options_proto", srcs = [ @@ -21,9 +35,3 @@ go_proto_library( importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options", proto = ":options_proto", ) - -go_library( - name = "go_default_library", - embed = [":options_go_proto"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options", -) From 762f88c422f34baded04bb2fac0e7f377fa6cf4e Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 7 Dec 2018 19:56:03 +0000 Subject: [PATCH 321/552] Generate changelog for 1.6.0 --- CHANGELOG.md | 68 +++++++++++++++++++++++++++++++++++++++++++++------- Makefile | 2 +- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d7184d2058..e6ca50f188c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,54 @@ # Change Log -## [v1.5.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.5.1) (2018-10-01) +## [v1.6.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.0) (2018-12-07) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.5.1...v1.6.0) + +**Implemented enhancements:** + +- Add 'License' message to the annotation proto. [\#644](https://github.com/grpc-ecosystem/grpc-gateway/pull/644) ([ensonic](https://github.com/ensonic)) + +**Fixed bugs:** + +- Cannot return HTTP header using "Grpc-Metadata-" prefix [\#782](https://github.com/grpc-ecosystem/grpc-gateway/issues/782) +- protoc-gen-swagger throws the error: Any JSON doesn't have '@type' [\#771](https://github.com/grpc-ecosystem/grpc-gateway/issues/771) +- proto-gen-swagger: provide default description for HTTP 200 responses [\#766](https://github.com/grpc-ecosystem/grpc-gateway/issues/766) + +**Closed issues:** + +- Please release the repo, IOReaderFactory is not available on the latest release! [\#823](https://github.com/grpc-ecosystem/grpc-gateway/issues/823) +- Unable to add protobuf wrappers in url template option [\#808](https://github.com/grpc-ecosystem/grpc-gateway/issues/808) +- Class 'GPBMetadata\ProtocGenSwagger\Options\Annotations' not found [\#794](https://github.com/grpc-ecosystem/grpc-gateway/issues/794) +- REST gateway over RPCS? [\#789](https://github.com/grpc-ecosystem/grpc-gateway/issues/789) +- Why the rctx is substituted by a new empty context? [\#788](https://github.com/grpc-ecosystem/grpc-gateway/issues/788) +- grpc gateway intercepter [\#785](https://github.com/grpc-ecosystem/grpc-gateway/issues/785) +- "error" and "message" fields in error response [\#768](https://github.com/grpc-ecosystem/grpc-gateway/issues/768) +- Go1.11: http.CloseNotifier is deprecated [\#736](https://github.com/grpc-ecosystem/grpc-gateway/issues/736) +- Access to raw post body [\#652](https://github.com/grpc-ecosystem/grpc-gateway/issues/652) + +**Merged pull requests:** + +- Add filegroup for options proto files [\#821](https://github.com/grpc-ecosystem/grpc-gateway/pull/821) ([kellycampbell](https://github.com/kellycampbell)) +- Added support for more WKT [\#816](https://github.com/grpc-ecosystem/grpc-gateway/pull/816) ([mayankcpdixit](https://github.com/mayankcpdixit)) +- Fix protobuf repository's owner name on README.md [\#814](https://github.com/grpc-ecosystem/grpc-gateway/pull/814) ([micnncim](https://github.com/micnncim)) +- Revert "Adding support for more well known types in descriptor" [\#813](https://github.com/grpc-ecosystem/grpc-gateway/pull/813) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Feature/patch2 rebased [\#812](https://github.com/grpc-ecosystem/grpc-gateway/pull/812) ([razamiDev](https://github.com/razamiDev)) +- Correct wellKnownTypeConv function references [\#811](https://github.com/grpc-ecosystem/grpc-gateway/pull/811) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Adding support for more well known types in descriptor [\#809](https://github.com/grpc-ecosystem/grpc-gateway/pull/809) ([mayankcpdixit](https://github.com/mayankcpdixit)) +- Make Bazel CI failures clearer [\#807](https://github.com/grpc-ecosystem/grpc-gateway/pull/807) ([drigz](https://github.com/drigz)) +- fix bug: the resource name of custom method doesn't be retained [\#805](https://github.com/grpc-ecosystem/grpc-gateway/pull/805) ([ch3rub1m](https://github.com/ch3rub1m)) +- Update rules\_go and gazelle [\#802](https://github.com/grpc-ecosystem/grpc-gateway/pull/802) ([drigz](https://github.com/drigz)) +- Use newer Bazel repo rules [\#798](https://github.com/grpc-ecosystem/grpc-gateway/pull/798) ([drigz](https://github.com/drigz)) +- Run buildifer on Bazel files [\#797](https://github.com/grpc-ecosystem/grpc-gateway/pull/797) ([drigz](https://github.com/drigz)) +- protoc-gen-swagger: Fix formatting of license field definition. [\#796](https://github.com/grpc-ecosystem/grpc-gateway/pull/796) ([ivucica](https://github.com/ivucica)) +- Remove http.CloseNotifier code from Go \>= 1.7 builds [\#795](https://github.com/grpc-ecosystem/grpc-gateway/pull/795) ([SpikesDivZero](https://github.com/SpikesDivZero)) +- ci: add job for building binaries for releases [\#793](https://github.com/grpc-ecosystem/grpc-gateway/pull/793) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Add documentation to the rest of methods on the examples [\#791](https://github.com/grpc-ecosystem/grpc-gateway/pull/791) ([rvegas](https://github.com/rvegas)) +- fix \#782 Cannot return HTTP header using "Grpc-Metadata-" prefix [\#784](https://github.com/grpc-ecosystem/grpc-gateway/pull/784) ([joelclouddistrict](https://github.com/joelclouddistrict)) +- Fix CircleCI configuration [\#777](https://github.com/grpc-ecosystem/grpc-gateway/pull/777) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- tests: s/iotuil/ioutil/ typo [\#775](https://github.com/grpc-ecosystem/grpc-gateway/pull/775) ([srenatus](https://github.com/srenatus)) +- Replace travis with CircleCI for easier testing [\#772](https://github.com/grpc-ecosystem/grpc-gateway/pull/772) ([johanbrandhorst](https://github.com/johanbrandhorst)) + +## [v1.5.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.5.1) (2018-10-02) [Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.5.0...v1.5.1) **Implemented enhancements:** @@ -21,9 +69,12 @@ - How to write tests for the gateway? [\#699](https://github.com/grpc-ecosystem/grpc-gateway/issues/699) - protoc-gen-swagger: No comments for path parameters [\#694](https://github.com/grpc-ecosystem/grpc-gateway/issues/694) - Can you differentiate between an empty map vs field not provided? [\#552](https://github.com/grpc-ecosystem/grpc-gateway/issues/552) +- import\_path option not working as intended [\#536](https://github.com/grpc-ecosystem/grpc-gateway/issues/536) **Merged pull requests:** +- Add default value for swagger 200 response [\#767](https://github.com/grpc-ecosystem/grpc-gateway/pull/767) ([johnchildren](https://github.com/johnchildren)) +- Generate changelog for release v1.5.1 [\#764](https://github.com/grpc-ecosystem/grpc-gateway/pull/764) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Revert \#708 since it breaks backwards compatibility [\#761](https://github.com/grpc-ecosystem/grpc-gateway/pull/761) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Update README.md [\#757](https://github.com/grpc-ecosystem/grpc-gateway/pull/757) ([wora](https://github.com/wora)) - Added camelCase Example [\#751](https://github.com/grpc-ecosystem/grpc-gateway/pull/751) ([srikrsna](https://github.com/srikrsna)) @@ -44,7 +95,6 @@ - autoregister all provided services [\#732](https://github.com/grpc-ecosystem/grpc-gateway/issues/732) - `go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway` fails on clean environment [\#731](https://github.com/grpc-ecosystem/grpc-gateway/issues/731) - format tool [\#729](https://github.com/grpc-ecosystem/grpc-gateway/issues/729) -- Client grabbing errors [\#728](https://github.com/grpc-ecosystem/grpc-gateway/issues/728) - how to do tls auth in grpc+grpc-gateway [\#727](https://github.com/grpc-ecosystem/grpc-gateway/issues/727) - Let service choose it's own marshaller [\#725](https://github.com/grpc-ecosystem/grpc-gateway/issues/725) - why gateway proxy can not distribute the http request to local server? prompt 404 [\#722](https://github.com/grpc-ecosystem/grpc-gateway/issues/722) @@ -210,7 +260,7 @@ - properly respect file flag for protoc-gen-swagger [\#293](https://github.com/grpc-ecosystem/grpc-gateway/pull/293) ([tmc](https://github.com/tmc)) ## [v1.3.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3.1) (2017-12-23) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3.1) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.1) **Implemented enhancements:** @@ -251,7 +301,7 @@ - swagger: Unclear comments' parser behaviour [\#352](https://github.com/grpc-ecosystem/grpc-gateway/issues/352) - Support semicolon syntax in go\_package protobuf option [\#341](https://github.com/grpc-ecosystem/grpc-gateway/issues/341) - Add SOAP proxy [\#339](https://github.com/grpc-ecosystem/grpc-gateway/issues/339) -- Support combination of query params and body for POSTs [\#234](https://github.com/grpc-ecosystem/grpc-gateway/issues/234) +- Support combination of query params and body for POSTs with body: "\*" [\#234](https://github.com/grpc-ecosystem/grpc-gateway/issues/234) - Interceptor [\#221](https://github.com/grpc-ecosystem/grpc-gateway/issues/221) **Merged pull requests:** @@ -267,11 +317,11 @@ - grpc-gateway/generator: respect full package [\#462](https://github.com/grpc-ecosystem/grpc-gateway/pull/462) ([glerchundi](https://github.com/glerchundi)) - Add proto marshaller for proto-over-http [\#459](https://github.com/grpc-ecosystem/grpc-gateway/pull/459) ([MatthewDolan](https://github.com/MatthewDolan)) -## [v1.3.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.0) - ## [v1.3](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3) + +## [v1.3.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3.0) **Closed issues:** @@ -685,4 +735,4 @@ -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/Makefile b/Makefile index 865058628ef..d7eb8fa9781 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://grpc-ecosystem.github.io/grpc-gateway \ --unreleased-label "**Next release**" \ - --future-release=v1.5.1 + --future-release=v1.6.0 lint: golint --set_exit_status $(PKG)/runtime golint --set_exit_status $(PKG)/utilities/... From d4828b21ecb1b8054281b01b3c1027b75cc7349b Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 7 Dec 2018 20:25:40 +0000 Subject: [PATCH 322/552] Check out code before calling ghr --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b4189cd4638..7e0e657f5af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -148,6 +148,7 @@ jobs: steps: - attach_workspace: at: ./release + - checkout - run: name: "Publish Release on GitHub" command: | From 41883ac5a07ce749a8a0c9df6a6d29ed1a4ada0d Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 7 Dec 2018 21:24:57 +0000 Subject: [PATCH 323/552] Write version to intermediate file for release publish --- .circleci/config.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7e0e657f5af..b1fe018b1bd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,6 +76,17 @@ jobs: command: 'bazel run //:buildifier_check || (echo "ERROR: Bazel files not formatted, please run \`bazel run :buildifier\`" >&2; exit 1)' when: always + write_release_version: + docker: + - image: docker:git + working_directory: /src + steps: + - checkout + - run: git describe --tags --abbrev=0 > VERSION + - persist_to_workspace: + root: ./ + paths: + - VERSION build_linux_release: docker: - image: jfbrandhorst/grpc-gateway-build-env @@ -147,13 +158,12 @@ jobs: - image: cibuilds/github:0.10 steps: - attach_workspace: - at: ./release - - checkout + at: /workspace - run: name: "Publish Release on GitHub" command: | - VERSION=$(git describe --tags --abbrev=0) - ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} ./release/ + VERSION=$(cat /workspace/VERSION) + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} /workspace/release/ workflows: version: 2 all: @@ -164,6 +174,12 @@ workflows: - generate - lint - bazel + - write_release_version: + filters: + branches: + ignore: /.*/ + tags: + only: /^v\d+\.\d+\.\d+$/ - build_linux_release: filters: branches: @@ -184,6 +200,7 @@ workflows: only: /^v\d+\.\d+\.\d+$/ - publish_github_release: requires: + - write_release_version - build_linux_release - build_darwin_release - build_windows_release From d57bb14ffabe21591a7056b27b51c9259a5d65fd Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Fri, 7 Dec 2018 17:21:11 -0700 Subject: [PATCH 324/552] Stop the publishing recursion --- .circleci/config.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b1fe018b1bd..09d050563e0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -198,14 +198,14 @@ workflows: ignore: /.*/ tags: only: /^v\d+\.\d+\.\d+$/ - - publish_github_release: - requires: - - write_release_version - - build_linux_release - - build_darwin_release - - build_windows_release - filters: - branches: - ignore: /.*/ - tags: - only: /^v\d+\.\d+\.\d+$/ +# - publish_github_release: +# requires: +# - write_release_version +# - build_linux_release +# - build_darwin_release +# - build_windows_release +# filters: +# branches: +# ignore: /.*/ +# tags: +# only: /^v\d+\.\d+\.\d+$/ From 8a1a32a2930620d05a51708e66707d608eba8a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Br=C3=BCderl?= Date: Thu, 8 Nov 2018 16:51:33 +0100 Subject: [PATCH 325/552] Swagger-gen: Major overhaul of well-known-type handling - swaggerSchemaObject.Properties is now optional (pointer), because google.protobuf.Empty requires us to set Properties{} instead of nil, because this equals in Swagger to an empty JSON object (which is exactly what Empty represents and how the gateway treats it). If it's not a pointer, we can't distinguish between "not set" (in most cases, we don't want Properties to be set, instead usually just .Ref is set), and "set to an empty value e.g. Properties{} with length 0). We don't want Properties{} to occur except for specific cases, e.g. for Empty. - Wrappers and Empty are not rendered as definitions, now also for RPC Method input/output. instead, all necessary schema information is provided "in-line" via schema.type and schema.properties. - Empty is now omitted as well if it's input/output of a RPC Method. --- Makefile | 1 - examples/clients/abe/BUILD.bazel | 1 - .../abe/a_bit_of_everything_service_api.go | 60 +-- .../abe/camel_case_service_name_api.go | 6 +- .../abe/examplepb_a_bit_of_everything.go | 2 +- examples/clients/abe/protobuf_empty.go | 15 - .../a_bit_of_everything.swagger.json | 29 +- examples/proto/examplepb/wrappers.pb.go | 404 +++++++++++++++-- examples/proto/examplepb/wrappers.pb.gw.go | 412 ++++++++++++++++++ examples/proto/examplepb/wrappers.proto | 62 +++ .../proto/examplepb/wrappers.swagger.json | 276 ++++++++++++ protoc-gen-swagger/genswagger/template.go | 92 ++-- protoc-gen-swagger/genswagger/types.go | 4 +- 13 files changed, 1232 insertions(+), 132 deletions(-) delete mode 100644 examples/clients/abe/protobuf_empty.go diff --git a/Makefile b/Makefile index d7eb8fa9781..b2d6722d2c7 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,6 @@ ABE_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/abe/a_bit_of_everything_nested.go \ $(EXAMPLE_CLIENT_DIR)/abe/examplepb_body.go \ $(EXAMPLE_CLIENT_DIR)/abe/examplepb_numeric_enum.go \ $(EXAMPLE_CLIENT_DIR)/abe/nested_deep_enum.go \ - $(EXAMPLE_CLIENT_DIR)/abe/protobuf_empty.go \ $(EXAMPLE_CLIENT_DIR)/abe/sub_string_message.go UNANNOTATED_ECHO_EXAMPLE_SPEC=examples/proto/examplepb/unannotated_echo_service.swagger.json UNANNOTATED_ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/unannotatedecho/api_client.go \ diff --git a/examples/clients/abe/BUILD.bazel b/examples/clients/abe/BUILD.bazel index 5df684b7f31..4d3c3546e93 100644 --- a/examples/clients/abe/BUILD.bazel +++ b/examples/clients/abe/BUILD.bazel @@ -22,7 +22,6 @@ go_library( "message_path_enum_nested_path_enum.go", "nested_deep_enum.go", "pathenum_path_enum.go", - "protobuf_empty.go", "protobuf_field_mask.go", "sub_string_message.go", ], diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 5e8d72779c3..85e864ca833 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -303,9 +303,9 @@ func (a ABitOfEverythingServiceApi) DeepPathEcho(singleNestedName string, body E * * * @param uuid - * @return *ProtobufEmpty + * @return *interface{} */ -func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) Delete(uuid string) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Delete") // create path and map variables @@ -350,7 +350,7 @@ func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIRes if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) @@ -371,9 +371,9 @@ func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIRes /** * * - * @return *ProtobufEmpty + * @return *interface{} */ -func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables @@ -422,7 +422,7 @@ func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*ProtobufEmpty, *APIResp if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) @@ -445,9 +445,9 @@ func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*ProtobufEmpty, *APIResp * * @param id * @param body - * @return *ProtobufEmpty + * @return *interface{} */ -func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body ExamplepbBody) (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body ExamplepbBody) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables @@ -499,7 +499,7 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb } // body params localVarPostBody = &body - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) @@ -547,9 +547,9 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param nonConventionalNameValue * @param timestampValue * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @return *ProtobufEmpty + * @return *interface{} */ -func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables @@ -616,7 +616,7 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName strin if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) @@ -817,9 +817,9 @@ func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEveryth * * @param abeUuid * @param body - * @return *ProtobufEmpty + * @return *interface{} */ -func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, body ExamplepbUpdateV2Request) (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, body ExamplepbUpdateV2Request) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Patch") // create path and map variables @@ -871,7 +871,7 @@ func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, bod } // body params localVarPostBody = &body - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) @@ -894,9 +894,9 @@ func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, bod * * @param name * @param body - * @return *ProtobufEmpty + * @return *interface{} */ -func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body ExamplepbBody) (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body ExamplepbBody) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables @@ -948,7 +948,7 @@ func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body Examplep } // body params localVarPostBody = &body - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) @@ -969,9 +969,9 @@ func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body Examplep /** * * - * @return *ProtobufEmpty + * @return *interface{} */ -func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) Timeout() (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables @@ -1020,7 +1020,7 @@ func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, err if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) @@ -1043,9 +1043,9 @@ func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, err * * @param uuid * @param body - * @return *ProtobufEmpty + * @return *interface{} */ -func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Put") // create path and map variables @@ -1097,7 +1097,7 @@ func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEver } // body params localVarPostBody = &body - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) @@ -1120,9 +1120,9 @@ func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEver * * @param abeUuid * @param body - * @return *ProtobufEmpty + * @return *interface{} */ -func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Put") // create path and map variables @@ -1174,7 +1174,7 @@ func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitO } // body params localVarPostBody = &body - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) @@ -1197,9 +1197,9 @@ func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitO * * @param abeUuid * @param body - * @return *ProtobufEmpty + * @return *interface{} */ -func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Patch") // create path and map variables @@ -1251,7 +1251,7 @@ func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABit } // body params localVarPostBody = &body - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) diff --git a/examples/clients/abe/camel_case_service_name_api.go b/examples/clients/abe/camel_case_service_name_api.go index ff49b76851b..cb8cb48fd99 100644 --- a/examples/clients/abe/camel_case_service_name_api.go +++ b/examples/clients/abe/camel_case_service_name_api.go @@ -40,9 +40,9 @@ func NewCamelCaseServiceNameApiWithBasePath(basePath string) *CamelCaseServiceNa * Create a new ABitOfEverything * This API creates a new ABitOfEverything * - * @return *ProtobufEmpty + * @return *interface{} */ -func (a CamelCaseServiceNameApi) Empty() (*ProtobufEmpty, *APIResponse, error) { +func (a CamelCaseServiceNameApi) Empty() (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables @@ -91,7 +91,7 @@ func (a CamelCaseServiceNameApi) Empty() (*ProtobufEmpty, *APIResponse, error) { if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - var successPayload = new(ProtobufEmpty) + var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go index f413637e1ca..9701914d126 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -61,7 +61,7 @@ type ExamplepbABitOfEverything struct { RepeatedStringValue []string `json:"repeated_string_value,omitempty"` - OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"` + OneofEmpty interface{} `json:"oneof_empty,omitempty"` OneofString string `json:"oneof_string,omitempty"` diff --git a/examples/clients/abe/protobuf_empty.go b/examples/clients/abe/protobuf_empty.go deleted file mode 100644 index 97c7bf612b8..00000000000 --- a/examples/clients/abe/protobuf_empty.go +++ /dev/null @@ -1,15 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -// service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. -type ProtobufEmpty struct { -} diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index b3249e62612..227bb4eeea5 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -128,7 +128,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -636,7 +636,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -683,7 +683,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -960,7 +960,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -1006,7 +1006,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -1160,7 +1160,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -1192,7 +1192,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -1224,7 +1224,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -1272,7 +1272,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -1304,7 +1304,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -1352,7 +1352,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} } }, "403": { @@ -1521,7 +1521,7 @@ } }, "oneof_empty": { - "$ref": "#/definitions/protobufEmpty" + "properties": {} }, "oneof_string": { "type": "string" @@ -1723,11 +1723,6 @@ ], "default": "ABC" }, - "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:" - }, "protobufFieldMask": { "type": "object", "properties": { diff --git a/examples/proto/examplepb/wrappers.pb.go b/examples/proto/examplepb/wrappers.pb.go index fb44ca7aba9..0b0616ee60c 100644 --- a/examples/proto/examplepb/wrappers.pb.go +++ b/examples/proto/examplepb/wrappers.pb.go @@ -6,6 +6,7 @@ package examplepb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" +import empty "github.com/golang/protobuf/ptypes/empty" import wrappers "github.com/golang/protobuf/ptypes/wrappers" import _ "google.golang.org/genproto/googleapis/api/annotations" @@ -44,7 +45,7 @@ func (m *Wrappers) Reset() { *m = Wrappers{} } func (m *Wrappers) String() string { return proto.CompactTextString(m) } func (*Wrappers) ProtoMessage() {} func (*Wrappers) Descriptor() ([]byte, []int) { - return fileDescriptor_wrappers_5850bd48b0187754, []int{0} + return fileDescriptor_wrappers_3d2e9c7780d635b4, []int{0} } func (m *Wrappers) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Wrappers.Unmarshal(m, b) @@ -144,6 +145,16 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type WrappersServiceClient interface { Create(ctx context.Context, in *Wrappers, opts ...grpc.CallOption) (*Wrappers, error) + CreateStringValue(ctx context.Context, in *wrappers.StringValue, opts ...grpc.CallOption) (*wrappers.StringValue, error) + CreateInt32Value(ctx context.Context, in *wrappers.Int32Value, opts ...grpc.CallOption) (*wrappers.Int32Value, error) + CreateInt64Value(ctx context.Context, in *wrappers.Int64Value, opts ...grpc.CallOption) (*wrappers.Int64Value, error) + CreateFloatValue(ctx context.Context, in *wrappers.FloatValue, opts ...grpc.CallOption) (*wrappers.FloatValue, error) + CreateDoubleValue(ctx context.Context, in *wrappers.DoubleValue, opts ...grpc.CallOption) (*wrappers.DoubleValue, error) + CreateBoolValue(ctx context.Context, in *wrappers.BoolValue, opts ...grpc.CallOption) (*wrappers.BoolValue, error) + CreateUInt32Value(ctx context.Context, in *wrappers.UInt32Value, opts ...grpc.CallOption) (*wrappers.UInt32Value, error) + CreateUInt64Value(ctx context.Context, in *wrappers.UInt64Value, opts ...grpc.CallOption) (*wrappers.UInt64Value, error) + CreateBytesValue(ctx context.Context, in *wrappers.BytesValue, opts ...grpc.CallOption) (*wrappers.BytesValue, error) + CreateEmpty(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) } type wrappersServiceClient struct { @@ -163,9 +174,109 @@ func (c *wrappersServiceClient) Create(ctx context.Context, in *Wrappers, opts . return out, nil } +func (c *wrappersServiceClient) CreateStringValue(ctx context.Context, in *wrappers.StringValue, opts ...grpc.CallOption) (*wrappers.StringValue, error) { + out := new(wrappers.StringValue) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateStringValue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wrappersServiceClient) CreateInt32Value(ctx context.Context, in *wrappers.Int32Value, opts ...grpc.CallOption) (*wrappers.Int32Value, error) { + out := new(wrappers.Int32Value) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateInt32Value", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wrappersServiceClient) CreateInt64Value(ctx context.Context, in *wrappers.Int64Value, opts ...grpc.CallOption) (*wrappers.Int64Value, error) { + out := new(wrappers.Int64Value) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateInt64Value", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wrappersServiceClient) CreateFloatValue(ctx context.Context, in *wrappers.FloatValue, opts ...grpc.CallOption) (*wrappers.FloatValue, error) { + out := new(wrappers.FloatValue) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateFloatValue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wrappersServiceClient) CreateDoubleValue(ctx context.Context, in *wrappers.DoubleValue, opts ...grpc.CallOption) (*wrappers.DoubleValue, error) { + out := new(wrappers.DoubleValue) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateDoubleValue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wrappersServiceClient) CreateBoolValue(ctx context.Context, in *wrappers.BoolValue, opts ...grpc.CallOption) (*wrappers.BoolValue, error) { + out := new(wrappers.BoolValue) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateBoolValue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wrappersServiceClient) CreateUInt32Value(ctx context.Context, in *wrappers.UInt32Value, opts ...grpc.CallOption) (*wrappers.UInt32Value, error) { + out := new(wrappers.UInt32Value) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateUInt32Value", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wrappersServiceClient) CreateUInt64Value(ctx context.Context, in *wrappers.UInt64Value, opts ...grpc.CallOption) (*wrappers.UInt64Value, error) { + out := new(wrappers.UInt64Value) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateUInt64Value", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wrappersServiceClient) CreateBytesValue(ctx context.Context, in *wrappers.BytesValue, opts ...grpc.CallOption) (*wrappers.BytesValue, error) { + out := new(wrappers.BytesValue) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateBytesValue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wrappersServiceClient) CreateEmpty(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { + out := new(empty.Empty) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateEmpty", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // WrappersServiceServer is the server API for WrappersService service. type WrappersServiceServer interface { Create(context.Context, *Wrappers) (*Wrappers, error) + CreateStringValue(context.Context, *wrappers.StringValue) (*wrappers.StringValue, error) + CreateInt32Value(context.Context, *wrappers.Int32Value) (*wrappers.Int32Value, error) + CreateInt64Value(context.Context, *wrappers.Int64Value) (*wrappers.Int64Value, error) + CreateFloatValue(context.Context, *wrappers.FloatValue) (*wrappers.FloatValue, error) + CreateDoubleValue(context.Context, *wrappers.DoubleValue) (*wrappers.DoubleValue, error) + CreateBoolValue(context.Context, *wrappers.BoolValue) (*wrappers.BoolValue, error) + CreateUInt32Value(context.Context, *wrappers.UInt32Value) (*wrappers.UInt32Value, error) + CreateUInt64Value(context.Context, *wrappers.UInt64Value) (*wrappers.UInt64Value, error) + CreateBytesValue(context.Context, *wrappers.BytesValue) (*wrappers.BytesValue, error) + CreateEmpty(context.Context, *empty.Empty) (*empty.Empty, error) } func RegisterWrappersServiceServer(s *grpc.Server, srv WrappersServiceServer) { @@ -190,6 +301,186 @@ func _WrappersService_Create_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _WrappersService_CreateStringValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(wrappers.StringValue) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).CreateStringValue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateStringValue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).CreateStringValue(ctx, req.(*wrappers.StringValue)) + } + return interceptor(ctx, in, info, handler) +} + +func _WrappersService_CreateInt32Value_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(wrappers.Int32Value) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).CreateInt32Value(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateInt32Value", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).CreateInt32Value(ctx, req.(*wrappers.Int32Value)) + } + return interceptor(ctx, in, info, handler) +} + +func _WrappersService_CreateInt64Value_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(wrappers.Int64Value) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).CreateInt64Value(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateInt64Value", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).CreateInt64Value(ctx, req.(*wrappers.Int64Value)) + } + return interceptor(ctx, in, info, handler) +} + +func _WrappersService_CreateFloatValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(wrappers.FloatValue) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).CreateFloatValue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateFloatValue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).CreateFloatValue(ctx, req.(*wrappers.FloatValue)) + } + return interceptor(ctx, in, info, handler) +} + +func _WrappersService_CreateDoubleValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(wrappers.DoubleValue) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).CreateDoubleValue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateDoubleValue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).CreateDoubleValue(ctx, req.(*wrappers.DoubleValue)) + } + return interceptor(ctx, in, info, handler) +} + +func _WrappersService_CreateBoolValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(wrappers.BoolValue) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).CreateBoolValue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateBoolValue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).CreateBoolValue(ctx, req.(*wrappers.BoolValue)) + } + return interceptor(ctx, in, info, handler) +} + +func _WrappersService_CreateUInt32Value_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(wrappers.UInt32Value) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).CreateUInt32Value(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateUInt32Value", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).CreateUInt32Value(ctx, req.(*wrappers.UInt32Value)) + } + return interceptor(ctx, in, info, handler) +} + +func _WrappersService_CreateUInt64Value_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(wrappers.UInt64Value) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).CreateUInt64Value(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateUInt64Value", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).CreateUInt64Value(ctx, req.(*wrappers.UInt64Value)) + } + return interceptor(ctx, in, info, handler) +} + +func _WrappersService_CreateBytesValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(wrappers.BytesValue) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).CreateBytesValue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateBytesValue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).CreateBytesValue(ctx, req.(*wrappers.BytesValue)) + } + return interceptor(ctx, in, info, handler) +} + +func _WrappersService_CreateEmpty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(empty.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WrappersServiceServer).CreateEmpty(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateEmpty", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WrappersServiceServer).CreateEmpty(ctx, req.(*empty.Empty)) + } + return interceptor(ctx, in, info, handler) +} + var _WrappersService_serviceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.examplepb.WrappersService", HandlerType: (*WrappersServiceServer)(nil), @@ -198,39 +489,92 @@ var _WrappersService_serviceDesc = grpc.ServiceDesc{ MethodName: "Create", Handler: _WrappersService_Create_Handler, }, + { + MethodName: "CreateStringValue", + Handler: _WrappersService_CreateStringValue_Handler, + }, + { + MethodName: "CreateInt32Value", + Handler: _WrappersService_CreateInt32Value_Handler, + }, + { + MethodName: "CreateInt64Value", + Handler: _WrappersService_CreateInt64Value_Handler, + }, + { + MethodName: "CreateFloatValue", + Handler: _WrappersService_CreateFloatValue_Handler, + }, + { + MethodName: "CreateDoubleValue", + Handler: _WrappersService_CreateDoubleValue_Handler, + }, + { + MethodName: "CreateBoolValue", + Handler: _WrappersService_CreateBoolValue_Handler, + }, + { + MethodName: "CreateUInt32Value", + Handler: _WrappersService_CreateUInt32Value_Handler, + }, + { + MethodName: "CreateUInt64Value", + Handler: _WrappersService_CreateUInt64Value_Handler, + }, + { + MethodName: "CreateBytesValue", + Handler: _WrappersService_CreateBytesValue_Handler, + }, + { + MethodName: "CreateEmpty", + Handler: _WrappersService_CreateEmpty_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/proto/examplepb/wrappers.proto", } func init() { - proto.RegisterFile("examples/proto/examplepb/wrappers.proto", fileDescriptor_wrappers_5850bd48b0187754) -} - -var fileDescriptor_wrappers_5850bd48b0187754 = []byte{ - // 381 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdf, 0x4a, 0xf3, 0x30, - 0x18, 0xc6, 0xe9, 0xbe, 0x7d, 0x73, 0x4b, 0x05, 0xa1, 0x78, 0xa0, 0x75, 0x38, 0xd9, 0x89, 0x7f, - 0x0e, 0x52, 0xdc, 0xc6, 0x40, 0x11, 0x84, 0x29, 0x82, 0xa7, 0x0e, 0x15, 0x3c, 0x91, 0x64, 0xcb, - 0x4a, 0xa1, 0x36, 0x25, 0x4d, 0x37, 0x77, 0x24, 0x78, 0x09, 0x7a, 0x45, 0x5e, 0x83, 0xb7, 0xe0, - 0x85, 0x48, 0xb2, 0x37, 0xd9, 0x74, 0x54, 0x3d, 0x7b, 0xde, 0xe6, 0xf9, 0x3d, 0xe1, 0x7d, 0x48, - 0xd1, 0x2e, 0x7b, 0x24, 0x0f, 0x69, 0xcc, 0xb2, 0x20, 0x15, 0x5c, 0xf2, 0x00, 0xc6, 0x94, 0x06, - 0x13, 0x41, 0xd2, 0x94, 0x89, 0x0c, 0xeb, 0x03, 0xaf, 0x11, 0x8a, 0x74, 0x80, 0x43, 0x22, 0xd9, - 0x84, 0x4c, 0xb1, 0xa1, 0xb0, 0xf5, 0xfb, 0xf5, 0x90, 0xf3, 0x30, 0x66, 0x01, 0x49, 0xa3, 0x80, - 0x24, 0x09, 0x97, 0x44, 0x46, 0x3c, 0x01, 0xdc, 0xdf, 0x86, 0x53, 0x3d, 0xd1, 0x7c, 0xf4, 0x2d, - 0xbe, 0xf9, 0x56, 0x46, 0xd5, 0x5b, 0xf8, 0xe4, 0x9d, 0xa2, 0xd5, 0x4c, 0x8a, 0x28, 0x09, 0xef, - 0xc7, 0x24, 0xce, 0xd9, 0x86, 0xb3, 0xe3, 0xec, 0xb9, 0xad, 0x3a, 0x9e, 0x65, 0x60, 0x93, 0x81, - 0xfb, 0xda, 0x74, 0xa3, 0x3c, 0x57, 0x6e, 0x36, 0x1f, 0xbc, 0x13, 0xe4, 0x46, 0x89, 0x6c, 0xb7, - 0x80, 0x2f, 0x69, 0x7e, 0x6b, 0x89, 0xbf, 0x54, 0x9e, 0x19, 0x8e, 0x22, 0xab, 0x81, 0xee, 0x76, - 0x80, 0xfe, 0x57, 0x4c, 0x77, 0x3b, 0x73, 0x1a, 0xb4, 0xa2, 0x47, 0x31, 0x27, 0x12, 0xe8, 0x72, - 0x01, 0x7d, 0xa1, 0x3c, 0x40, 0x8f, 0xac, 0x56, 0xab, 0x0f, 0x79, 0x4e, 0x63, 0x06, 0xf8, 0xff, - 0x82, 0xd5, 0xcf, 0xb5, 0x09, 0x56, 0x1f, 0xce, 0x07, 0xef, 0x08, 0x21, 0xca, 0x79, 0x0c, 0x78, - 0x45, 0xe3, 0xfe, 0x12, 0xde, 0xe3, 0x3c, 0x9e, 0xc1, 0x35, 0x6a, 0xa4, 0xba, 0x3b, 0x5f, 0xac, - 0x6d, 0xa5, 0xe0, 0xee, 0xeb, 0x85, 0xde, 0xdc, 0x7c, 0xa1, 0x38, 0x08, 0xb0, 0xcd, 0x55, 0x7f, - 0x08, 0x30, 0xd5, 0xb9, 0xf9, 0xd7, 0xee, 0xe8, 0x54, 0xb2, 0x0c, 0xf8, 0x5a, 0x41, 0x77, 0x3d, - 0xe5, 0x81, 0xee, 0xa8, 0xd5, 0xad, 0x17, 0x07, 0xad, 0x99, 0x37, 0xd4, 0x67, 0x62, 0x1c, 0x0d, - 0x98, 0xf7, 0x84, 0x2a, 0x67, 0x82, 0x11, 0xc9, 0xbc, 0x7d, 0xfc, 0xcb, 0x0b, 0xc6, 0x86, 0xf5, - 0xff, 0x6e, 0x6d, 0x36, 0x9e, 0xdf, 0x3f, 0x5e, 0x4b, 0x9b, 0xcd, 0xf5, 0x60, 0x7c, 0x68, 0x7e, - 0x1e, 0xfb, 0xb6, 0x8f, 0x9d, 0x83, 0x9e, 0x7b, 0x57, 0xb3, 0x18, 0xad, 0xe8, 0x15, 0xda, 0x9f, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x0a, 0xc7, 0xe3, 0xe9, 0x76, 0x03, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/wrappers.proto", fileDescriptor_wrappers_3d2e9c7780d635b4) +} + +var fileDescriptor_wrappers_3d2e9c7780d635b4 = []byte{ + // 578 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0xdd, 0x6e, 0xd3, 0x30, + 0x14, 0xc7, 0xd5, 0x31, 0xca, 0xea, 0x0c, 0xc6, 0x0c, 0x82, 0xcd, 0x9b, 0x18, 0xca, 0x0d, 0xb0, + 0x8b, 0x44, 0x74, 0x55, 0x25, 0x26, 0x24, 0xa4, 0xf2, 0x21, 0x71, 0xcb, 0x34, 0x26, 0x71, 0x83, + 0xec, 0xcd, 0x8d, 0x82, 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e, 0x20, 0x0c, + 0x75, 0x3d, 0x81, 0x44, 0x7f, 0x47, 0x1b, 0x61, 0xff, 0xb6, 0x33, 0xd2, 0xda, 0xaa, 0x8f, 0xbb, + 0x3a, 0x68, 0x3e, 0x08, 0x24, 0x5e, 0xeb, 0x33, 0x9d, 0xb4, 0x7c, 0xea, 0x61, 0xc1, 0xd0, 0x24, + 0x11, 0x48, 0xec, 0xfa, 0x68, 0xad, 0x75, 0x47, 0x8d, 0xa9, 0xc2, 0xe0, 0xcc, 0x11, 0x50, 0xed, + 0xde, 0x91, 0x11, 0x95, 0x17, 0x43, 0x5b, 0xc6, 0xab, 0x1a, 0x41, 0x0c, 0x8c, 0x27, 0x01, 0x34, + 0xff, 0xa1, 0x76, 0xd9, 0xf6, 0x37, 0x9d, 0x8b, 0x92, 0x5a, 0xe7, 0x69, 0x4c, 0x2a, 0x06, 0xe7, + 0x98, 0x80, 0x6a, 0xf7, 0x3c, 0xa7, 0xb1, 0xeb, 0x85, 0x96, 0x97, 0x6b, 0x06, 0x70, 0xe4, 0x09, + 0xa8, 0x5e, 0xef, 0xb5, 0xd2, 0x0f, 0xf5, 0x03, 0x80, 0xa1, 0xd7, 0x81, 0x40, 0x62, 0xb7, 0x1f, + 0xb4, 0xa6, 0x7c, 0xce, 0x90, 0x67, 0x7c, 0xde, 0xaa, 0x7f, 0x28, 0xfc, 0xa0, 0x93, 0x45, 0x7f, + 0x27, 0x3d, 0xdf, 0xbb, 0x89, 0xf5, 0xe7, 0xe3, 0xc1, 0xe1, 0xcc, 0xfb, 0x34, 0xaa, 0xde, 0x10, + 0x36, 0xd4, 0xd8, 0xd1, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x05, 0x83, 0xaf, 0x71, 0xa0, 0x07, + 0x00, 0x00, } diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index 7e95a4c6163..703f2e604fb 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -13,6 +13,8 @@ import ( "net/http" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" + "github.com/golang/protobuf/ptypes/wrappers" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" "golang.org/x/net/context" @@ -45,6 +47,176 @@ func request_WrappersService_Create_0(ctx context.Context, marshaler runtime.Mar } +func request_WrappersService_CreateStringValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.StringValue + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateStringValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_WrappersService_CreateInt32Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.Int32Value + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateInt32Value(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_WrappersService_CreateInt64Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.Int64Value + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateInt64Value(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_WrappersService_CreateFloatValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.FloatValue + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateFloatValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_WrappersService_CreateDoubleValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.DoubleValue + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateDoubleValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_WrappersService_CreateBoolValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.BoolValue + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateBoolValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_WrappersService_CreateUInt32Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.UInt32Value + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateUInt32Value(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_WrappersService_CreateUInt64Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.UInt64Value + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateUInt64Value(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_WrappersService_CreateBytesValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.BytesValue + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateBytesValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateEmpty(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + // RegisterWrappersServiceHandlerFromEndpoint is same as RegisterWrappersServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterWrappersServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { @@ -103,13 +275,253 @@ func RegisterWrappersServiceHandlerClient(ctx context.Context, mux *runtime.Serv }) + mux.Handle("POST", pattern_WrappersService_CreateStringValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_CreateStringValue_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateStringValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateInt32Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_CreateInt32Value_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateInt32Value_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateInt64Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_CreateInt64Value_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateInt64Value_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateFloatValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_CreateFloatValue_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateFloatValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateDoubleValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_CreateDoubleValue_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateDoubleValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateBoolValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_CreateBoolValue_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateBoolValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateUInt32Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_CreateUInt32Value_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateUInt32Value_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateUInt64Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_CreateUInt64Value_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateUInt64Value_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateBytesValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_CreateBytesValue_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateBytesValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateEmpty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_WrappersService_CreateEmpty_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateEmpty_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_WrappersService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "wrappers"}, "")) + + pattern_WrappersService_CreateStringValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testString"}, "")) + + pattern_WrappersService_CreateInt32Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testInt32"}, "")) + + pattern_WrappersService_CreateInt64Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testInt64"}, "")) + + pattern_WrappersService_CreateFloatValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testFloat"}, "")) + + pattern_WrappersService_CreateDoubleValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testDouble"}, "")) + + pattern_WrappersService_CreateBoolValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testBool"}, "")) + + pattern_WrappersService_CreateUInt32Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testUint32"}, "")) + + pattern_WrappersService_CreateUInt64Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testUint64"}, "")) + + pattern_WrappersService_CreateBytesValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testBytes"}, "")) + + pattern_WrappersService_CreateEmpty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testEmpty"}, "")) ) var ( forward_WrappersService_Create_0 = runtime.ForwardResponseMessage + + forward_WrappersService_CreateStringValue_0 = runtime.ForwardResponseMessage + + forward_WrappersService_CreateInt32Value_0 = runtime.ForwardResponseMessage + + forward_WrappersService_CreateInt64Value_0 = runtime.ForwardResponseMessage + + forward_WrappersService_CreateFloatValue_0 = runtime.ForwardResponseMessage + + forward_WrappersService_CreateDoubleValue_0 = runtime.ForwardResponseMessage + + forward_WrappersService_CreateBoolValue_0 = runtime.ForwardResponseMessage + + forward_WrappersService_CreateUInt32Value_0 = runtime.ForwardResponseMessage + + forward_WrappersService_CreateUInt64Value_0 = runtime.ForwardResponseMessage + + forward_WrappersService_CreateBytesValue_0 = runtime.ForwardResponseMessage + + forward_WrappersService_CreateEmpty_0 = runtime.ForwardResponseMessage ) diff --git a/examples/proto/examplepb/wrappers.proto b/examples/proto/examplepb/wrappers.proto index b232a37fc83..46b2552a3f7 100644 --- a/examples/proto/examplepb/wrappers.proto +++ b/examples/proto/examplepb/wrappers.proto @@ -4,6 +4,7 @@ package grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; import "google/protobuf/wrappers.proto"; +import "google/protobuf/empty.proto"; message Wrappers { google.protobuf.StringValue string_value = 1; @@ -24,4 +25,65 @@ service WrappersService { body: "*" }; } + + rpc CreateStringValue(google.protobuf.StringValue) returns (google.protobuf.StringValue) { + option (google.api.http) = { + post: "/v1/testString" + body: "*" + }; + } + rpc CreateInt32Value(google.protobuf.Int32Value) returns (google.protobuf.Int32Value) { + option (google.api.http) = { + post: "/v1/testInt32" + body: "*" + }; + } + rpc CreateInt64Value(google.protobuf.Int64Value) returns (google.protobuf.Int64Value){ + option (google.api.http) = { + post: "/v1/testInt64" + body: "*" + }; + } + rpc CreateFloatValue(google.protobuf.FloatValue) returns (google.protobuf.FloatValue){ + option (google.api.http) = { + post: "/v1/testFloat" + body: "*" + }; + } + rpc CreateDoubleValue(google.protobuf.DoubleValue) returns (google.protobuf.DoubleValue){ + option (google.api.http) = { + post: "/v1/testDouble" + body: "*" + }; + } + rpc CreateBoolValue(google.protobuf.BoolValue) returns (google.protobuf.BoolValue){ + option (google.api.http) = { + post: "/v1/testBool" + body: "*" + }; + } + rpc CreateUInt32Value(google.protobuf.UInt32Value) returns (google.protobuf.UInt32Value){ + option (google.api.http) = { + post: "/v1/testUint32" + body: "*" + }; + } + rpc CreateUInt64Value(google.protobuf.UInt64Value) returns (google.protobuf.UInt64Value){ + option (google.api.http) = { + post: "/v1/testUint64" + body: "*" + }; + } + rpc CreateBytesValue(google.protobuf.BytesValue) returns (google.protobuf.BytesValue){ + option (google.api.http) = { + post: "/v1/testBytes" + body: "*" + }; + } + rpc CreateEmpty(google.protobuf.Empty) returns (google.protobuf.Empty){ + option (google.api.http) = { + post: "/v1/testEmpty" + body: "*" + }; + } } diff --git a/examples/proto/examplepb/wrappers.swagger.json b/examples/proto/examplepb/wrappers.swagger.json index 8e2df83bb20..f45b512e1c6 100644 --- a/examples/proto/examplepb/wrappers.swagger.json +++ b/examples/proto/examplepb/wrappers.swagger.json @@ -40,6 +40,282 @@ "WrappersService" ] } + }, + "/v1/testBool": { + "post": { + "operationId": "CreateBoolValue", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "boolean", + "format": "boolean" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "boolean", + "format": "boolean" + } + } + ], + "tags": [ + "WrappersService" + ] + } + }, + "/v1/testBytes": { + "post": { + "operationId": "CreateBytesValue", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "string", + "format": "byte" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "string", + "format": "byte" + } + } + ], + "tags": [ + "WrappersService" + ] + } + }, + "/v1/testDouble": { + "post": { + "operationId": "CreateDoubleValue", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "number", + "format": "double" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "number", + "format": "double" + } + } + ], + "tags": [ + "WrappersService" + ] + } + }, + "/v1/testEmpty": { + "post": { + "operationId": "CreateEmpty", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "properties": {} + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "properties": {} + } + } + ], + "tags": [ + "WrappersService" + ] + } + }, + "/v1/testFloat": { + "post": { + "operationId": "CreateFloatValue", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "number", + "format": "float" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "number", + "format": "float" + } + } + ], + "tags": [ + "WrappersService" + ] + } + }, + "/v1/testInt32": { + "post": { + "operationId": "CreateInt32Value", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "integer", + "format": "int32" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "tags": [ + "WrappersService" + ] + } + }, + "/v1/testInt64": { + "post": { + "operationId": "CreateInt64Value", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "string", + "format": "int64" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "string", + "format": "int64" + } + } + ], + "tags": [ + "WrappersService" + ] + } + }, + "/v1/testString": { + "post": { + "operationId": "CreateStringValue", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "string" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + } + ], + "tags": [ + "WrappersService" + ] + } + }, + "/v1/testUint32": { + "post": { + "operationId": "CreateUInt32Value", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "integer", + "format": "int64" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "tags": [ + "WrappersService" + ] + } + }, + "/v1/testUint64": { + "post": { + "operationId": "CreateUInt64Value", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "string", + "format": "uint64" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "string", + "format": "uint64" + } + } + ], + "tags": [ + "WrappersService" + ] + } } }, "definitions": { diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index f2f9a8e354a..930b6c78d7d 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -58,6 +58,7 @@ var wktSchemas = map[string]schemaCore{ Type: "boolean", Format: "boolean", }, + ".google.protobuf.Empty": schemaCore{}, } func listEnumNames(enum *descriptor.Enum) (names []string) { @@ -170,11 +171,15 @@ func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descripto for _, meth := range svc.Methods { // Request may be fully included in query if _, ok := refs[fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg))]; ok { - m[fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)] = meth.RequestType + if !skipRenderingRef(meth.RequestType.FQMN()) { + m[fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)] = meth.RequestType + } } findNestedMessagesAndEnumerations(meth.RequestType, reg, m, e) - m[fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)] = meth.ResponseType + if !skipRenderingRef(meth.ResponseType.FQMN()) { + m[fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)] = meth.ResponseType + } findNestedMessagesAndEnumerations(meth.ResponseType, reg, m, e) } } @@ -204,32 +209,19 @@ func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descrip } } +func skipRenderingRef(refName string) bool { + if _, ok := wktSchemas[refName]; ok { + return true + } + return false +} + func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry, customRefs refMap) { for name, msg := range messages { - switch name { - case ".google.protobuf.Timestamp": - continue - case ".google.protobuf.Duration": - continue - case ".google.protobuf.StringValue": - continue - case ".google.protobuf.BytesValue": - continue - case ".google.protobuf.Int32Value": - continue - case ".google.protobuf.UInt32Value": - continue - case ".google.protobuf.Int64Value": - continue - case ".google.protobuf.UInt64Value": - continue - case ".google.protobuf.FloatValue": - continue - case ".google.protobuf.DoubleValue": - continue - case ".google.protobuf.BoolValue": + if skipRenderingRef(name) { continue } + if opt := msg.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { continue } @@ -289,7 +281,10 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, } else { kv.Key = f.GetName() } - schema.Properties = append(schema.Properties, kv) + if schema.Properties == nil { + schema.Properties = &swaggerSchemaObjectProperties{} + } + *schema.Properties = append(*schema.Properties, kv) } d[fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)] = schema } @@ -318,16 +313,23 @@ func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) s aggregate = array } + var props *swaggerSchemaObjectProperties + switch ft := fd.GetType(); ft { case pbdescriptor.FieldDescriptorProto_TYPE_ENUM, pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE, pbdescriptor.FieldDescriptorProto_TYPE_GROUP: if wktSchema, ok := wktSchemas[fd.GetTypeName()]; ok { core = wktSchema + + if fd.GetTypeName() == ".google.protobuf.Empty" { + props = &swaggerSchemaObjectProperties{} + } } else { core = schemaCore{ Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(fd.GetTypeName(), reg), } if refs != nil { refs[fd.GetTypeName()] = struct{}{} + } } default: @@ -352,11 +354,12 @@ func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) s schemaCore: schemaCore{ Type: "object", }, - AdditionalProperties: &swaggerSchemaObject{schemaCore: core}, + AdditionalProperties: &swaggerSchemaObject{Properties: props, schemaCore: core}, } default: ret := swaggerSchemaObject{ schemaCore: core, + Properties: props, } if j, err := extractJSONSchemaFromFieldDescriptor(fd); err == nil { updateSwaggerObjectFromJSONSchema(&ret, j) @@ -657,9 +660,19 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re if len(b.Body.FieldPath) == 0 { schema = swaggerSchemaObject{ - schemaCore: schemaCore{ - Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)), - }, + schemaCore: schemaCore{}, + } + + wknSchemaCore, isWkn := wktSchemas[meth.RequestType.FQMN()] + if !isWkn { + schema.Ref = fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)) + } else { + schema.schemaCore = wknSchemaCore + + // Special workaround for Empty: it's well-known type but wknSchemas only returns schema.schemaCore; but we need to set schema.Properties which is a level higher. + if meth.RequestType.FQMN() == ".google.protobuf.Empty" { + schema.Properties = &swaggerSchemaObjectProperties{} + } } } else { lastField := b.Body.FieldPath[len(b.Body.FieldPath)-1] @@ -701,9 +714,23 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re if b.ResponseBody == nil || len(b.ResponseBody.FieldPath) == 0 { responseSchema = swaggerSchemaObject{ - schemaCore: schemaCore{ - Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)), - }, + schemaCore: schemaCore{}, + } + + // Don't link to a full definition for + // empty; it's overly verbose. + // schema.Properties{} renders it as + // well, without a definition + wknSchemaCore, isWkn := wktSchemas[meth.ResponseType.FQMN()] + if !isWkn { + responseSchema.Ref = fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)) + } else { + responseSchema.schemaCore = wknSchemaCore + + // Special workaround for Empty: it's well-known type but wknSchemas only returns schema.schemaCore; but we need to set schema.Properties which is a level higher. + if meth.ResponseType.FQMN() == ".google.protobuf.Empty" { + responseSchema.Properties = &swaggerSchemaObjectProperties{} + } } } else { // This is resolving the value of response_body in the google.api.HttpRule @@ -1498,6 +1525,7 @@ func addCustomRefs(d swaggerDefinitionsObject, reg *descriptor.Registry, refs re enumMap[fullyQualifiedNameToSwaggerName(ref, reg)] = enum continue } + // ?? Should be either enum or msg } renderMessagesAsDefinition(msgMap, d, reg, refs) diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 9d01e21d15c..b66450cdaa3 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -199,8 +199,8 @@ func (op swaggerSchemaObjectProperties) MarshalJSON() ([]byte, error) { type swaggerSchemaObject struct { schemaCore // Properties can be recursively defined - Properties swaggerSchemaObjectProperties `json:"properties,omitempty"` - AdditionalProperties *swaggerSchemaObject `json:"additionalProperties,omitempty"` + Properties *swaggerSchemaObjectProperties `json:"properties,omitempty"` + AdditionalProperties *swaggerSchemaObject `json:"additionalProperties,omitempty"` Description string `json:"description,omitempty"` Title string `json:"title,omitempty"` From 3ab55fa3032eea6a8c66df2220de2959c26066db Mon Sep 17 00:00:00 2001 From: Sam Batschelet Date: Tue, 18 Dec 2018 17:47:05 -0500 Subject: [PATCH 326/552] protoc-gen-swagger: check typeIndex when typeName is Method Signed-off-by: Sam Batschelet --- protoc-gen-swagger/genswagger/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 930b6c78d7d..e579d953dbe 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1245,7 +1245,7 @@ func isProtoPathMatches(paths []int32, outerPaths []int32, typeName string, type } if typeName == "Method" { - if paths[0] != serviceProtoPath || paths[2] != methodProtoPath { + if paths[0] != serviceProtoPath || paths[1] != typeIndex || paths[2] != methodProtoPath { return false } paths = paths[2:] From 6b3897f997b43a2627eaa9dacaf811d9ce628923 Mon Sep 17 00:00:00 2001 From: Sam Batschelet Date: Thu, 20 Dec 2018 13:00:11 -0500 Subject: [PATCH 327/552] protoc-gen-swagger: add tests for isProtoPathMatches and protoComments Signed-off-by: Sam Batschelet --- .../genswagger/template_test.go | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 5dcb33756ed..359a1b92dce 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -1019,3 +1019,145 @@ func TestSchemaOfField(t *testing.T) { } } } + +func fileFixtureServices(services []string) *descriptor.File { + var ( + svcdesc = []*protodescriptor.ServiceDescriptorProto{} + loc = []*protodescriptor.SourceCodeInfo_Location{} + msgdesc = []*protodescriptor.DescriptorProto{} + methdesc = []*protodescriptor.MethodDescriptorProto{} + msg = []*descriptor.Message{} + svc = []*descriptor.Service{} + ) + + for _, service := range services { + // loc + sc := &protodescriptor.SourceCodeInfo_Location{ + LeadingComments: proto.String(fmt.Sprintf("%s message", service)), + } + loc = append(loc, sc) + // methdesc + md := &protodescriptor.MethodDescriptorProto{ + Name: proto.String(service), + InputType: proto.String(fmt.Sprintf("%sMessage", service)), + OutputType: proto.String(fmt.Sprintf("%sMessage", service)), + } + methdesc = append(methdesc, md) + // svcdesc + sd := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String(fmt.Sprintf("%sService", service)), + Method: []*protodescriptor.MethodDescriptorProto{md}, + } + svcdesc = append(svcdesc, sd) + // msgdesc + d := &protodescriptor.DescriptorProto{ + Name: proto.String(fmt.Sprintf("%sRequest", service)), + } + msgdesc = append(msgdesc, d) + // msg + m := &descriptor.Message{ + DescriptorProto: d, + } + msg = append(msg, m) + // methods + meth := &descriptor.Method{ + MethodDescriptorProto: md, + RequestType: m, + ResponseType: m, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "POST", + Body: &descriptor.Body{FieldPath: nil}, + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: fmt.Sprintf("/v1/%s", service), + }, + }, + }, + } + s := &descriptor.Service{ + ServiceDescriptorProto: sd, + Methods: []*descriptor.Method{meth}, + } + svc = append(svc, s) + } + + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{ + Location: loc, + }, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{}, + MessageType: msgdesc, + Service: svcdesc, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example1.pb", + Name: "example_pb", + }, + Messages: msg, + Services: svc, + } + return &file +} + +func TestIsProtoPathMatches(t *testing.T) { + for _, test := range []struct { + path []int32 + outerPaths []int32 + typeName string + typeIndex int32 + fieldPaths []int32 + want bool + }{ + {[]int32{6, 0, 2, 0}, []int32{}, "Method", 1, []int32{2, 0}, false}, + {[]int32{6, 0, 2, 0, 1}, []int32{}, "Method", 1, []int32{2, 0}, false}, + {[]int32{6, 0, 2, 0}, []int32{}, "Method", 0, []int32{2, 0}, true}, + {[]int32{}, []int32{}, "Package", 2, []int32{}, false}, + {[]int32{2}, []int32{}, "Package", 3, []int32{}, false}, + {[]int32{2}, []int32{}, "Package", 2, []int32{}, true}, + {[]int32{4, 0}, []int32{}, "MessageType", 1, []int32{}, false}, + {[]int32{4, 0, 2, 0}, []int32{}, "MessageType", 0, []int32{4, 0}, false}, + } { + got := isProtoPathMatches(test.path, test.outerPaths, test.typeName, test.typeIndex, test.fieldPaths) + if got != test.want { + t.Errorf("isProtoPathMatches(%v) got (%t) want %t", test, got, test.want) + } + } +} + +func TestProtoComments(t *testing.T) { + for _, test := range []struct { + services []string + startPath []int32 + outers []string + typeName string + typeIndex int32 + fieldPaths []int32 + want string + }{ + {[]string{"Foo", "Bar"}, []int32{6, 0, 2, 0}, []string{}, "Method", 0, []int32{2, 0}, "Foo message"}, + {[]string{"Foo", "Bar"}, []int32{6, 0, 2, 0}, []string{}, "Method", 1, []int32{2, 0}, "Bar message"}, + {[]string{"Foo", "Bar"}, []int32{6, 0, 2, 0}, []string{}, "Method", 2, []int32{2, 0}, ""}, + {[]string{"Foo", "Bar"}, []int32{4, 0, 1}, []string{}, "Method", 0, []int32{2, 0}, ""}, + {[]string{"Foo", "Bar"}, []int32{6, 0, 1, 1}, []string{}, "Method", 0, []int32{2, 0}, ""}, + {[]string{"Foo", "Bar", "Baz"}, []int32{6, 0, 2, 0}, []string{}, "Method", 2, []int32{2, 0}, "Baz message"}, + } { + file := fileFixtureServices(test.services) + for i, loc := range file.SourceCodeInfo.Location { + test.startPath[1] = int32(i) + loc.Path = append(loc.Path, test.startPath...) + } + reg := descriptor.NewRegistry() + reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}, + }) + got := protoComments(reg, file, test.outers, test.typeName, test.typeIndex, test.fieldPaths...) + if got != test.want { + t.Errorf("protoComments(%v) got (%s) want %s", test, got, test.want) + } + } +} From cd6ad9591e8fe903d4b529b33625d57a6beb1173 Mon Sep 17 00:00:00 2001 From: Sam Batschelet Date: Thu, 20 Dec 2018 13:36:28 -0500 Subject: [PATCH 328/552] examples/*: regenerate files Signed-off-by: Sam Batschelet --- examples/clients/abe/camel_case_service_name_api.go | 3 +-- examples/proto/examplepb/a_bit_of_everything.swagger.json | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/examples/clients/abe/camel_case_service_name_api.go b/examples/clients/abe/camel_case_service_name_api.go index cb8cb48fd99..d761b19786c 100644 --- a/examples/clients/abe/camel_case_service_name_api.go +++ b/examples/clients/abe/camel_case_service_name_api.go @@ -37,8 +37,7 @@ func NewCamelCaseServiceNameApiWithBasePath(basePath string) *CamelCaseServiceNa } /** - * Create a new ABitOfEverything - * This API creates a new ABitOfEverything + * * * @return *interface{} */ diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 227bb4eeea5..7ca5c86992c 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -1153,8 +1153,6 @@ }, "/v2/example/empty": { "get": { - "summary": "Create a new ABitOfEverything", - "description": "This API creates a new ABitOfEverything", "operationId": "Empty", "responses": { "200": { From 7cd4c80a8efe182ffd021f3f0eea71238a934e00 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 21 Dec 2018 13:03:14 +0000 Subject: [PATCH 329/552] Include version in release builds --- protoc-gen-grpc-gateway/main.go | 14 ++++++++++++++ protoc-gen-swagger/main.go | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index a34627534ca..39ceb256fc9 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -10,6 +10,7 @@ package main import ( "flag" + "fmt" "os" "strings" @@ -31,12 +32,25 @@ var ( pathType = flag.String("paths", "", "specifies how the paths of generated files are structured") allowRepeatedFieldsInBody = flag.Bool("allow_repeated_fields_in_body", false, "allows to use repeated field in `body` and `response_body` field of `google.api.http` annotation option") repeatedPathParamSeparator = flag.String("repeated_path_param_separator", "csv", "configures how repeated fields should be split. Allowed values are `csv`, `pipes`, `ssv` and `tsv`.") + versionFlag = flag.Bool("version", false, "print the current verison") +) + +// Variables set by goreleaser at build time +var ( + version = "dev" + commit = "unknown" + date = "unknown" ) func main() { flag.Parse() defer glog.Flush() + if *versionFlag { + fmt.Printf("Version %v, commit %v, built at %v\n", version, commit, date) + os.Exit(0) + } + reg := descriptor.NewRegistry() glog.V(1).Info("Parsing code generator request") diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index 578b5c4233e..5c921f6e163 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -23,12 +23,25 @@ var ( mergeFileName = flag.String("merge_file_name", "apidocs", "target swagger file name prefix after merge") useJSONNamesForFields = flag.Bool("json_names_for_fields", false, "if it sets Field.GetJsonName() will be used for generating swagger definitions, otherwise Field.GetName() will be used") repeatedPathParamSeparator = flag.String("repeated_path_param_separator", "csv", "configures how repeated fields should be split. Allowed values are `csv`, `pipes`, `ssv` and `tsv`.") + versionFlag = flag.Bool("version", false, "print the current verison") +) + +// Variables set by goreleaser at build time +var ( + version = "dev" + commit = "unknown" + date = "unknown" ) func main() { flag.Parse() defer glog.Flush() + if *versionFlag { + fmt.Printf("Version %v, commit %v, built at %v\n", version, commit, date) + os.Exit(0) + } + reg := descriptor.NewRegistry() glog.V(1).Info("Processing code generator request") From ebda25e5d4e46e9a4d652ee501de7f691c6e93ef Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 21 Dec 2018 12:32:37 +0000 Subject: [PATCH 330/552] Replace complicated release procedure with goreleaser --- .circleci/config.yml | 117 ++----------------------------------------- .goreleaser.yml | 27 ++++++++++ 2 files changed, 31 insertions(+), 113 deletions(-) create mode 100644 .goreleaser.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 09d050563e0..68dd572a8ca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,94 +76,14 @@ jobs: command: 'bazel run //:buildifier_check || (echo "ERROR: Bazel files not formatted, please run \`bazel run :buildifier\`" >&2; exit 1)' when: always - write_release_version: - docker: - - image: docker:git - working_directory: /src - steps: - - checkout - - run: git describe --tags --abbrev=0 > VERSION - - persist_to_workspace: - root: ./ - paths: - - VERSION - build_linux_release: - docker: - - image: jfbrandhorst/grpc-gateway-build-env - working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway - environment: - CGO_ENABLED: "0" - GOOS: "linux" - GOARCH: "amd64" - steps: - - checkout - - run: mkdir -p release - - run: dep ensure --vendor-only - - run: | - VERSION=$(git describe --tags --abbrev=0) - go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-linux-x86_64 ./protoc-gen-grpc-gateway/ - - run: | - VERSION=$(git describe --tags --abbrev=0) - go build -o ./release/protoc-gen-swagger-${VERSION}-linux-x86_64 ./protoc-gen-swagger/ - - persist_to_workspace: - root: ./ - paths: - - release - build_darwin_release: - docker: - - image: jfbrandhorst/grpc-gateway-build-env - working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway - environment: - CGO_ENABLED: "0" - GOOS: "darwin" - GOARCH: "amd64" - steps: - - checkout - - run: mkdir -p release - - run: dep ensure --vendor-only - - run: | - VERSION=$(git describe --tags --abbrev=0) - go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-darwin-x86_64 ./protoc-gen-grpc-gateway/ - - run: | - VERSION=$(git describe --tags --abbrev=0) - go build -o ./release/protoc-gen-swagger-${VERSION}-darwin-x86_64 ./protoc-gen-swagger/ - - persist_to_workspace: - root: ./ - paths: - - release - build_windows_release: + release: docker: - image: jfbrandhorst/grpc-gateway-build-env working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway - environment: - CGO_ENABLED: "0" - GOOS: "windows" - GOARCH: "amd64" steps: - checkout - - run: mkdir -p release - run: dep ensure --vendor-only - - run: | - VERSION=$(git describe --tags --abbrev=0) - go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-windows-x86_64.exe ./protoc-gen-grpc-gateway/ - - run: | - VERSION=$(git describe --tags --abbrev=0) - go build -o ./release/protoc-gen-swagger-${VERSION}-windows-x86_64.exe ./protoc-gen-swagger/ - - persist_to_workspace: - root: ./ - paths: - - release - publish_github_release: - docker: - - image: cibuilds/github:0.10 - steps: - - attach_workspace: - at: /workspace - - run: - name: "Publish Release on GitHub" - command: | - VERSION=$(cat /workspace/VERSION) - ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} /workspace/release/ + - run: curl -sL https://git.io/goreleaser | bash workflows: version: 2 all: @@ -174,38 +94,9 @@ workflows: - generate - lint - bazel - - write_release_version: - filters: - branches: - ignore: /.*/ - tags: - only: /^v\d+\.\d+\.\d+$/ - - build_linux_release: - filters: - branches: - ignore: /.*/ - tags: - only: /^v\d+\.\d+\.\d+$/ - - build_windows_release: - filters: - branches: - ignore: /.*/ - tags: - only: /^v\d+\.\d+\.\d+$/ - - build_darwin_release: + - release: filters: branches: ignore: /.*/ tags: - only: /^v\d+\.\d+\.\d+$/ -# - publish_github_release: -# requires: -# - write_release_version -# - build_linux_release -# - build_darwin_release -# - build_windows_release -# filters: -# branches: -# ignore: /.*/ -# tags: -# only: /^v\d+\.\d+\.\d+$/ + only: /v[0-9]+(\.[0-9]+)*(-.*)*/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000000..28131d84ff0 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,27 @@ +builds: + - main: ./protoc-gen-grpc-gateway/main.go + binary: protoc-gen-grpc-gateway + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - main: ./protoc-gen-swagger/main.go + binary: protoc-gen-swagger + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 +archive: + name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}" + format: binary + replacements: + amd64: x86_64 +dist: _output From 969f17a7f8496bfc2dab4a966d95235d51dab6af Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 21 Dec 2018 14:38:24 +0000 Subject: [PATCH 331/552] Regenerate changelog for 1.6.3 --- CHANGELOG.md | 40 ++++++++++++++++++++++++++++++++++------ Makefile | 2 +- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6ca50f188c..19c081f8c0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,30 @@ # Change Log +## [v1.6.3](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.3) (2018-12-21) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.6.2...v1.6.3) + +**Fixed bugs:** + +- Comments of rpc method gets copied if multiple services are present in a proto file. [\#746](https://github.com/grpc-ecosystem/grpc-gateway/issues/746) + +**Closed issues:** + +- Issue with google.protobuf.Empty representation in swagger file [\#831](https://github.com/grpc-ecosystem/grpc-gateway/issues/831) + +**Merged pull requests:** + +- protoc-gen-swagger: check typeIndex when typeName is Method [\#833](https://github.com/grpc-ecosystem/grpc-gateway/pull/833) ([hexfusion](https://github.com/hexfusion)) +- Replace complicated circle CI release with goreleaser. [\#828](https://github.com/grpc-ecosystem/grpc-gateway/pull/828) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Stop the publishing recursion [\#827](https://github.com/grpc-ecosystem/grpc-gateway/pull/827) ([achew22](https://github.com/achew22)) + +## [v1.6.2](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.2) (2018-12-07) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.6.0...v1.6.2) + ## [v1.6.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.0) (2018-12-07) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.5.1...v1.6.0) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.6.1...v1.6.0) + +## [v1.6.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.1) (2018-12-07) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.5.1...v1.6.1) **Implemented enhancements:** @@ -16,6 +39,7 @@ **Closed issues:** - Please release the repo, IOReaderFactory is not available on the latest release! [\#823](https://github.com/grpc-ecosystem/grpc-gateway/issues/823) +- Bazel CI breaks frequently [\#817](https://github.com/grpc-ecosystem/grpc-gateway/issues/817) - Unable to add protobuf wrappers in url template option [\#808](https://github.com/grpc-ecosystem/grpc-gateway/issues/808) - Class 'GPBMetadata\ProtocGenSwagger\Options\Annotations' not found [\#794](https://github.com/grpc-ecosystem/grpc-gateway/issues/794) - REST gateway over RPCS? [\#789](https://github.com/grpc-ecosystem/grpc-gateway/issues/789) @@ -27,6 +51,9 @@ **Merged pull requests:** +- Write version to intermediate file for release publish [\#826](https://github.com/grpc-ecosystem/grpc-gateway/pull/826) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Check out code before calling ghr [\#825](https://github.com/grpc-ecosystem/grpc-gateway/pull/825) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Generate changelog for 1.6.0 [\#824](https://github.com/grpc-ecosystem/grpc-gateway/pull/824) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Add filegroup for options proto files [\#821](https://github.com/grpc-ecosystem/grpc-gateway/pull/821) ([kellycampbell](https://github.com/kellycampbell)) - Added support for more WKT [\#816](https://github.com/grpc-ecosystem/grpc-gateway/pull/816) ([mayankcpdixit](https://github.com/mayankcpdixit)) - Fix protobuf repository's owner name on README.md [\#814](https://github.com/grpc-ecosystem/grpc-gateway/pull/814) ([micnncim](https://github.com/micnncim)) @@ -37,6 +64,7 @@ - Make Bazel CI failures clearer [\#807](https://github.com/grpc-ecosystem/grpc-gateway/pull/807) ([drigz](https://github.com/drigz)) - fix bug: the resource name of custom method doesn't be retained [\#805](https://github.com/grpc-ecosystem/grpc-gateway/pull/805) ([ch3rub1m](https://github.com/ch3rub1m)) - Update rules\_go and gazelle [\#802](https://github.com/grpc-ecosystem/grpc-gateway/pull/802) ([drigz](https://github.com/drigz)) +- Properly omit wrappers and google.protobuf.empty from swagger definitions [\#801](https://github.com/grpc-ecosystem/grpc-gateway/pull/801) ([birdayz](https://github.com/birdayz)) - Use newer Bazel repo rules [\#798](https://github.com/grpc-ecosystem/grpc-gateway/pull/798) ([drigz](https://github.com/drigz)) - Run buildifer on Bazel files [\#797](https://github.com/grpc-ecosystem/grpc-gateway/pull/797) ([drigz](https://github.com/drigz)) - protoc-gen-swagger: Fix formatting of license field definition. [\#796](https://github.com/grpc-ecosystem/grpc-gateway/pull/796) ([ivucica](https://github.com/ivucica)) @@ -260,7 +288,7 @@ - properly respect file flag for protoc-gen-swagger [\#293](https://github.com/grpc-ecosystem/grpc-gateway/pull/293) ([tmc](https://github.com/tmc)) ## [v1.3.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3.1) (2017-12-23) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.1) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3.1) **Implemented enhancements:** @@ -317,11 +345,11 @@ - grpc-gateway/generator: respect full package [\#462](https://github.com/grpc-ecosystem/grpc-gateway/pull/462) ([glerchundi](https://github.com/glerchundi)) - Add proto marshaller for proto-over-http [\#459](https://github.com/grpc-ecosystem/grpc-gateway/pull/459) ([MatthewDolan](https://github.com/MatthewDolan)) -## [v1.3](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3) - ## [v1.3.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3.0) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.0) + +## [v1.3](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3) **Closed issues:** diff --git a/Makefile b/Makefile index b2d6722d2c7..cdc140a0c30 100644 --- a/Makefile +++ b/Makefile @@ -193,7 +193,7 @@ changelog: --compare-link \ --github-site=https://grpc-ecosystem.github.io/grpc-gateway \ --unreleased-label "**Next release**" \ - --future-release=v1.6.0 + --future-release=v1.6.3 lint: golint --set_exit_status $(PKG)/runtime golint --set_exit_status $(PKG)/utilities/... From ac69a392060eacca696e4f85f7a25e524e6c7b21 Mon Sep 17 00:00:00 2001 From: royeo Date: Wed, 26 Dec 2018 20:17:54 +0800 Subject: [PATCH 332/552] Fix the url of gRPC timeouts on README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b32b0e76213..165a620cc57 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRP * Mapping streaming APIs to newline-delimited JSON streams * Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata (prefixed with `grpcgateway-`) * Optionally emitting API definition for [Swagger](http://swagger.io). -* Setting [gRPC timeouts](http://www.grpc.io/docs/guides/wire.html) through inbound HTTP `Grpc-Timeout` header. +* Setting [gRPC timeouts](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) through inbound HTTP `Grpc-Timeout` header. * Partial support for [gRPC API Configuration]((https://cloud.google.com/endpoints/docs/grpc/grpc-service-config)) files as an alternative to annotation. ### Want to support From fb64a3c4f0cb86c0be78a1e39d070b4faee3f18c Mon Sep 17 00:00:00 2001 From: Royeo Date: Wed, 26 Dec 2018 21:35:24 +0800 Subject: [PATCH 333/552] Fix the url of gRPC timeouts on README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 165a620cc57..a780964be08 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRP * Mapping streaming APIs to newline-delimited JSON streams * Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata (prefixed with `grpcgateway-`) * Optionally emitting API definition for [Swagger](http://swagger.io). -* Setting [gRPC timeouts](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) through inbound HTTP `Grpc-Timeout` header. +* Setting [gRPC timeouts](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests) through inbound HTTP `Grpc-Timeout` header. * Partial support for [gRPC API Configuration]((https://cloud.google.com/endpoints/docs/grpc/grpc-service-config)) files as an alternative to annotation. ### Want to support From adaa5e023b8748f65ce538c4c953e8c7e4679d08 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Mon, 7 Jan 2019 16:33:36 -0700 Subject: [PATCH 334/552] Update bazel dependencies --- WORKSPACE | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 6dc67684db1..e74086a7aff 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,40 +1,38 @@ workspace(name = "grpc_ecosystem_grpc_gateway") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -# master as of 2018-11-09. This should be updated when a new release is tagged. http_archive( name = "io_bazel_rules_go", - sha256 = "c23db3b50b8822e153bc5accfea75baeecedb481a162391c4f3b9aec451e34b4", - strip_prefix = "rules_go-109c520465fcb418f2c4be967f3744d959ad66d3", - urls = [ - "https://github.com/bazelbuild/rules_go/archive/109c520465fcb418f2c4be967f3744d959ad66d3.tar.gz", - ], + sha256 = "7be7dc01f1e0afdba6c8eb2b43d2fa01c743be1b9273ab1eaf6c233df078d705", + urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.16.5/rules_go-0.16.5.tar.gz"], ) -# master as of 2018-11-09. This should be updated when a new release is tagged. http_archive( name = "bazel_gazelle", - sha256 = "a3af4a61d7b2f2c5386761f94a21f474871a32f0e94b13f08824248c4df25229", - strip_prefix = "bazel-gazelle-7b1e3c6eb5447c6647955fc93c012635f274f0f0", - urls = [ - "https://github.com/bazelbuild/bazel-gazelle/archive/7b1e3c6eb5447c6647955fc93c012635f274f0f0.tar.gz", - ], + sha256 = "7949fc6cc17b5b191103e97481cf8889217263acf52e00b560683413af204fcb", + urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"], ) -http_archive( - name = "com_github_bazelbuild_buildtools", - sha256 = "e4c83a7a5d0712e2cea2077112a5eb6bb1af75a84e34c8c9b77330e322966b8b", - strip_prefix = "buildtools-e90e7cc6ef3e6d08d4ca8a982935c3eed638e058", - url = "https://github.com/bazelbuild/buildtools/archive/e90e7cc6ef3e6d08d4ca8a982935c3eed638e058.tar.gz", -) +load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies") -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") +go_rules_dependencies() + +go_register_toolchains() + +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") gazelle_dependencies() load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies") +go_rules_dependencies() + +go_register_toolchains() + +load("@bazel_gazelle//:deps.bzl", "go_repository") + # Also define in Gopkg.toml go_repository( name = "org_golang_google_genproto", @@ -70,9 +68,11 @@ go_repository( importpath = "gopkg.in/yaml.v2", ) -go_rules_dependencies() - -go_register_toolchains() +http_archive( + name = "com_github_bazelbuild_buildtools", + strip_prefix = "buildtools-bf564b4925ab5876a3f64d8b90fab7f769013d42", + url = "https://github.com/bazelbuild/buildtools/archive/bf564b4925ab5876a3f64d8b90fab7f769013d42.zip", +) load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies") From 2e6be2a35dee8053ac10c3614522fcd5cf5627da Mon Sep 17 00:00:00 2001 From: Gorka Lerchundi Osa Date: Mon, 7 Jan 2019 22:52:55 +0100 Subject: [PATCH 335/552] gengateway: allow opting out patch feature Closes #839 --- .../gengateway/generator.go | 5 +- .../gengateway/template.go | 13 ++- .../gengateway/template_test.go | 85 ++++++++++++++++++- protoc-gen-grpc-gateway/main.go | 3 +- 4 files changed, 98 insertions(+), 8 deletions(-) diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index a619fae399e..fa1adc3470f 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -32,10 +32,11 @@ type generator struct { useRequestContext bool registerFuncSuffix string pathType pathType + allowPatchFeature bool } // New returns a new generator which generates grpc gateway files. -func New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix, pathTypeString string) gen.Generator { +func New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix, pathTypeString string, allowPatchFeature bool) gen.Generator { var imports []descriptor.GoPackage for _, pkgpath := range []string{ "io", @@ -82,6 +83,7 @@ func New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix, p useRequestContext: useRequestContext, registerFuncSuffix: registerFuncSuffix, pathType: pathType, + allowPatchFeature: allowPatchFeature, } } @@ -142,6 +144,7 @@ func (g *generator) generate(file *descriptor.File) (string, error) { Imports: imports, UseRequestContext: g.useRequestContext, RegisterFuncSuffix: g.registerFuncSuffix, + AllowPatchFeature: g.allowPatchFeature, } return applyTemplate(params, g.reg) } diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index fad1392c0c0..fd5fc1157d9 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -17,11 +17,13 @@ type param struct { Imports []descriptor.GoPackage UseRequestContext bool RegisterFuncSuffix string + AllowPatchFeature bool } type binding struct { *descriptor.Binding - Registry *descriptor.Registry + Registry *descriptor.Registry + AllowPatchFeature bool } // GetBodyFieldPath returns the binding body's fieldpath. @@ -153,7 +155,11 @@ func applyTemplate(p param, reg *descriptor.Registry) (string, error) { meth.Name = &methName for _, b := range meth.Bindings { methodWithBindingsSeen = true - if err := handlerTemplate.Execute(w, binding{Binding: b, Registry: reg}); err != nil { + if err := handlerTemplate.Execute(w, binding{ + Binding: b, + Registry: reg, + AllowPatchFeature: p.AllowPatchFeature, + }); err != nil { return "", err } } @@ -268,6 +274,7 @@ func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx cont `)) _ = template.Must(handlerTemplate.New("client-rpc-request-func").Parse(` +{{$AllowPatchFeature := .AllowPatchFeature}} {{if .HasQueryParam}} var ( filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}} = {{.QueryParamFilter}} @@ -284,7 +291,7 @@ var ( if err := marshaler.NewDecoder(newReader()).Decode(&{{.Body.AssignableExpr "protoReq"}}); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - {{- if and (eq (.HTTPMethod) "PATCH") (.FieldMaskField)}} + {{- if and $AllowPatchFeature (and (eq (.HTTPMethod) "PATCH") (.FieldMaskField))}} if protoReq.{{.FieldMaskField}} != nil && len(protoReq.{{.FieldMaskField}}.GetPaths()) > 0 { runtime.CamelCaseFieldMask(protoReq.{{.FieldMaskField}}) } {{if not (eq "*" .GetBodyFieldPath)}} else { diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index ca9e587a69d..33c28eb1586 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -77,7 +77,7 @@ func TestApplyTemplateHeader(t *testing.T) { }, }, } - got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler"}, descriptor.NewRegistry()) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -222,7 +222,7 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { }, }, } - got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler"}, descriptor.NewRegistry()) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -383,7 +383,7 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { }, }, } - got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler"}, descriptor.NewRegistry()) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -402,3 +402,82 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { } } } + +func TestAllowPatchFeature(t *testing.T) { + updateMaskDesc := &protodescriptor.FieldDescriptorProto{ + Name: proto.String("UpdateMask"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String(".google.protobuf.FieldMask"), + Number: proto.Int32(1), + } + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{updateMaskDesc}, + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Example"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + updateMaskField := &descriptor.Field{ + Message: msg, + FieldDescriptorProto: updateMaskDesc, + } + msg.Fields = append(msg.Fields, updateMaskField) + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + Name: proto.String("example.proto"), + Package: proto.String("example"), + MessageType: []*protodescriptor.DescriptorProto{msgdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "PATCH", + Body: &descriptor.Body{FieldPath: nil}, + }, + }, + }, + }, + }, + }, + } + want := "if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 {\n" + for _, allowPatchFeature := range []bool{true, false} { + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: allowPatchFeature}, descriptor.NewRegistry()) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + if allowPatchFeature { + if !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + } else { + if strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to _not_ contain %s", file, got, want) + } + } + } +} diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 39ceb256fc9..60d9de92e6b 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -32,6 +32,7 @@ var ( pathType = flag.String("paths", "", "specifies how the paths of generated files are structured") allowRepeatedFieldsInBody = flag.Bool("allow_repeated_fields_in_body", false, "allows to use repeated field in `body` and `response_body` field of `google.api.http` annotation option") repeatedPathParamSeparator = flag.String("repeated_path_param_separator", "csv", "configures how repeated fields should be split. Allowed values are `csv`, `pipes`, `ssv` and `tsv`.") + allowPatchFeature = flag.Bool("allow_patch_feature", true, "determines whether to use PATCH feature involving update masks (using google.protobuf.FieldMask).") versionFlag = flag.Bool("version", false, "print the current verison") ) @@ -79,7 +80,7 @@ func main() { } } - g := gengateway.New(reg, *useRequestContext, *registerFuncSuffix, *pathType) + g := gengateway.New(reg, *useRequestContext, *registerFuncSuffix, *pathType, *allowPatchFeature) if *grpcAPIConfiguration != "" { if err := reg.LoadGrpcAPIServiceFromYAML(*grpcAPIConfiguration); err != nil { From 6ea534d79a5f6d4dff78a994d84c0994deb92d23 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 8 Jan 2019 09:20:40 +0000 Subject: [PATCH 336/552] Generate changelog for 1.6.4 --- CHANGELOG.md | 15 +++++++++++++++ Makefile | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19c081f8c0c..605e291a65c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Change Log +## [v1.6.4](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.4) (2019-01-08) +[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.6.3...v1.6.4) + +**Closed issues:** + +- feature request: opt-out fieldmask behaviour in patch [\#839](https://github.com/grpc-ecosystem/grpc-gateway/issues/839) +- gRPC streaming keepAlive doesn't work with docker swarm [\#838](https://github.com/grpc-ecosystem/grpc-gateway/issues/838) + +**Merged pull requests:** + +- Update bazel dependencies [\#841](https://github.com/grpc-ecosystem/grpc-gateway/pull/841) ([achew22](https://github.com/achew22)) +- gengateway: allow opting out patch feature [\#840](https://github.com/grpc-ecosystem/grpc-gateway/pull/840) ([glerchundi](https://github.com/glerchundi)) +- Fix the url of gRPC timeouts on README.md [\#836](https://github.com/grpc-ecosystem/grpc-gateway/pull/836) ([royeo](https://github.com/royeo)) + ## [v1.6.3](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.3) (2018-12-21) [Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.6.2...v1.6.3) @@ -13,6 +27,7 @@ **Merged pull requests:** +- Regenerate changelog for 1.6.3 [\#835](https://github.com/grpc-ecosystem/grpc-gateway/pull/835) ([johanbrandhorst](https://github.com/johanbrandhorst)) - protoc-gen-swagger: check typeIndex when typeName is Method [\#833](https://github.com/grpc-ecosystem/grpc-gateway/pull/833) ([hexfusion](https://github.com/hexfusion)) - Replace complicated circle CI release with goreleaser. [\#828](https://github.com/grpc-ecosystem/grpc-gateway/pull/828) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Stop the publishing recursion [\#827](https://github.com/grpc-ecosystem/grpc-gateway/pull/827) ([achew22](https://github.com/achew22)) diff --git a/Makefile b/Makefile index cdc140a0c30..74f7901cfec 100644 --- a/Makefile +++ b/Makefile @@ -193,7 +193,7 @@ changelog: --compare-link \ --github-site=https://grpc-ecosystem.github.io/grpc-gateway \ --unreleased-label "**Next release**" \ - --future-release=v1.6.3 + --future-release=v1.6.4 lint: golint --set_exit_status $(PKG)/runtime golint --set_exit_status $(PKG)/utilities/... From fc2588b9447a6d04d32d37dcc7a45933d912b3ff Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 9 Jan 2019 11:03:27 +0000 Subject: [PATCH 337/552] Fix the generated URL in the changelog --- CHANGELOG.md | 71 ++++++++++++++++++++++++++-------------------------- Makefile | 2 +- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 605e291a65c..1e230f8e92d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Change Log -## [v1.6.4](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.4) (2019-01-08) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.6.3...v1.6.4) +## [v1.6.4](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.6.4) (2019-01-08) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.6.3...v1.6.4) **Closed issues:** @@ -10,12 +10,13 @@ **Merged pull requests:** +- Generate changelog for 1.6.4 [\#843](https://github.com/grpc-ecosystem/grpc-gateway/pull/843) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Update bazel dependencies [\#841](https://github.com/grpc-ecosystem/grpc-gateway/pull/841) ([achew22](https://github.com/achew22)) - gengateway: allow opting out patch feature [\#840](https://github.com/grpc-ecosystem/grpc-gateway/pull/840) ([glerchundi](https://github.com/glerchundi)) - Fix the url of gRPC timeouts on README.md [\#836](https://github.com/grpc-ecosystem/grpc-gateway/pull/836) ([royeo](https://github.com/royeo)) -## [v1.6.3](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.3) (2018-12-21) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.6.2...v1.6.3) +## [v1.6.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.6.3) (2018-12-21) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.6.2...v1.6.3) **Fixed bugs:** @@ -32,14 +33,14 @@ - Replace complicated circle CI release with goreleaser. [\#828](https://github.com/grpc-ecosystem/grpc-gateway/pull/828) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Stop the publishing recursion [\#827](https://github.com/grpc-ecosystem/grpc-gateway/pull/827) ([achew22](https://github.com/achew22)) -## [v1.6.2](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.2) (2018-12-07) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.6.0...v1.6.2) +## [v1.6.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.6.2) (2018-12-07) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.6.0...v1.6.2) -## [v1.6.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.0) (2018-12-07) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.6.1...v1.6.0) +## [v1.6.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.6.0) (2018-12-07) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.6.1...v1.6.0) -## [v1.6.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.6.1) (2018-12-07) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.5.1...v1.6.1) +## [v1.6.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.6.1) (2018-12-07) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.5.1...v1.6.1) **Implemented enhancements:** @@ -91,8 +92,8 @@ - tests: s/iotuil/ioutil/ typo [\#775](https://github.com/grpc-ecosystem/grpc-gateway/pull/775) ([srenatus](https://github.com/srenatus)) - Replace travis with CircleCI for easier testing [\#772](https://github.com/grpc-ecosystem/grpc-gateway/pull/772) ([johanbrandhorst](https://github.com/johanbrandhorst)) -## [v1.5.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.5.1) (2018-10-02) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.5.0...v1.5.1) +## [v1.5.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.5.1) (2018-10-02) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.5.0...v1.5.1) **Implemented enhancements:** @@ -123,8 +124,8 @@ - Added camelCase Example [\#751](https://github.com/grpc-ecosystem/grpc-gateway/pull/751) ([srikrsna](https://github.com/srikrsna)) - Add more guidance to issue template [\#750](https://github.com/grpc-ecosystem/grpc-gateway/pull/750) ([johanbrandhorst](https://github.com/johanbrandhorst)) -## [v1.5.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.5.0) (2018-09-09) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.4.1...v1.5.0) +## [v1.5.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.5.0) (2018-09-09) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.4.1...v1.5.0) **Fixed bugs:** @@ -189,8 +190,8 @@ - Allow explicit empty security definition to overwrite existing definitions [\#666](https://github.com/grpc-ecosystem/grpc-gateway/pull/666) ([co3k](https://github.com/co3k)) - protoc-gen-swagger: Add ability to specify custom response objects [\#663](https://github.com/grpc-ecosystem/grpc-gateway/pull/663) ([johanbrandhorst](https://github.com/johanbrandhorst)) -## [v1.4.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.4.1) (2018-05-23) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.4.0...v1.4.1) +## [v1.4.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.4.1) (2018-05-23) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.4.0...v1.4.1) **Closed issues:** @@ -201,8 +202,8 @@ - Generate release notes for v1.4.1 [\#659](https://github.com/grpc-ecosystem/grpc-gateway/pull/659) ([achew22](https://github.com/achew22)) - Translate gRPC FailedPrecondition as HTTP PreconditionFailed [\#657](https://github.com/grpc-ecosystem/grpc-gateway/pull/657) ([slomek](https://github.com/slomek)) -## [v1.4.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.4.0) (2018-05-20) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3.1...v1.4.0) +## [v1.4.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.4.0) (2018-05-20) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3.1...v1.4.0) **Implemented enhancements:** @@ -302,8 +303,8 @@ - Support mapping bytes to \[\]byte [\#489](https://github.com/grpc-ecosystem/grpc-gateway/pull/489) ([loderunner](https://github.com/loderunner)) - properly respect file flag for protoc-gen-swagger [\#293](https://github.com/grpc-ecosystem/grpc-gateway/pull/293) ([tmc](https://github.com/tmc)) -## [v1.3.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3.1) (2017-12-23) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3.1) +## [v1.3.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.1) (2017-12-23) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3.1) **Implemented enhancements:** @@ -360,11 +361,11 @@ - grpc-gateway/generator: respect full package [\#462](https://github.com/grpc-ecosystem/grpc-gateway/pull/462) ([glerchundi](https://github.com/glerchundi)) - Add proto marshaller for proto-over-http [\#459](https://github.com/grpc-ecosystem/grpc-gateway/pull/459) ([MatthewDolan](https://github.com/MatthewDolan)) -## [v1.3.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.0) +## [v1.3.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.0) -## [v1.3](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3) +## [v1.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3) **Closed issues:** @@ -433,16 +434,16 @@ - fixes package name override doesn't work [\#277](https://github.com/grpc-ecosystem/grpc-gateway/pull/277) ([favadi](https://github.com/favadi)) - add custom options to allow more control of swagger/openapi output [\#145](https://github.com/grpc-ecosystem/grpc-gateway/pull/145) ([ivucica](https://github.com/ivucica)) -## [v1.2.2](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.2.2) (2017-04-17) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.2.1...v1.2.2) +## [v1.2.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.2) (2017-04-17) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.1...v1.2.2) **Merged pull requests:** - Add changelog for 1.2.2 [\#363](https://github.com/grpc-ecosystem/grpc-gateway/pull/363) ([tmc](https://github.com/tmc)) - metadata: fix properly and change to Outgoing [\#361](https://github.com/grpc-ecosystem/grpc-gateway/pull/361) ([tmc](https://github.com/tmc)) -## [v1.2.1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.2.1) (2017-04-17) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.2.0...v1.2.1) +## [v1.2.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.1) (2017-04-17) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.0...v1.2.1) **Fixed bugs:** @@ -460,8 +461,8 @@ - Add changelog for 1.2.1 [\#360](https://github.com/grpc-ecosystem/grpc-gateway/pull/360) ([tmc](https://github.com/tmc)) - bugfix: reflect upstream api change. [\#359](https://github.com/grpc-ecosystem/grpc-gateway/pull/359) ([tmc](https://github.com/tmc)) -## [v1.2.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.2.0) (2017-03-31) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.2.0.rc1...v1.2.0) +## [v1.2.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.0) (2017-03-31) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.0.rc1...v1.2.0) **Closed issues:** @@ -472,8 +473,8 @@ - Add changelog for 1.2.0 [\#342](https://github.com/grpc-ecosystem/grpc-gateway/pull/342) ([tmc](https://github.com/tmc)) -## [v1.2.0.rc1](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.2.0.rc1) (2017-03-24) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.1.0...v1.2.0.rc1) +## [v1.2.0.rc1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.0.rc1) (2017-03-24) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.1.0...v1.2.0.rc1) **Implemented enhancements:** @@ -594,8 +595,8 @@ - Allowing unknown fields to be dropped instead of returning error from… [\#208](https://github.com/grpc-ecosystem/grpc-gateway/pull/208) ([sriniven](https://github.com/sriniven)) - Avoid Internal Server Error on zero-length input for bidi streaming [\#200](https://github.com/grpc-ecosystem/grpc-gateway/pull/200) ([yugui](https://github.com/yugui)) -## [v1.1.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.1.0) (2016-07-23) -[Full Changelog](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/compare/v1.0.0...v1.1.0) +## [v1.1.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.1.0) (2016-07-23) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.0.0...v1.1.0) **Implemented enhancements:** @@ -620,7 +621,7 @@ - send Trailer header on error [\#188](https://github.com/grpc-ecosystem/grpc-gateway/pull/188) ([kazegusuri](https://github.com/kazegusuri)) - generate swagger output for streaming endpoints with a basic note [\#183](https://github.com/grpc-ecosystem/grpc-gateway/pull/183) ([tmc](https://github.com/tmc)) -## [v1.0.0](https://grpc-ecosystem.github.io/grpc-gateway/grpc-ecosystem/grpc-gateway/tree/v1.0.0) (2016-06-15) +## [v1.0.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.0.0) (2016-06-15) **Implemented enhancements:** - support protobuf-over-HTTP [\#124](https://github.com/grpc-ecosystem/grpc-gateway/issues/124) diff --git a/Makefile b/Makefile index 74f7901cfec..23b720ad4a5 100644 --- a/Makefile +++ b/Makefile @@ -191,7 +191,7 @@ changelog: -p grpc-gateway \ --author \ --compare-link \ - --github-site=https://grpc-ecosystem.github.io/grpc-gateway \ + --github-site=https://github.com \ --unreleased-label "**Next release**" \ --future-release=v1.6.4 lint: From 53e9ebd40e48e223d92ccd10eca7de4db8cd2ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Br=C3=BCderl?= Date: Wed, 7 Nov 2018 23:52:43 +0100 Subject: [PATCH 338/552] fill example attribute of swagger schema if provided for messages --- protoc-gen-swagger/genswagger/template.go | 7 +++++++ protoc-gen-swagger/genswagger/types.go | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index e579d953dbe..09069a6900a 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -266,6 +266,9 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, if protoSchema.Description != "" { schema.Description = protoSchema.Description } + if protoSchema.Example != "" { + schema.Example = protoSchema.Example + } } for _, f := range msg.Fields { @@ -1454,6 +1457,10 @@ func swaggerSchemaFromProtoSchema(s *swagger_options.Schema, reg *descriptor.Reg ret.schemaCore = protoJSONSchemaToSwaggerSchemaCore(s.GetJsonSchema(), reg, refs) updateSwaggerObjectFromJSONSchema(&ret, s.GetJsonSchema()) + if s.Example != nil { + ret.Example = string(s.Example.Value) + } + return ret } diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index b66450cdaa3..62787d4b8c3 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -133,9 +133,10 @@ type swaggerParameterObject struct { // core part of schema, which is common to itemsObject and schemaObject. // http://swagger.io/specification/#itemsObject type schemaCore struct { - Type string `json:"type,omitempty"` - Format string `json:"format,omitempty"` - Ref string `json:"$ref,omitempty"` + Type string `json:"type,omitempty"` + Format string `json:"format,omitempty"` + Ref string `json:"$ref,omitempty"` + Example string `json:"example,omitempty"` Items *swaggerItemsObject `json:"items,omitempty"` From 7d881ebcf85fc8235a73408748dbebe5f9008ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Br=C3=BCderl?= Date: Thu, 8 Nov 2018 00:04:03 +0100 Subject: [PATCH 339/552] fix nil dereference --- protoc-gen-swagger/genswagger/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 09069a6900a..2132d880957 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1457,7 +1457,7 @@ func swaggerSchemaFromProtoSchema(s *swagger_options.Schema, reg *descriptor.Reg ret.schemaCore = protoJSONSchemaToSwaggerSchemaCore(s.GetJsonSchema(), reg, refs) updateSwaggerObjectFromJSONSchema(&ret, s.GetJsonSchema()) - if s.Example != nil { + if s != nil && s.Example != nil { ret.Example = string(s.Example.Value) } From 8d8000c31d63cafd867039313c6e403e679db035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Br=C3=BCderl?= Date: Thu, 8 Nov 2018 10:20:42 +0100 Subject: [PATCH 340/552] use json.RawMessage for property & object examples with json.RawMessage, users can supply complete json for swagger objects (i.e. for a proto Message). If it's correct json, it will be added to the output.json and rendered correctly by consuming applications (i.e. code generators or swagger-ui) Example, in proto: option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = { example: { value: '{"someKey" : "someValue", "anotherKey" : 5}'; }; }; Rendered JSON: "example": { "someKey": "someValue", "anotherKey": 5 } If we used string instead of json.RawMessage, the serializer would escape the quotes and it would be serialized as a string. This is not desirable, because the output should be in fact JSON key/value pairs. --- protoc-gen-swagger/genswagger/template.go | 6 ++++-- protoc-gen-swagger/genswagger/types.go | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 2132d880957..4f8ecd6ce94 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -9,6 +9,8 @@ import ( "strings" "sync" + "encoding/json" + "github.com/golang/protobuf/proto" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" @@ -266,7 +268,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, if protoSchema.Description != "" { schema.Description = protoSchema.Description } - if protoSchema.Example != "" { + if protoSchema.Example != nil { schema.Example = protoSchema.Example } } @@ -1458,7 +1460,7 @@ func swaggerSchemaFromProtoSchema(s *swagger_options.Schema, reg *descriptor.Reg updateSwaggerObjectFromJSONSchema(&ret, s.GetJsonSchema()) if s != nil && s.Example != nil { - ret.Example = string(s.Example.Value) + ret.Example = json.RawMessage(s.Example.Value) } return ret diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 62787d4b8c3..6125c80f314 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -133,10 +133,10 @@ type swaggerParameterObject struct { // core part of schema, which is common to itemsObject and schemaObject. // http://swagger.io/specification/#itemsObject type schemaCore struct { - Type string `json:"type,omitempty"` - Format string `json:"format,omitempty"` - Ref string `json:"$ref,omitempty"` - Example string `json:"example,omitempty"` + Type string `json:"type,omitempty"` + Format string `json:"format,omitempty"` + Ref string `json:"$ref,omitempty"` + Example json.RawMessage `json:"example,omitempty"` Items *swaggerItemsObject `json:"items,omitempty"` From 2f0faa43ea0a4d4a00773bb0bb89ade0a07374e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Br=C3=BCderl?= Date: Thu, 8 Nov 2018 10:55:26 +0100 Subject: [PATCH 341/552] goimports --- protoc-gen-swagger/genswagger/template.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 4f8ecd6ce94..d7650d57494 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1,6 +1,7 @@ package genswagger import ( + "encoding/json" "fmt" "os" "reflect" @@ -9,8 +10,6 @@ import ( "strings" "sync" - "encoding/json" - "github.com/golang/protobuf/proto" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" From 1aa455ef674eae11ea538c059f9c0ae168605b4d Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 9 Jan 2019 16:04:51 +0100 Subject: [PATCH 342/552] a_bit_of_everything.proto: add 'example' example Signed-off-by: Stephan Renatus --- .../proto/examplepb/a_bit_of_everything.pb.go | 393 +++++++++--------- .../proto/examplepb/a_bit_of_everything.proto | 1 + .../a_bit_of_everything.swagger.json | 3 + 3 files changed, 202 insertions(+), 195 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 4f29c98d99c..41f237ae881 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{0} + return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -129,7 +129,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{0} + return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -467,7 +467,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{0, 0} + return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -536,7 +536,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{1} + return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -679,7 +679,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{2} + return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -718,7 +718,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{3} + return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -765,7 +765,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_7494e8194e1b43f3, []int{4} + return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1529,191 +1529,194 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_7494e8194e1b43f3) -} - -var fileDescriptor_a_bit_of_everything_7494e8194e1b43f3 = []byte{ - // 2901 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xcd, 0x6f, 0x1b, 0xd7, - 0xb5, 0xd7, 0x70, 0xa8, 0xaf, 0xa3, 0x2f, 0xea, 0xca, 0x1f, 0x32, 0xad, 0x44, 0xd7, 0x8c, 0xf3, - 0x32, 0x51,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90, 0x05, 0x21, - 0x0e, 0x5a, 0x84, 0x89, 0x9d, 0x16, 0x23, 0x62, 0x7b, 0x97, 0xb4, 0x3c, 0x3a, 0xaf, 0x62, 0x45, - 0xcb, 0x18, 0x20, 0x5f, 0xdd, 0xf5, 0xdf, 0xa0, 0x53, 0x30, 0x59, 0x67, 0x5e, 0xb5, 0x45, 0x43, - 0x8a, 0x2c, 0x56, 0x34, 0xc5, 0x98, 0x08, 0xde, 0x05, 0x24, 0x8b, 0x30, 0x61, 0xda, 0xe2, 0xad, - 0xf3, 0x21, 0xc5, 0x30, 0x56, 0x34, 0xd5, 0x00, 0xf9, 0xaa, 0x83, 0xe1, 0xc5, 0x29, 0x46, 0xb0, - 0xa2, 0x65, 0x8d, 0x09, 0x2f, 0x46, 0x12, 0x60, 0x9c, 0x2b, 0x87, 0x14, 0xa3, 0x58, 0xd1, 0x86, - 0x25, 0xc6, 0xb9, 0x72, 0x40, 0xf0, 0x0a, 0x4c, 0xed, 0x98, 0x8f, 0x69, 0xbd, 0x03, 0x32, 0x86, - 0x15, 0x6d, 0xc4, 0x98, 0x0c, 0x5f, 0x26, 0x89, 0x3a, 0x38, 0xe3, 0x58, 0xd1, 0x46, 0x43, 0xa2, - 0x08, 0xe9, 0x25, 0x80, 0x2a, 0x63, 0xad, 0x90, 0x02, 0xb0, 0xa2, 0x8d, 0x19, 0xe3, 0xfe, 0x9b, - 0x8e, 0xb2, 0x5c, 0xb8, 0xa6, 0xdd, 0x08, 0x09, 0x26, 0xfc, 0xa8, 0x1a, 0x13, 0xc1, 0xbb, 0x8e, - 0xb2, 0xd5, 0xb6, 0xa0, 0x3c, 0xa4, 0x78, 0x09, 0x2b, 0xda, 0xa4, 0x01, 0xf2, 0x55, 0xc2, 0xe0, - 0x8e, 0x1a, 0x53, 0x58, 0xd1, 0xa6, 0x02, 0x83, 0x23, 0x2d, 0xae, 0x01, 0xf8, 0x47, 0x29, 0x24, - 0x98, 0xc6, 0x8a, 0x36, 0x5d, 0x7e, 0xf3, 0xd0, 0x70, 0x6e, 0x7a, 0x16, 0x75, 0xcd, 0xda, 0xba, - 0xed, 0x59, 0xc6, 0xb8, 0xcf, 0x1f, 0x80, 0x6d, 0xc1, 0x4c, 0xe7, 0x70, 0x86, 0x88, 0x2f, 0x4b, - 0x44, 0xad, 0x0f, 0x62, 0x74, 0xa6, 0x4b, 0x5b, 0x44, 0x34, 0x25, 0xda, 0x94, 0x13, 0x3e, 0x05, - 0x88, 0x1c, 0x8e, 0x05, 0x19, 0xb2, 0x9d, 0x06, 0x5e, 0x94, 0xc0, 0xef, 0x1e, 0x06, 0x7c, 0x23, - 0x38, 0xe5, 0x11, 0x7e, 0x98, 0x77, 0x1d, 0x71, 0x73, 0x76, 0x62, 0x1d, 0x08, 0x7d, 0x15, 0xa6, - 0x79, 0x32, 0x7e, 0x33, 0x58, 0xd1, 0x66, 0x8c, 0x29, 0x9e, 0x08, 0x60, 0x87, 0xac, 0x93, 0x0b, - 0x39, 0xac, 0x68, 0xb9, 0x88, 0x2c, 0x96, 0x75, 0x3c, 0x1e, 0x84, 0x59, 0xac, 0x68, 0xb3, 0xc6, - 0x04, 0x8f, 0x05, 0x21, 0x24, 0xe9, 0xe0, 0x20, 0xac, 0x68, 0x28, 0x20, 0x89, 0x50, 0xca, 0x70, - 0xd4, 0xa5, 0x0e, 0x25, 0xbe, 0x2b, 0x12, 0x79, 0x31, 0x87, 0x55, 0x6d, 0xdc, 0x98, 0x8b, 0x36, - 0x6f, 0xc7, 0xf2, 0xe3, 0x22, 0x4c, 0x30, 0x9b, 0xfa, 0x95, 0xdf, 0x2f, 0xbb, 0xf3, 0x47, 0x64, - 0xb5, 0x39, 0x56, 0x0a, 0x2a, 0x5d, 0x29, 0xaa, 0x74, 0xa5, 0x75, 0x7f, 0xf7, 0xea, 0x90, 0x01, - 0x92, 0x58, 0xae, 0xd0, 0x2b, 0x30, 0x19, 0xb0, 0x06, 0xb2, 0xe6, 0x8f, 0xfa, 0xd9, 0x77, 0x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53, 0xee, 0x8a, 0x4f, 0x6b, 0x80, 0x55, 0x6d, 0x32, 0xe9, 0xae, 0x95, 0x83, 0xc9, - 0xad, 0x67, 0x98, 0x3a, 0xe6, 0x4e, 0x60, 0x55, 0x9b, 0xea, 0x0e, 0x53, 0x64, 0x2d, 0x4d, 0x5b, - 0x1b, 0xab, 0xe4, 0x93, 0xcf, 0x51, 0xc9, 0x13, 0xbe, 0x39, 0x18, 0x93, 0x2e, 0xc1, 0x42, 0xca, - 0x37, 0xc9, 0xa0, 0x4c, 0x61, 0x55, 0x9b, 0x31, 0x4e, 0x24, 0xbc, 0x93, 0x18, 0xa0, 0xfa, 0x00, - 0x74, 0x92, 0x62, 0x1a, 0xab, 0x5a, 0xae, 0x17, 0x40, 0xdf, 0x64, 0x4e, 0x0c, 0x5a, 0x33, 0x58, - 0xd5, 0x66, 0x53, 0xd1, 0x89, 0x79, 0xa9, 0x27, 0x73, 0x6c, 0x94, 0x53, 0x35, 0xd4, 0xcd, 0x1c, - 0x4a, 0x2e, 0xe4, 0x21, 0xbb, 0xc2, 0xea, 0xed, 0x5e, 0x6d, 0xac, 0x70, 0x1f, 0x66, 0xc2, 0xa9, - 0xf3, 0xff, 0x4c, 0xd1, 0x94, 0x64, 0xd3, 0x90, 0x89, 0x2e, 0x66, 0x46, 0xc6, 0xf4, 0x0b, 0x47, - 0xb6, 0x4e, 0x04, 0x09, 0xeb, 0xef, 0xab, 0x87, 0x46, 0xc3, 0x07, 0x31, 0x24, 0x4b, 0xe1, 0x33, - 0x05, 0x66, 0xde, 0x77, 0xea, 0x44, 0xd0, 0xbb, 0x65, 0x83, 0x7e, 0xec, 0x51, 0x2e, 0xd0, 0x2a, - 0xa8, 0xa4, 0x1a, 0x28, 0x31, 0x51, 0x3e, 0x3b, 0x70, 0x35, 0x37, 0x7c, 0x6e, 0xf4, 0x36, 0x4c, - 0x78, 0x12, 0x57, 0xde, 0xe0, 0x43, 0xd5, 0xba, 0x67, 0x87, 0xcb, 0xfe, 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, 0x05, 0x5c, 0x67, 0xc4, 0x13, 0x4d, 0xdd, 0xff, 0xc3, 0x5c, 0xf3, 0x1b, 0x74, 0x79, - 0xb1, 0x3f, 0x91, 0x60, 0x0f, 0xa9, 0xbd, 0xf2, 0x6d, 0xc8, 0x07, 0x17, 0x0e, 0x84, 0xae, 0xb8, - 0xc4, 0x16, 0x1c, 0xfb, 0x8b, 0xd0, 0x7b, 0xb0, 0x10, 0x5e, 0x43, 0xd0, 0x5c, 0xb8, 0x29, 0x57, - 0xd1, 0xee, 0x2a, 0x0c, 0x93, 0xba, 0x65, 0xda, 0x68, 0x39, 0xc1, 0x6a, 0xd7, 0x13, 0x64, 0x32, - 0x18, 0x3e, 0x99, 0xc9, 0x85, 0xdf, 0x89, 0x76, 0x29, 0x36, 0xed, 0x1d, 0xe6, 0x5a, 0x32, 0xde, - 0xd5, 0x45, 0x98, 0x8a, 0xbb, 0x62, 0x28, 0x7d, 0x35, 0xaa, 0xbe, 0xde, 0xf7, 0x72, 0x94, 0x26, - 0x75, 0x37, 0xe0, 0xf8, 0x8d, 0x83, 0xea, 0x13, 0x3f, 0x53, 0x83, 0x9e, 0xa5, 0x7b, 0xe3, 0x9d, - 0xc8, 0x55, 0x47, 0xe4, 0x79, 0x3e, 0xf7, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x52, 0x42, 0x5e, - 0xa6, 0x8f, 0x23, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_2003bb04c40c37e3) +} + +var fileDescriptor_a_bit_of_everything_2003bb04c40c37e3 = []byte{ + // 2945 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0xcb, 0x6f, 0x1b, 0xc7, + 0xdd, 0x5a, 0x2e, 0xf5, 0xfa, 0xe9, 0x45, 0x8d, 0xfc, 0x90, 0x69, 0x25, 0x1a, 0x33, 0xce, 0x97, + 0x8d, 0x12, 0x72, 0x25, 0x4a, 0x71, 0x6c, 0x05, 0x89, 0x3f, 0xea, 0x61, 0x5b, 0xb1, 0x2d, 0xcb, + 0x6b, 0xc7, 0x5f, 0xe0, 0xcf, 0x89, 0x30, 0x24, 0x87, 0xe4, 0xda, 0xdc, 0x9d, 0xcd, 0xee, 0xac, + 0x6c, 0x7e, 0xfa, 0xd4, 0xa6, 0x2d, 0xd0, 0xa2, 0xcd, 0xa1, 0x80, 0xd3, 0x53, 0x51, 0xf4, 0xdc, + 0x43, 0xaf, 0x3d, 0xe5, 0xd0, 0x5e, 0x7a, 0xea, 0xad, 0x2d, 0x02, 0x14, 0x05, 0x7a, 0x69, 0x0b, + 0xf4, 0x2f, 0x68, 0x51, 0xb4, 0x87, 0x62, 0x67, 0x77, 0xa9, 0xdd, 0x25, 0x69, 0x99, 0x72, 0x90, + 0x8b, 0xb4, 0x33, 0xf3, 0x7b, 0xbf, 0x67, 0x08, 0x45, 0xfa, 0x84, 0x18, 0x56, 0x93, 0x3a, 0xaa, + 0x65, 0x33, 0xce, 0xd4, 0x60, 0x69, 0x95, 0x55, 0xb2, 0x5b, 0xd6, 0xf9, 0x2e, 0xab, 0xed, 0xd2, + 0x3d, 0x6a, 0xb7, 0x78, 0x43, 0x37, 0xeb, 0x05, 0x01, 0x83, 0xe6, 0xeb, 0xb6, 0x55, 0x29, 0xd4, + 0x09, 0xa7, 0x8f, 0x49, 0xab, 0x10, 0x12, 0x28, 0xb4, 0x51, 0xb3, 0x73, 0x75, 0xc6, 0xea, 0x4d, + 0xaa, 0x12, 0x4b, 0x57, 0x89, 0x69, 0x32, 0x4e, 0xb8, 0xce, 0x4c, 0xc7, 0x47, 0xcf, 0xe2, 0xe0, + 0x54, 0xac, 0xca, 0x6e, 0x4d, 0xad, 0xe9, 0xb4, 0x59, 0xdd, 0x35, 0x88, 0xf3, 0x28, 0x80, 0x38, + 0x9b, 0x84, 0xa0, 0x86, 0xc5, 0x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0x1a, 0x04, 0x74, 0xd0, 0x3c, 0x8c, + 0xd5, 0x9a, 0x8c, 0xf0, 0xdd, 0x3d, 0xd2, 0x74, 0xe9, 0xac, 0x8c, 0x25, 0x25, 0xa5, 0x81, 0xd8, + 0xba, 0xe7, 0xed, 0xa0, 0x73, 0x30, 0x5e, 0x65, 0x6e, 0xb9, 0x49, 0x03, 0x88, 0x34, 0x96, 0x14, + 0x49, 0x1b, 0xf3, 0xf7, 0x7c, 0x90, 0x79, 0x18, 0xd3, 0x4d, 0x7e, 0x61, 0x25, 0x80, 0x18, 0xc4, + 0x92, 0x22, 0x6b, 0x20, 0xb6, 0xda, 0x34, 0xdc, 0x28, 0xc4, 0x10, 0x96, 0x94, 0xb4, 0x36, 0xe6, + 0x46, 0x40, 0x7c, 0x1a, 0xcb, 0xc5, 0x00, 0x62, 0x18, 0x4b, 0xca, 0xa0, 0xa0, 0xb1, 0x5c, 0xf4, + 0x01, 0x5e, 0x81, 0x89, 0x9a, 0xfe, 0x84, 0x56, 0xdb, 0x44, 0x46, 0xb0, 0xa4, 0x0c, 0x69, 0xe3, + 0xc1, 0x66, 0x1c, 0xa8, 0x4d, 0x67, 0x14, 0x4b, 0xca, 0x70, 0x00, 0x14, 0x52, 0x7a, 0x09, 0xa0, + 0xcc, 0x58, 0x33, 0x80, 0x00, 0x2c, 0x29, 0x23, 0xda, 0xa8, 0xb7, 0xd3, 0x16, 0xd6, 0xe1, 0xb6, + 0x6e, 0xd6, 0x03, 0x80, 0x31, 0xcf, 0xab, 0xda, 0x98, 0xbf, 0xd7, 0x16, 0xb6, 0xdc, 0xe2, 0xd4, + 0x09, 0x20, 0x5e, 0xc2, 0x92, 0x32, 0xae, 0x81, 0xd8, 0x8a, 0x29, 0xdc, 0x16, 0x63, 0x02, 0x4b, + 0xca, 0x84, 0xaf, 0x70, 0x28, 0xc5, 0x75, 0x00, 0x2f, 0x95, 0x02, 0x80, 0x49, 0x2c, 0x29, 0x93, + 0xc5, 0x37, 0x8f,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c, 0xbb, 0xff, 0xfd, 0x14, + 0x4c, 0xc1, 0xe8, 0x1a, 0x71, 0xf4, 0x8a, 0x98, 0xff, 0x53, 0x23, 0x12, 0xbc, 0x14, 0xbb, 0x11, + 0x4c, 0x8d, 0xa4, 0xb2, 0xa3, 0x1f, 0xe6, 0x4b, 0x3b, 0x5b, 0xf9, 0xeb, 0xb4, 0x85, 0x53, 0xf0, + 0xa5, 0xd4, 0xbe, 0x21, 0xfc, 0x46, 0x1a, 0x91, 0x95, 0x74, 0xf1, 0x95, 0xd0, 0x87, 0x11, 0x87, + 0xab, 0x8c, 0xb8, 0xbc, 0xa1, 0x7a, 0x7f, 0x98, 0xad, 0xff, 0x1f, 0x5d, 0x9d, 0xef, 0x0d, 0xc4, + 0xd9, 0x23, 0x6a, 0xae, 0x7d, 0x13, 0xb2, 0xfe, 0x85, 0x03, 0xa1, 0xab, 0x36, 0x31, 0xb9, 0x83, + 0xbd, 0x45, 0x60, 0x3d, 0x98, 0x0b, 0xae, 0x21, 0x68, 0x26, 0x38, 0x14, 0xab, 0xf0, 0x74, 0x1d, + 0x06, 0x49, 0xd5, 0xd0, 0x4d, 0xb4, 0x1a, 0x43, 0x35, 0xab, 0x31, 0x30, 0xe1, 0x0c, 0x0f, 0x4c, + 0x77, 0xb8, 0xd7, 0x89, 0xf6, 0x28, 0xd6, 0xcd, 0x1a, 0xb3, 0x0d, 0xe1, 0xef, 0xf2, 0x3c, 0x4c, + 0x44, 0x4d, 0x31, 0x90, 0xbc, 0x1a, 0x95, 0x5f, 0xef, 0x79, 0x39, 0x4a, 0x82, 0xda, 0x5b, 0x70, + 0xfa, 0xe6, 0x61, 0xf5, 0x89, 0xe6, 0x54, 0xbf, 0xb9, 0x74, 0x7f, 0xb4, 0xed, 0xb9, 0xf2, 0x90, + 0xc8, 0xe7, 0xe5, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x2c, 0x9b, 0x2b, 0x68, 0xc5, 0x23, 0x00, + 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index e07b09789d5..ffa464680f8 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -144,6 +144,7 @@ message ABitOfEverything { url: "https://github.com/grpc-ecosystem/grpc-gateway"; description: "Find out more about ABitOfEverything"; } + example: { value: '{ "uuid": "0cf361e1-4b44-483d-a159-54dabdf7e814" }' } }; // Nested is nested type. diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 7ca5c86992c..1ca1a155d56 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -1429,6 +1429,9 @@ }, "examplepbABitOfEverything": { "type": "object", + "example": { + "uuid": "0cf361e1-4b44-483d-a159-54dabdf7e814" + }, "properties": { "single_nested": { "$ref": "#/definitions/ABitOfEverythingNested" From f0d122a6cd458bf25a23794d6079c90ebe4978a6 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Thu, 10 Jan 2019 11:29:28 +0100 Subject: [PATCH 343/552] protoc-gen-swagger/genswagger: add tests for message definitions Signed-off-by: Stephan Renatus --- .../genswagger/template_test.go | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 359a1b92dce..c63ff1adb86 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -1,6 +1,7 @@ package genswagger import ( + "encoding/json" "fmt" "reflect" "testing" @@ -8,8 +9,10 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/golang/protobuf/ptypes/any" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { @@ -1020,6 +1023,156 @@ func TestSchemaOfField(t *testing.T) { } } +func TestRenderMessagesAsDefinition(t *testing.T) { + tests := []struct { + schema swagger_options.Schema + defs swaggerDefinitionsObject + }{ + { + schema: swagger_options.Schema{}, + defs: map[string]swaggerSchemaObject{ + "Message": swaggerSchemaObject{schemaCore: schemaCore{Type: "object"}}, + }, + }, + { + schema: swagger_options.Schema{ + Example: &any.Any{ + TypeUrl: "this_isnt_used", + Value: []byte(`{"foo":"bar"}`), + }, + }, + defs: map[string]swaggerSchemaObject{ + "Message": swaggerSchemaObject{schemaCore: schemaCore{ + Type: "object", + Example: json.RawMessage(`{"foo":"bar"}`), + }}, + }, + }, + { + schema: swagger_options.Schema{ + Example: &any.Any{ + Value: []byte(`XXXX anything goes XXXX`), + }, + }, + defs: map[string]swaggerSchemaObject{ + "Message": swaggerSchemaObject{schemaCore: schemaCore{ + Type: "object", + Example: json.RawMessage(`XXXX anything goes XXXX`), + }}, + }, + }, + { + schema: swagger_options.Schema{ + ExternalDocs: &swagger_options.ExternalDocumentation{ + Description: "glorious docs", + Url: "https://nada", + }, + }, + defs: map[string]swaggerSchemaObject{ + "Message": swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "object", + }, + ExternalDocs: &swaggerExternalDocumentationObject{ + Description: "glorious docs", + URL: "https://nada", + }, + }, + }, + }, + { // JSONSchema options + schema: swagger_options.Schema{ + JsonSchema: &swagger_options.JSONSchema{ + Title: "title", + Description: "desc", + MultipleOf: 100, + Maximum: 101, + ExclusiveMaximum: true, + Minimum: 1, + ExclusiveMinimum: true, + MaxLength: 10, + MinLength: 3, + Pattern: "[a-z]+", + MaxItems: 20, + MinItems: 2, + UniqueItems: true, + MaxProperties: 33, + MinProperties: 22, + Required: []string{"req"}, + }, + }, + defs: map[string]swaggerSchemaObject{ + "Message": swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "object", + }, + Title: "title", + Description: "desc", + MultipleOf: 100, + Maximum: 101, + ExclusiveMaximum: true, + Minimum: 1, + ExclusiveMinimum: true, + MaxLength: 10, + MinLength: 3, + Pattern: "[a-z]+", + MaxItems: 20, + MinItems: 2, + UniqueItems: true, + MaxProperties: 33, + MinProperties: 22, + Required: []string{"req"}, + }, + }, + }, + } + + for _, test := range tests { + + d := &protodescriptor.DescriptorProto{ + Name: proto.String("Message"), + Options: &protodescriptor.MessageOptions{}, + } + err := proto.SetExtension(d.Options, swagger_options.E_Openapiv2Schema, &test.schema) + if err != nil { + t.Fatalf("SetExtension returned error: %v", err) + } + + reg := descriptor.NewRegistry() + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{}, + MessageType: []*protodescriptor.DescriptorProto{d}, + EnumType: []*protodescriptor.EnumDescriptorProto{}, + Service: []*protodescriptor.ServiceDescriptorProto{}, + }, + Messages: []*descriptor.Message{&descriptor.Message{DescriptorProto: d}}, + } + reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}, + }) + + msg, err := reg.LookupMsg("", ".example.Message") + if err != nil { + t.Fatalf("lookup message: %v", err) + } + + refs := make(refMap) + actual := make(swaggerDefinitionsObject) + msgMap := map[string]*descriptor.Message{ + msg.FQMN(): msg, + } + renderMessagesAsDefinition(msgMap, actual, reg, refs) + + if !reflect.DeepEqual(actual, test.defs) { + t.Errorf("Expected renderMessagesAsDefinition() to add defs %v, not %v", test.defs, actual) + } + } +} + func fileFixtureServices(services []string) *descriptor.File { var ( svcdesc = []*protodescriptor.ServiceDescriptorProto{} From 59a695bfc4ebf6ebf1a148c80bfd93a9ef04c903 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Thu, 10 Jan 2019 11:30:37 +0100 Subject: [PATCH 344/552] protoc-gen-swagger/genswagger: simplify skipRenderingRef Signed-off-by: Stephan Renatus --- protoc-gen-swagger/genswagger/template.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index d7650d57494..5c869e0f31d 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -211,10 +211,8 @@ func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descrip } func skipRenderingRef(refName string) bool { - if _, ok := wktSchemas[refName]; ok { - return true - } - return false + _, ok := wktSchemas[refName] + return ok } func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry, customRefs refMap) { From fd90abbb1b3f098b023d48d033df7c8c30ae6e66 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Thu, 10 Jan 2019 12:34:38 +0100 Subject: [PATCH 345/552] template_test: make test loop fit into the scheme used for other tests Originally, I wanted this to become a test for nested messages; but I didn't make it that far. Anyhow, I think this way of testing this is better than what I had in this PR before. Signed-off-by: Stephan Renatus --- .../genswagger/template_test.go | 179 +++++++++++------- 1 file changed, 109 insertions(+), 70 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index c63ff1adb86..b653ce51ce9 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -1024,21 +1024,34 @@ func TestSchemaOfField(t *testing.T) { } func TestRenderMessagesAsDefinition(t *testing.T) { + tests := []struct { - schema swagger_options.Schema - defs swaggerDefinitionsObject + descr string + msgDescs []*protodescriptor.DescriptorProto + schema map[string]swagger_options.Schema // per-message schema to add + defs swaggerDefinitionsObject }{ { - schema: swagger_options.Schema{}, + descr: "no swagger options", + msgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{Name: proto.String("Message")}, + }, + schema: map[string]swagger_options.Schema{}, defs: map[string]swaggerSchemaObject{ "Message": swaggerSchemaObject{schemaCore: schemaCore{Type: "object"}}, }, }, { - schema: swagger_options.Schema{ - Example: &any.Any{ - TypeUrl: "this_isnt_used", - Value: []byte(`{"foo":"bar"}`), + descr: "example option", + msgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{Name: proto.String("Message")}, + }, + schema: map[string]swagger_options.Schema{ + "Message": swagger_options.Schema{ + Example: &any.Any{ + TypeUrl: "this_isnt_used", + Value: []byte(`{"foo":"bar"}`), + }, }, }, defs: map[string]swaggerSchemaObject{ @@ -1049,9 +1062,15 @@ func TestRenderMessagesAsDefinition(t *testing.T) { }, }, { - schema: swagger_options.Schema{ - Example: &any.Any{ - Value: []byte(`XXXX anything goes XXXX`), + descr: "example option with something non-json", + msgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{Name: proto.String("Message")}, + }, + schema: map[string]swagger_options.Schema{ + "Message": swagger_options.Schema{ + Example: &any.Any{ + Value: []byte(`XXXX anything goes XXXX`), + }, }, }, defs: map[string]swaggerSchemaObject{ @@ -1062,10 +1081,16 @@ func TestRenderMessagesAsDefinition(t *testing.T) { }, }, { - schema: swagger_options.Schema{ - ExternalDocs: &swagger_options.ExternalDocumentation{ - Description: "glorious docs", - Url: "https://nada", + descr: "external docs option", + msgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{Name: proto.String("Message")}, + }, + schema: map[string]swagger_options.Schema{ + "Message": swagger_options.Schema{ + ExternalDocs: &swagger_options.ExternalDocumentation{ + Description: "glorious docs", + Url: "https://nada", + }, }, }, defs: map[string]swaggerSchemaObject{ @@ -1080,25 +1105,31 @@ func TestRenderMessagesAsDefinition(t *testing.T) { }, }, }, - { // JSONSchema options - schema: swagger_options.Schema{ - JsonSchema: &swagger_options.JSONSchema{ - Title: "title", - Description: "desc", - MultipleOf: 100, - Maximum: 101, - ExclusiveMaximum: true, - Minimum: 1, - ExclusiveMinimum: true, - MaxLength: 10, - MinLength: 3, - Pattern: "[a-z]+", - MaxItems: 20, - MinItems: 2, - UniqueItems: true, - MaxProperties: 33, - MinProperties: 22, - Required: []string{"req"}, + { + descr: "JSONSchema options", + msgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{Name: proto.String("Message")}, + }, + schema: map[string]swagger_options.Schema{ + "Message": swagger_options.Schema{ + JsonSchema: &swagger_options.JSONSchema{ + Title: "title", + Description: "desc", + MultipleOf: 100, + Maximum: 101, + ExclusiveMaximum: true, + Minimum: 1, + ExclusiveMinimum: true, + MaxLength: 10, + MinLength: 3, + Pattern: "[a-z]+", + MaxItems: 20, + MinItems: 2, + UniqueItems: true, + MaxProperties: 33, + MinProperties: 22, + Required: []string{"req"}, + }, }, }, defs: map[string]swaggerSchemaObject{ @@ -1128,48 +1159,56 @@ func TestRenderMessagesAsDefinition(t *testing.T) { } for _, test := range tests { + t.Run(test.descr, func(t *testing.T) { - d := &protodescriptor.DescriptorProto{ - Name: proto.String("Message"), - Options: &protodescriptor.MessageOptions{}, - } - err := proto.SetExtension(d.Options, swagger_options.E_Openapiv2Schema, &test.schema) - if err != nil { - t.Fatalf("SetExtension returned error: %v", err) - } + msgs := []*descriptor.Message{} + for _, msgdesc := range test.msgDescs { + msgdesc.Options = &protodescriptor.MessageOptions{} + msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) + } - reg := descriptor.NewRegistry() - file := descriptor.File{ - FileDescriptorProto: &protodescriptor.FileDescriptorProto{ - SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, - Name: proto.String("example.proto"), - Package: proto.String("example"), - Dependency: []string{}, - MessageType: []*protodescriptor.DescriptorProto{d}, - EnumType: []*protodescriptor.EnumDescriptorProto{}, - Service: []*protodescriptor.ServiceDescriptorProto{}, - }, - Messages: []*descriptor.Message{&descriptor.Message{DescriptorProto: d}}, - } - reg.Load(&plugin.CodeGeneratorRequest{ - ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}, - }) + reg := descriptor.NewRegistry() + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{}, + MessageType: test.msgDescs, + EnumType: []*protodescriptor.EnumDescriptorProto{}, + Service: []*protodescriptor.ServiceDescriptorProto{}, + }, + Messages: msgs, + } + reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}, + }) - msg, err := reg.LookupMsg("", ".example.Message") - if err != nil { - t.Fatalf("lookup message: %v", err) - } + msgMap := map[string]*descriptor.Message{} + for _, d := range test.msgDescs { + name := d.GetName() + msg, err := reg.LookupMsg("example", name) + if err != nil { + t.Fatalf("lookup message %v: %v", name, err) + } + msgMap[msg.FQMN()] = msg - refs := make(refMap) - actual := make(swaggerDefinitionsObject) - msgMap := map[string]*descriptor.Message{ - msg.FQMN(): msg, - } - renderMessagesAsDefinition(msgMap, actual, reg, refs) + if schema, ok := test.schema[name]; ok { + err := proto.SetExtension(d.Options, swagger_options.E_Openapiv2Schema, &schema) + if err != nil { + t.Fatalf("SetExtension(%s, ...) returned error: %v", msg, err) + } + } + } - if !reflect.DeepEqual(actual, test.defs) { - t.Errorf("Expected renderMessagesAsDefinition() to add defs %v, not %v", test.defs, actual) - } + refs := make(refMap) + actual := make(swaggerDefinitionsObject) + renderMessagesAsDefinition(msgMap, actual, reg, refs) + + if !reflect.DeepEqual(actual, test.defs) { + t.Errorf("Expected renderMessagesAsDefinition() to add defs %+v, not %+v", test.defs, actual) + } + }) } } From 2a6ed03bcb1ef81a13e111110c8371ef1fbe4d1d Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Thu, 10 Jan 2019 12:38:25 +0100 Subject: [PATCH 346/552] examples/a_bit_of_everything: add nested msg example Signed-off-by: Stephan Renatus --- .../proto/examplepb/a_bit_of_everything.pb.go | 391 +++++++++--------- .../proto/examplepb/a_bit_of_everything.proto | 3 + .../a_bit_of_everything.swagger.json | 3 + 3 files changed, 202 insertions(+), 195 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 41f237ae881..3b5727f2db2 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{0} + return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -129,7 +129,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{0} + return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -467,7 +467,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{0, 0} + return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -536,7 +536,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{1} + return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -679,7 +679,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{2} + return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -718,7 +718,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{3} + return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -765,7 +765,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_2003bb04c40c37e3, []int{4} + return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1529,194 +1529,195 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_2003bb04c40c37e3) + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_11870f281dcdb894) } -var fileDescriptor_a_bit_of_everything_2003bb04c40c37e3 = []byte{ - // 2945 bytes of a gzipped FileDescriptorProto +var fileDescriptor_a_bit_of_everything_11870f281dcdb894 = []byte{ + // 2964 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0xcb, 0x6f, 0x1b, 0xc7, - 0xdd, 0x5a, 0x2e, 0xf5, 0xfa, 0xe9, 0x45, 0x8d, 0xfc, 0x90, 0x69, 0x25, 0x1a, 0x33, 0xce, 0x97, - 0x8d, 0x12, 0x72, 0x25, 0x4a, 0x71, 0x6c, 0x05, 0x89, 0x3f, 0xea, 0x61, 0x5b, 0xb1, 0x2d, 0xcb, - 0x6b, 0xc7, 0x5f, 0xe0, 0xcf, 0x89, 0x30, 0x24, 0x87, 0xe4, 0xda, 0xdc, 0x9d, 0xcd, 0xee, 0xac, - 0x6c, 0x7e, 0xfa, 0xd4, 0xa6, 0x2d, 0xd0, 0xa2, 0xcd, 0xa1, 0x80, 0xd3, 0x53, 0x51, 0xf4, 0xdc, - 0x43, 0xaf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0x7e, 0xef, 0x28, 0xc2, 0x37, 0xfd, 0x2c, 0x0f, 0xe9, - 0x07, 0x71, 0xd7, 0x66, 0x37, 0x63, 0xc6, 0xd6, 0x3e, 0xd3, 0x57, 0x61, 0xd2, 0x89, 0xfb, 0x6f, - 0x0a, 0x4b, 0xca, 0x94, 0x36, 0xe1, 0xc4, 0x1c, 0xd8, 0x06, 0x6b, 0xc7, 0x42, 0x06, 0x4b, 0x4a, - 0x26, 0x04, 0x8b, 0x44, 0x9d, 0x13, 0x75, 0xc2, 0x34, 0x96, 0x94, 0x69, 0x6d, 0xcc, 0x89, 0x38, - 0x21, 0x00, 0x69, 0xd3, 0x41, 0x58, 0x52, 0x90, 0x0f, 0x12, 0x52, 0x29, 0xc2, 0x49, 0x9b, 0x5a, - 0x94, 0x78, 0xa6, 0x88, 0xc5, 0xc5, 0x0c, 0x96, 0x95, 0x51, 0x6d, 0x26, 0x3c, 0xbc, 0x13, 0x89, - 0x8f, 0x4b, 0x30, 0xc6, 0x4c, 0xea, 0x55, 0x7e, 0xaf, 0xec, 0xce, 0x9e, 0x10, 0xd5, 0xe6, 0x54, - 0xc1, 0xaf, 0x74, 0x85, 0xb0, 0xd2, 0x15, 0x36, 0xbd, 0xd3, 0x6b, 0x03, 0x1a, 0x08, 0x60, 0xb1, - 0x42, 0xaf, 0xc0, 0xb8, 0x8f, 0xea, 0xf3, 0x9a, 0x3d, 0xe9, 0x45, 0xdf, 0xb5, 0x01, 0xcd, 0x27, - 0xe8, 0x33, 0x41, 0x0f, 0x60, 0xd4, 0x20, 0x56, 0x20, 0xc7, 0x29, 0x51, 0x09, 0x2e, 0xf7, 0x5f, - 0x09, 0x6e, 0x12, 0x4b, 0x88, 0xbb, 0x69, 0x72, 0xbb, 0xa5, 0x8d, 0x18, 0xc1, 0x12, 0x3d, 0x81, - 0x19, 0x83, 0x58, 0x56, 0x52, 0xdf, 0xd3, 0x82, 0xcf, 0xb5, 0x63, 0xf1, 0xb1, 0x62, 0xf6, 0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5c, 0xd1, 0x19, 0x0f, 0xb0, 0xac, 0x8c, 0xc7, 0xcd, 0xb5, 0x76, 0x38, 0xef, 0x75, 0x75, - 0x53, 0x5b, 0xdd, 0x31, 0x2c, 0x2b, 0x13, 0x9d, 0x6e, 0x0a, 0xb5, 0xa5, 0x49, 0x6d, 0x23, 0xf5, - 0x7f, 0xfc, 0x18, 0xf5, 0x3f, 0x66, 0x9b, 0xc3, 0xe1, 0xea, 0x32, 0xcc, 0x25, 0x6c, 0x13, 0x77, - 0xca, 0x04, 0x96, 0x95, 0x29, 0xed, 0x4c, 0xcc, 0x3a, 0xb1, 0xb1, 0xab, 0x07, 0x81, 0x76, 0x50, - 0x4c, 0x62, 0x59, 0xc9, 0x74, 0x23, 0xd0, 0x33, 0x98, 0x63, 0xe3, 0xd9, 0x14, 0x96, 0x95, 0xe9, - 0x84, 0x77, 0x22, 0x56, 0xea, 0x8a, 0x1c, 0x19, 0x00, 0x65, 0x05, 0x75, 0x22, 0x07, 0x9c, 0x73, - 0x59, 0x48, 0xaf, 0xb1, 0x6a, 0xab, 0x5b, 0xf3, 0xcb, 0x3d, 0x80, 0xa9, 0x60, 0x56, 0xfd, 0x1f, - 0x9d, 0x37, 0x04, 0xd8, 0x24, 0xa4, 0xc2, 0xeb, 0x9c, 0x96, 0xd2, 0xbd, 0xc2, 0x91, 0xae, 0x12, - 0x4e, 0x82, 0xaa, 0xfd, 0xea, 0x91, 0xde, 0xf0, 0x88, 0x68, 0x02, 0x25, 0xf7, 0xb9, 0x04, 0x53, - 0x1f, 0x58, 0x55, 0xc2, 0xe9, 0xbd, 0xa2, 0x46, 0x3f, 0x71, 0xa9, 0xc3, 0xd1, 0x3a, 0xc8, 0xa4, - 0xec, 0x0b, 0x31, 0x56, 0x5c, 0xea, 0xbb, 0x07, 0x68, 0x1e, 0x36, 0x7a, 0x07, 0xc6, 0x5c, 0x41, - 0x57, 0xdc, 0xfb, 0x03, 0xd1, 0x3a, 0x27, 0x8e, 0x2b, 0x3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 0x31, 0x7f, 0xcf, 0x07, 0x99, 0x07, 0x63, 0x86, 0xc5, 0x2e, 0xad, 0x04, 0x10, 0x83, 0x48, + 0x52, 0x64, 0x0d, 0x88, 0xad, 0x36, 0x0d, 0x2f, 0x0a, 0x31, 0x84, 0x24, 0x25, 0xad, 0x8d, 0x79, + 0x11, 0x10, 0x9f, 0xc6, 0x72, 0x31, 0x80, 0x18, 0x46, 0x92, 0x32, 0x28, 0x68, 0x2c, 0x17, 0x7d, + 0x80, 0x57, 0xc0, 0x44, 0xd5, 0x78, 0x4a, 0xf4, 0x36, 0x91, 0x11, 0x24, 0x29, 0x43, 0xda, 0x78, + 0xb0, 0x19, 0x07, 0x6a, 0xd3, 0x19, 0x45, 0x92, 0x32, 0x1c, 0x00, 0x85, 0x94, 0x5e, 0x02, 0xa0, + 0x4c, 0x69, 0x23, 0x80, 0x00, 0x48, 0x52, 0x46, 0xb4, 0x51, 0xbe, 0xd3, 0x16, 0xd6, 0x65, 0x8e, + 0x61, 0xd5, 0x02, 0x80, 0x31, 0xee, 0x55, 0x6d, 0xcc, 0xdf, 0x6b, 0x0b, 0x5b, 0x6e, 0x32, 0xe2, + 0x06, 0x10, 0x2f, 0x21, 0x49, 0x19, 0xd7, 0x80, 0xd8, 0x8a, 0x29, 0xdc, 0x16, 0x63, 0x02, 0x49, + 0xca, 0x84, 0xaf, 0x70, 0x28, 0xc5, 0x4d, 0x00, 0x78, 0x2a, 0x05, 0x00, 0x93, 0x48, 0x52, 0x26, + 0x8b, 0x6f, 0x1e, 0xeb, 0xce, 0x6d, 0xcf, 0x24, 0x8e, 0x51, 0xd9, 0xb4, 0x3c, 0x53, 0x1b, 0xe5, + 0xf8, 0x3e, 0xb1, 0x1d, 0x30, 0xd5, 0x4e, 0xce, 0x80, 0xe2, 0xcb, 0x82, 0xa2, 0xd2, 0x83, 0x62, + 0x98, 0xd3, 0x85, 0x1d, 0xcc, 0xea, 0x82, 0xda, 0x84, 0x1d, 0x7c, 0xf9, 0x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66, 0xe3, 0xe8, 0x91, 0x41, 0x6e, 0x04, 0xc9, 0xca, 0x88, 0x76, + 0x3a, 0x8a, 0xbb, 0xd6, 0x1e, 0xea, 0x3a, 0xcc, 0x15, 0x6b, 0x6d, 0xa3, 0xa2, 0x95, 0xc7, 0xcc, + 0x15, 0x6f, 0xe7, 0x09, 0x73, 0x45, 0x87, 0x3f, 0x80, 0x64, 0x65, 0x3c, 0x6e, 0xae, 0xb5, 0xa3, + 0x41, 0xb0, 0xab, 0x9b, 0xda, 0xea, 0x8e, 0x21, 0x59, 0x99, 0xe8, 0x74, 0x53, 0xa8, 0x2d, 0x49, + 0x6a, 0x1b, 0x69, 0x0c, 0xe3, 0x27, 0x68, 0x0c, 0x31, 0xdb, 0x1c, 0x4d, 0x5d, 0x57, 0xc1, 0x5c, + 0xc2, 0x36, 0x71, 0xa7, 0x4c, 0x20, 0x59, 0x99, 0xd2, 0xce, 0xc5, 0xac, 0x13, 0x9b, 0xc7, 0x7a, + 0x10, 0x68, 0x07, 0xc5, 0x24, 0x92, 0x95, 0x4c, 0x37, 0x02, 0x3d, 0x83, 0x39, 0x36, 0xb7, 0x4d, + 0x21, 0x59, 0x99, 0x4e, 0x78, 0x27, 0x62, 0xa5, 0xae, 0xc8, 0x91, 0xc9, 0x50, 0x56, 0x60, 0x27, + 0x72, 0xc0, 0x39, 0x97, 0x05, 0xe9, 0x35, 0xaa, 0x37, 0xbb, 0x75, 0xc5, 0xdc, 0x23, 0x30, 0x15, + 0x0c, 0xb1, 0xff, 0x63, 0xb0, 0xba, 0x00, 0x9b, 0x04, 0xa9, 0xf0, 0x9e, 0xa7, 0xa5, 0x0c, 0x5e, + 0x38, 0xd2, 0x3a, 0x66, 0x38, 0xa8, 0xda, 0xaf, 0x1e, 0xeb, 0x0d, 0x4e, 0x44, 0x13, 0x28, 0xb9, + 0xcf, 0x25, 0x30, 0xf5, 0x81, 0xad, 0x63, 0x46, 0x1e, 0x14, 0x35, 0xf2, 0x89, 0x47, 0x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 0x02, 0x21, 0x2e, 0x64, 0xaf, 0x49, 0xb5, 0xa5, 0x1e, 0x1c, 0x55, 0x90, 0x96, + 0x7a, 0x90, 0xb8, 0xd9, 0x71, 0xcc, 0xae, 0x57, 0xbe, 0x16, 0xfc, 0x99, 0x04, 0x80, 0xef, 0x58, + 0x91, 0x06, 0x5f, 0x8f, 0x73, 0x17, 0x84, 0x6f, 0x2f, 0xe6, 0xe6, 0x8f, 0xf1, 0xec, 0xaa, 0xb4, + 0x00, 0xff, 0x1f, 0x0c, 0xdd, 0xa2, 0x74, 0xcf, 0xb3, 0xe1, 0x54, 0xc1, 0xf5, 0xca, 0xc5, 0xc2, + 0x96, 0x1e, 0xe4, 0xee, 0x49, 0x38, 0x17, 0x04, 0x67, 0x05, 0xfe, 0xd7, 0xb1, 0x31, 0xc5, 0xa7, + 0x92, 0x16, 0xfc, 0xae, 0x04, 0x86, 0xfc, 0x5c, 0x3e, 0x89, 0x69, 0x7a, 0x5c, 0x0c, 0x73, 0x4b, + 0x42, 0x8a, 0x37, 0xb2, 0xcf, 0x29, 0x05, 0x37, 0xc3, 0xaf, 0x24, 0x30, 0x12, 0x16, 0x15, 0xb8, + 0x78, 0xac, 0x28, 0x89, 0xfa, 0xd3, 0x53, 0x92, 0xc7, 0x42, 0x12, 0x3d, 0xbb, 0xa0, 0xee, 0x17, + 0x9f, 0x2d, 0x09, 0x2e, 0x93, 0x82, 0x2f, 0x0d, 0xaf, 0x45, 0x0f, 0x97, 0x8a, 0xfd, 0xa2, 0xc0, + 0x9f, 0x4a, 0x60, 0x76, 0x07, 0xb3, 0x4a, 0x9d, 0x17, 0xdd, 0x76, 0x91, 0xda, 0xb2, 0x44, 0xe0, + 0x7d, 0x75, 0x2a, 0x5d, 0x12, 0x2a, 0x2d, 0x16, 0xdf, 0x50, 0xf7, 0x8b, 0xf8, 0x79, 0x05, 0x94, + 0x16, 0xe0, 0x0f, 0x25, 0x30, 0xb4, 0x41, 0x1a, 0x84, 0x91, 0xce, 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+ 0xfb, 0x2c, 0xae, 0xb1, 0x16, 0x0b, 0x7f, 0x23, 0x83, 0xf4, 0x66, 0xa5, 0x4e, 0x61, 0xaf, 0xf7, + 0x55, 0xd7, 0x2b, 0x17, 0xfc, 0x2b, 0x44, 0x58, 0x1c, 0x9e, 0x1b, 0x32, 0xf7, 0xf7, 0xd4, 0x61, + 0xe9, 0x5b, 0x29, 0x30, 0x4e, 0x2a, 0x75, 0x8a, 0x5c, 0x7f, 0xb4, 0x02, 0x23, 0x62, 0xe5, 0xd8, + 0x15, 0x38, 0x7d, 0xcf, 0x33, 0x4d, 0xec, 0x34, 0x57, 0xd1, 0x66, 0xb0, 0x95, 0xcd, 0x6c, 0x10, + 0xb7, 0xe2, 0x18, 0xe2, 0x47, 0x11, 0xb1, 0x9b, 0xdb, 0x00, 0x30, 0x9e, 0xb6, 0x42, 0xda, 0x3e, + 0x93, 0xf5, 0xfd, 0xab, 0x40, 0x7e, 0x6b, 0x71, 0x19, 0x5e, 0x06, 0x97, 0x34, 0xc2, 0x3c, 0xc7, + 0x22, 0x3a, 0x7a, 0x52, 0x27, 0x16, 0x62, 0x75, 0x82, 0x1c, 0xe2, 0x52, 0xcf, 0xa9, 0x10, 0x64, + 0xb8, 0x88, 0x11, 0xd3, 0xa6, 0x0e, 0x76, 0x8c, 0x46, 0x13, 0x79, 0x16, 0xde, 0xc7, 0x46, 0x03, + 0x97, 0x1b, 0xa4, 0xf0, 0xfe, 0x3b, 0x40, 0x5e, 0x59, 0x5c, 0x81, 0x2b, 0x60, 0xe1, 0x19, 0x04, + 0x74, 0x4a, 0x5c, 0x64, 0x51, 0x86, 0xc8, 0x53, 0xc3, 0x65, 0x05, 0x38, 0x04, 0xd2, 0x3f, 0x49, + 0x49, 0xb2, 0x48, 0xb2, 0x8f, 0x8e, 0x2f, 0x13, 0xdc, 0x30, 0xea, 0x81, 0xef, 0x98, 0x87, 0xe7, + 0x72, 0x99, 0x68, 0xc3, 0xe1, 0x67, 0xab, 0xfe, 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, 0x56, 0xfe, 0x26, 0x69, + 0xa2, 0x14, 0xf8, 0x52, 0x6a, 0xdf, 0x10, 0x7e, 0x2b, 0x8d, 0xc8, 0x4a, 0xba, 0xf8, 0x4a, 0xe8, + 0xc3, 0x88, 0xc3, 0x55, 0x8a, 0x3d, 0x56, 0x57, 0xf9, 0x1f, 0xea, 0x18, 0xff, 0x47, 0x56, 0xe7, + 0x7b, 0x03, 0x31, 0xba, 0x47, 0xac, 0xb5, 0x6f, 0x82, 0xac, 0x7f, 0xe1, 0x80, 0xf0, 0xba, 0x83, + 0x2d, 0xe6, 0x22, 0xbe, 0x08, 0xac, 0x07, 0xe6, 0x82, 0x6b, 0x08, 0x9c, 0x09, 0x0e, 0xc5, 0x2a, + 0x3c, 0x5d, 0x07, 0x83, 0x58, 0x37, 0x0d, 0x0b, 0xae, 0xc6, 0x50, 0x2d, 0x3d, 0x06, 0x26, 0x9c, + 0xc1, 0xc1, 0x0c, 0x97, 0xf1, 0x4e, 0xb4, 0x4f, 0x90, 0x61, 0x55, 0xa9, 0x63, 0x0a, 0x7f, 0x97, + 0xe7, 0xc1, 0x44, 0xd4, 0x14, 0x03, 0xc9, 0xab, 0x51, 0xf9, 0xf5, 0x9e, 0x97, 0xa3, 0x24, 0xa8, + 0xb3, 0x05, 0xce, 0xde, 0x3e, 0xaa, 0x3e, 0xd1, 0x9c, 0xea, 0x37, 0x97, 0x1e, 0x8e, 0xb6, 0x3d, + 0x57, 0x1e, 0x12, 0xf9, 0xbc, 0xfc, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x89, 0x81, 0xa8, + 0xde, 0x23, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index ffa464680f8..dbb62a79a06 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -149,6 +149,9 @@ message ABitOfEverything { // Nested is nested type. message Nested { + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = { + example: { value: '{ "ok": "TRUE" }' } + }; // name is nested field. string name = 1; uint32 amount = 2; diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 1ca1a155d56..c85d1345f32 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -1395,6 +1395,9 @@ "definitions": { "ABitOfEverythingNested": { "type": "object", + "example": { + "ok": "TRUE" + }, "properties": { "name": { "type": "string", From 796f1e8cd00be939cb3debf37dece20166eedf8c Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Thu, 10 Jan 2019 12:40:47 +0100 Subject: [PATCH 347/552] protoc-gen-swagger/genswagger: update BUILD.bazel Signed-off-by: Stephan Renatus --- protoc-gen-swagger/genswagger/BUILD.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/genswagger/BUILD.bazel index 172330ad88f..683b5eeec06 100644 --- a/protoc-gen-swagger/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/genswagger/BUILD.bazel @@ -30,7 +30,9 @@ go_test( deps = [ "//protoc-gen-grpc-gateway/descriptor:go_default_library", "//protoc-gen-grpc-gateway/httprule:go_default_library", + "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", + "@io_bazel_rules_go//proto/wkt:any_go_proto", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], From f07c49f02b4153a8f8d4b94ef9bd7af3a99196de Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Thu, 10 Jan 2019 12:58:35 +0100 Subject: [PATCH 348/552] examples/a_bit_of_everything: add more complex message example Signed-off-by: Stephan Renatus --- .../proto/examplepb/a_bit_of_everything.pb.go | 401 +++++++++--------- .../proto/examplepb/a_bit_of_everything.proto | 3 + .../a_bit_of_everything.swagger.json | 13 + 3 files changed, 218 insertions(+), 199 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 3b5727f2db2..bb0eb2d17c9 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{0} + return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -129,7 +129,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{0} + return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -467,7 +467,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{0, 0} + return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -536,7 +536,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{1} + return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -679,7 +679,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{2} + return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -718,7 +718,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{3} + return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -765,7 +765,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_11870f281dcdb894, []int{4} + return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1529,195 +1529,198 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_11870f281dcdb894) -} - -var fileDescriptor_a_bit_of_everything_11870f281dcdb894 = []byte{ - // 2964 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0xcb, 0x6f, 0x1b, 0xc7, - 0xdd, 0x5a, 0x2e, 0xf5, 0x1a, 0xbd, 0xa8, 0x91, 0x1f, 0x32, 0xad, 0x44, 0x63, 0xc6, 0xf9, 0xb2, - 0x51, 0x42, 0xae, 0x44, 0x29, 0x8e, 0xad, 0x20, 0xf1, 0x47, 0x3d, 0x6c, 0x2b, 0xb6, 0x65, 0x79, - 0xed, 0xf8, 0x0b, 0xfc, 0x39, 0x11, 0x86, 0xdc, 0x21, 0xb9, 0x16, 0x77, 0x67, 0xb3, 0x3b, 0x2b, - 0x9b, 0x9f, 0x3e, 0xb6, 0x69, 0x0b, 0xb4, 0x68, 0x73, 0x28, 0xa0, 0xb4, 0x97, 0xa2, 0xe8, 0x5f, - 0xd0, 0x6b, 0x4f, 0x39, 0xb4, 0x3d, 0xf4, 0xd4, 0x5b, 0x5b, 0x04, 0x28, 0x0a, 0xf4, 0xd2, 0x16, - 0xe8, 0x5f, 0xd0, 0xa2, 0xe8, 0xa5, 0x98, 0xd9, 0x5d, 0x6a, 0x77, 0x49, 0x5a, 0xa6, 0x1c, 0xe4, - 0x22, 0xed, 0xcc, 0xfc, 0xde, 0xef, 0x19, 0x82, 0x22, 0x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, - 0x4c, 0xb8, 0x86, 0x55, 0x6b, 0x90, 0x5d, 0x8b, 0xb8, 0x8c, 0xe8, 0xb3, 0xe7, 0x90, 0xa4, 0x8c, - 0x15, 0x2f, 0x17, 0x8e, 0xf1, 0x43, 0x21, 0x49, 0xa9, 0xb0, 0x2d, 0xf0, 0xb5, 0x71, 0x9f, 0x9c, - 0xbf, 0x82, 0x75, 0x90, 0xf6, 0x3c, 0x43, 0x9f, 0x95, 0x90, 0xa4, 0x8c, 0xae, 0xdd, 0x3f, 0x2c, - 0xdd, 0xfd, 0x54, 0x92, 0x7e, 0x20, 0xdd, 0xfc, 0x5f, 0x9c, 0xaf, 0x96, 0xf2, 0xd7, 0x16, 0xf3, - 0x57, 0x3e, 0x3a, 0xb8, 0xdc, 0xca, 0x47, 0x97, 0x2b, 0xfd, 0x2c, 0x97, 0x8a, 0x2d, 0x4d, 0x70, - 0x80, 0x3b, 0x60, 0x28, 0xd0, 0x20, 0x85, 0xe4, 0x17, 0xd2, 0x20, 0xa0, 0x03, 0xe7, 0xc1, 0x58, - 0xb5, 0x41, 0x31, 0xdb, 0xdd, 0xc7, 0x0d, 0x8f, 0xcc, 0xca, 0x48, 0x52, 0x52, 0x1a, 0x10, 0x5b, - 0x0f, 0xf8, 0x0e, 0xbc, 0x00, 0xc6, 0x75, 0xea, 0x95, 0x1b, 0x24, 0x80, 0x48, 0x23, 0x49, 0x91, - 0xb4, 0x31, 0x7f, 0xcf, 0x07, 0x99, 0x07, 0x63, 0x86, 0xc5, 0x2e, 0xad, 0x04, 0x10, 0x83, 0x48, - 0x52, 0x64, 0x0d, 0x88, 0xad, 0x36, 0x0d, 0x2f, 0x0a, 0x31, 0x84, 0x24, 0x25, 0xad, 0x8d, 0x79, - 0x11, 0x10, 0x9f, 0xc6, 0x72, 0x31, 0x80, 0x18, 0x46, 0x92, 0x32, 0x28, 0x68, 0x2c, 0x17, 0x7d, - 0x80, 0x57, 0xc0, 0x44, 0xd5, 0x78, 0x4a, 0xf4, 0x36, 0x91, 0x11, 0x24, 0x29, 0x43, 0xda, 0x78, - 0xb0, 0x19, 0x07, 0x6a, 0xd3, 0x19, 0x45, 0x92, 0x32, 0x1c, 0x00, 0x85, 0x94, 0x5e, 0x02, 0xa0, - 0x4c, 0x69, 0x23, 0x80, 0x00, 0x48, 0x52, 0x46, 0xb4, 0x51, 0xbe, 0xd3, 0x16, 0xd6, 0x65, 0x8e, - 0x61, 0xd5, 0x02, 0x80, 0x31, 0xee, 0x55, 0x6d, 0xcc, 0xdf, 0x6b, 0x0b, 0x5b, 0x6e, 0x32, 0xe2, - 0x06, 0x10, 0x2f, 0x21, 0x49, 0x19, 0xd7, 0x80, 0xd8, 0x8a, 0x29, 0xdc, 0x16, 0x63, 0x02, 0x49, - 0xca, 0x84, 0xaf, 0x70, 0x28, 0xc5, 0x4d, 0x00, 0x78, 0x2a, 0x05, 0x00, 0x93, 0x48, 0x52, 0x26, - 0x8b, 0x6f, 0x1e, 0xeb, 0xce, 0x6d, 0xcf, 0x24, 0x8e, 0x51, 0xd9, 0xb4, 0x3c, 0x53, 0x1b, 0xe5, - 0xf8, 0x3e, 0xb1, 0x1d, 0x30, 0xd5, 0x4e, 0xce, 0x80, 0xe2, 0xcb, 0x82, 0xa2, 0xd2, 0x83, 0x62, - 0x98, 0xd3, 0x85, 0x1d, 0xcc, 0xea, 0x82, 0xda, 0x84, 0x1d, 0x7c, 0xf9, 0x14, 0x5d, 0x70, 0xc6, - 0x8f, 0x90, 0xdd, 0x24, 0xe1, 0x79, 0x41, 0xf8, 0xbd, 0xe3, 0x08, 0xdf, 0xf6, 0xb3, 0x3c, 0xa4, - 0x1f, 0xc4, 0x5d, 0x9b, 0xdd, 0x8c, 0x15, 0x5b, 0xfb, 0x4c, 0x5f, 0x05, 0x93, 0x6e, 0xdc, 0x7f, - 0x53, 0x48, 0x52, 0xa6, 0xb4, 0x09, 0x37, 0xe6, 0xc0, 0x36, 0x58, 0x3b, 0x16, 0x32, 0x48, 0x52, - 0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xe8, 0x74, 0x53, 0xa8, 0x2d, 0x49, - 0x6a, 0x1b, 0x69, 0x0c, 0xe3, 0x27, 0x68, 0x0c, 0x31, 0xdb, 0x1c, 0x4d, 0x5d, 0x57, 0xc1, 0x5c, - 0xc2, 0x36, 0x71, 0xa7, 0x4c, 0x20, 0x59, 0x99, 0xd2, 0xce, 0xc5, 0xac, 0x13, 0x9b, 0xc7, 0x7a, - 0x10, 0x68, 0x07, 0xc5, 0x24, 0x92, 0x95, 0x4c, 0x37, 0x02, 0x3d, 0x83, 0x39, 0x36, 0xb7, 0x4d, - 0x21, 0x59, 0x99, 0x4e, 0x78, 0x27, 0x62, 0xa5, 0xae, 0xc8, 0x91, 0xc9, 0x50, 0x56, 0x60, 0x27, - 0x72, 0xc0, 0x39, 0x97, 0x05, 0xe9, 0x35, 0xaa, 0x37, 0xbb, 0x75, 0xc5, 0xdc, 0x23, 0x30, 0x15, - 0x0c, 0xb1, 0xff, 0x63, 0xb0, 0xba, 0x00, 0x9b, 0x04, 0xa9, 0xf0, 0x9e, 0xa7, 0xa5, 0x0c, 0x5e, - 0x38, 0xd2, 0x3a, 0x66, 0x38, 0xa8, 0xda, 0xaf, 0x1e, 0xeb, 0x0d, 0x4e, 0x44, 0x13, 0x28, 0xb9, - 0xcf, 0x25, 0x30, 0xf5, 0x81, 0xad, 0x63, 0x46, 0x1e, 0x14, 0x35, 0xf2, 0x89, 0x47, 0x5c, 0x06, - 0xd7, 0x81, 0x8c, 0xcb, 0xbe, 0x10, 0x63, 0xc5, 0xa5, 0xbe, 0x7b, 0x80, 0xc6, 0xb1, 0xe1, 0x3b, - 0x60, 0xcc, 0x13, 0x74, 0xc5, 0x83, 0x40, 0x20, 0x5a, 0xe7, 0x28, 0x72, 0xcd, 0x20, 0x0d, 0xfd, - 0x36, 0x76, 0xf7, 0x34, 0xe0, 0x83, 0xf3, 0xef, 0x05, 0x04, 0xc6, 0x22, 0x11, 0xc3, 0xdb, 0xf2, - 0xc3, 0x4d, 0xed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, 0xb3, 0xe1, 0x54, 0xc1, 0xf5, 0xca, 0xc5, 0xc2, - 0x96, 0x1e, 0xe4, 0xee, 0x49, 0x38, 0x17, 0x04, 0x67, 0x05, 0xfe, 0xd7, 0xb1, 0x31, 0xc5, 0xa7, - 0x92, 0x16, 0xfc, 0xae, 0x04, 0x86, 0xfc, 0x5c, 0x3e, 0x89, 0x69, 0x7a, 0x5c, 0x0c, 0x73, 0x4b, - 0x42, 0x8a, 0x37, 0xb2, 0xcf, 0x29, 0x05, 0x37, 0xc3, 0xaf, 0x24, 0x30, 0x12, 0x16, 0x15, 0xb8, - 0x78, 0xac, 0x28, 0x89, 0xfa, 0xd3, 0x53, 0x92, 0xc7, 0x42, 0x12, 0x3d, 0xbb, 0xa0, 0xee, 0x17, - 0x9f, 0x2d, 0x09, 0x2e, 0x93, 0x82, 0x2f, 0x0d, 0xaf, 0x45, 0x0f, 0x97, 0x8a, 0xfd, 0xa2, 0xc0, - 0x9f, 0x4a, 0x60, 0x76, 0x07, 0xb3, 0x4a, 0x9d, 0x17, 0xdd, 0x76, 0x91, 0xda, 0xb2, 0x44, 0xe0, - 0x7d, 0x75, 0x2a, 0x5d, 0x12, 0x2a, 0x2d, 0x16, 0xdf, 0x50, 0xf7, 0x8b, 0xf8, 0x79, 0x05, 0x94, - 0x16, 0xe0, 0x0f, 0x25, 0x30, 0xb4, 0x41, 0x1a, 0x84, 0x91, 0xce, 0x48, 0xeb, 0xc5, 0xeb, 0xd1, - 0x61, 0xe9, 0x8d, 0xf2, 0xeb, 0x60, 0x12, 0x80, 0x92, 0x6d, 0xdc, 0x24, 0xcd, 0x92, 0xc7, 0xea, - 0x70, 0x00, 0x9c, 0x05, 0x43, 0x77, 0xf8, 0x67, 0x11, 0x4e, 0x80, 0xb4, 0x43, 0xb0, 0x0e, 0x06, - 0x9f, 0x38, 0x06, 0x23, 0x7e, 0xf0, 0x2d, 0x3c, 0x6f, 0xf0, 0xfd, 0x45, 0x02, 0x23, 0xd7, 0x09,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f, 0x33, 0x4d, 0xec, 0x34, 0x57, 0xd1, 0x66, 0xb0, 0x95, 0xcd, 0x6c, 0x10, - 0xb7, 0xe2, 0x18, 0xe2, 0x47, 0x11, 0xb1, 0x9b, 0xdb, 0x00, 0x30, 0x9e, 0xb6, 0x42, 0xda, 0x3e, - 0x93, 0xf5, 0xfd, 0xab, 0x40, 0x7e, 0x6b, 0x71, 0x19, 0x5e, 0x06, 0x97, 0x34, 0xc2, 0x3c, 0xc7, - 0x22, 0x3a, 0x7a, 0x52, 0x27, 0x16, 0x62, 0x75, 0x82, 0x1c, 0xe2, 0x52, 0xcf, 0xa9, 0x10, 0x64, - 0xb8, 0x88, 0x11, 0xd3, 0xa6, 0x0e, 0x76, 0x8c, 0x46, 0x13, 0x79, 0x16, 0xde, 0xc7, 0x46, 0x03, - 0x97, 0x1b, 0xa4, 0xf0, 0xfe, 0x3b, 0x40, 0x5e, 0x59, 0x5c, 0x81, 0x2b, 0x60, 0xe1, 0x19, 0x04, - 0x74, 0x4a, 0x5c, 0x64, 0x51, 0x86, 0xc8, 0x53, 0xc3, 0x65, 0x05, 0x38, 0x04, 0xd2, 0x3f, 0x49, - 0x49, 0xb2, 0x48, 0xb2, 0x8f, 0x8e, 0x2f, 0x13, 0xdc, 0x30, 0xea, 0x81, 0xef, 0x98, 0x87, 0xe7, - 0x72, 0x99, 0x68, 0xc3, 0xe1, 0x67, 0xab, 0xfe, 0x93, 0xc8, 0x43, 0x08, 0x3b, 0x8e, 0xe0, 0x2f, - 0x24, 0x30, 0xbe, 0x41, 0x88, 0x2d, 0x9e, 0xa1, 0xf9, 0xc6, 0xd7, 0x33, 0xd9, 0x5c, 0x15, 0xba, - 0x5d, 0xc9, 0xad, 0x1c, 0x5b, 0xe2, 0x63, 0x3f, 0x5b, 0x15, 0xf8, 0xb5, 0x44, 0x74, 0xa1, 0x12, - 0x00, 0xdb, 0x74, 0xcd, 0xb0, 0x74, 0xc3, 0xaa, 0xb9, 0xf0, 0x5c, 0x47,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17, 0x64, 0x29, 0x95, 0x2e, 0x66, 0xb0, 0xed, - 0x3f, 0x1a, 0x1b, 0xd4, 0x52, 0x1f, 0xbb, 0xd4, 0x2a, 0x9e, 0x89, 0xee, 0x3c, 0xcd, 0x57, 0x29, - 0xcd, 0x9b, 0x86, 0x49, 0x56, 0x3b, 0x20, 0x57, 0x7b, 0x40, 0x6a, 0x3b, 0xbc, 0x63, 0x2c, 0xc3, - 0x2d, 0x70, 0xbd, 0xb3, 0x63, 0x78, 0x2e, 0x71, 0x8e, 0xba, 0x45, 0x1d, 0xef, 0x13, 0x64, 0x13, - 0xc7, 0x34, 0x5c, 0x97, 0x07, 0x26, 0xa3, 0x08, 0x57, 0x2a, 0xc4, 0x75, 0x63, 0xdd, 0xa5, 0xa0, - 0xbd, 0x40, 0x0f, 0x1a, 0xd6, 0x6e, 0x00, 0x79, 0x65, 0xe9, 0x32, 0x2c, 0x81, 0x89, 0xad, 0xd7, - 0x4c, 0x84, 0x11, 0x23, 0xd8, 0xa6, 0xac, 0x00, 0x17, 0x41, 0x21, 0xdb, 0xd7, 0xe3, 0xdb, 0xc3, - 0xef, 0xa7, 0xc0, 0x14, 0x18, 0x5d, 0xc3, 0xae, 0x51, 0x11, 0xf3, 0x7f, 0x6a, 0x44, 0x02, 0x2f, - 0xc5, 0x6e, 0x04, 0x53, 0x23, 0xa9, 0xec, 0xe8, 0x87, 0xf9, 0xd2, 0xce, 0x56, 0xfe, 0x26, 0x69, - 0xa2, 0x14, 0xf8, 0x52, 0x6a, 0xdf, 0x10, 0x7e, 0x2b, 0x8d, 0xc8, 0x4a, 0xba, 0xf8, 0x4a, 0xe8, - 0xc3, 0x88, 0xc3, 0x55, 0x8a, 0x3d, 0x56, 0x57, 0xf9, 0x1f, 0xea, 0x18, 0xff, 0x47, 0x56, 0xe7, - 0x7b, 0x03, 0x31, 0xba, 0x47, 0xac, 0xb5, 0x6f, 0x82, 0xac, 0x7f, 0xe1, 0x80, 0xf0, 0xba, 0x83, - 0x2d, 0xe6, 0x22, 0xbe, 0x08, 0xac, 0x07, 0xe6, 0x82, 0x6b, 0x08, 0x9c, 0x09, 0x0e, 0xc5, 0x2a, - 0x3c, 0x5d, 0x07, 0x83, 0x58, 0x37, 0x0d, 0x0b, 0xae, 0xc6, 0x50, 0x2d, 0x3d, 0x06, 0x26, 0x9c, - 0xc1, 0xc1, 0x0c, 0x97, 0xf1, 0x4e, 0xb4, 0x4f, 0x90, 0x61, 0x55, 0xa9, 0x63, 0x0a, 0x7f, 0x97, - 0xe7, 0xc1, 0x44, 0xd4, 0x14, 0x03, 0xc9, 0xab, 0x51, 0xf9, 0xf5, 0x9e, 0x97, 0xa3, 0x24, 0xa8, - 0xb3, 0x05, 0xce, 0xde, 0x3e, 0xaa, 0x3e, 0xd1, 0x9c, 0xea, 0x37, 0x97, 0x1e, 0x8e, 0xb6, 0x3d, - 0x57, 0x1e, 0x12, 0xf9, 0xbc, 0xfc, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x89, 0x81, 0xa8, - 0xde, 0x23, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_583e142cf4e91dc2) +} + +var fileDescriptor_a_bit_of_everything_583e142cf4e91dc2 = []byte{ + // 3012 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0x5b, 0x6f, 0x1b, 0xc7, + 0xb9, 0x5a, 0x2e, 0x75, 0x1b, 0xdd, 0xa8, 0x91, 0x2f, 0x32, 0xad, 0x44, 0x63, 0xc6, 0x39, 0xd9, + 0x28, 0x26, 0x57, 0xa2, 0x14, 0xc7, 0x66, 0x90, 0xf8, 0x50, 0x17, 0xdb, 0x8a, 0x6d, 0x59, 0x5e, + 0x3b, 0x3e, 0x81, 0x63, 0x47, 0x18, 0x92, 0x43, 0x72, 0x2d, 0xee, 0xce, 0x66, 0x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x56, 0xa8, 0x5b, 0x6a, 0x10, 0x1f, 0x22, + 0x89, 0x24, 0x45, 0xd2, 0x26, 0xbc, 0x3d, 0x0f, 0x64, 0x11, 0x4c, 0xe8, 0x26, 0xbb, 0xb8, 0xe6, + 0x43, 0x0c, 0x23, 0x49, 0x91, 0x35, 0x20, 0xb6, 0x3a, 0x34, 0xdc, 0x30, 0xc4, 0x08, 0x92, 0x94, + 0xa4, 0x36, 0xe1, 0x86, 0x40, 0x3c, 0x1a, 0xab, 0x79, 0x1f, 0x62, 0x14, 0x49, 0xca, 0xb0, 0xa0, + 0xb1, 0x9a, 0xf7, 0x00, 0x5e, 0x03, 0x53, 0x55, 0xfd, 0x29, 0xa9, 0x74, 0x88, 0x8c, 0x21, 0x49, + 0x19, 0xd1, 0x26, 0xfd, 0xcd, 0x28, 0x50, 0x87, 0xce, 0x38, 0x92, 0x94, 0x51, 0x1f, 0x28, 0xa0, + 0xf4, 0x0a, 0x00, 0x25, 0x4a, 0x1b, 0x3e, 0x04, 0x40, 0x92, 0x32, 0xa6, 0x8d, 0xf3, 0x9d, 0x8e, + 0xb0, 0x0e, 0xb3, 0x75, 0xb3, 0xe6, 0x03, 0x4c, 0x70, 0xaf, 0x6a, 0x13, 0xde, 0x5e, 0x47, 0xd8, + 0x52, 0x93, 0x11, 0xc7, 0x87, 0x78, 0x05, 0x49, 0xca, 0xa4, 0x06, 0xc4, 0x56, 0x44, 0xe1, 0x8e, + 0x18, 0x53, 0x48, 0x52, 0xa6, 0x3c, 0x85, 0x03, 0x29, 0x6e, 0x00, 0xc0, 0xaf, 0x92, 0x0f, 0x30, + 0x8d, 0x24, 0x65, 0x3a, 0x7f, 0xe1, 0x58, 0x77, 0xee, 0xb8, 0x06, 0xb1, 0xf5, 0xf2, 0x96, 0xe9, + 0x1a, 0xda, 0x38, 0xc7, 0xf7, 0x88, 0xed, 0x82, 0x99, 0xce, 0xe5, 0xf4, 0x29, 0xbe, 0x2a, 0x28, + 0x2a, 0x7d, 0x28, 0x06, 0x77, 0x3a, 0xb7, 0x8b, 0x59, 0x5d, 0x50, 0x9b, 0xb2, 0xfc, 0x2f, 0x8f, + 0xa2, 0x03, 0x4e, 0x79, 0x11, 0xb2, 0x17, 0x27, 0xbc, 0x28, 0x08, 0xbf, 0x7f, 0x1c, 0xe1, 0x5b, + 0xde, 0x2d, 0x0f, 0xe8, 0xfb, 0x71, 0xd7, 0x61, 0x37, 0x67, 0x46, 0xd6, 0x1e, 0xd3, 0xd7, 0xc1, + 0xb4, 0x13, 0xf5, 0xdf, 0x0c, 0x92, 0x94, 0x19, 0x6d, 0xca, 0x89, 0x38, 0xb0, 0x03, 0xd6, 0x89, + 0x85, 0x14, 0x92, 0x94, 0x54, 0x00, 0x16, 0x8a, 0x3a, 0x27, 0xec, 0x84, 0x59, 0x24, 0x29, 0xb3, + 0xda, 0x84, 0x13, 0x72, 0x82, 0x0f, 0xd2, 0xa1, 0x03, 0x91, 0xa4, 0x40, 0x0f, 0x24, 0xa0, 0x92, + 0x07, 0x27, 0x6d, 0x62, 0x11, 0xcc, 0x4d, 0x11, 0x89, 0x8b, 0x39, 0x24, 0x2b, 0xe3, 0xda, 0x5c, + 0x70, 0x78, 0x37, 0x14, 0x1f, 0x97, 0xc1, 0x04, 0x35, 0x09, 0xcf, 0xfc, 0x3c, 0xed, 0xce, 0x9f, + 0x10, 0xd9, 0xe6, 0x54, 0xce, 0xcb, 0x74, 0xb9, 0x20, 0xd3, 0xe5, 0xb6, 0xf8, 0xe9, 0xf5, 0x21, + 0x0d, 0x08, 0x60, 0xb1, 0x82, 0xaf, 0x81, 0x49, 0x0f, 0xd5, 0xe3, 0x35, 0x7f, 0x92, 0x47, 0xdf, + 0xf5, 0x21, 0xcd, 0x23, 0xe8, 0x31, 0x81, 0x0f, 0xc1, 0xb8, 0x81, 0x2d, 0x5f, 0x8e, 0x53, 0x22, + 0x13, 0x5c, 0x19, 0x3c, 0x13, 0xdc, 0xc2, 0x96, 0x10, 0x77, 0xcb, 0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0x32, 0x35, 0x54, 0xae, 0x6e, 0x96, 0x94, + 0xa9, 0xd3, 0x74, 0x18, 0xf1, 0x97, 0xbe, 0xf6, 0xf9, 0x35, 0x98, 0x6f, 0xa1, 0x0c, 0x67, 0xc1, + 0xc3, 0x61, 0xb9, 0x5c, 0x5d, 0xbd, 0xb8, 0x42, 0x56, 0xb2, 0x6b, 0xa5, 0xb5, 0xb5, 0xec, 0xda, + 0xa5, 0xd5, 0x4a, 0x16, 0xaf, 0xbc, 0x7d, 0x39, 0xfb, 0xf6, 0x5a, 0x05, 0x97, 0x2a, 0xd5, 0x77, + 0xc8, 0xa5, 0x95, 0xb5, 0x0c, 0x6a, 0xaf, 0x4f, 0x05, 0x39, 0x58, 0x18, 0x24, 0xf3, 0xaf, 0x31, + 0x30, 0x1f, 0x97, 0x44, 0xf3, 0xef, 0x09, 0xbc, 0x0c, 0xce, 0x88, 0x2a, 0xd7, 0xb9, 0x81, 0xe1, + 0x96, 0x48, 0x42, 0xb2, 0x92, 0xd0, 0x4e, 0x71, 0x80, 0x00, 0xe1, 0xea, 0x51, 0x7b, 0xf4, 0x2e, + 0x48, 0x47, 0x51, 0x23, 0xcd, 0x12, 0xef, 0xd2, 0x24, 0xed, 0x74, 0x18, 0x77, 0x33, 0xd4, 0x38, + 0x75, 0xf1, 0x0d, 0xd7, 0x22, 0x19, 0xc9, 0x8a, 0x1c, 0xe5, 0xbb, 0x7d, 0x54, 0x96, 0xba, 0xf8, + 0x46, 0x1a, 0xac, 0x24, 0x92, 0x95, 0x64, 0x94, 0xef, 0x87, 0xa1, 0x9a, 0xd6, 0x8b, 0x6f, 0xa7, + 0x4c, 0x0e, 0x23, 0x59, 0x19, 0xee, 0xe2, 0x1b, 0x54, 0xcc, 0xf7, 0xc0, 0xd9, 0x98, 0xa9, 0x22, + 0x85, 0x78, 0x04, 0xc9, 0xca, 0x88, 0x36, 0x1f, 0x31, 0x56, 0xb8, 0x26, 0xf7, 0x46, 0x0f, 0xb5, + 0x7d,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a, 0x97, 0x1e, 0x8c, 0x77, 0x3c, + 0x57, 0x1a, 0x11, 0xf7, 0x79, 0xf5, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8e, 0xc2, 0x5e, 0xf3, + 0x48, 0x24, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index dbb62a79a06..eba0d7d629c 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -206,6 +206,9 @@ message ABitOfEverything { // ABitOfEverythingRepeated is used to validate repeated path parameter functionality message ABitOfEverythingRepeated { + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = { + example: { value: '{ "path_repeated_bool_value": [true, true, false, true], "path_repeated_int32_value": [1, 2, 3] }' } + }; // repeated values. they are comma-separated in path repeated float path_repeated_float_value = 1; diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index c85d1345f32..b4c3e5bb17e 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -1575,6 +1575,19 @@ }, "examplepbABitOfEverythingRepeated": { "type": "object", + "example": { + "path_repeated_bool_value": [ + true, + true, + false, + true + ], + "path_repeated_int32_value": [ + 1, + 2, + 3 + ] + }, "properties": { "path_repeated_float_value": { "type": "array", From dffd2198c38a7b3de36b1d54620eec1d2534814e Mon Sep 17 00:00:00 2001 From: Alex Bice Date: Thu, 17 Jan 2019 15:35:55 -0700 Subject: [PATCH 349/552] Support outputting arrays in protoc-gen-swagger (#853) * protoc-gen-swagger: add flag 'allow_repeated_fields_in_body' Also added/updated tests for flags * protoc-gen-swagger: updated response body example Also: * Added integration tests * Added an extra cli test for parsing the flag --- Makefile | 4 +- examples/clients/responsebody/BUILD.bazel | 3 + .../docs/ExamplepbRepeatedResponseBodyOut.md | 10 + ...xamplepbRepeatedResponseBodyOutResponse.md | 10 + .../docs/ExamplepbRepeatedResponseStrings.md | 10 + .../docs/ResponseBodyServiceApi.md | 56 ++++ .../examplepb_repeated_response_body_out.go | 16 ++ ...epb_repeated_response_body_out_response.go | 16 ++ .../examplepb_repeated_response_strings.go | 16 ++ .../responsebody/response_body_service_api.go | 120 +++++++++ examples/integration/integration_test.go | 50 ++++ .../examplepb/response_body_service.pb.go | 240 ++++++++++++++++-- .../examplepb/response_body_service.pb.gw.go | 120 +++++++++ .../examplepb/response_body_service.proto | 43 +++- .../response_body_service.swagger.json | 84 ++++++ examples/server/responsebody.go | 16 ++ protoc-gen-grpc-gateway/BUILD.bazel | 5 +- protoc-gen-swagger/defs.bzl | 2 +- protoc-gen-swagger/main.go | 9 + protoc-gen-swagger/main_test.go | 209 ++++++++------- 20 files changed, 901 insertions(+), 138 deletions(-) create mode 100644 examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOut.md create mode 100644 examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md create mode 100644 examples/clients/responsebody/docs/ExamplepbRepeatedResponseStrings.md create mode 100644 examples/clients/responsebody/examplepb_repeated_response_body_out.go create mode 100644 examples/clients/responsebody/examplepb_repeated_response_body_out_response.go create mode 100644 examples/clients/responsebody/examplepb_repeated_response_strings.go diff --git a/Makefile b/Makefile index 23b720ad4a5..8d7156cc378 100644 --- a/Makefile +++ b/Makefile @@ -149,11 +149,11 @@ $(EXAMPLE_DEPSRCS): $(GO_PLUGIN) $(EXAMPLE_DEPS) $(EXAMPLE_GWSRCS): ADDITIONAL_GW_FLAGS:=$(ADDITIONAL_GW_FLAGS),grpc_api_configuration=examples/proto/examplepb/unannotated_echo_service.yaml $(EXAMPLE_GWSRCS): $(GATEWAY_PLUGIN) $(EXAMPLES) - protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GATEWAY_PLUGIN) --grpc-gateway_out=logtostderr=true,$(PKGMAP)$(ADDITIONAL_GW_FLAGS):. $(EXAMPLES) + protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GATEWAY_PLUGIN) --grpc-gateway_out=logtostderr=true,allow_repeated_fields_in_body=true,$(PKGMAP)$(ADDITIONAL_GW_FLAGS):. $(EXAMPLES) $(EXAMPLE_SWAGGERSRCS): ADDITIONAL_SWG_FLAGS:=$(ADDITIONAL_SWG_FLAGS),grpc_api_configuration=examples/proto/examplepb/unannotated_echo_service.yaml $(EXAMPLE_SWAGGERSRCS): $(SWAGGER_PLUGIN) $(SWAGGER_EXAMPLES) - protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(SWAGGER_PLUGIN) --swagger_out=logtostderr=true,$(PKGMAP)$(ADDITIONAL_SWG_FLAGS):. $(SWAGGER_EXAMPLES) + protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(SWAGGER_PLUGIN) --swagger_out=logtostderr=true,allow_repeated_fields_in_body=true,$(PKGMAP)$(ADDITIONAL_SWG_FLAGS):. $(SWAGGER_EXAMPLES) $(ECHO_EXAMPLE_SRCS): $(ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ECHO_EXAMPLE_SPEC) \ diff --git a/examples/clients/responsebody/BUILD.bazel b/examples/clients/responsebody/BUILD.bazel index bdbc237a815..393d28446e4 100644 --- a/examples/clients/responsebody/BUILD.bazel +++ b/examples/clients/responsebody/BUILD.bazel @@ -6,6 +6,9 @@ go_library( "api_client.go", "api_response.go", "configuration.go", + "examplepb_repeated_response_body_out.go", + "examplepb_repeated_response_body_out_response.go", + "examplepb_repeated_response_strings.go", "examplepb_response_body_message.go", "examplepb_response_body_message_response.go", "examplepb_response_body_out.go", diff --git a/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOut.md b/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOut.md new file mode 100644 index 00000000000..1a78a92234c --- /dev/null +++ b/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOut.md @@ -0,0 +1,10 @@ +# ExamplepbRepeatedResponseBodyOut + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Response** | [**[]ExamplepbRepeatedResponseBodyOutResponse**](examplepbRepeatedResponseBodyOutResponse.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md b/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md new file mode 100644 index 00000000000..b11c5bb123f --- /dev/null +++ b/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md @@ -0,0 +1,10 @@ +# ExamplepbRepeatedResponseBodyOutResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/clients/responsebody/docs/ExamplepbRepeatedResponseStrings.md b/examples/clients/responsebody/docs/ExamplepbRepeatedResponseStrings.md new file mode 100644 index 00000000000..702cfa03868 --- /dev/null +++ b/examples/clients/responsebody/docs/ExamplepbRepeatedResponseStrings.md @@ -0,0 +1,10 @@ +# ExamplepbRepeatedResponseStrings + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Values** | **[]string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/clients/responsebody/docs/ResponseBodyServiceApi.md b/examples/clients/responsebody/docs/ResponseBodyServiceApi.md index 7c4506cc991..458725faa9b 100644 --- a/examples/clients/responsebody/docs/ResponseBodyServiceApi.md +++ b/examples/clients/responsebody/docs/ResponseBodyServiceApi.md @@ -5,6 +5,8 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- [**GetResponseBody**](ResponseBodyServiceApi.md#GetResponseBody) | **Get** /responsebody/{data} | +[**ListResponseBodies**](ResponseBodyServiceApi.md#ListResponseBodies) | **Get** /responsebodies/{data} | +[**ListResponseStrings**](ResponseBodyServiceApi.md#ListResponseStrings) | **Get** /responsestrings/{data} | # **GetResponseBody** @@ -34,3 +36,57 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **ListResponseBodies** +> []ExamplepbRepeatedResponseBodyOutResponse ListResponseBodies($data) + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **data** | **string**| | + +### Return type + +[**[]ExamplepbRepeatedResponseBodyOutResponse**](examplepbRepeatedResponseBodyOutResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **ListResponseStrings** +> []string ListResponseStrings($data) + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **data** | **string**| | + +### Return type + +**[]string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/examples/clients/responsebody/examplepb_repeated_response_body_out.go b/examples/clients/responsebody/examplepb_repeated_response_body_out.go new file mode 100644 index 00000000000..18977ab5732 --- /dev/null +++ b/examples/clients/responsebody/examplepb_repeated_response_body_out.go @@ -0,0 +1,16 @@ +/* + * examples/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package responsebody + +type ExamplepbRepeatedResponseBodyOut struct { + + Response []ExamplepbRepeatedResponseBodyOutResponse `json:"response,omitempty"` +} diff --git a/examples/clients/responsebody/examplepb_repeated_response_body_out_response.go b/examples/clients/responsebody/examplepb_repeated_response_body_out_response.go new file mode 100644 index 00000000000..c13c50cb507 --- /dev/null +++ b/examples/clients/responsebody/examplepb_repeated_response_body_out_response.go @@ -0,0 +1,16 @@ +/* + * examples/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package responsebody + +type ExamplepbRepeatedResponseBodyOutResponse struct { + + Data string `json:"data,omitempty"` +} diff --git a/examples/clients/responsebody/examplepb_repeated_response_strings.go b/examples/clients/responsebody/examplepb_repeated_response_strings.go new file mode 100644 index 00000000000..94a35e877ab --- /dev/null +++ b/examples/clients/responsebody/examplepb_repeated_response_strings.go @@ -0,0 +1,16 @@ +/* + * examples/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package responsebody + +type ExamplepbRepeatedResponseStrings struct { + + Values []string `json:"values,omitempty"` +} diff --git a/examples/clients/responsebody/response_body_service_api.go b/examples/clients/responsebody/response_body_service_api.go index 15fa4e5bb63..000cecd6ddd 100644 --- a/examples/clients/responsebody/response_body_service_api.go +++ b/examples/clients/responsebody/response_body_service_api.go @@ -97,3 +97,123 @@ func (a ResponseBodyServiceApi) GetResponseBody(data string) (*ExamplepbResponse return successPayload, localVarAPIResponse, err } +/** + * + * + * @param data + * @return []ExamplepbRepeatedResponseBodyOutResponse + */ +func (a ResponseBodyServiceApi) ListResponseBodies(data string) ([]ExamplepbRepeatedResponseBodyOutResponse, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/responsebodies/{data}" + localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new([]ExamplepbRepeatedResponseBodyOutResponse) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "ListResponseBodies", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return *successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return *successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param data + * @return []string + */ +func (a ResponseBodyServiceApi) ListResponseStrings(data string) ([]string, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/responsestrings/{data}" + localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new([]string) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "ListResponseStrings", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return *successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return *successPayload, localVarAPIResponse, err +} + diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index 96b36d04b58..f9ea66b9a26 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -1307,6 +1307,8 @@ func TestResponseBody(t *testing.T) { } testResponseBody(t, 8080) + testResponseBodies(t, 8080) + testResponseStrings(t, 8080) } func testResponseBody(t *testing.T, port int) { @@ -1332,3 +1334,51 @@ func testResponseBody(t *testing.T, port int) { t.Errorf("response = %q; want %q", got, want) } } + +func testResponseBodies(t *testing.T, port int) { + url := fmt.Sprintf("http://localhost:%d/responsebodies/foo", port) + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + if got, want := string(buf), `[{"data":"foo"}]`; got != want { + t.Errorf("response = %q; want %q", got, want) + } +} + +func testResponseStrings(t *testing.T, port int) { + url := fmt.Sprintf("http://localhost:%d/responsestrings/foo", port) + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + if got, want := string(buf), `["hello","foo"]`; got != want { + t.Errorf("response = %q; want %q", got, want) + } +} diff --git a/examples/proto/examplepb/response_body_service.pb.go b/examples/proto/examplepb/response_body_service.pb.go index fcad76e5898..922aafa8fef 100644 --- a/examples/proto/examplepb/response_body_service.pb.go +++ b/examples/proto/examplepb/response_body_service.pb.go @@ -35,7 +35,7 @@ func (m *ResponseBodyIn) Reset() { *m = ResponseBodyIn{} } func (m *ResponseBodyIn) String() string { return proto.CompactTextString(m) } func (*ResponseBodyIn) ProtoMessage() {} func (*ResponseBodyIn) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_5010ebf28bf7b965, []int{0} + return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{0} } func (m *ResponseBodyIn) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyIn.Unmarshal(m, b) @@ -73,7 +73,7 @@ func (m *ResponseBodyOut) Reset() { *m = ResponseBodyOut{} } func (m *ResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut) ProtoMessage() {} func (*ResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_5010ebf28bf7b965, []int{1} + return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{1} } func (m *ResponseBodyOut) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyOut.Unmarshal(m, b) @@ -111,7 +111,7 @@ func (m *ResponseBodyOut_Response) Reset() { *m = ResponseBodyOut_Respon func (m *ResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut_Response) ProtoMessage() {} func (*ResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_5010ebf28bf7b965, []int{1, 0} + return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{1, 0} } func (m *ResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyOut_Response.Unmarshal(m, b) @@ -138,10 +138,127 @@ func (m *ResponseBodyOut_Response) GetData() string { return "" } +type RepeatedResponseBodyOut struct { + Response []*RepeatedResponseBodyOut_Response `protobuf:"bytes,2,rep,name=response,proto3" json:"response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RepeatedResponseBodyOut) Reset() { *m = RepeatedResponseBodyOut{} } +func (m *RepeatedResponseBodyOut) String() string { return proto.CompactTextString(m) } +func (*RepeatedResponseBodyOut) ProtoMessage() {} +func (*RepeatedResponseBodyOut) Descriptor() ([]byte, []int) { + return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{2} +} +func (m *RepeatedResponseBodyOut) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RepeatedResponseBodyOut.Unmarshal(m, b) +} +func (m *RepeatedResponseBodyOut) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RepeatedResponseBodyOut.Marshal(b, m, deterministic) +} +func (dst *RepeatedResponseBodyOut) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepeatedResponseBodyOut.Merge(dst, src) +} +func (m *RepeatedResponseBodyOut) XXX_Size() int { + return xxx_messageInfo_RepeatedResponseBodyOut.Size(m) +} +func (m *RepeatedResponseBodyOut) XXX_DiscardUnknown() { + xxx_messageInfo_RepeatedResponseBodyOut.DiscardUnknown(m) +} + +var xxx_messageInfo_RepeatedResponseBodyOut proto.InternalMessageInfo + +func (m *RepeatedResponseBodyOut) GetResponse() []*RepeatedResponseBodyOut_Response { + if m != nil { + return m.Response + } + return nil +} + +type RepeatedResponseBodyOut_Response struct { + Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RepeatedResponseBodyOut_Response) Reset() { *m = RepeatedResponseBodyOut_Response{} } +func (m *RepeatedResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } +func (*RepeatedResponseBodyOut_Response) ProtoMessage() {} +func (*RepeatedResponseBodyOut_Response) Descriptor() ([]byte, []int) { + return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{2, 0} +} +func (m *RepeatedResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RepeatedResponseBodyOut_Response.Unmarshal(m, b) +} +func (m *RepeatedResponseBodyOut_Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RepeatedResponseBodyOut_Response.Marshal(b, m, deterministic) +} +func (dst *RepeatedResponseBodyOut_Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepeatedResponseBodyOut_Response.Merge(dst, src) +} +func (m *RepeatedResponseBodyOut_Response) XXX_Size() int { + return xxx_messageInfo_RepeatedResponseBodyOut_Response.Size(m) +} +func (m *RepeatedResponseBodyOut_Response) XXX_DiscardUnknown() { + xxx_messageInfo_RepeatedResponseBodyOut_Response.DiscardUnknown(m) +} + +var xxx_messageInfo_RepeatedResponseBodyOut_Response proto.InternalMessageInfo + +func (m *RepeatedResponseBodyOut_Response) GetData() string { + if m != nil { + return m.Data + } + return "" +} + +type RepeatedResponseStrings struct { + Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RepeatedResponseStrings) Reset() { *m = RepeatedResponseStrings{} } +func (m *RepeatedResponseStrings) String() string { return proto.CompactTextString(m) } +func (*RepeatedResponseStrings) ProtoMessage() {} +func (*RepeatedResponseStrings) Descriptor() ([]byte, []int) { + return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{3} +} +func (m *RepeatedResponseStrings) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RepeatedResponseStrings.Unmarshal(m, b) +} +func (m *RepeatedResponseStrings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RepeatedResponseStrings.Marshal(b, m, deterministic) +} +func (dst *RepeatedResponseStrings) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepeatedResponseStrings.Merge(dst, src) +} +func (m *RepeatedResponseStrings) XXX_Size() int { + return xxx_messageInfo_RepeatedResponseStrings.Size(m) +} +func (m *RepeatedResponseStrings) XXX_DiscardUnknown() { + xxx_messageInfo_RepeatedResponseStrings.DiscardUnknown(m) +} + +var xxx_messageInfo_RepeatedResponseStrings proto.InternalMessageInfo + +func (m *RepeatedResponseStrings) GetValues() []string { + if m != nil { + return m.Values + } + return nil +} + func init() { proto.RegisterType((*ResponseBodyIn)(nil), "grpc.gateway.examples.examplepb.ResponseBodyIn") proto.RegisterType((*ResponseBodyOut)(nil), "grpc.gateway.examples.examplepb.ResponseBodyOut") proto.RegisterType((*ResponseBodyOut_Response)(nil), "grpc.gateway.examples.examplepb.ResponseBodyOut.Response") + proto.RegisterType((*RepeatedResponseBodyOut)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseBodyOut") + proto.RegisterType((*RepeatedResponseBodyOut_Response)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseBodyOut.Response") + proto.RegisterType((*RepeatedResponseStrings)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseStrings") } // Reference imports to suppress errors if they are not otherwise used. @@ -157,6 +274,8 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ResponseBodyServiceClient interface { GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) + ListResponseBodies(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseBodyOut, error) + ListResponseStrings(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseStrings, error) } type responseBodyServiceClient struct { @@ -176,9 +295,29 @@ func (c *responseBodyServiceClient) GetResponseBody(ctx context.Context, in *Res return out, nil } +func (c *responseBodyServiceClient) ListResponseBodies(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseBodyOut, error) { + out := new(RepeatedResponseBodyOut) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ResponseBodyService/ListResponseBodies", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *responseBodyServiceClient) ListResponseStrings(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseStrings, error) { + out := new(RepeatedResponseStrings) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ResponseBodyService/ListResponseStrings", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ResponseBodyServiceServer is the server API for ResponseBodyService service. type ResponseBodyServiceServer interface { GetResponseBody(context.Context, *ResponseBodyIn) (*ResponseBodyOut, error) + ListResponseBodies(context.Context, *ResponseBodyIn) (*RepeatedResponseBodyOut, error) + ListResponseStrings(context.Context, *ResponseBodyIn) (*RepeatedResponseStrings, error) } func RegisterResponseBodyServiceServer(s *grpc.Server, srv ResponseBodyServiceServer) { @@ -203,6 +342,42 @@ func _ResponseBodyService_GetResponseBody_Handler(srv interface{}, ctx context.C return interceptor(ctx, in, info, handler) } +func _ResponseBodyService_ListResponseBodies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResponseBodyIn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ResponseBodyServiceServer).ListResponseBodies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ResponseBodyService/ListResponseBodies", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ResponseBodyServiceServer).ListResponseBodies(ctx, req.(*ResponseBodyIn)) + } + return interceptor(ctx, in, info, handler) +} + +func _ResponseBodyService_ListResponseStrings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResponseBodyIn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ResponseBodyServiceServer).ListResponseStrings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ResponseBodyService/ListResponseStrings", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ResponseBodyServiceServer).ListResponseStrings(ctx, req.(*ResponseBodyIn)) + } + return interceptor(ctx, in, info, handler) +} + var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.examplepb.ResponseBodyService", HandlerType: (*ResponseBodyServiceServer)(nil), @@ -211,32 +386,47 @@ var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ MethodName: "GetResponseBody", Handler: _ResponseBodyService_GetResponseBody_Handler, }, + { + MethodName: "ListResponseBodies", + Handler: _ResponseBodyService_ListResponseBodies_Handler, + }, + { + MethodName: "ListResponseStrings", + Handler: _ResponseBodyService_ListResponseStrings_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/proto/examplepb/response_body_service.proto", } func init() { - proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_response_body_service_5010ebf28bf7b965) -} - -var fileDescriptor_response_body_service_5010ebf28bf7b965 = []byte{ - // 257 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x49, 0xad, 0x48, 0xcc, - 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x72, 0x0b, 0x92, 0xf4, - 0x8b, 0x52, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0xe3, 0x93, 0xf2, 0x53, 0x2a, 0xe3, 0x8b, 0x53, - 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0xc0, 0xaa, 0x84, 0xe4, 0xd3, 0x8b, 0x0a, 0x92, 0xf5, 0xd2, - 0x13, 0x4b, 0x52, 0xcb, 0x13, 0x2b, 0xf5, 0x60, 0x46, 0xe8, 0xc1, 0x35, 0x4b, 0xc9, 0xa4, 0xe7, - 0xe7, 0xa7, 0xe7, 0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, 0xe5, 0x97, 0x24, 0x96, - 0x64, 0xe6, 0xe7, 0x15, 0x43, 0xb4, 0x2b, 0xa9, 0x70, 0xf1, 0x05, 0x41, 0x4d, 0x77, 0xca, 0x4f, - 0xa9, 0xf4, 0xcc, 0x13, 0x12, 0xe2, 0x62, 0x49, 0x49, 0x2c, 0x49, 0x94, 0x60, 0x54, 0x60, 0xd4, - 0xe0, 0x0c, 0x02, 0xb3, 0x95, 0x3a, 0x18, 0xb9, 0xf8, 0x91, 0x95, 0xf9, 0x97, 0x96, 0x08, 0x85, - 0x72, 0x71, 0xc0, 0xdc, 0x25, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x6d, 0x64, 0xa9, 0x47, 0xc0, 0x2d, - 0x7a, 0x68, 0x66, 0xc0, 0xf9, 0x41, 0x70, 0xa3, 0xa4, 0xe4, 0xb8, 0x38, 0x60, 0xa2, 0xd8, 0x9c, - 0x62, 0xb4, 0x85, 0x91, 0x4b, 0x18, 0xd9, 0x98, 0x60, 0x48, 0x68, 0x08, 0xcd, 0x61, 0xe4, 0xe2, - 0x77, 0x4f, 0x2d, 0x41, 0x96, 0x12, 0xd2, 0x27, 0xc9, 0x41, 0x9e, 0x79, 0x52, 0x06, 0xa4, 0xfa, - 0x40, 0x49, 0xad, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x0a, 0x42, 0x22, 0xf0, 0x48, 0x02, 0xc5, 0x91, - 0x7e, 0x35, 0xc8, 0xad, 0xb5, 0x49, 0x70, 0x6f, 0x39, 0x71, 0x47, 0x71, 0xc2, 0x0d, 0x49, 0x62, - 0x03, 0x87, 0xbd, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x4a, 0x08, 0x5b, 0xf2, 0x01, 0x00, - 0x00, + proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_response_body_service_5b2acb9aa53489f0) +} + +var fileDescriptor_response_body_service_5b2acb9aa53489f0 = []byte{ + // 378 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x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0xff, 0xff, 0x39, 0xa0, 0x6e, 0xed, 0x18, 0x04, 0x00, 0x00, } diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index 41480f44bb9..804a4815442 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -55,6 +55,60 @@ func request_ResponseBodyService_GetResponseBody_0(ctx context.Context, marshale } +func request_ResponseBodyService_ListResponseBodies_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ResponseBodyIn + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["data"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") + } + + protoReq.Data, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) + } + + msg, err := client.ListResponseBodies(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ResponseBodyService_ListResponseStrings_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ResponseBodyIn + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["data"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") + } + + protoReq.Data, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) + } + + msg, err := client.ListResponseStrings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + // RegisterResponseBodyServiceHandlerFromEndpoint is same as RegisterResponseBodyServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterResponseBodyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { @@ -113,6 +167,46 @@ func RegisterResponseBodyServiceHandlerClient(ctx context.Context, mux *runtime. }) + mux.Handle("GET", pattern_ResponseBodyService_ListResponseBodies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ResponseBodyService_ListResponseBodies_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ResponseBodyService_ListResponseBodies_0(ctx, mux, outboundMarshaler, w, req, response_ResponseBodyService_ListResponseBodies_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ResponseBodyService_ListResponseStrings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ResponseBodyService_ListResponseStrings_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ResponseBodyService_ListResponseStrings_0(ctx, mux, outboundMarshaler, w, req, response_ResponseBodyService_ListResponseStrings_0{resp}, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -125,10 +219,36 @@ func (m response_ResponseBodyService_GetResponseBody_0) XXX_ResponseBody() inter return response.Response } +type response_ResponseBodyService_ListResponseBodies_0 struct { + proto.Message +} + +func (m response_ResponseBodyService_ListResponseBodies_0) XXX_ResponseBody() interface{} { + response := m.Message.(*RepeatedResponseBodyOut) + return response.Response +} + +type response_ResponseBodyService_ListResponseStrings_0 struct { + proto.Message +} + +func (m response_ResponseBodyService_ListResponseStrings_0) XXX_ResponseBody() interface{} { + response := m.Message.(*RepeatedResponseStrings) + return response.Values +} + var ( pattern_ResponseBodyService_GetResponseBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebody", "data"}, "")) + + pattern_ResponseBodyService_ListResponseBodies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebodies", "data"}, "")) + + pattern_ResponseBodyService_ListResponseStrings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsestrings", "data"}, "")) ) var ( forward_ResponseBodyService_GetResponseBody_0 = runtime.ForwardResponseMessage + + forward_ResponseBodyService_ListResponseBodies_0 = runtime.ForwardResponseMessage + + forward_ResponseBodyService_ListResponseStrings_0 = runtime.ForwardResponseMessage ) diff --git a/examples/proto/examplepb/response_body_service.proto b/examples/proto/examplepb/response_body_service.proto index 65d430e348d..9e2f0165a3e 100644 --- a/examples/proto/examplepb/response_body_service.proto +++ b/examples/proto/examplepb/response_body_service.proto @@ -5,22 +5,39 @@ package grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; -message ResponseBodyIn { - string data = 1; -} +message ResponseBodyIn { string data = 1; } message ResponseBodyOut { - message Response { - string data = 1; - } - Response response = 2; + message Response { string data = 1; } + Response response = 2; +} + +message RepeatedResponseBodyOut { + message Response { string data = 1; } + repeated Response response = 2; } +message RepeatedResponseStrings { repeated string values = 1; } + service ResponseBodyService { - rpc GetResponseBody(ResponseBodyIn) returns (ResponseBodyOut) { - option (google.api.http) = { - get: "/responsebody/{data}" - response_body: "response" - }; - } + rpc GetResponseBody(ResponseBodyIn) returns (ResponseBodyOut) { + option (google.api.http) = { + get : "/responsebody/{data}" + response_body : "response" + }; + } + + rpc ListResponseBodies(ResponseBodyIn) returns (RepeatedResponseBodyOut) { + option (google.api.http) = { + get : "/responsebodies/{data}" + response_body : "response" + }; + } + + rpc ListResponseStrings(ResponseBodyIn) returns (RepeatedResponseStrings) { + option (google.api.http) = { + get : "/responsestrings/{data}" + response_body : "values" + }; + } } diff --git a/examples/proto/examplepb/response_body_service.swagger.json b/examples/proto/examplepb/response_body_service.swagger.json index c13e7646bcf..c77d6ea05e0 100644 --- a/examples/proto/examplepb/response_body_service.swagger.json +++ b/examples/proto/examplepb/response_body_service.swagger.json @@ -15,6 +15,33 @@ "application/json" ], "paths": { + "/responsebodies/{data}": { + "get": { + "operationId": "ListResponseBodies", + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/examplepbRepeatedResponseBodyOutResponse" + } + } + } + }, + "parameters": [ + { + "name": "data", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ResponseBodyService" + ] + } + }, "/responsebody/{data}": { "get": { "operationId": "GetResponseBody", @@ -38,9 +65,66 @@ "ResponseBodyService" ] } + }, + "/responsestrings/{data}": { + "get": { + "operationId": "ListResponseStrings", + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "parameters": [ + { + "name": "data", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ResponseBodyService" + ] + } } }, "definitions": { + "examplepbRepeatedResponseBodyOut": { + "type": "object", + "properties": { + "response": { + "type": "array", + "items": { + "$ref": "#/definitions/examplepbRepeatedResponseBodyOutResponse" + } + } + } + }, + "examplepbRepeatedResponseBodyOutResponse": { + "type": "object", + "properties": { + "data": { + "type": "string" + } + } + }, + "examplepbRepeatedResponseStrings": { + "type": "object", + "properties": { + "values": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "examplepbResponseBodyOut": { "type": "object", "properties": { diff --git a/examples/server/responsebody.go b/examples/server/responsebody.go index 62cff2f47db..f27a0718be7 100644 --- a/examples/server/responsebody.go +++ b/examples/server/responsebody.go @@ -21,3 +21,19 @@ func (s *responseBodyServer) GetResponseBody(ctx context.Context, req *examples. }, }, nil } + +func (s *responseBodyServer) ListResponseBodies(ctx context.Context, req *examples.ResponseBodyIn) (*examples.RepeatedResponseBodyOut, error) { + return &examples.RepeatedResponseBodyOut{ + Response: []*examples.RepeatedResponseBodyOut_Response{ + &examples.RepeatedResponseBodyOut_Response{ + Data: req.Data, + }, + }, + }, nil +} + +func (s *responseBodyServer) ListResponseStrings(ctx context.Context, req *examples.ResponseBodyIn) (*examples.RepeatedResponseStrings, error) { + return &examples.RepeatedResponseStrings{ + Values: []string{"hello", req.Data}, + }, nil +} diff --git a/protoc-gen-grpc-gateway/BUILD.bazel b/protoc-gen-grpc-gateway/BUILD.bazel index 1af07f27f79..cb772efe9e1 100644 --- a/protoc-gen-grpc-gateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/BUILD.bazel @@ -25,7 +25,10 @@ go_binary( go_proto_compiler( name = "go_gen_grpc_gateway", - options = ["logtostderr=true"], + options = [ + "logtostderr=true", + "allow_repeated_fields_in_body=true", + ], plugin = ":protoc-gen-grpc-gateway", suffix = ".pb.gw.go", visibility = ["//visibility:public"], diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index a2933cdbeaa..d049ce596af 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -40,7 +40,7 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action inputs = direct_proto_srcs + transitive_proto_srcs + [protoc_gen_swagger] - options = ["logtostderr=true"] + options = ["logtostderr=true", "allow_repeated_fields_in_body=true"] if grpc_api_configuration: options.append("grpc_api_configuration=%s" % grpc_api_configuration.path) inputs.append(grpc_api_configuration) diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index 5c921f6e163..174e4fad384 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -24,6 +24,7 @@ var ( useJSONNamesForFields = flag.Bool("json_names_for_fields", false, "if it sets Field.GetJsonName() will be used for generating swagger definitions, otherwise Field.GetName() will be used") repeatedPathParamSeparator = flag.String("repeated_path_param_separator", "csv", "configures how repeated fields should be split. Allowed values are `csv`, `pipes`, `ssv` and `tsv`.") versionFlag = flag.Bool("version", false, "print the current verison") + allowRepeatedFieldsInBody = flag.Bool("allow_repeated_fields_in_body", false, "allows to use repeated field in `body` and `response_body` field of `google.api.http` annotation option") ) // Variables set by goreleaser at build time @@ -72,6 +73,7 @@ func main() { reg.SetAllowMerge(*allowMerge) reg.SetMergeFileName(*mergeFileName) reg.SetUseJSONNamesForFields(*useJSONNamesForFields) + reg.SetAllowRepeatedFieldsInBody(*allowRepeatedFieldsInBody) if err := reg.SetRepeatedPathParamSeparator(*repeatedPathParamSeparator); err != nil { emitError(err) return @@ -154,6 +156,13 @@ func parseReqParam(param string, f *flag.FlagSet, pkgMap map[string]string) erro } continue } + if spec[0] == "allow_repeated_fields_in_body" { + err := f.Set(spec[0], "true") + if err != nil { + return fmt.Errorf("Cannot set flag %s: %v", p, err) + } + continue + } err := f.Set(spec[0], "") if err != nil { return fmt.Errorf("Cannot set flag %s: %v", p, err) diff --git a/protoc-gen-swagger/main_test.go b/protoc-gen-swagger/main_test.go index 7bdca480979..dc8e09bdb12 100644 --- a/protoc-gen-swagger/main_test.go +++ b/protoc-gen-swagger/main_test.go @@ -1,116 +1,129 @@ package main import ( + "errors" "flag" "reflect" "testing" ) func TestParseReqParam(t *testing.T) { - - f := flag.CommandLine - // this one must be first - with no leading clearFlags call it - // verifies our expectation of default values as we reset by - // clearFlags - pkgMap := make(map[string]string) - expected := map[string]string{} - err := parseReqParam("", f, pkgMap) - if err != nil { - t.Errorf("Test 0: unexpected parse error '%v'", err) + testcases := []struct { + name string + expected map[string]string + request string + expectedError error + allowDeleteBodyV bool + allowMergeV bool + allowRepeatedFieldsInBodyV bool + fileV string + importPathV string + mergeFileNameV string + }{ + { + // this one must be first - with no leading clearFlags call it + // verifies our expectation of default values as we reset by + // clearFlags + name: "Test 0", + expected: map[string]string{}, + request: "", + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, + fileV: "-", importPathV: "", mergeFileNameV: "apidocs", + }, + { + name: "Test 1", + expected: map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"}, + request: "allow_delete_body,allow_merge,allow_repeated_fields_in_body,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", + allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, + fileV: "./foo.pb", importPathV: "/bar/baz", mergeFileNameV: "apidocs", + }, + { + name: "Test 2", + expected: map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"}, + request: "allow_delete_body=true,allow_merge=true,allow_repeated_fields_in_body=true,merge_file_name=test_name,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", + allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, + fileV: "./foo.pb", importPathV: "/bar/baz", mergeFileNameV: "test_name", + }, + { + name: "Test 3", + expected: map[string]string{"a/b/c.proto": "github.com/x/y/z", "f/g/h.proto": "github.com/1/2/3/"}, + request: "allow_delete_body=false,allow_merge=false,Ma/b/c.proto=github.com/x/y/z,Mf/g/h.proto=github.com/1/2/3/", + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, + fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", + }, + { + name: "Test 4", + expected: map[string]string{}, + request: "", + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, + fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", + }, + { + name: "Test 5", + expected: map[string]string{}, + request: "unknown_param=17", + expectedError: errors.New("Cannot set flag unknown_param=17: no such flag -unknown_param"), + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, + fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", + }, + { + name: "Test 6", + expected: map[string]string{}, + request: "Mfoo", + expectedError: errors.New("Cannot set flag Mfoo: no such flag -Mfoo"), + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, + fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", + }, + { + name: "Test 7", + expected: map[string]string{}, + request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body,merge_file_name", + allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, + fileV: "", importPathV: "", mergeFileNameV: "", + }, + { + name: "Test 8", + expected: map[string]string{}, + request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body=3,merge_file_name", + expectedError: errors.New(`Cannot set flag allow_repeated_fields_in_body=3: strconv.ParseBool: parsing "3": invalid syntax`), + allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: false, + fileV: "", importPathV: "", mergeFileNameV: "apidocs", + }, } - if !reflect.DeepEqual(pkgMap, expected) { - t.Errorf("Test 0: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) - } - checkFlags(false, false, "-", "", "apidocs", t, 0) - - clearFlags() - pkgMap = make(map[string]string) - expected = map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"} - err = parseReqParam("allow_delete_body,allow_merge,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) - if err != nil { - t.Errorf("Test 1: unexpected parse error '%v'", err) - } - if !reflect.DeepEqual(pkgMap, expected) { - t.Errorf("Test 1: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) - } - checkFlags(true, true, "./foo.pb", "/bar/baz", "apidocs", t, 1) - - clearFlags() - pkgMap = make(map[string]string) - expected = map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"} - err = parseReqParam("allow_delete_body=true,allow_merge=true,merge_file_name=test_name,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) - if err != nil { - t.Errorf("Test 2: unexpected parse error '%v'", err) - } - if !reflect.DeepEqual(pkgMap, expected) { - t.Errorf("Test 2: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) - } - checkFlags(true, true,"./foo.pb", "/bar/baz", "test_name", t, 2) - - clearFlags() - pkgMap = make(map[string]string) - expected = map[string]string{"a/b/c.proto": "github.com/x/y/z", "f/g/h.proto": "github.com/1/2/3/"} - err = parseReqParam("allow_delete_body=false,allow_merge=false,Ma/b/c.proto=github.com/x/y/z,Mf/g/h.proto=github.com/1/2/3/", f, pkgMap) - if err != nil { - t.Errorf("Test 3: unexpected parse error '%v'", err) - } - if !reflect.DeepEqual(pkgMap, expected) { - t.Errorf("Test 3: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) - } - checkFlags(false, false,"stdin", "", "apidocs", t, 3) - clearFlags() - pkgMap = make(map[string]string) - expected = map[string]string{} - err = parseReqParam("", f, pkgMap) - if err != nil { - t.Errorf("Test 4: unexpected parse error '%v'", err) - } - if !reflect.DeepEqual(pkgMap, expected) { - t.Errorf("Test 4: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) - } - checkFlags(false, false, "stdin", "", "apidocs", t, 4) - - clearFlags() - pkgMap = make(map[string]string) - expected = map[string]string{} - err = parseReqParam("unknown_param=17", f, pkgMap) - if err == nil { - t.Error("Test 5: expected parse error not returned") - } - if !reflect.DeepEqual(pkgMap, expected) { - t.Errorf("Test 5: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) - } - checkFlags(false, false,"stdin", "", "apidocs", t, 5) + for i, tc := range testcases { + t.Run(tc.name, func(tt *testing.T) { + f := flag.CommandLine + pkgMap := make(map[string]string) + err := parseReqParam(tc.request, f, pkgMap) + if tc.expectedError == nil { + if err != nil { + tt.Errorf("unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, tc.expected) { + tt.Errorf("pkgMap parse error, expected '%v', got '%v'", tc.expected, pkgMap) + } + } else { + if err == nil { + tt.Error("expected parse error not returned") + } + if !reflect.DeepEqual(pkgMap, tc.expected) { + tt.Errorf("pkgMap parse error, expected '%v', got '%v'", tc.expected, pkgMap) + } + if err.Error() != tc.expectedError.Error() { + tt.Errorf("expected error malformed, expected %q, go %q", tc.expectedError.Error(), err.Error()) + } + } + checkFlags(tc.allowDeleteBodyV, tc.allowMergeV, tc.allowRepeatedFieldsInBodyV, tc.fileV, tc.importPathV, tc.mergeFileNameV, tt, i) - clearFlags() - pkgMap = make(map[string]string) - expected = map[string]string{} - err = parseReqParam("Mfoo", f, pkgMap) - if err == nil { - t.Error("Test 6: expected parse error not returned") + clearFlags() + }) } - if !reflect.DeepEqual(pkgMap, expected) { - t.Errorf("Test 6: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) - } - checkFlags(false, false,"stdin", "", "apidocs", t, 6) - - clearFlags() - pkgMap = make(map[string]string) - expected = map[string]string{} - err = parseReqParam("allow_delete_body,file,import_prefix,allow_merge,merge_file_name", f, pkgMap) - if err != nil { - t.Errorf("Test 7: unexpected parse error '%v'", err) - } - if !reflect.DeepEqual(pkgMap, expected) { - t.Errorf("Test 7: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) - } - checkFlags(true, true, "", "", "", t, 7) } -func checkFlags(allowDeleteV, allowMergeV bool, fileV, importPathV, mergeFileNameV string, t *testing.T, tid int) { +func checkFlags(allowDeleteV, allowMergeV, allowRepeatedFieldsInBodyV bool, fileV, importPathV, mergeFileNameV string, t *testing.T, tid int) { if *importPrefix != importPathV { t.Errorf("Test %v: import_prefix misparsed, expected '%v', got '%v'", tid, importPathV, *importPrefix) } @@ -126,6 +139,9 @@ func checkFlags(allowDeleteV, allowMergeV bool, fileV, importPathV, mergeFileNam if *mergeFileName != mergeFileNameV { t.Errorf("Test %v: merge_file_name misparsed, expected '%v', got '%v'", tid, mergeFileNameV, *mergeFileName) } + if *allowRepeatedFieldsInBody != allowRepeatedFieldsInBodyV { + t.Errorf("Test %v: allow_repeated_fields_in_body misparsed, expected '%v', got '%v'", tid, allowRepeatedFieldsInBodyV, *allowRepeatedFieldsInBody) + } } func clearFlags() { @@ -133,5 +149,6 @@ func clearFlags() { *file = "stdin" *allowDeleteBody = false *allowMerge = false + *allowRepeatedFieldsInBody = false *mergeFileName = "apidocs" } From 8220da34291e4465394dd8ee79d2624e3883de6b Mon Sep 17 00:00:00 2001 From: Alex Bice Date: Fri, 18 Jan 2019 16:04:34 -0700 Subject: [PATCH 350/552] marshal_jsonpb: Added nil slice default value (#854) * marshal_jsonpb: Added nil slice default value * marshal_jsonpb: reduced indentation --- examples/integration/integration_test.go | 68 ++++++++---- examples/server/responsebody.go | 5 + runtime/marshal_jsonpb.go | 4 + runtime/marshal_jsonpb_test.go | 130 +++++++++++++++++++++++ 4 files changed, 189 insertions(+), 18 deletions(-) diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index f9ea66b9a26..c361300371d 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -1360,25 +1360,57 @@ func testResponseBodies(t *testing.T, port int) { } func testResponseStrings(t *testing.T, port int) { - url := fmt.Sprintf("http://localhost:%d/responsestrings/foo", port) - resp, err := http.Get(url) - if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) - return - } - defer resp.Body.Close() - buf, err := ioutil.ReadAll(resp.Body) - if err != nil { - t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) - return - } + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + // Run Secondary server with different marshalling + ch := make(chan error) + go func() { + if err := runGateway(ctx, ":8081", runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{EmitDefaults: true})); err != nil { + ch <- fmt.Errorf("cannot run gateway service: %v", err) + } + }() - if got, want := resp.StatusCode, http.StatusOK; got != want { - t.Errorf("resp.StatusCode = %d; want %d", got, want) - t.Logf("%s", buf) - } + port = 8081 - if got, want := string(buf), `["hello","foo"]`; got != want { - t.Errorf("response = %q; want %q", got, want) + for i, spec := range []struct { + endpoint string + expectedCode int + expectedBody string + }{ + { + endpoint: fmt.Sprintf("http://localhost:%d/responsestrings/foo", port), + expectedCode: http.StatusOK, + expectedBody: `["hello","foo"]`, + }, + { + endpoint: fmt.Sprintf("http://localhost:%d/responsestrings/empty", port), + expectedCode: http.StatusOK, + expectedBody: `[]`, + }, + } { + t.Run(strconv.Itoa(i), func(t *testing.T) { + url := spec.endpoint + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, spec.expectedCode; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + if got, want := string(buf), spec.expectedBody; got != want { + t.Errorf("response = %q; want %q", got, want) + } + }) } + } diff --git a/examples/server/responsebody.go b/examples/server/responsebody.go index f27a0718be7..e5dc800a423 100644 --- a/examples/server/responsebody.go +++ b/examples/server/responsebody.go @@ -33,6 +33,11 @@ func (s *responseBodyServer) ListResponseBodies(ctx context.Context, req *exampl } func (s *responseBodyServer) ListResponseStrings(ctx context.Context, req *examples.ResponseBodyIn) (*examples.RepeatedResponseStrings, error) { + if req.Data == "empty" { + return &examples.RepeatedResponseStrings{ + Values: []string{}, + }, nil + } return &examples.RepeatedResponseStrings{ Values: []string{"hello", req.Data}, }, nil diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index f56072a6f15..1567944e6f2 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -67,6 +67,10 @@ func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) { rv = rv.Elem() } + if rv.Kind() == reflect.Slice && rv.IsNil() && j.EmitDefaults { + return []byte("[]"), nil + } + if rv.Kind() == reflect.Map { m := make(map[string]*json.RawMessage) for _, k := range rv.MapKeys() { diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index 00dcfd99c5e..72d791d262b 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -3,6 +3,7 @@ package runtime_test import ( "bytes" "reflect" + "strconv" "strings" "testing" @@ -614,3 +615,132 @@ var ( // TODO(yugui) Add other well-known types once jsonpb supports them } ) + +func TestJSONPbMarshalResponseBodies(t *testing.T) { + for i, spec := range []struct { + input interface{} + emitDefaults bool + verifier func(json string) + }{ + { + input: &examplepb.ResponseBodyOut{ + Response: &examplepb.ResponseBodyOut_Response{Data: "abcdef"}, + }, + verifier: func(json string) { + expected := `{"response":{"data":"abcdef"}}` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + emitDefaults: true, + input: &examplepb.ResponseBodyOut{}, + verifier: func(json string) { + expected := `{"response":null}` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + input: &examplepb.RepeatedResponseBodyOut_Response{}, + verifier: func(json string) { + expected := `{}` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + emitDefaults: true, + input: &examplepb.RepeatedResponseBodyOut_Response{}, + verifier: func(json string) { + expected := `{"data":""}` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + input: ([]*examplepb.RepeatedResponseBodyOut_Response)(nil), + verifier: func(json string) { + expected := `null` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + emitDefaults: true, + input: ([]*examplepb.RepeatedResponseBodyOut_Response)(nil), + verifier: func(json string) { + expected := `[]` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + input: []*examplepb.RepeatedResponseBodyOut_Response{}, + verifier: func(json string) { + expected := `[]` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + input: []string{"something"}, + verifier: func(json string) { + expected := `["something"]` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + input: []string{}, + verifier: func(json string) { + expected := `[]` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + input: ([]string)(nil), + verifier: func(json string) { + expected := `null` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + emitDefaults: true, + input: ([]string)(nil), + verifier: func(json string) { + expected := `[]` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + } { + + t.Run(strconv.Itoa(i), func(t *testing.T) { + m := runtime.JSONPb{ + EmitDefaults: spec.emitDefaults, + } + val := spec.input + buf, err := m.Marshal(val) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success; spec=%v", val, err, spec) + } + if spec.verifier != nil { + spec.verifier(string(buf)) + } + }) + } +} From 5a9b22a21ec82b61d7f3d059e79adab96df029df Mon Sep 17 00:00:00 2001 From: Alex Bice Date: Mon, 21 Jan 2019 06:13:05 -0700 Subject: [PATCH 351/552] marshal_jsonpb: add check for slice sub types implementing proto.Message (#856) * marshal_jsonpb: add check for slice sub types implementing proto.Message * Added more tests. --- examples/clients/responsebody/BUILD.bazel | 1 + ...xamplepbRepeatedResponseBodyOutResponse.md | 1 + .../responsebody/docs/ResponseResponseType.md | 9 ++ ...epb_repeated_response_body_out_response.go | 2 + .../responsebody/response_response_type.go | 14 ++ examples/integration/integration_test.go | 7 +- .../examplepb/response_body_service.pb.go | 120 ++++++++++++------ .../examplepb/response_body_service.proto | 13 +- .../response_body_service.swagger.json | 13 ++ runtime/marshal_jsonpb.go | 39 +++++- runtime/marshal_jsonpb_test.go | 33 ++++- 11 files changed, 208 insertions(+), 44 deletions(-) create mode 100644 examples/clients/responsebody/docs/ResponseResponseType.md create mode 100644 examples/clients/responsebody/response_response_type.go diff --git a/examples/clients/responsebody/BUILD.bazel b/examples/clients/responsebody/BUILD.bazel index 393d28446e4..e621bea6960 100644 --- a/examples/clients/responsebody/BUILD.bazel +++ b/examples/clients/responsebody/BUILD.bazel @@ -15,6 +15,7 @@ go_library( "examplepb_response_body_out_response.go", "examplepb_response_body_req.go", "response_body_service_api.go", + "response_response_type.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/responsebody", visibility = ["//visibility:public"], diff --git a/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md b/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md index b11c5bb123f..64153cb125c 100644 --- a/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md +++ b/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Data** | **string** | | [optional] [default to null] +**Type_** | [**ResponseResponseType**](ResponseResponseType.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/examples/clients/responsebody/docs/ResponseResponseType.md b/examples/clients/responsebody/docs/ResponseResponseType.md new file mode 100644 index 00000000000..31085130a0c --- /dev/null +++ b/examples/clients/responsebody/docs/ResponseResponseType.md @@ -0,0 +1,9 @@ +# ResponseResponseType + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/clients/responsebody/examplepb_repeated_response_body_out_response.go b/examples/clients/responsebody/examplepb_repeated_response_body_out_response.go index c13c50cb507..8c5c20bac24 100644 --- a/examples/clients/responsebody/examplepb_repeated_response_body_out_response.go +++ b/examples/clients/responsebody/examplepb_repeated_response_body_out_response.go @@ -13,4 +13,6 @@ package responsebody type ExamplepbRepeatedResponseBodyOutResponse struct { Data string `json:"data,omitempty"` + + Type_ ResponseResponseType `json:"type,omitempty"` } diff --git a/examples/clients/responsebody/response_response_type.go b/examples/clients/responsebody/response_response_type.go new file mode 100644 index 00000000000..1c986fb7f92 --- /dev/null +++ b/examples/clients/responsebody/response_response_type.go @@ -0,0 +1,14 @@ +/* + * examples/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: version not set + * + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package responsebody + +type ResponseResponseType struct { +} diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index c361300371d..b0e8926a82c 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -1365,7 +1365,7 @@ func testResponseStrings(t *testing.T, port int) { // Run Secondary server with different marshalling ch := make(chan error) go func() { - if err := runGateway(ctx, ":8081", runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{EmitDefaults: true})); err != nil { + if err := runGateway(ctx, ":8081", runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{EnumsAsInts: false, EmitDefaults: true})); err != nil { ch <- fmt.Errorf("cannot run gateway service: %v", err) } }() @@ -1387,6 +1387,11 @@ func testResponseStrings(t *testing.T, port int) { expectedCode: http.StatusOK, expectedBody: `[]`, }, + { + endpoint: fmt.Sprintf("http://localhost:%d/responsebodies/foo", port), + expectedCode: http.StatusOK, + expectedBody: `[{"data":"foo","type":"UNKNOWN"}]`, + }, } { t.Run(strconv.Itoa(i), func(t *testing.T) { url := spec.endpoint diff --git a/examples/proto/examplepb/response_body_service.pb.go b/examples/proto/examplepb/response_body_service.pb.go index 922aafa8fef..ba11d58bb78 100644 --- a/examples/proto/examplepb/response_body_service.pb.go +++ b/examples/proto/examplepb/response_body_service.pb.go @@ -24,6 +24,35 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +type RepeatedResponseBodyOut_Response_ResponseType int32 + +const ( + // UNKNOWN + RepeatedResponseBodyOut_Response_UNKNOWN RepeatedResponseBodyOut_Response_ResponseType = 0 + // A is 1 + RepeatedResponseBodyOut_Response_A RepeatedResponseBodyOut_Response_ResponseType = 1 + // B is 2 + RepeatedResponseBodyOut_Response_B RepeatedResponseBodyOut_Response_ResponseType = 2 +) + +var RepeatedResponseBodyOut_Response_ResponseType_name = map[int32]string{ + 0: "UNKNOWN", + 1: "A", + 2: "B", +} +var RepeatedResponseBodyOut_Response_ResponseType_value = map[string]int32{ + "UNKNOWN": 0, + "A": 1, + "B": 2, +} + +func (x RepeatedResponseBodyOut_Response_ResponseType) String() string { + return proto.EnumName(RepeatedResponseBodyOut_Response_ResponseType_name, int32(x)) +} +func (RepeatedResponseBodyOut_Response_ResponseType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{2, 0, 0} +} + type ResponseBodyIn struct { Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -35,7 +64,7 @@ func (m *ResponseBodyIn) Reset() { *m = ResponseBodyIn{} } func (m *ResponseBodyIn) String() string { return proto.CompactTextString(m) } func (*ResponseBodyIn) ProtoMessage() {} func (*ResponseBodyIn) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{0} + return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{0} } func (m *ResponseBodyIn) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyIn.Unmarshal(m, b) @@ -73,7 +102,7 @@ func (m *ResponseBodyOut) Reset() { *m = ResponseBodyOut{} } func (m *ResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut) ProtoMessage() {} func (*ResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{1} + return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{1} } func (m *ResponseBodyOut) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyOut.Unmarshal(m, b) @@ -111,7 +140,7 @@ func (m *ResponseBodyOut_Response) Reset() { *m = ResponseBodyOut_Respon func (m *ResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut_Response) ProtoMessage() {} func (*ResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{1, 0} + return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{1, 0} } func (m *ResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyOut_Response.Unmarshal(m, b) @@ -149,7 +178,7 @@ func (m *RepeatedResponseBodyOut) Reset() { *m = RepeatedResponseBodyOut func (m *RepeatedResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseBodyOut) ProtoMessage() {} func (*RepeatedResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{2} + return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{2} } func (m *RepeatedResponseBodyOut) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseBodyOut.Unmarshal(m, b) @@ -177,17 +206,18 @@ func (m *RepeatedResponseBodyOut) GetResponse() []*RepeatedResponseBodyOut_Respo } type RepeatedResponseBodyOut_Response struct { - Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Type RepeatedResponseBodyOut_Response_ResponseType `protobuf:"varint,3,opt,name=type,proto3,enum=grpc.gateway.examples.examplepb.RepeatedResponseBodyOut_Response_ResponseType" json:"type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RepeatedResponseBodyOut_Response) Reset() { *m = RepeatedResponseBodyOut_Response{} } func (m *RepeatedResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseBodyOut_Response) ProtoMessage() {} func (*RepeatedResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{2, 0} + return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{2, 0} } func (m *RepeatedResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseBodyOut_Response.Unmarshal(m, b) @@ -214,6 +244,13 @@ func (m *RepeatedResponseBodyOut_Response) GetData() string { return "" } +func (m *RepeatedResponseBodyOut_Response) GetType() RepeatedResponseBodyOut_Response_ResponseType { + if m != nil { + return m.Type + } + return RepeatedResponseBodyOut_Response_UNKNOWN +} + type RepeatedResponseStrings struct { Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -225,7 +262,7 @@ func (m *RepeatedResponseStrings) Reset() { *m = RepeatedResponseStrings func (m *RepeatedResponseStrings) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseStrings) ProtoMessage() {} func (*RepeatedResponseStrings) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_5b2acb9aa53489f0, []int{3} + return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{3} } func (m *RepeatedResponseStrings) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseStrings.Unmarshal(m, b) @@ -259,6 +296,7 @@ func init() { proto.RegisterType((*RepeatedResponseBodyOut)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseBodyOut") proto.RegisterType((*RepeatedResponseBodyOut_Response)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseBodyOut.Response") proto.RegisterType((*RepeatedResponseStrings)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseStrings") + proto.RegisterEnum("grpc.gateway.examples.examplepb.RepeatedResponseBodyOut_Response_ResponseType", RepeatedResponseBodyOut_Response_ResponseType_name, RepeatedResponseBodyOut_Response_ResponseType_value) } // Reference imports to suppress errors if they are not otherwise used. @@ -400,33 +438,37 @@ var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_response_body_service_5b2acb9aa53489f0) -} - -var fileDescriptor_response_body_service_5b2acb9aa53489f0 = []byte{ - // 378 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0xd3, 0xc1, 0x4a, 0xc3, 0x30, - 0x18, 0x07, 0x70, 0xb2, 0x8d, 0xb1, 0x65, 0xe0, 0x20, 0x93, 0x6d, 0x0c, 0xd1, 0x5a, 0x44, 0x7b, - 0x6a, 0x75, 0x7a, 0xd0, 0xa3, 0xbb, 0xc8, 0x40, 0x10, 0x3a, 0xbc, 0x08, 0x32, 0xd2, 0xf5, 0xa3, - 0x14, 0x66, 0x12, 0x9a, 0x6c, 0x3a, 0xc4, 0x8b, 0x27, 0x0f, 0xde, 0xbc, 0x78, 0xf0, 0x05, 0x7c, - 0x1e, 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0x20, 0x9b, 0xc8, 0xc8, 0x5b, 0x65, 0x37, 0x19, - 0xb5, 0x9f, 0x0b, 0xb8, 0x96, 0x3d, 0xb9, 0x37, 0xab, 0x2d, 0x79, 0x43, 0xb8, 0x7a, 0x06, 0x2a, - 0x3b, 0x45, 0x9c, 0xa5, 0xae, 0xb7, 0xcb, 0x5a, 0xfb, 0xcb, 0xd6, 0xc3, 0xdc, 0x7d, 0xfc, 0xf8, - 0x7c, 0xc9, 0x19, 0x64, 0x5d, 0xb7, 0xdc, 0xb4, 0xe3, 0x9c, 0xfb, 0xe9, 0xe7, 0x3d, 0x78, 0xfa, - 0x26, 0xc8, 0x3b, 0xc2, 0xe4, 0x3c, 0x94, 0x59, 0x5f, 0x08, 0x72, 0x79, 0xe1, 0xf1, 0xaa, 0xe5, - 0x31, 0xad, 0x58, 0x6a, 0x92, 0x7a, 0x56, 0x1a, 0x82, 0x5c, 0x68, 0xad, 0x65, 0xad, 0x69, 0x49, - 0xfe, 0x01, 0x9b, 0x1c, 0x65, 0xee, 0xc5, 0xd8, 0x6d, 0xd2, 0xd0, 0x58, 0x39, 0x9b, 0x49, 0xb5, - 0x49, 0x3b, 0x74, 0x2a, 0x57, 0x65, 0x9d, 0xe6, 0x15, 0xe3, 0x3f, 0xf4, 0xf0, 0x2b, 0x00, 0x00, - 0xff, 0xff, 0x39, 0xa0, 0x6e, 0xed, 0x18, 0x04, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_response_body_service_811d1d707fc0d3aa) +} + +var fileDescriptor_response_body_service_811d1d707fc0d3aa = []byte{ + // 441 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0xcf, 0xaa, 0xd3, 0x40, + 0x14, 0xc6, 0x9d, 0xb4, 0x5e, 0x6f, 0x27, 0x72, 0x6f, 0x99, 0x2b, 0xf7, 0x86, 0x22, 0x1a, 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2, 0xd6, 0x96, 0xfc, 0x07, 0xd8, + 0x2a, 0x15, 0xbd, 0x59, 0xc2, 0x5e, 0x23, 0x67, 0x1a, 0x56, 0x6e, 0x4f, 0x6a, 0xda, 0xaa, 0x1d, + 0x46, 0xe6, 0xb3, 0x9e, 0x56, 0x8b, 0x0e, 0xca, 0x3f, 0xc6, 0xdd, 0xef, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x07, 0xc9, 0xea, 0x62, 0xa8, 0x04, 0x00, 0x00, } diff --git a/examples/proto/examplepb/response_body_service.proto b/examples/proto/examplepb/response_body_service.proto index 9e2f0165a3e..48b50f80545 100644 --- a/examples/proto/examplepb/response_body_service.proto +++ b/examples/proto/examplepb/response_body_service.proto @@ -13,7 +13,18 @@ message ResponseBodyOut { } message RepeatedResponseBodyOut { - message Response { string data = 1; } + message Response { + string data = 1; + enum ResponseType { + // UNKNOWN + UNKNOWN = 0; + // A is 1 + A = 1; + // B is 2 + B = 2; + } + ResponseType type = 3; + } repeated Response response = 2; } diff --git a/examples/proto/examplepb/response_body_service.swagger.json b/examples/proto/examplepb/response_body_service.swagger.json index c77d6ea05e0..820129e93eb 100644 --- a/examples/proto/examplepb/response_body_service.swagger.json +++ b/examples/proto/examplepb/response_body_service.swagger.json @@ -95,6 +95,16 @@ } }, "definitions": { + "ResponseResponseType": { + "type": "string", + "enum": [ + "UNKNOWN", + "A", + "B" + ], + "default": "UNKNOWN", + "title": "- UNKNOWN: UNKNOWN\n - A: A is 1\n - B: B is 2" + }, "examplepbRepeatedResponseBodyOut": { "type": "object", "properties": { @@ -111,6 +121,9 @@ "properties": { "data": { "type": "string" + }, + "type": { + "$ref": "#/definitions/ResponseResponseType" } } }, diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index 1567944e6f2..3530dddd0aa 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -50,6 +50,11 @@ func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error { return (*jsonpb.Marshaler)(j).Marshal(w, p) } +var ( + // protoMessageType is stored to prevent constant lookup of the same type at runtime. + protoMessageType = reflect.TypeOf((*proto.Message)(nil)).Elem() +) + // marshalNonProto marshals a non-message field of a protobuf message. // This function does not correctly marshals arbitrary data structure into JSON, // but it is only capable of marshaling non-message field values of protobuf, @@ -67,8 +72,38 @@ func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) { rv = rv.Elem() } - if rv.Kind() == reflect.Slice && rv.IsNil() && j.EmitDefaults { - return []byte("[]"), nil + if rv.Kind() == reflect.Slice { + if rv.IsNil() { + if j.EmitDefaults { + return []byte("[]"), nil + } + return []byte("null"), nil + } + + if rv.Type().Elem().Implements(protoMessageType) { + var buf bytes.Buffer + err := buf.WriteByte('[') + if err != nil { + return nil, err + } + for i := 0; i < rv.Len(); i++ { + if i != 0 { + err = buf.WriteByte(',') + if err != nil { + return nil, err + } + } + if err = (*jsonpb.Marshaler)(j).Marshal(&buf, rv.Index(i).Interface().(proto.Message)); err != nil { + return nil, err + } + } + err = buf.WriteByte(']') + if err != nil { + return nil, err + } + + return buf.Bytes(), nil + } } if rv.Kind() == reflect.Map { diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index 72d791d262b..cec41bda914 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -656,7 +656,7 @@ func TestJSONPbMarshalResponseBodies(t *testing.T) { emitDefaults: true, input: &examplepb.RepeatedResponseBodyOut_Response{}, verifier: func(json string) { - expected := `{"data":""}` + expected := `{"data":"","type":"UNKNOWN"}` if json != expected { t.Errorf("json not equal (%q, %q)", json, expected) } @@ -727,6 +727,37 @@ func TestJSONPbMarshalResponseBodies(t *testing.T) { } }, }, + { + input: []*examplepb.RepeatedResponseBodyOut_Response{ + &examplepb.RepeatedResponseBodyOut_Response{}, + &examplepb.RepeatedResponseBodyOut_Response{ + Data: "abc", + Type: examplepb.RepeatedResponseBodyOut_Response_A, + }, + }, + verifier: func(json string) { + expected := `[{},{"data":"abc","type":"A"}]` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, + { + emitDefaults: true, + input: []*examplepb.RepeatedResponseBodyOut_Response{ + &examplepb.RepeatedResponseBodyOut_Response{}, + &examplepb.RepeatedResponseBodyOut_Response{ + Data: "abc", + Type: examplepb.RepeatedResponseBodyOut_Response_B, + }, + }, + verifier: func(json string) { + expected := `[{"data":"","type":"UNKNOWN"},{"data":"abc","type":"B"}]` + if json != expected { + t.Errorf("json not equal (%q, %q)", json, expected) + } + }, + }, } { t.Run(strconv.Itoa(i), func(t *testing.T) { From 00289e6fe17efc6a6fb6238db067b5e4b9038ab3 Mon Sep 17 00:00:00 2001 From: Uladzimir Trehubenka Date: Tue, 22 Jan 2019 13:41:01 +0300 Subject: [PATCH 352/552] Added WithDisablePathLengthFallback option (to fix issue #447) (#855) --- runtime/mux.go | 30 ++++++++++++++++++----------- runtime/mux_test.go | 47 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 12 deletions(-) diff --git a/runtime/mux.go b/runtime/mux.go index 3064c69ecbd..ec81e55b5ef 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -20,13 +20,14 @@ type HandlerFunc func(w http.ResponseWriter, r *http.Request, pathParams map[str // It matches http requests to patterns and invokes the corresponding handler. type ServeMux struct { // handlers maps HTTP method to a list of handlers. - handlers map[string][]handler - forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error - marshalers marshalerRegistry - incomingHeaderMatcher HeaderMatcherFunc - outgoingHeaderMatcher HeaderMatcherFunc - metadataAnnotators []func(context.Context, *http.Request) metadata.MD - protoErrorHandler ProtoErrorHandlerFunc + handlers map[string][]handler + forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error + marshalers marshalerRegistry + incomingHeaderMatcher HeaderMatcherFunc + outgoingHeaderMatcher HeaderMatcherFunc + metadataAnnotators []func(context.Context, *http.Request) metadata.MD + protoErrorHandler ProtoErrorHandlerFunc + disablePathLengthFallback bool } // ServeMuxOption is an option that can be given to a ServeMux on construction. @@ -102,6 +103,13 @@ func WithProtoErrorHandler(fn ProtoErrorHandlerFunc) ServeMuxOption { } } +// WithDisablePathLengthFallback returns a ServeMuxOption for disable path length fallback. +func WithDisablePathLengthFallback() ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.disablePathLengthFallback = true + } +} + // NewServeMux returns a new ServeMux whose internal mapping is empty. func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ @@ -177,7 +185,7 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { components[l-1], verb = c[:idx], c[idx+1:] } - if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && isPathLengthFallback(r) { + if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && s.isPathLengthFallback(r) { r.Method = strings.ToUpper(override) if err := r.ParseForm(); err != nil { if s.protoErrorHandler != nil { @@ -211,7 +219,7 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { continue } // X-HTTP-Method-Override is optional. Always allow fallback to POST. - if isPathLengthFallback(r) { + if s.isPathLengthFallback(r) { if err := r.ParseForm(); err != nil { if s.protoErrorHandler != nil { _, outboundMarshaler := MarshalerForRequest(s, r) @@ -250,8 +258,8 @@ func (s *ServeMux) GetForwardResponseOptions() []func(context.Context, http.Resp return s.forwardResponseOptions } -func isPathLengthFallback(r *http.Request) bool { - return r.Method == "POST" && r.Header.Get("Content-Type") == "application/x-www-form-urlencoded" +func (s *ServeMux) isPathLengthFallback(r *http.Request) bool { + return !s.disablePathLengthFallback && r.Method == "POST" && r.Header.Get("Content-Type") == "application/x-www-form-urlencoded" } type handler struct { diff --git a/runtime/mux_test.go b/runtime/mux_test.go index f3ecbf63388..08ed6cc6806 100644 --- a/runtime/mux_test.go +++ b/runtime/mux_test.go @@ -27,6 +27,8 @@ func TestMuxServeHTTP(t *testing.T) { respStatus int respContent string + + disablePathLengthFallback bool }{ { patterns: nil, @@ -122,6 +124,45 @@ func TestMuxServeHTTP(t *testing.T) { respStatus: http.StatusOK, respContent: "GET /foo", }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + }, + reqMethod: "POST", + reqPath: "/foo", + headers: map[string]string{ + "Content-Type": "application/x-www-form-urlencoded", + }, + respStatus: http.StatusMethodNotAllowed, + respContent: "Method Not Allowed\n", + disablePathLengthFallback: true, + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + { + method: "POST", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + }, + reqMethod: "POST", + reqPath: "/foo", + headers: map[string]string{ + "Content-Type": "application/x-www-form-urlencoded", + }, + respStatus: http.StatusOK, + respContent: "POST /foo", + disablePathLengthFallback: true, + }, { patterns: []stubPattern{ { @@ -199,7 +240,11 @@ func TestMuxServeHTTP(t *testing.T) { respContent: "GET /foo/{id=*}:verb", }, } { - mux := runtime.NewServeMux() + var opts []runtime.ServeMuxOption + if spec.disablePathLengthFallback { + opts = append(opts, runtime.WithDisablePathLengthFallback()) + } + mux := runtime.NewServeMux(opts...) for _, p := range spec.patterns { func(p stubPattern) { pat, err := runtime.NewPattern(1, p.ops, p.pool, p.verb) From fb01528c356cf02ba1cf11ea2692c948f86661ee Mon Sep 17 00:00:00 2001 From: Fabian Hernandez Date: Tue, 22 Jan 2019 11:44:56 -0600 Subject: [PATCH 353/552] Adding support for default and required swagger annotation fields. (#852) * Adding support for default and required swagger annotation fields:Solves issue #851 * Fixing test for swagger generation * updating swagger definition * removing breaking changes over enums * Adding example for required field as an array --- .../abe/a_bit_of_everything_service_api.go | 6 +- .../abe/examplepb_a_bit_of_everything.go | 5 +- .../proto/examplepb/a_bit_of_everything.pb.go | 406 +++++++++--------- .../proto/examplepb/a_bit_of_everything.proto | 4 +- .../a_bit_of_everything.swagger.json | 21 +- protoc-gen-swagger/genswagger/template.go | 25 +- 6 files changed, 251 insertions(+), 216 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 85e864ca833..1e8956c2aff 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -42,7 +42,7 @@ func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythin * Create a new ABitOfEverything * This API creates a new ABitOfEverything * - * @param floatValue + * @param floatValue Float value field * @param doubleValue * @param int64Value * @param uint64Value @@ -521,10 +521,10 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * * * @param uuid + * @param floatValue Float value field * @param singleNestedName name is nested field. * @param singleNestedAmount * @param singleNestedOk - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param floatValue * @param doubleValue * @param int64Value * @param uint64Value @@ -549,7 +549,7 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 * @return *interface{} */ -func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*interface{}, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, singleNestedName string, singleNestedAmount int64, singleNestedOk string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go index 9701914d126..91320d0e7c3 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -23,11 +23,12 @@ type ExamplepbABitOfEverything struct { Nested []ABitOfEverythingNested `json:"nested,omitempty"` + // Float value field FloatValue float32 `json:"float_value,omitempty"` - DoubleValue float64 `json:"double_value,omitempty"` + DoubleValue float64 `json:"double_value"` - Int64Value string `json:"int64_value,omitempty"` + Int64Value string `json:"int64_value"` Uint64Value string `json:"uint64_value,omitempty"` diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index bb0eb2d17c9..896288bd685 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{0} + return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -129,7 +129,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{0} + return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -467,7 +467,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{0, 0} + return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -536,7 +536,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{1} + return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -679,7 +679,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{2} + return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -718,7 +718,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{3} + return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -765,7 +765,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_583e142cf4e91dc2, []int{4} + return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1529,198 +1529,200 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_583e142cf4e91dc2) -} - -var fileDescriptor_a_bit_of_everything_583e142cf4e91dc2 = []byte{ - // 3012 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0x5b, 0x6f, 0x1b, 0xc7, - 0xb9, 0x5a, 0x2e, 0x75, 0x1b, 0xdd, 0xa8, 0x91, 0x2f, 0x32, 0xad, 0x44, 0x63, 0xc6, 0x39, 0xd9, - 0x28, 0x26, 0x57, 0xa2, 0x14, 0xc7, 0x66, 0x90, 0xf8, 0x50, 0x17, 0xdb, 0x8a, 0x6d, 0x59, 0x5e, - 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, 0x91, 0xa4, 0x24, - 0x34, 0x20, 0xb6, 0xee, 0xf3, 0x1d, 0x78, 0x0e, 0x4c, 0x56, 0xa8, 0x5b, 0x6a, 0x10, 0x1f, 0x22, - 0x89, 0x24, 0x45, 0xd2, 0x26, 0xbc, 0x3d, 0x0f, 0x64, 0x11, 0x4c, 0xe8, 0x26, 0xbb, 0xb8, 0xe6, - 0x43, 0x0c, 0x23, 0x49, 0x91, 0x35, 0x20, 0xb6, 0x3a, 0x34, 0xdc, 0x30, 0xc4, 0x08, 0x92, 0x94, - 0xa4, 0x36, 0xe1, 0x86, 0x40, 0x3c, 0x1a, 0xab, 0x79, 0x1f, 0x62, 0x14, 0x49, 0xca, 0xb0, 0xa0, - 0xb1, 0x9a, 0xf7, 0x00, 0x5e, 0x03, 0x53, 0x55, 0xfd, 0x29, 0xa9, 0x74, 0x88, 0x8c, 0x21, 0x49, - 0x19, 0xd1, 0x26, 0xfd, 0xcd, 0x28, 0x50, 0x87, 0xce, 0x38, 0x92, 0x94, 0x51, 0x1f, 0x28, 0xa0, - 0xf4, 0x0a, 0x00, 0x25, 0x4a, 0x1b, 0x3e, 0x04, 0x40, 0x92, 0x32, 0xa6, 0x8d, 0xf3, 0x9d, 0x8e, - 0xb0, 0x0e, 0xb3, 0x75, 0xb3, 0xe6, 0x03, 0x4c, 0x70, 0xaf, 0x6a, 0x13, 0xde, 0x5e, 0x47, 0xd8, - 0x52, 0x93, 0x11, 0xc7, 0x87, 0x78, 0x05, 0x49, 0xca, 0xa4, 0x06, 0xc4, 0x56, 0x44, 0xe1, 0x8e, - 0x18, 0x53, 0x48, 0x52, 0xa6, 0x3c, 0x85, 0x03, 0x29, 0x6e, 0x00, 0xc0, 0xaf, 0x92, 0x0f, 0x30, - 0x8d, 0x24, 0x65, 0x3a, 0x7f, 0xe1, 0x58, 0x77, 0xee, 0xb8, 0x06, 0xb1, 0xf5, 0xf2, 0x96, 0xe9, - 0x1a, 0xda, 0x38, 0xc7, 0xf7, 0x88, 0xed, 0x82, 0x99, 0xce, 0xe5, 0xf4, 0x29, 0xbe, 0x2a, 0x28, - 0x2a, 0x7d, 0x28, 0x06, 0x77, 0x3a, 0xb7, 0x8b, 0x59, 0x5d, 0x50, 0x9b, 0xb2, 0xfc, 0x2f, 0x8f, - 0xa2, 0x03, 0x4e, 0x79, 0x11, 0xb2, 0x17, 0x27, 0xbc, 0x28, 0x08, 0xbf, 0x7f, 0x1c, 0xe1, 0x5b, - 0xde, 0x2d, 0x0f, 0xe8, 0xfb, 0x71, 0xd7, 0x61, 0x37, 0x67, 0x46, 0xd6, 0x1e, 0xd3, 0xd7, 0xc1, - 0xb4, 0x13, 0xf5, 0xdf, 0x0c, 0x92, 0x94, 0x19, 0x6d, 0xca, 0x89, 0x38, 0xb0, 0x03, 0xd6, 0x89, - 0x85, 0x14, 0x92, 0x94, 0x54, 0x00, 0x16, 0x8a, 0x3a, 0x27, 0xec, 0x84, 0x59, 0x24, 0x29, 0xb3, - 0xda, 0x84, 0x13, 0x72, 0x82, 0x0f, 0xd2, 0xa1, 0x03, 0x91, 0xa4, 0x40, 0x0f, 0x24, 0xa0, 0x92, - 0x07, 0x27, 0x6d, 0x62, 0x11, 0xcc, 0x4d, 0x11, 0x89, 0x8b, 0x39, 0x24, 0x2b, 0xe3, 0xda, 0x5c, - 0x70, 0x78, 0x37, 0x14, 0x1f, 0x97, 0xc1, 0x04, 0x35, 0x09, 0xcf, 0xfc, 0x3c, 0xed, 0xce, 0x9f, - 0x10, 0xd9, 0xe6, 0x54, 0xce, 0xcb, 0x74, 0xb9, 0x20, 0xd3, 0xe5, 0xb6, 0xf8, 0xe9, 0xf5, 0x21, - 0x0d, 0x08, 0x60, 0xb1, 0x82, 0xaf, 0x81, 0x49, 0x0f, 0xd5, 0xe3, 0x35, 0x7f, 0x92, 0x47, 0xdf, - 0xf5, 0x21, 0xcd, 0x23, 0xe8, 0x31, 0x81, 0x0f, 0xc1, 0xb8, 0x81, 0x2d, 0x5f, 0x8e, 0x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 0x6a, - 0x6f, 0x83, 0xd3, 0xb7, 0x8e, 0xb2, 0x4f, 0xf8, 0x4e, 0x0d, 0x7a, 0x97, 0x1e, 0x8c, 0x77, 0x3c, - 0x57, 0x1a, 0x11, 0xf7, 0x79, 0xf5, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8e, 0xc2, 0x5e, 0xf3, - 0x48, 0x24, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_74470c9779693dcd) +} + +var fileDescriptor_a_bit_of_everything_74470c9779693dcd = []byte{ + // 3044 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0xcb, 0x6f, 0x1b, 0xc7, + 0xdd, 0x5a, 0xae, 0x9e, 0xa3, 0x17, 0x35, 0xf2, 0x43, 0xa6, 0x95, 0x68, 0xcc, 0x38, 0xc9, 0x5a, + 0x31, 0xb9, 0xd2, 0x4a, 0x71, 0x6c, 0x06, 0x89, 0x3f, 0xea, 0x61, 0x5b, 0xb1, 0x2d, 0xcb, 0x6b, + 0xc7, 0x5f, 0xe0, 0xd8, 0x11, 0x86, 0xe4, 0x50, 0x5c, 0x8b, 0xbb, 0xb3, 0xd9, 0x9d, 0x95, 0xcd, + 0x4f, 0x1f, 0xbf, 0x2f, 0x7d, 0xa0, 0x45, 0x9b, 0x43, 0x01, 0x05, 0x3d, 0xb4, 0x28, 0xfa, 0x17, + 0xf4, 0xda, 0x53, 0x0e, 0x6d, 0x0f, 0x3d, 0xf5, 0xe6, 0x16, 0x01, 0x8a, 0x02, 0xb9, 0xb4, 0x05, + 0xfa, 0x17, 0x14, 0xe8, 0xa5, 0x28, 0x66, 0x76, 0x97, 0xda, 0x5d, 0x92, 0x96, 0x69, 0x07, 0xb9, + 0x48, 0x3b, 0x33, 0xbf, 0xd7, 0xfc, 0xde, 0xbf, 0x21, 0xd0, 0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47, 0xbd, 0x08, 0x88, 0x4f, 0x63, 0x49, 0x0b, + 0x20, 0x86, 0x90, 0xa4, 0x0c, 0x08, 0x1a, 0x4b, 0x9a, 0x0f, 0xf0, 0x1a, 0x18, 0xaf, 0x1a, 0x4f, + 0x48, 0xa5, 0x45, 0x64, 0x18, 0x49, 0xca, 0xa0, 0x3e, 0x16, 0x6c, 0xc6, 0x81, 0x5a, 0x74, 0x46, + 0x90, 0xa4, 0x0c, 0x05, 0x40, 0x21, 0xa5, 0x57, 0x00, 0x28, 0x51, 0x5a, 0x0f, 0x20, 0x00, 0x92, + 0x94, 0x61, 0x7d, 0x84, 0xef, 0xb4, 0x84, 0x75, 0x99, 0x63, 0x58, 0x3b, 0x01, 0xc0, 0x28, 0x77, + 0x00, 0x7d, 0xd4, 0xdf, 0x6b, 0x09, 0x5b, 0x6a, 0x30, 0xe2, 0x06, 0x10, 0xaf, 0x20, 0x49, 0x19, + 0xd3, 0x81, 0xd8, 0x8a, 0x5d, 0xb8, 0x25, 0xc6, 0x38, 0x92, 0x94, 0x71, 0xff, 0xc2, 0xa1, 0x14, + 0xd7, 0x01, 0xe0, 0x51, 0x17, 0x00, 0x4c, 0x20, 0x49, 0x99, 0xd0, 0xce, 0x1f, 0x69, 0xf9, 0x4d, + 0xcf, 0x24, 0x8e, 0x51, 0x5e, 0xb7, 0x3c, 0x53, 0x1f, 0xe1, 0xf8, 0x3e, 0xb1, 0x2d, 0x30, 0xd9, + 0x8a, 0xe3, 0x80, 0xe2, 0xab, 0x82, 0xa2, 0xd2, 0x85, 0x62, 0x18, 0xfe, 0xf9, 0x2d, 0xcc, 0x6a, + 0x82, 0xda, 0xb8, 0x1d, 0x7c, 0xf9, 0x14, 0x5d, 0x70, 0xc2, 0x77, 0xa6, 0xed, 0x24, 0xe1, 0x39, + 0x41, 0xf8, 0xfd, 0xa3, 0x08, 0xdf, 0xf4, 0x13, 0x42, 0x48, 0x3f, 0x70, 0xd1, 0x16, 0xbb, 0x69, + 0x2b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 0xcb, 0x71, 0xf6, 0x3d, 0xaf, 0x9d, 0x73, 0x64, 0x1f, + 0x16, 0xc0, 0x8c, 0x45, 0xad, 0x55, 0x6a, 0xed, 0x11, 0x8b, 0x57, 0x1e, 0x5c, 0xdf, 0xc4, 0xa6, + 0x9f, 0xde, 0x66, 0x32, 0x22, 0x01, 0x74, 0x3d, 0x87, 0xab, 0x60, 0xb2, 0x55, 0xde, 0x02, 0x89, + 0x4f, 0x0b, 0x8b, 0x67, 0xda, 0x2c, 0x7e, 0x37, 0x84, 0xd3, 0x27, 0x5a, 0x28, 0x3e, 0x91, 0x07, + 0xa0, 0xe5, 0x49, 0xd1, 0x60, 0x9b, 0x45, 0x72, 0xcf, 0x79, 0x61, 0x2a, 0x24, 0xd4, 0x0a, 0xac, + 0xcc, 0xef, 0x24, 0x30, 0x18, 0xd4, 0x35, 0x08, 0xfa, 0x2d, 0x6c, 0x12, 0xbf, 0xae, 0xe9, 0xe2, + 0x1b, 0x9e, 0x00, 0x83, 0xd8, 0xa4, 0x9e, 0xc5, 0x66, 0x52, 0x22, 0x51, 0x05, 0x2b, 0x78, 0x1b, + 0xa4, 0xe8, 0xae, 0x28, 0x1f, 0x13, 0x5a, 0xf1, 0x45, 0xab, 0x52, 0x7e, 0x8d, 0x10, 0x5b, 0x08, + 0x96, 0xa2, 0xbb, 0xd9, 0x39, 0x30, 0x1c, 0xae, 0xe1, 0x08, 0x18, 0xb8, 0x52, 0xbc, 0x71, 0x67, + 0x3d, 0xdd, 0x07, 0x87, 0x41, 0xff, 0x5d, 0xfd, 0xc3, 0xf5, 0xb4, 0x54, 0x38, 0x79, 0x50, 0x3c, + 0xa6, 0x41, 0x98, 0xde, 0x47, 0x59, 0xba, 0x9b, 0x2d, 0xa0, 0x2c, 0xdf, 0xcf, 0xa2, 0x66, 0xc6, + 0x00, 0xe3, 0x31, 0x8f, 0x85, 0x69, 0x20, 0xef, 0x92, 0x46, 0x70, 0x11, 0xfe, 0x09, 0x57, 0xc0, + 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, 0x7c, + 0x23, 0xa2, 0xd0, 0xc7, 0xd4, 0x15, 0x2f, 0xf6, 0x09, 0x75, 0x45, 0x5b, 0x43, 0x80, 0x64, 0x65, + 0x2c, 0xae, 0xae, 0x95, 0xc3, 0x36, 0xb1, 0xa3, 0x99, 0x5a, 0xd7, 0x1d, 0x45, 0xb2, 0x32, 0xde, + 0x6e, 0xa6, 0xf0, 0xb6, 0x24, 0x79, 0xdb, 0x48, 0xd9, 0x18, 0x7b, 0x81, 0xb2, 0x11, 0xd3, 0xcd, + 0x61, 0x4f, 0x76, 0x19, 0xcc, 0x26, 0x74, 0x13, 0x37, 0xca, 0x38, 0x92, 0x95, 0x49, 0xfd, 0x54, + 0x4c, 0x3b, 0xb1, 0x6e, 0xad, 0x0b, 0x81, 0x96, 0x53, 0x4c, 0x20, 0x59, 0x49, 0x77, 0x22, 0xd0, + 0xd5, 0x99, 0x63, 0x5d, 0xdd, 0x24, 0x92, 0x95, 0xa9, 0x84, 0x75, 0x22, 0x5a, 0xea, 0x88, 0x1c, + 0xe9, 0x1b, 0x65, 0x05, 0xb6, 0x23, 0x07, 0x9c, 0x0b, 0xb5, 0x83, 0x22, 0xd1, 0xca, 0x10, 0xef, + 0xa3, 0x6c, 0x37, 0xc7, 0xca, 0x16, 0xd0, 0xc7, 0xcc, 0xf1, 0xc8, 0x79, 0xe4, 0xff, 0xad, 0xe2, + 0xba, 0x1b, 0x2c, 0x1e, 0x9e, 0x4f, 0xa2, 0x45, 0xe4, 0xe6, 0x78, 0x8b, 0xe7, 0x91, 0x76, 0x1e, + 0x2d, 0x3d, 0x44, 0xcd, 0x6c, 0x06, 0xf4, 0xaf, 0xd0, 0x4a, 0xa3, 0x53, 0x75, 0xce, 0x3e, 0x00, + 0x93, 0x41, 0x33, 0xfd, 0xdf, 0x06, 0xab, 0x09, 0xb0, 0x09, 0x90, 0x0a, 0x47, 0x53, 0x3d, 0x65, + 0xf0, 0x14, 0xd5, 0x5f, 0xc1, 0x0c, 0x07, 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37, 0x56, 0xe3, 0xba, 0x77, 0xf3, 0xed, 0x78, 0x87, + 0xdd, 0x7a, 0xc7, 0x8b, 0x74, 0x65, 0xd8, 0x5e, 0xc2, 0xba, 0xb4, 0xc8, 0x5d, 0x8e, 0xbb, 0xde, + 0xd3, 0x7d, 0x16, 0xd7, 0x58, 0x89, 0x85, 0xbf, 0x97, 0x41, 0xff, 0x7a, 0xb9, 0x46, 0x61, 0xb7, + 0x77, 0x5e, 0xd7, 0x2b, 0xe5, 0xfd, 0x61, 0x25, 0x4c, 0x0e, 0xcf, 0x0d, 0x99, 0xfd, 0x47, 0xea, + 0xa0, 0xf8, 0x9d, 0x14, 0x18, 0x23, 0xe5, 0x1a, 0x45, 0xae, 0xdf, 0x5a, 0x81, 0x61, 0xb1, 0x72, + 0xec, 0x32, 0x9c, 0xba, 0xe3, 0x99, 0x26, 0x76, 0x1a, 0x05, 0xb4, 0x1e, 0x6c, 0x65, 0xd2, 0x6b, + 0xc4, 0x2d, 0x3b, 0x86, 0xf8, 0x1d, 0x47, 0xec, 0x66, 0xd7, 0x00, 0x8c, 0x87, 0xad, 0x90, 0xb6, + 0xc7, 0x60, 0xfd, 0xe0, 0x32, 0x90, 0xdf, 0x5e, 0x58, 0x82, 0x17, 0xc1, 0x05, 0x9d, 0x30, 0xcf, + 0xb1, 0x48, 0x05, 0x3d, 0xae, 0x11, 0x0b, 0xb1, 0x1a, 0x41, 0x0e, 0x71, 0xa9, 0xe7, 0x94, 0x09, + 0x32, 0x5c, 0xc4, 0x88, 0x69, 0x53, 0x07, 0x3b, 0x46, 0xbd, 0x81, 0x3c, 0x0b, 0xef, 0x61, 0xa3, + 0x8e, 0x4b, 0x75, 0x92, 0xff, 0xe0, 0x5d, 0x20, 0x2f, 0x2f, 0x2c, 0xc3, 0x65, 0x30, 0xff, 0x0c, + 0x02, 0x15, 0x4a, 0x5c, 0x64, 0x51, 0x86, 0xc8, 0x13, 0xc3, 0x65, 0x79, 0x38, 0x08, 0xfa, 0x7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, 0x30, 0x09, 0x46, 0x56, 0xb0, 0x6b, 0x94, 0x45, 0xff, 0x9f, 0x1a, 0x96, 0xc0, + 0x2b, 0xb1, 0x89, 0x60, 0x72, 0x38, 0x95, 0x19, 0xf9, 0x28, 0x57, 0xdc, 0xda, 0xc8, 0x5d, 0x27, + 0x0d, 0x94, 0x02, 0x5f, 0x49, 0xad, 0x09, 0xe1, 0x0f, 0xd2, 0xb0, 0xac, 0xf4, 0x6b, 0xaf, 0x85, + 0x36, 0x8c, 0x18, 0x5c, 0xa5, 0xd8, 0x63, 0x35, 0x95, 0xff, 0xa1, 0x8e, 0xf1, 0x3f, 0xa4, 0x30, + 0xd7, 0x1d, 0x88, 0xd1, 0x5d, 0x62, 0xad, 0xfc, 0x3f, 0xc8, 0xf8, 0x03, 0x07, 0x84, 0x57, 0x1d, + 0x6c, 0x31, 0x17, 0xf1, 0x45, 0xa0, 0x3d, 0x30, 0x1b, 0x8c, 0x21, 0x70, 0x3a, 0x38, 0x14, 0xab, + 0xf0, 0x74, 0x15, 0x0c, 0xe0, 0x8a, 0x69, 0x58, 0xb0, 0x10, 0x43, 0xb5, 0x2a, 0x31, 0x30, 0x61, + 0x0c, 0x0e, 0x66, 0xb8, 0x8c, 0x57, 0xa2, 0x3d, 0x82, 0x0c, 0xab, 0x4a, 0x1d, 0x53, 0xd8, 0xbb, + 0x34, 0x07, 0xc6, 0xa3, 0xaa, 0xe8, 0x4b, 0x8e, 0x46, 0xa5, 0x73, 0x5d, 0x87, 0xa3, 0x24, 0xa8, + 0xb3, 0x01, 0x4e, 0xde, 0x3c, 0xcc, 0x3e, 0xd1, 0x98, 0xea, 0x35, 0x96, 0xee, 0x8f, 0xb4, 0x2c, + 0x57, 0x1a, 0x14, 0xf1, 0xbc, 0xf4, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xec, 0x8b, 0x0d, 0x32, + 0x91, 0x24, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index eba0d7d629c..9533cad3e5e 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -138,7 +138,7 @@ message ABitOfEverything { json_schema: { title: "A bit of everything" description: "Intentionaly complicated message type to cover many features of Protobuf." - required: ["uuid"] + required: ["uuid", "int64_value", "double_value"] } external_docs: { url: "https://github.com/grpc-ecosystem/grpc-gateway"; @@ -168,7 +168,7 @@ message ABitOfEverything { string uuid = 1 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", min_length: 1}]; repeated Nested nested = 2; - float float_value = 3; + float float_value = 3 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {description: "Float value field", default: "0.2", required: ['float_value']}]; double double_value = 4; int64 int64_value = 5; uint64 uint64_value = 6; diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index b4c3e5bb17e..3e246b63c78 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -183,10 +183,12 @@ }, { "name": "float_value", + "description": "Float value field", "in": "query", - "required": false, + "required": true, "type": "number", - "format": "float" + "format": "float", + "default": "0.2" }, { "name": "double_value", @@ -405,10 +407,12 @@ "parameters": [ { "name": "float_value", + "description": "Float value field", "in": "path", "required": true, "type": "number", - "format": "float" + "format": "float", + "default": "0.2" }, { "name": "double_value", @@ -1452,7 +1456,12 @@ }, "float_value": { "type": "number", - "format": "float" + "format": "float", + "default": "0.2", + "description": "Float value field", + "required": [ + "float_value" + ] }, "double_value": { "type": "number", @@ -1570,7 +1579,9 @@ "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ - "uuid" + "uuid", + "int64_value", + "double_value" ] }, "examplepbABitOfEverythingRepeated": { diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 5c869e0f31d..e8675963b75 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -90,7 +90,7 @@ func messageToQueryParameters(message *descriptor.Message, reg *descriptor.Regis return params, nil } -// queryParams converts a field to a list of swagger query parameters recuresively. +// queryParams converts a field to a list of swagger query parameters recursively. func queryParams(message *descriptor.Message, field *descriptor.Field, prefix string, reg *descriptor.Registry, pathParams []descriptor.Parameter) (params []swaggerParameterObject, err error) { // make sure the parameter is not already listed as a path parameter for _, pathParam := range pathParams { @@ -120,14 +120,27 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st if schema.Title != "" { // merge title because title of parameter object will be ignored desc = strings.TrimSpace(schema.Title + ". " + schema.Description) } + + // verify if the field is required + required := false + for _, fieldName := range schema.Required { + if fieldName == field.GetName() { + required = true + break + } + } + param := swaggerParameterObject{ Name: prefix + field.GetName(), Description: desc, In: "query", + Default: schema.Default, Type: schema.Type, Items: schema.Items, Format: schema.Format, + Required: required, } + if isEnum { enum, err := reg.LookupEnum("", fieldType) if err != nil { @@ -250,6 +263,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, schema.MaxLength = protoSchema.MaxLength schema.MinLength = protoSchema.MinLength schema.Pattern = protoSchema.Pattern + schema.Default = protoSchema.Default schema.MaxItems = protoSchema.MaxItems schema.MinItems = protoSchema.MinItems schema.UniqueItems = protoSchema.UniqueItems @@ -589,7 +603,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re parameters := swaggerParametersObject{} for _, parameter := range b.PathParams { - var paramType, paramFormat, desc, collectionFormat string + var paramType, paramFormat, desc, collectionFormat, defaultValue string var enumNames []string var items *swaggerItemsObject var minItems *int @@ -603,6 +617,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re paramType = schema.Type paramFormat = schema.Format desc = schema.Description + defaultValue = schema.Default } else { return fmt.Errorf("only primitive and well-known types are allowed in path parameters") } @@ -620,6 +635,10 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re if !ok { return fmt.Errorf("unknown field type %v", pt) } + + schema := schemaOfField(parameter.Target, reg, customRefs) + desc = schema.Description + defaultValue = schema.Default } if parameter.IsRepeated() { @@ -646,6 +665,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re Description: desc, In: "path", Required: true, + Default: defaultValue, // Parameters in gRPC-Gateway can only be strings? Type: paramType, Format: paramFormat, @@ -1440,6 +1460,7 @@ func updateSwaggerObjectFromJSONSchema(s *swaggerSchemaObject, j *swagger_option s.MaxLength = j.GetMaxLength() s.MinLength = j.GetMinLength() s.Pattern = j.GetPattern() + s.Default = j.GetDefault() s.MaxItems = j.GetMaxItems() s.MinItems = j.GetMinItems() s.UniqueItems = j.GetUniqueItems() From ff2ddac0c4d01d77283c40e84ab1656e38cc341f Mon Sep 17 00:00:00 2001 From: Michael Chinn <1105686+mechinn@users.noreply.github.com> Date: Wed, 23 Jan 2019 10:22:47 -0500 Subject: [PATCH 354/552] make generated swagger json match gateway behavior for server streams (#850) * #579 fixing protoc-gen-swagger to wrap server stream messages with "result" object to match gateway behavior * #579 fixing test example swagger json * change streamdefinitions to x-stream-definitions and add test * move runtime internal to root of repo for use in protoc-gen-swagger, adding error to stream wrapper * adding comment explaining AddStreamError * fix bazel --- Makefile | 3 +- examples/proto/examplepb/stream.swagger.json | 362 ++++++++++++++++++ {runtime/internal => internal}/BUILD.bazel | 6 +- .../internal => internal}/stream_chunk.pb.go | 39 +- .../internal => internal}/stream_chunk.proto | 0 protoc-gen-swagger/genswagger/BUILD.bazel | 2 + protoc-gen-swagger/genswagger/generator.go | 3 + protoc-gen-swagger/genswagger/template.go | 127 +++++- .../genswagger/template_test.go | 75 +++- protoc-gen-swagger/genswagger/types.go | 1 + protoc-gen-swagger/main.go | 5 + runtime/BUILD.bazel | 4 +- runtime/handler.go | 2 +- runtime/handler_test.go | 2 +- 14 files changed, 586 insertions(+), 45 deletions(-) create mode 100644 examples/proto/examplepb/stream.swagger.json rename {runtime/internal => internal}/BUILD.bazel (66%) rename {runtime/internal => internal}/stream_chunk.pb.go (64%) rename {runtime/internal => internal}/stream_chunk.proto (100%) diff --git a/Makefile b/Makefile index 8d7156cc378..d627f84511d 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ SWAGGER_PLUGIN_FLAGS?= GOOGLEAPIS_DIR=third_party/googleapis OUTPUT_DIR=_output -RUNTIME_PROTO=runtime/internal/stream_chunk.proto +RUNTIME_PROTO=internal/stream_chunk.proto RUNTIME_GO=$(RUNTIME_PROTO:.proto=.pb.go) OPENAPIV2_PROTO=protoc-gen-swagger/options/openapiv2.proto protoc-gen-swagger/options/annotations.proto @@ -63,6 +63,7 @@ endif SWAGGER_EXAMPLES=examples/proto/examplepb/echo_service.proto \ examples/proto/examplepb/a_bit_of_everything.proto \ examples/proto/examplepb/wrappers.proto \ + examples/proto/examplepb/stream.proto \ examples/proto/examplepb/unannotated_echo_service.proto \ examples/proto/examplepb/response_body_service.proto diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json new file mode 100644 index 00000000000..a441c36be48 --- /dev/null +++ b/examples/proto/examplepb/stream.swagger.json @@ -0,0 +1,362 @@ +{ + "swagger": "2.0", + "info": { + "title": "examples/proto/examplepb/stream.proto", + "version": "version not set" + }, + "schemes": [ + "http", + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/example/a_bit_of_everything": { + "get": { + "operationId": "List", + "responses": { + "200": { + "description": "A successful response.(streaming responses)", + "schema": { + "$ref": "#/x-stream-definitions/examplepbABitOfEverything" + } + } + }, + "tags": [ + "StreamService" + ] + } + }, + "/v1/example/a_bit_of_everything/bulk": { + "post": { + "operationId": "BulkCreate", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "properties": {} + } + } + }, + "parameters": [ + { + "name": "body", + "description": " (streaming inputs)", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + ], + "tags": [ + "StreamService" + ] + } + }, + "/v1/example/a_bit_of_everything/echo": { + "post": { + "operationId": "BulkEcho", + "responses": { + "200": { + "description": "A successful response.(streaming responses)", + "schema": { + "$ref": "#/x-stream-definitions/subStringMessage" + } + } + }, + "parameters": [ + { + "name": "body", + "description": " (streaming inputs)", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/subStringMessage" + } + } + ], + "tags": [ + "StreamService" + ] + } + } + }, + "definitions": { + "ABitOfEverythingNested": { + "type": "object", + "example": { + "ok": "TRUE" + }, + "properties": { + "name": { + "type": "string", + "description": "name is nested field." + }, + "amount": { + "type": "integer", + "format": "int64" + }, + "ok": { + "$ref": "#/definitions/NestedDeepEnum" + } + }, + "description": "Nested is nested type." + }, + "MessagePathEnumNestedPathEnum": { + "type": "string", + "enum": [ + "GHI", + "JKL" + ], + "default": "GHI" + }, + "NestedDeepEnum": { + "type": "string", + "enum": [ + "FALSE", + "TRUE" + ], + "default": "FALSE", + "description": "DeepEnum is one or zero.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true." + }, + "examplepbABitOfEverything": { + "type": "object", + "example": { + "uuid": "0cf361e1-4b44-483d-a159-54dabdf7e814" + }, + "properties": { + "single_nested": { + "$ref": "#/definitions/ABitOfEverythingNested" + }, + "uuid": { + "type": "string", + "minLength": 1, + "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" + }, + "nested": { + "type": "array", + "items": { + "$ref": "#/definitions/ABitOfEverythingNested" + } + }, + "float_value": { + "type": "number", + "format": "float" + }, + "double_value": { + "type": "number", + "format": "double" + }, + "int64_value": { + "type": "string", + "format": "int64" + }, + "uint64_value": { + "type": "string", + "format": "uint64" + }, + "int32_value": { + "type": "integer", + "format": "int32" + }, + "fixed64_value": { + "type": "string", + "format": "uint64" + }, + "fixed32_value": { + "type": "integer", + "format": "int64" + }, + "bool_value": { + "type": "boolean", + "format": "boolean" + }, + "string_value": { + "type": "string" + }, + "bytes_value": { + "type": "string", + "format": "byte" + }, + "uint32_value": { + "type": "integer", + "format": "int64" + }, + "enum_value": { + "$ref": "#/definitions/examplepbNumericEnum" + }, + "path_enum_value": { + "$ref": "#/definitions/pathenumPathEnum" + }, + "nested_path_enum_value": { + "$ref": "#/definitions/MessagePathEnumNestedPathEnum" + }, + "sfixed32_value": { + "type": "integer", + "format": "int32" + }, + "sfixed64_value": { + "type": "string", + "format": "int64" + }, + "sint32_value": { + "type": "integer", + "format": "int32" + }, + "sint64_value": { + "type": "string", + "format": "int64" + }, + "repeated_string_value": { + "type": "array", + "items": { + "type": "string" + } + }, + "oneof_empty": { + "properties": {} + }, + "oneof_string": { + "type": "string" + }, + "map_value": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/examplepbNumericEnum" + } + }, + "mapped_string_value": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "mapped_nested_value": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ABitOfEverythingNested" + } + }, + "nonConventionalNameValue": { + "type": "string" + }, + "timestamp_value": { + "type": "string", + "format": "date-time" + }, + "repeated_enum_value": { + "type": "array", + "items": { + "$ref": "#/definitions/examplepbNumericEnum" + }, + "title": "repeated enum value. it is comma-separated in query" + } + }, + "description": "Intentionaly complicated message type to cover many features of Protobuf.", + "title": "A bit of everything", + "externalDocs": { + "description": "Find out more about ABitOfEverything", + "url": "https://github.com/grpc-ecosystem/grpc-gateway" + }, + "required": [ + "uuid" + ] + }, + "examplepbNumericEnum": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ], + "default": "ZERO", + "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" + }, + "pathenumPathEnum": { + "type": "string", + "enum": [ + "ABC", + "DEF" + ], + "default": "ABC" + }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string", + "description": "A URL/resource name whose content describes the type of the\nserialized protocol buffer message.\n\nFor URLs which use the scheme `http`, `https`, or no scheme, the\nfollowing restrictions and interpretations apply:\n\n* If no scheme is provided, `https` is assumed.\n* The last segment of the URL's path must represent the fully\n qualified name of the type (as in `path/google.protobuf.Duration`).\n The name should be in a canonical form (e.g., leading \".\" is\n not accepted).\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + }, + "value": { + "type": "string", + "format": "byte", + "description": "Must be a valid serialized protocol buffer of the above specified type." + } + }, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "runtimeStreamError": { + "type": "object", + "properties": { + "grpc_code": { + "type": "integer", + "format": "int32" + }, + "http_code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "http_status": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "subStringMessage": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + } + } + }, + "x-stream-definitions": { + "examplepbABitOfEverything": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/examplepbABitOfEverything" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of examplepbABitOfEverything" + }, + "subStringMessage": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/subStringMessage" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of subStringMessage" + } + } +} diff --git a/runtime/internal/BUILD.bazel b/internal/BUILD.bazel similarity index 66% rename from runtime/internal/BUILD.bazel rename to internal/BUILD.bazel index 63565730423..76cafe6ec7f 100644 --- a/runtime/internal/BUILD.bazel +++ b/internal/BUILD.bazel @@ -1,7 +1,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") -package(default_visibility = ["//runtime:__subpackages__"]) +package(default_visibility = ["//visibility:public"]) proto_library( name = "internal_proto", @@ -11,12 +11,12 @@ proto_library( go_proto_library( name = "internal_go_proto", - importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime/internal", + importpath = "github.com/grpc-ecosystem/grpc-gateway/internal", proto = ":internal_proto", ) go_library( name = "go_default_library", embed = [":internal_go_proto"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime/internal", + importpath = "github.com/grpc-ecosystem/grpc-gateway/internal", ) diff --git a/runtime/internal/stream_chunk.pb.go b/internal/stream_chunk.pb.go similarity index 64% rename from runtime/internal/stream_chunk.pb.go rename to internal/stream_chunk.pb.go index f4af074808b..c6cfb5c1c02 100644 --- a/runtime/internal/stream_chunk.pb.go +++ b/internal/stream_chunk.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: runtime/internal/stream_chunk.proto +// source: internal/stream_chunk.proto package internal @@ -36,7 +36,7 @@ func (m *StreamError) Reset() { *m = StreamError{} } func (m *StreamError) String() string { return proto.CompactTextString(m) } func (*StreamError) ProtoMessage() {} func (*StreamError) Descriptor() ([]byte, []int) { - return fileDescriptor_stream_chunk_6adb10b40700458b, []int{0} + return fileDescriptor_stream_chunk_cac6867f460b29a5, []int{0} } func (m *StreamError) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamError.Unmarshal(m, b) @@ -96,24 +96,23 @@ func init() { } func init() { - proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDescriptor_stream_chunk_6adb10b40700458b) + proto.RegisterFile("internal/stream_chunk.proto", fileDescriptor_stream_chunk_cac6867f460b29a5) } -var fileDescriptor_stream_chunk_6adb10b40700458b = []byte{ - // 226 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0xc1, 0x4e, 0x84, 0x30, - 0x10, 0x86, 0x83, 0xeb, 0xba, 0xbb, 0xc3, 0x8d, 0xec, 0xa1, 0xea, 0x41, 0xa2, 0x17, 0x4e, 0x25, - 0xd1, 0x27, 0x50, 0xe3, 0x0b, 0xb0, 0x37, 0x2f, 0x9b, 0x59, 0x18, 0x0b, 0x11, 0x5a, 0x32, 0x1d, - 0x62, 0x78, 0x2d, 0x9f, 0xd0, 0xb4, 0xc8, 0xb1, 0xdf, 0xf7, 0xff, 0x93, 0x3f, 0x85, 0x27, 0x9e, - 0xac, 0x74, 0x03, 0x95, 0x9d, 0x15, 0x62, 0x8b, 0x7d, 0xe9, 0x85, 0x09, 0x87, 0x73, 0xdd, 0x4e, - 0xf6, 0x5b, 0x8f, 0xec, 0xc4, 0x65, 0x47, 0xc3, 0x63, 0xad, 0x0d, 0x0a, 0xfd, 0xe0, 0xac, 0xff, - 0x1b, 0x77, 0xb7, 0xc6, 0x39, 0xd3, 0x53, 0x19, 0x33, 0x97, 0xe9, 0xab, 0x44, 0x3b, 0x2f, 0x85, - 0xc7, 0xdf, 0x04, 0xd2, 0x53, 0xbc, 0xf3, 0xc1, 0xec, 0x38, 0xbb, 0x87, 0x43, 0x38, 0x71, 0xae, - 0x5d, 0x43, 0x2a, 0xc9, 0x93, 0x62, 0x5b, 0xed, 0x03, 0x78, 0x77, 0x0d, 0x05, 0xd9, 0x8a, 0x8c, - 0x8b, 0xbc, 0x5a, 0x64, 0x00, 0x51, 0x2a, 0xd8, 0x0d, 0xe4, 0x3d, 0x1a, 0x52, 0x9b, 0x3c, 0x29, - 0x0e, 0xd5, 0xfa, 0xcc, 0x1e, 0x20, 0x8d, 0x35, 0x2f, 0x28, 0x93, 0x57, 0xd7, 0xd1, 0x42, 0x40, - 0xa7, 0x48, 0x32, 0x0d, 0xbb, 0x86, 0x04, 0xbb, 0xde, 0xab, 0x6d, 0xbe, 0x29, 0xd2, 0xe7, 0xa3, - 0x5e, 0x16, 0xeb, 0x75, 0xb1, 0x7e, 0xb5, 0x73, 0xb5, 0x86, 0xde, 0xe0, 0x73, 0xbf, 0x7e, 0xc2, - 0xe5, 0x26, 0x46, 0x5e, 0xfe, 0x02, 0x00, 0x00, 0xff, 0xff, 0x16, 0x75, 0x92, 0x08, 0x1f, 0x01, - 0x00, 0x00, +var fileDescriptor_stream_chunk_cac6867f460b29a5 = []byte{ + // 223 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x41, 0x4e, 0xc3, 0x30, + 0x10, 0x45, 0x15, 0x4a, 0x69, 0x3b, 0xd9, 0x45, 0x5d, 0x18, 0xba, 0x20, 0x62, 0x95, 0x95, 0x23, + 0xc1, 0x09, 0x00, 0x71, 0x81, 0x74, 0xc7, 0xa6, 0x9a, 0x26, 0x83, 0x13, 0x91, 0xd8, 0xd1, 0x78, + 0x22, 0x94, 0x6b, 0x71, 0xc2, 0xca, 0x8e, 0xb2, 0xf4, 0x7b, 0x7f, 0xbe, 0xbe, 0x0c, 0xa7, 0xce, + 0x0a, 0xb1, 0xc5, 0xbe, 0xf4, 0xc2, 0x84, 0xc3, 0xa5, 0x6e, 0x27, 0xfb, 0xab, 0x47, 0x76, 0xe2, + 0xb2, 0xa3, 0xe1, 0xb1, 0xd6, 0x06, 0x85, 0xfe, 0x70, 0xd6, 0x3c, 0x59, 0xe9, 0x06, 0x7a, 0x7a, + 0x34, 0xce, 0x99, 0x9e, 0xca, 0x98, 0xb9, 0x4e, 0x3f, 0x25, 0xda, 0x79, 0x39, 0x78, 0xf9, 0x4f, + 0x20, 0x3d, 0xc7, 0x9e, 0x2f, 0x66, 0xc7, 0xd9, 0x09, 0x0e, 0xa1, 0xe2, 0x52, 0xbb, 0x86, 0x54, + 0x92, 0x27, 0xc5, 0xb6, 0xda, 0x07, 0xf0, 0xe9, 0x1a, 0x0a, 0xb2, 0x15, 0x19, 0x17, 0x79, 0xb7, + 0xc8, 0x00, 0xa2, 0x54, 0xb0, 0x1b, 0xc8, 0x7b, 0x34, 0xa4, 0x36, 0x79, 0x52, 0x1c, 0xaa, 0xf5, + 0x99, 0x3d, 0x43, 0x1a, 0xcf, 0xbc, 0xa0, 0x4c, 0x5e, 0xdd, 0x47, 0x0b, 0x01, 0x9d, 0x23, 0xc9, + 0x34, 0xec, 0x1a, 0x12, 0xec, 0x7a, 0xaf, 0xb6, 0xf9, 0xa6, 0x48, 0x5f, 0x8f, 0x7a, 0x59, 0xac, + 0xd7, 0xc5, 0xfa, 0xdd, 0xce, 0xd5, 0x1a, 0xfa, 0x80, 0xef, 0xfd, 0xfa, 0x09, 0xd7, 0x87, 0x18, + 0x79, 0xbb, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x7d, 0xa5, 0x18, 0x17, 0x01, 0x00, 0x00, } diff --git a/runtime/internal/stream_chunk.proto b/internal/stream_chunk.proto similarity index 100% rename from runtime/internal/stream_chunk.proto rename to internal/stream_chunk.proto diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/genswagger/BUILD.bazel index 683b5eeec06..be398fb0dc1 100644 --- a/protoc-gen-swagger/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/genswagger/BUILD.bazel @@ -12,11 +12,13 @@ go_library( ], importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger", deps = [ + "//internal:go_default_library", "//protoc-gen-grpc-gateway/descriptor:go_default_library", "//protoc-gen-grpc-gateway/generator:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", + "@io_bazel_rules_go//proto/wkt:any_go_proto", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go index 8eba8ac66a4..b69f7e42e3e 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/genswagger/generator.go @@ -47,6 +47,9 @@ func mergeTargetFile(targets []*wrapper, mergeFileName string) *wrapper { for k, v := range f.swagger.Definitions { mergedTarget.swagger.Definitions[k] = v } + for k, v := range f.swagger.StreamDefinitions { + mergedTarget.swagger.StreamDefinitions[k] = v + } for k, v := range f.swagger.Paths { mergedTarget.swagger.Paths[k] = v } diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index e8675963b75..f5a6e031164 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1,6 +1,8 @@ package genswagger import ( + "bytes" + "compress/gzip" "encoding/json" "fmt" "os" @@ -10,8 +12,12 @@ import ( "strings" "sync" + "github.com/golang/glog" "github.com/golang/protobuf/proto" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/golang/protobuf/ptypes/any" + "github.com/grpc-ecosystem/grpc-gateway/internal" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) @@ -180,7 +186,7 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st } // findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service. -func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, e enumMap, refs refMap) { +func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, ms messageMap, e enumMap, refs refMap) { for _, svc := range s { for _, meth := range svc.Methods { // Request may be fully included in query @@ -193,6 +199,20 @@ func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descripto if !skipRenderingRef(meth.ResponseType.FQMN()) { m[fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)] = meth.ResponseType + if meth.GetServerStreaming() { + runtimeStreamError := fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.StreamError", reg) + glog.V(1).Infof("StreamError FQMN: %s", runtimeStreamError) + streamError, err := reg.LookupMsg(".grpc.gateway.runtime", "StreamError") + if err == nil { + glog.V(1).Infof("StreamError: %v", streamError) + m[runtimeStreamError] = streamError + findNestedMessagesAndEnumerations(streamError, reg, m, e) + } else { + //just in case there is an error looking up StreamError + glog.Error(err) + } + ms[fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)] = meth.ResponseType + } } findNestedMessagesAndEnumerations(meth.ResponseType, reg, m, e) } @@ -306,6 +326,92 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, } } +//AddStreamError Adds internal.StreamError and Any to registry for stream responses +func AddStreamError(reg *descriptor.Registry) error { + //load internal protos + any, err := fileDescriptorProtoFromProtoDescriptor(&any.Any{}) + if err != nil { + return err + } + streamError, err := fileDescriptorProtoFromProtoDescriptor(&internal.StreamError{}) + if err != nil { + return err + } + if err := reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*pbdescriptor.FileDescriptorProto{ + any, + streamError, + }, + }); err != nil { + return err + } + return nil +} + +type protoDescriptor interface { + Descriptor() ([]byte, []int) +} + +func fileDescriptorProtoFromProtoDescriptor(pd protoDescriptor) (*pbdescriptor.FileDescriptorProto, error) { + pdd, _ := pd.Descriptor() + r, err := gzip.NewReader(bytes.NewReader(pdd)) + if err != nil { + return nil, err + } + var buf bytes.Buffer + _, err = buf.ReadFrom(r) + if err != nil { + return nil, err + } + err = r.Close() + if err != nil { + return nil, err + } + fdp := &pbdescriptor.FileDescriptorProto{} + if err := proto.Unmarshal(buf.Bytes(), fdp); err != nil { + return nil, err + } + //hide the fact that we are loading this from the pb.go instead of the proto directly + fdp.SourceCodeInfo = &pbdescriptor.SourceCodeInfo{} + return fdp, nil +} + +func renderMessagesAsStreamDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { + for name, msg := range messages { + if skipRenderingRef(name) { + continue + } + + if opt := msg.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { + continue + } + d[fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)] = swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "object", + }, + Title: fmt.Sprintf("Stream result of %s", fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)), + Properties: &swaggerSchemaObjectProperties{ + keyVal{ + Key: "result", + Value: swaggerSchemaObject{ + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)), + }, + }, + }, + keyVal{ + Key: "error", + Value: swaggerSchemaObject{ + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.StreamError", reg)), + }, + }, + }, + }, + } + } +} + // schemaOfField returns a swagger Schema Object for a protobuf field. func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) swaggerSchemaObject { const ( @@ -766,6 +872,8 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } if meth.GetServerStreaming() { desc += "(streaming responses)" + // Use the streamdefinition which wraps the message in a "result" + responseSchema.Ref = strings.Replace(responseSchema.Ref, `#/definitions/`, `#/x-stream-definitions/`, 1) } operationObject := &swaggerOperationObject{ Tags: []string{svc.GetName()}, @@ -882,12 +990,13 @@ func applyTemplate(p param) (*swaggerObject, error) { // defined off of. s := swaggerObject{ // Swagger 2.0 is the version of this document - Swagger: "2.0", - Schemes: []string{"http", "https"}, - Consumes: []string{"application/json"}, - Produces: []string{"application/json"}, - Paths: make(swaggerPathsObject), - Definitions: make(swaggerDefinitionsObject), + Swagger: "2.0", + Schemes: []string{"http", "https"}, + Consumes: []string{"application/json"}, + Produces: []string{"application/json"}, + Paths: make(swaggerPathsObject), + Definitions: make(swaggerDefinitionsObject), + StreamDefinitions: make(swaggerDefinitionsObject), Info: swaggerInfoObject{ Title: *p.File.Name, Version: "version not set", @@ -905,9 +1014,11 @@ func applyTemplate(p param) (*swaggerObject, error) { // Find all the service's messages and enumerations that are defined (recursively) // and write request, response and other custom (but referenced) types out as definition objects. m := messageMap{} + ms := messageMap{} e := enumMap{} - findServicesMessagesAndEnumerations(p.Services, p.reg, m, e, requestResponseRefs) + findServicesMessagesAndEnumerations(p.Services, p.reg, m, ms, e, requestResponseRefs) renderMessagesAsDefinition(m, s.Definitions, p.reg, customRefs) + renderMessagesAsStreamDefinition(ms, s.StreamDefinitions, p.reg) renderEnumerationsAsDefinition(e, s.Definitions, p.reg) // File itself might have some comments and metadata. diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index b653ce51ce9..4e20a3ccd25 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -280,7 +280,6 @@ func TestApplyTemplateSimple(t *testing.T) { } func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { - t.Skip() msgdesc := &protodescriptor.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*protodescriptor.FieldDescriptorProto{ @@ -405,7 +404,9 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { }, }, } - result, err := applyTemplate(param{File: crossLinkFixture(&file)}) + reg := descriptor.NewRegistry() + reg.Load(&plugin.CodeGeneratorRequest{ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}}) + result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -425,9 +426,6 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { if want, got := []string{"application/json"}, result.Produces; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).Produces = %s want to be %s", file, got, want) } - if want, got, name := "Generated for ExampleService.Echo - ", result.Paths["/v1/echo"].Post.Summary, "Paths[/v1/echo].Post.Summary"; !reflect.DeepEqual(got, want) { - t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) - } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { @@ -437,7 +435,6 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { } func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { - t.Skip() msgdesc := &protodescriptor.DescriptorProto{ Name: proto.String("ExampleMessage"), Field: []*protodescriptor.FieldDescriptorProto{ @@ -561,11 +558,71 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { }, }, } - _, err := applyTemplate(param{File: crossLinkFixture(&file)}) - if err == nil { - t.Errorf("applyTemplate(%#v) should have failed cause swagger doesn't support streaming", file) + reg := descriptor.NewRegistry() + if err := AddStreamError(reg); err != nil { + t.Errorf("AddStreamError(%#v) failed with %v; want success", reg, err) return } + reg.Load(&plugin.CodeGeneratorRequest{ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}}) + result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + + // Only ExampleMessage must be present, not NestedMessage + if want, got, name := 3, len(result.Definitions), "len(Definitions)"; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) + } + // stream ExampleMessage must be present + if want, got, name := 1, len(result.StreamDefinitions), "len(StreamDefinitions)"; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) + } else { + streamExampleExampleMessage := result.StreamDefinitions["exampleExampleMessage"] + if want, got, name := "object", streamExampleExampleMessage.Type, `StreamDefinitions["exampleExampleMessage"].Type`; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) + } + if want, got, name := "Stream result of exampleExampleMessage", streamExampleExampleMessage.Title, `StreamDefinitions["exampleExampleMessage"].Title`; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) + } + streamExampleExampleMessageProperties := *(streamExampleExampleMessage.Properties) + if want, got, name := 2, len(streamExampleExampleMessageProperties), `len(StreamDefinitions["exampleExampleMessage"].Properties)`; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) + } else { + resultProperty := streamExampleExampleMessageProperties[0] + if want, got, name := "result", resultProperty.Key, `(*(StreamDefinitions["exampleExampleMessage"].Properties))[0].Key`; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) + } + result := resultProperty.Value.(swaggerSchemaObject) + if want, got, name := "#/definitions/exampleExampleMessage", result.Ref, `((*(StreamDefinitions["exampleExampleMessage"].Properties))[0].Value.(swaggerSchemaObject)).Ref`; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) + } + errorProperty := streamExampleExampleMessageProperties[1] + if want, got, name := "error", errorProperty.Key, `(*(StreamDefinitions["exampleExampleMessage"].Properties))[0].Key`; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) + } + err := errorProperty.Value.(swaggerSchemaObject) + if want, got, name := "#/definitions/runtimeStreamError", err.Ref, `((*(StreamDefinitions["exampleExampleMessage"].Properties))[0].Value.(swaggerSchemaObject)).Ref`; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) + } + } + } + if want, got, name := 1, len(result.Paths["/v1/echo"].Post.Responses), "len(Paths[/v1/echo].Post.Responses)"; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) + } else { + if want, got, name := "A successful response.(streaming responses)", result.Paths["/v1/echo"].Post.Responses["200"].Description, `result.Paths["/v1/echo"].Post.Responses["200"].Description`; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) + } + if want, got, name := "#/x-stream-definitions/exampleExampleMessage", result.Paths["/v1/echo"].Post.Responses["200"].Schema.Ref, `result.Paths["/v1/echo"].Post.Responses["200"].Description`; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) + } + } + + // If there was a failure, print out the input and the json result for debugging. + if t.Failed() { + t.Errorf("had: %s", file) + t.Errorf("got: %s", fmt.Sprint(result)) + } } func TestApplyTemplateRequestWithUnusedReferences(t *testing.T) { diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 6125c80f314..d2bed9aa92c 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -57,6 +57,7 @@ type swaggerObject struct { Produces []string `json:"produces"` Paths swaggerPathsObject `json:"paths"` Definitions swaggerDefinitionsObject `json:"definitions"` + StreamDefinitions swaggerDefinitionsObject `json:"x-stream-definitions,omitempty"` SecurityDefinitions swaggerSecurityDefinitionsObject `json:"securityDefinitions,omitempty"` Security []swaggerSecurityRequirementObject `json:"security,omitempty"` ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index 174e4fad384..a4d11fd1ef5 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -91,6 +91,11 @@ func main() { g := genswagger.New(reg) + if err := genswagger.AddStreamError(reg); err != nil { + emitError(err) + return + } + if err := reg.Load(req); err != nil { emitError(err) return diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index 059e2033535..c99f83e5851 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -24,7 +24,7 @@ go_library( ], importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime", deps = [ - "//runtime/internal:go_default_library", + "//internal:go_default_library", "//utilities:go_default_library", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", @@ -60,7 +60,7 @@ go_test( embed = [":go_default_library"], deps = [ "//examples/proto/examplepb:go_default_library", - "//runtime/internal:go_default_library", + "//internal:go_default_library", "//utilities:go_default_library", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", diff --git a/runtime/handler.go b/runtime/handler.go index 8ad9d766e1c..58ba686b81b 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -9,7 +9,7 @@ import ( "context" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/any" - "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" + "github.com/grpc-ecosystem/grpc-gateway/internal" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" diff --git a/runtime/handler_test.go b/runtime/handler_test.go index 6a712a4e64e..c9caa25cfc0 100644 --- a/runtime/handler_test.go +++ b/runtime/handler_test.go @@ -10,8 +10,8 @@ import ( "context" "github.com/golang/protobuf/proto" pb "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/internal" "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" From 74c9f172181c4b7eb58c1a595f030fcb80a58ac2 Mon Sep 17 00:00:00 2001 From: Michael Chinn <1105686+mechinn@users.noreply.github.com> Date: Wed, 23 Jan 2019 11:20:12 -0500 Subject: [PATCH 355/552] Use github.com/golang/protobuf/descriptor ForMessage and fix CI from not rebasing (#857) * Use github.com/golang/protobuf/descriptor ForMessage instead of extracting FileDescriptorProto ourselves and fixing generated stream.swagger.json * Fixing bazel and removing dead code * remove required github.com/golang/protobuf/descriptor * revert removing github.com/go-resty/resty --- Gopkg.lock | 4 +- examples/proto/examplepb/stream.swagger.json | 11 +++- protoc-gen-swagger/genswagger/BUILD.bazel | 1 + protoc-gen-swagger/genswagger/generator.go | 26 +++++++++ protoc-gen-swagger/genswagger/template.go | 55 -------------------- 5 files changed, 39 insertions(+), 58 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 1bbc8d61516..4e9da479903 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -23,9 +23,10 @@ revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" [[projects]] - digest = "1:77303a120dcd145972685b3465e58e1a0910544fcb323ca24755e073c1ea6d2c" + digest = "1:329b943e12961fb0c0db5bc18858433e569183178edfd0a8d99033ce032c62cc" name = "github.com/golang/protobuf" packages = [ + "descriptor", "jsonpb", "proto", "protoc-gen-go", @@ -160,6 +161,7 @@ "github.com/ghodss/yaml", "github.com/go-resty/resty", "github.com/golang/glog", + "github.com/golang/protobuf/descriptor", "github.com/golang/protobuf/jsonpb", "github.com/golang/protobuf/proto", "github.com/golang/protobuf/protoc-gen-go", diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index a441c36be48..7739b3ea13d 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -146,7 +146,12 @@ }, "float_value": { "type": "number", - "format": "float" + "format": "float", + "default": "0.2", + "description": "Float value field", + "required": [ + "float_value" + ] }, "double_value": { "type": "number", @@ -264,7 +269,9 @@ "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ - "uuid" + "uuid", + "int64_value", + "double_value" ] }, "examplepbNumericEnum": { diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/genswagger/BUILD.bazel index be398fb0dc1..18f72b9e37c 100644 --- a/protoc-gen-swagger/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/genswagger/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//protoc-gen-grpc-gateway/generator:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_glog//:go_default_library", + "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:any_go_proto", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go index b69f7e42e3e..a7bc905b672 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/genswagger/generator.go @@ -9,8 +9,12 @@ import ( "strings" "github.com/golang/glog" + pbdescriptor "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" + protocdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/golang/protobuf/ptypes/any" + "github.com/grpc-ecosystem/grpc-gateway/internal" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" @@ -133,3 +137,25 @@ func (g *generator) Generate(targets []*descriptor.File) ([]*plugin.CodeGenerato } return files, nil } + +//AddStreamError Adds grpc.gateway.runtime.StreamError and google.protobuf.Any to registry for stream responses +func AddStreamError(reg *descriptor.Registry) error { + //load internal protos + any := fileDescriptorProtoForMessage(&any.Any{}) + streamError := fileDescriptorProtoForMessage(&internal.StreamError{}) + if err := reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*protocdescriptor.FileDescriptorProto{ + any, + streamError, + }, + }); err != nil { + return err + } + return nil +} + +func fileDescriptorProtoForMessage(msg pbdescriptor.Message) *protocdescriptor.FileDescriptorProto { + fdp, _ := pbdescriptor.ForMessage(msg) + fdp.SourceCodeInfo = &protocdescriptor.SourceCodeInfo{} + return fdp +} diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index f5a6e031164..771a005c99b 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1,8 +1,6 @@ package genswagger import ( - "bytes" - "compress/gzip" "encoding/json" "fmt" "os" @@ -15,9 +13,6 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/golang/protobuf/ptypes/any" - "github.com/grpc-ecosystem/grpc-gateway/internal" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) @@ -326,56 +321,6 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, } } -//AddStreamError Adds internal.StreamError and Any to registry for stream responses -func AddStreamError(reg *descriptor.Registry) error { - //load internal protos - any, err := fileDescriptorProtoFromProtoDescriptor(&any.Any{}) - if err != nil { - return err - } - streamError, err := fileDescriptorProtoFromProtoDescriptor(&internal.StreamError{}) - if err != nil { - return err - } - if err := reg.Load(&plugin.CodeGeneratorRequest{ - ProtoFile: []*pbdescriptor.FileDescriptorProto{ - any, - streamError, - }, - }); err != nil { - return err - } - return nil -} - -type protoDescriptor interface { - Descriptor() ([]byte, []int) -} - -func fileDescriptorProtoFromProtoDescriptor(pd protoDescriptor) (*pbdescriptor.FileDescriptorProto, error) { - pdd, _ := pd.Descriptor() - r, err := gzip.NewReader(bytes.NewReader(pdd)) - if err != nil { - return nil, err - } - var buf bytes.Buffer - _, err = buf.ReadFrom(r) - if err != nil { - return nil, err - } - err = r.Close() - if err != nil { - return nil, err - } - fdp := &pbdescriptor.FileDescriptorProto{} - if err := proto.Unmarshal(buf.Bytes(), fdp); err != nil { - return nil, err - } - //hide the fact that we are loading this from the pb.go instead of the proto directly - fdp.SourceCodeInfo = &pbdescriptor.SourceCodeInfo{} - return fdp, nil -} - func renderMessagesAsStreamDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { for name, msg := range messages { if skipRenderingRef(name) { From d2a1956106a123990e0a383c5e7534e9a9f91b1c Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 23 Jan 2019 16:27:36 +0000 Subject: [PATCH 356/552] Generate changelog for 1.7.0 --- CHANGELOG.md | 21 +++++++++++++++++++++ Makefile | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e230f8e92d..f7cc4cb3def 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Change Log +## [v1.7.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.7.0) (2019-01-23) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.6.4...v1.7.0) + +**Closed issues:** + +- Error to build project with go module [\#846](https://github.com/grpc-ecosystem/grpc-gateway/issues/846) +- Result of gateway's Stream response is wrapped with "result" [\#579](https://github.com/grpc-ecosystem/grpc-gateway/issues/579) + +**Merged pull requests:** + +- Use github.com/golang/protobuf/descriptor ForMessage and fix CI from not rebasing [\#857](https://github.com/grpc-ecosystem/grpc-gateway/pull/857) ([mechinn](https://github.com/mechinn)) +- marshal\_jsonpb: add check for slice sub types implementing proto.Message [\#856](https://github.com/grpc-ecosystem/grpc-gateway/pull/856) ([abice](https://github.com/abice)) +- Added WithDisablePathLengthFallback option \(to fix issue \#447\) [\#855](https://github.com/grpc-ecosystem/grpc-gateway/pull/855) ([UladzimirTrehubenka](https://github.com/UladzimirTrehubenka)) +- marshal\_jsonpb: Added nil slice default value [\#854](https://github.com/grpc-ecosystem/grpc-gateway/pull/854) ([abice](https://github.com/abice)) +- Add flag 'allow\_repeated\_fields\_in\_body' to protoc-gen-swagger [\#853](https://github.com/grpc-ecosystem/grpc-gateway/pull/853) ([abice](https://github.com/abice)) +- Adding support for default and required swagger annotation fields. [\#852](https://github.com/grpc-ecosystem/grpc-gateway/pull/852) ([fahernandez](https://github.com/fahernandez)) +- make generated swagger json match gateway behavior for server streams [\#850](https://github.com/grpc-ecosystem/grpc-gateway/pull/850) ([mechinn](https://github.com/mechinn)) +- test: "fill attributes of swagger schema if provided for messages" [\#849](https://github.com/grpc-ecosystem/grpc-gateway/pull/849) ([srenatus](https://github.com/srenatus)) +- Fix the generated URL in the changelog [\#845](https://github.com/grpc-ecosystem/grpc-gateway/pull/845) ([johanbrandhorst](https://github.com/johanbrandhorst)) + ## [v1.6.4](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.6.4) (2019-01-08) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.6.3...v1.6.4) @@ -81,6 +101,7 @@ - fix bug: the resource name of custom method doesn't be retained [\#805](https://github.com/grpc-ecosystem/grpc-gateway/pull/805) ([ch3rub1m](https://github.com/ch3rub1m)) - Update rules\_go and gazelle [\#802](https://github.com/grpc-ecosystem/grpc-gateway/pull/802) ([drigz](https://github.com/drigz)) - Properly omit wrappers and google.protobuf.empty from swagger definitions [\#801](https://github.com/grpc-ecosystem/grpc-gateway/pull/801) ([birdayz](https://github.com/birdayz)) +- protoc-gen-swagger: honor example field of message option [\#799](https://github.com/grpc-ecosystem/grpc-gateway/pull/799) ([birdayz](https://github.com/birdayz)) - Use newer Bazel repo rules [\#798](https://github.com/grpc-ecosystem/grpc-gateway/pull/798) ([drigz](https://github.com/drigz)) - Run buildifer on Bazel files [\#797](https://github.com/grpc-ecosystem/grpc-gateway/pull/797) ([drigz](https://github.com/drigz)) - protoc-gen-swagger: Fix formatting of license field definition. [\#796](https://github.com/grpc-ecosystem/grpc-gateway/pull/796) ([ivucica](https://github.com/ivucica)) diff --git a/Makefile b/Makefile index d627f84511d..ba923e91f9c 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.6.4 + --future-release=v1.7.0 lint: golint --set_exit_status $(PKG)/runtime golint --set_exit_status $(PKG)/utilities/... From ce9d9459e1d93d2f798237f11645629c6d92ce61 Mon Sep 17 00:00:00 2001 From: zwcn Date: Mon, 28 Jan 2019 15:46:10 -0500 Subject: [PATCH 357/552] protoc-gen-swagger: add the package name to the tags field of each endpoint if the package name exists in the proto file (#860) * add the package name to the tags field of each endpoint * prepend the package name only if it is defined in the proto file * fix the generate stage of the CI by checking in generated files * add a boolean flag allow_package_name_in_tags and unit tests * update bazel files * rename the flag to include_package_in_tags --- .../descriptor/registry.go | 16 +++++++ protoc-gen-swagger/genswagger/template.go | 8 +++- protoc-gen-swagger/main.go | 9 ++++ protoc-gen-swagger/main_test.go | 43 ++++++++++++------- 4 files changed, 60 insertions(+), 16 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index 9a201112b0a..510ab253830 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -50,6 +50,10 @@ type Registry struct { // allowRepeatedFieldsInBody permits repeated field in body field path of `google.api.http` annotation option allowRepeatedFieldsInBody bool + // includePackageInTags controls whether the package name defined in the `package` directive + // in the proto file can be prepended to the gRPC service name in the `Tags` field of every operation. + includePackageInTags bool + // repeatedPathParamSeparator specifies how path parameter repeated fields are separated repeatedPathParamSeparator repeatedFieldSeparator @@ -350,6 +354,18 @@ func (r *Registry) IsAllowRepeatedFieldsInBody() bool { return r.allowRepeatedFieldsInBody } +// SetIncludePackageInTags controls whether the package name defined in the `package` directive +// in the proto file can be prepended to the gRPC service name in the `Tags` field of every operation. +func (r *Registry) SetIncludePackageInTags(allow bool) { + r.includePackageInTags = allow +} + +// IsIncludePackageInTags checks whether the package name defined in the `package` directive +// in the proto file can be prepended to the gRPC service name in the `Tags` field of every operation. +func (r *Registry) IsIncludePackageInTags() bool { + return r.includePackageInTags +} + // GetRepeatedPathParamSeparator returns a rune spcifying how // path parameter repeated fields are separated. func (r *Registry) GetRepeatedPathParamSeparator() rune { diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 771a005c99b..fcc98b1f51f 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -820,8 +820,14 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re // Use the streamdefinition which wraps the message in a "result" responseSchema.Ref = strings.Replace(responseSchema.Ref, `#/definitions/`, `#/x-stream-definitions/`, 1) } + + tag := svc.GetName() + if pkg := svc.File.GetPackage(); pkg != "" && reg.IsIncludePackageInTags() { + tag = pkg + "." + tag + } + operationObject := &swaggerOperationObject{ - Tags: []string{svc.GetName()}, + Tags: []string{tag}, Parameters: parameters, Responses: swaggerResponsesObject{ "200": swaggerResponseObject{ diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index a4d11fd1ef5..16ce528b709 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -25,6 +25,7 @@ var ( repeatedPathParamSeparator = flag.String("repeated_path_param_separator", "csv", "configures how repeated fields should be split. Allowed values are `csv`, `pipes`, `ssv` and `tsv`.") versionFlag = flag.Bool("version", false, "print the current verison") allowRepeatedFieldsInBody = flag.Bool("allow_repeated_fields_in_body", false, "allows to use repeated field in `body` and `response_body` field of `google.api.http` annotation option") + includePackageInTags = flag.Bool("include_package_in_tags", false, "if unset, the gRPC service name is added to the `Tags` field of each operation. if set and the `package` directive is shown in the proto file, the package name will be prepended to the service name") ) // Variables set by goreleaser at build time @@ -74,6 +75,7 @@ func main() { reg.SetMergeFileName(*mergeFileName) reg.SetUseJSONNamesForFields(*useJSONNamesForFields) reg.SetAllowRepeatedFieldsInBody(*allowRepeatedFieldsInBody) + reg.SetIncludePackageInTags(*includePackageInTags) if err := reg.SetRepeatedPathParamSeparator(*repeatedPathParamSeparator); err != nil { emitError(err) return @@ -168,6 +170,13 @@ func parseReqParam(param string, f *flag.FlagSet, pkgMap map[string]string) erro } continue } + if spec[0] == "include_package_in_tags" { + err := f.Set(spec[0], "true") + if err != nil { + return fmt.Errorf("Cannot set flag %s: %v", p, err) + } + continue + } err := f.Set(spec[0], "") if err != nil { return fmt.Errorf("Cannot set flag %s: %v", p, err) diff --git a/protoc-gen-swagger/main_test.go b/protoc-gen-swagger/main_test.go index dc8e09bdb12..b5ebda041a2 100644 --- a/protoc-gen-swagger/main_test.go +++ b/protoc-gen-swagger/main_test.go @@ -17,6 +17,7 @@ func TestParseReqParam(t *testing.T) { allowDeleteBodyV bool allowMergeV bool allowRepeatedFieldsInBodyV bool + includePackageInTagsV bool fileV string importPathV string mergeFileNameV string @@ -28,35 +29,35 @@ func TestParseReqParam(t *testing.T) { name: "Test 0", expected: map[string]string{}, request: "", - allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, fileV: "-", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 1", expected: map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"}, - request: "allow_delete_body,allow_merge,allow_repeated_fields_in_body,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", - allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, + request: "allow_delete_body,allow_merge,allow_repeated_fields_in_body,include_package_in_tags,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", + allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, includePackageInTagsV: true, fileV: "./foo.pb", importPathV: "/bar/baz", mergeFileNameV: "apidocs", }, { name: "Test 2", expected: map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"}, - request: "allow_delete_body=true,allow_merge=true,allow_repeated_fields_in_body=true,merge_file_name=test_name,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", - allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, + request: "allow_delete_body=true,allow_merge=true,allow_repeated_fields_in_body=true,include_package_in_tags=true,merge_file_name=test_name,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", + allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, includePackageInTagsV: true, fileV: "./foo.pb", importPathV: "/bar/baz", mergeFileNameV: "test_name", }, { name: "Test 3", expected: map[string]string{"a/b/c.proto": "github.com/x/y/z", "f/g/h.proto": "github.com/1/2/3/"}, request: "allow_delete_body=false,allow_merge=false,Ma/b/c.proto=github.com/x/y/z,Mf/g/h.proto=github.com/1/2/3/", - allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 4", expected: map[string]string{}, request: "", - allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { @@ -64,7 +65,7 @@ func TestParseReqParam(t *testing.T) { expected: map[string]string{}, request: "unknown_param=17", expectedError: errors.New("Cannot set flag unknown_param=17: no such flag -unknown_param"), - allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { @@ -72,14 +73,14 @@ func TestParseReqParam(t *testing.T) { expected: map[string]string{}, request: "Mfoo", expectedError: errors.New("Cannot set flag Mfoo: no such flag -Mfoo"), - allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, { name: "Test 7", expected: map[string]string{}, - request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body,merge_file_name", - allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, + request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body,include_package_in_tags,merge_file_name", + allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, includePackageInTagsV: true, fileV: "", importPathV: "", mergeFileNameV: "", }, { @@ -87,9 +88,17 @@ func TestParseReqParam(t *testing.T) { expected: map[string]string{}, request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body=3,merge_file_name", expectedError: errors.New(`Cannot set flag allow_repeated_fields_in_body=3: strconv.ParseBool: parsing "3": invalid syntax`), - allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: false, + allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, fileV: "", importPathV: "", mergeFileNameV: "apidocs", }, + { + name: "Test 9", + expected: map[string]string{}, + request: "include_package_in_tags=3", + expectedError: errors.New(`Cannot set flag include_package_in_tags=3: strconv.ParseBool: parsing "3": invalid syntax`), + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, + fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", + }, } for i, tc := range testcases { @@ -112,10 +121,10 @@ func TestParseReqParam(t *testing.T) { tt.Errorf("pkgMap parse error, expected '%v', got '%v'", tc.expected, pkgMap) } if err.Error() != tc.expectedError.Error() { - tt.Errorf("expected error malformed, expected %q, go %q", tc.expectedError.Error(), err.Error()) + tt.Errorf("expected error malformed, expected %q, got %q", tc.expectedError.Error(), err.Error()) } } - checkFlags(tc.allowDeleteBodyV, tc.allowMergeV, tc.allowRepeatedFieldsInBodyV, tc.fileV, tc.importPathV, tc.mergeFileNameV, tt, i) + checkFlags(tc.allowDeleteBodyV, tc.allowMergeV, tc.allowRepeatedFieldsInBodyV, tc.includePackageInTagsV, tc.fileV, tc.importPathV, tc.mergeFileNameV, tt, i) clearFlags() }) @@ -123,7 +132,7 @@ func TestParseReqParam(t *testing.T) { } -func checkFlags(allowDeleteV, allowMergeV, allowRepeatedFieldsInBodyV bool, fileV, importPathV, mergeFileNameV string, t *testing.T, tid int) { +func checkFlags(allowDeleteV, allowMergeV, allowRepeatedFieldsInBodyV, includePackageInTagsV bool, fileV, importPathV, mergeFileNameV string, t *testing.T, tid int) { if *importPrefix != importPathV { t.Errorf("Test %v: import_prefix misparsed, expected '%v', got '%v'", tid, importPathV, *importPrefix) } @@ -142,6 +151,9 @@ func checkFlags(allowDeleteV, allowMergeV, allowRepeatedFieldsInBodyV bool, file if *allowRepeatedFieldsInBody != allowRepeatedFieldsInBodyV { t.Errorf("Test %v: allow_repeated_fields_in_body misparsed, expected '%v', got '%v'", tid, allowRepeatedFieldsInBodyV, *allowRepeatedFieldsInBody) } + if *includePackageInTags != includePackageInTagsV { + t.Errorf("Test %v: allow_repeated_fields_in_body misparsed, expected '%v', got '%v'", tid, includePackageInTagsV, *includePackageInTags) + } } func clearFlags() { @@ -150,5 +162,6 @@ func clearFlags() { *allowDeleteBody = false *allowMerge = false *allowRepeatedFieldsInBody = false + *includePackageInTags = false *mergeFileName = "apidocs" } From c9db71ff058e6fe8a94cc1918d9eca84e79bd1ac Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 5 Feb 2019 11:34:38 +0000 Subject: [PATCH 358/552] Update CI badge link in documentation --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index bb36263e758..59e3047c87a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ # grpc-gateway -[![CircleCI](https://circleci.com/gh/johanbrandhorst/grpc-gateway.svg?style=svg)](https://circleci.com/gh/johanbrandhorst/grpc-gateway) +[![CircleCI](https://circleci.com/gh/grpc-ecosystem/grpc-gateway.svg?style=svg)](https://circleci.com/gh/grpc-ecosystem/grpc-gateway) grpc-gateway is a plugin of [protoc](http://github.com/google/protobuf). It reads [gRPC](http://github.com/grpc/grpc-common) service definition, From 60c1134c795e3cc016e0269c31a2fc293d4bf616 Mon Sep 17 00:00:00 2001 From: fahernandez Date: Mon, 11 Feb 2019 14:50:35 -0600 Subject: [PATCH 359/552] 863 adding swagger annotation support for enum, repeated enum, nested object, repeated nested object and repeated primitive fields --- .../abe/a_bit_of_everything_service_api.go | 30 +- .../abe/examplepb_a_bit_of_everything.go | 15 + examples/clients/echo/api_client.go | 2 +- examples/clients/echo/api_response.go | 2 +- examples/clients/echo/configuration.go | 2 +- examples/clients/echo/echo_service_api.go | 2 +- examples/clients/echo/examplepb_embedded.go | 2 +- .../clients/echo/examplepb_simple_message.go | 2 +- .../proto/examplepb/a_bit_of_everything.pb.go | 473 ++++++++++-------- .../examplepb/a_bit_of_everything.pb.gw.go | 63 ++- .../proto/examplepb/a_bit_of_everything.proto | 17 +- .../a_bit_of_everything.swagger.json | 153 +++++- .../proto/examplepb/echo_service.swagger.json | 2 +- examples/proto/examplepb/stream.swagger.json | 34 ++ protoc-gen-swagger/genswagger/template.go | 37 +- 15 files changed, 602 insertions(+), 234 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 1e8956c2aff..21971cc14fc 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -60,13 +60,17 @@ func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythin * @param enumValue * @param pathEnumValue * @param nestedPathEnumValue + * @param repeatedEnumValue repeated enum value. it is comma-separated in query + * @param repeatedEnumValueAnnotation Repeated numeric enum description. + * @param enumValueAnnotation Numeric enum description. + * @param repeatedStringAnnotation Repeated string description. * @return *ExamplepbABitOfEverything */ -func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string) (*ExamplepbABitOfEverything, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, repeatedEnumValue []string, repeatedEnumValueAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string) (*ExamplepbABitOfEverything, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables - localVarPath := a.Configuration.BasePath + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}" + localVarPath := a.Configuration.BasePath + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{repeated_enum_value_annotation}/{enum_value_annotation}/{repeated_string_annotation}" localVarPath = strings.Replace(localVarPath, "{"+"float_value"+"}", fmt.Sprintf("%v", floatValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"double_value"+"}", fmt.Sprintf("%v", doubleValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"int64_value"+"}", fmt.Sprintf("%v", int64Value), -1) @@ -85,6 +89,10 @@ func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float localVarPath = strings.Replace(localVarPath, "{"+"enum_value"+"}", fmt.Sprintf("%v", enumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"path_enum_value"+"}", fmt.Sprintf("%v", pathEnumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"nested_path_enum_value"+"}", fmt.Sprintf("%v", nestedPathEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repeated_enum_value"+"}", fmt.Sprintf("%v", repeatedEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repeated_enum_value_annotation"+"}", fmt.Sprintf("%v", repeatedEnumValueAnnotation), -1) + localVarPath = strings.Replace(localVarPath, "{"+"enum_value_annotation"+"}", fmt.Sprintf("%v", enumValueAnnotation), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repeated_string_annotation"+"}", fmt.Sprintf("%v", repeatedStringAnnotation), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -547,9 +555,15 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param nonConventionalNameValue * @param timestampValue * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param repeatedEnumValueAnnotation Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param enumValueAnnotation Numeric enum title. Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param repeatedStringAnnotation Repeated string title. Repeated string description. + * @param nestedAnnotationName name is nested field. + * @param nestedAnnotationAmount + * @param nestedAnnotationOk - FALSE: FALSE is false. - TRUE: TRUE is true. * @return *interface{} */ -func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, singleNestedName string, singleNestedAmount int64, singleNestedOk string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*interface{}, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, singleNestedName string, singleNestedAmount int64, singleNestedOk string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumValueAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationName string, nestedAnnotationAmount int64, nestedAnnotationOk string) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables @@ -596,6 +610,16 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, si var repeatedEnumValueCollectionFormat = "csv" localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) + var repeatedEnumValueAnnotationCollectionFormat = "csv" + localVarQueryParams.Add("repeated_enum_value_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumValueAnnotation, repeatedEnumValueAnnotationCollectionFormat)) + + localVarQueryParams.Add("enum_value_annotation", a.Configuration.APIClient.ParameterToString(enumValueAnnotation, "")) + var repeatedStringAnnotationCollectionFormat = "csv" + localVarQueryParams.Add("repeated_string_annotation", a.Configuration.APIClient.ParameterToString(repeatedStringAnnotation, repeatedStringAnnotationCollectionFormat)) + + localVarQueryParams.Add("nested_annotation.name", a.Configuration.APIClient.ParameterToString(nestedAnnotationName, "")) + localVarQueryParams.Add("nested_annotation.amount", a.Configuration.APIClient.ParameterToString(nestedAnnotationAmount, "")) + localVarQueryParams.Add("nested_annotation.ok", a.Configuration.APIClient.ParameterToString(nestedAnnotationOk, "")) // to determine the Content-Type header localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go index 91320d0e7c3..74ec2f41000 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -77,4 +77,19 @@ type ExamplepbABitOfEverything struct { TimestampValue time.Time `json:"timestamp_value,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeated_enum_value,omitempty"` + + // Repeated numeric enum description. + RepeatedEnumValueAnnotation []ExamplepbNumericEnum `json:"repeated_enum_value_annotation,omitempty"` + + // Numeric enum description. + EnumValueAnnotation ExamplepbNumericEnum `json:"enum_value_annotation,omitempty"` + + // Repeated string description. + RepeatedStringAnnotation []string `json:"repeated_string_annotation,omitempty"` + + // Repeated nested object description. + RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeated_nested_annotation,omitempty"` + + // Nested object description. + NestedAnnotation ABitOfEverythingNested `json:"nested_annotation,omitempty"` } diff --git a/examples/clients/echo/api_client.go b/examples/clients/echo/api_client.go index 7a517148026..d54e3e68565 100644 --- a/examples/clients/echo/api_client.go +++ b/examples/clients/echo/api_client.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/api_response.go b/examples/clients/echo/api_response.go index 8b0d07c4a13..a4f0ab08001 100644 --- a/examples/clients/echo/api_response.go +++ b/examples/clients/echo/api_response.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/configuration.go b/examples/clients/echo/configuration.go index 9a75a30aeec..6441b8dc698 100644 --- a/examples/clients/echo/configuration.go +++ b/examples/clients/echo/configuration.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/echo_service_api.go b/examples/clients/echo/echo_service_api.go index 6ae7cf85a32..7625bc9eec8 100644 --- a/examples/clients/echo/echo_service_api.go +++ b/examples/clients/echo/echo_service_api.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/examplepb_embedded.go b/examples/clients/echo/examplepb_embedded.go index 4b5fe265ac9..ad76336c25b 100644 --- a/examples/clients/echo/examplepb_embedded.go +++ b/examples/clients/echo/examplepb_embedded.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/examplepb_simple_message.go b/examples/clients/echo/examplepb_simple_message.go index 366a6876665..2b9b366e57e 100644 --- a/examples/clients/echo/examplepb_simple_message.go +++ b/examples/clients/echo/examplepb_simple_message.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 896288bd685..9f5eed795a3 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{0} + return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -119,17 +119,27 @@ type ABitOfEverything struct { NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue,proto3" json:"nonConventionalNameValue,omitempty"` TimestampValue *timestamp.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue,proto3" json:"timestamp_value,omitempty"` // repeated enum value. it is comma-separated in query - RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` + // repeated numeric enum comment (This comment is overridden by the field annotation) + RepeatedEnumValueAnnotation []NumericEnum `protobuf:"varint,32,rep,packed,name=repeated_enum_value_annotation,json=repeatedEnumValueAnnotation,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value_annotation,omitempty"` + // numeric enum comment (This comment is overridden by the field annotation) + EnumValueAnnotation NumericEnum `protobuf:"varint,33,opt,name=enum_value_annotation,json=enumValueAnnotation,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value_annotation,omitempty"` + // repeated string comment (This comment is overridden by the field annotation) + RepeatedStringAnnotation []string `protobuf:"bytes,34,rep,name=repeated_string_annotation,json=repeatedStringAnnotation,proto3" json:"repeated_string_annotation,omitempty"` + // repeated nested object comment (This comment is overridden by the field annotation) + RepeatedNestedAnnotation []*ABitOfEverything_Nested `protobuf:"bytes,35,rep,name=repeated_nested_annotation,json=repeatedNestedAnnotation,proto3" json:"repeated_nested_annotation,omitempty"` + // nested object comments (This comment is overridden by the field annotation) + NestedAnnotation *ABitOfEverything_Nested `protobuf:"bytes,36,opt,name=nested_annotation,json=nestedAnnotation,proto3" json:"nested_annotation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{0} + return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -382,6 +392,41 @@ func (m *ABitOfEverything) GetRepeatedEnumValue() []NumericEnum { return nil } +func (m *ABitOfEverything) GetRepeatedEnumValueAnnotation() []NumericEnum { + if m != nil { + return m.RepeatedEnumValueAnnotation + } + return nil +} + +func (m *ABitOfEverything) GetEnumValueAnnotation() NumericEnum { + if m != nil { + return m.EnumValueAnnotation + } + return NumericEnum_ZERO +} + +func (m *ABitOfEverything) GetRepeatedStringAnnotation() []string { + if m != nil { + return m.RepeatedStringAnnotation + } + return nil +} + +func (m *ABitOfEverything) GetRepeatedNestedAnnotation() []*ABitOfEverything_Nested { + if m != nil { + return m.RepeatedNestedAnnotation + } + return nil +} + +func (m *ABitOfEverything) GetNestedAnnotation() *ABitOfEverything_Nested { + if m != nil { + return m.NestedAnnotation + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*ABitOfEverything) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _ABitOfEverything_OneofMarshaler, _ABitOfEverything_OneofUnmarshaler, _ABitOfEverything_OneofSizer, []interface{}{ @@ -467,7 +512,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{0, 0} + return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -536,7 +581,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{1} + return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -679,7 +724,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{2} + return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -718,7 +763,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{3} + return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -765,7 +810,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_74470c9779693dcd, []int{4} + return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1529,200 +1574,212 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_74470c9779693dcd) -} - -var fileDescriptor_a_bit_of_everything_74470c9779693dcd = []byte{ - // 3044 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0xcb, 0x6f, 0x1b, 0xc7, - 0xdd, 0x5a, 0xae, 0x9e, 0xa3, 0x17, 0x35, 0xf2, 0x43, 0xa6, 0x95, 0x68, 0xcc, 0x38, 0xc9, 0x5a, - 0x31, 0xb9, 0xd2, 0x4a, 0x71, 0x6c, 0x06, 0x89, 0x3f, 0xea, 0x61, 0x5b, 0xb1, 0x2d, 0xcb, 0x6b, - 0xc7, 0x5f, 0xe0, 0xd8, 0x11, 0x86, 0xe4, 0x50, 0x5c, 0x8b, 0xbb, 0xb3, 0xd9, 0x9d, 0x95, 0xcd, - 0x4f, 0x1f, 0xbf, 0x2f, 0x7d, 0xa0, 0x45, 0x9b, 0x43, 0x01, 0x05, 0x3d, 0xb4, 0x28, 0xfa, 0x17, - 0xf4, 0xda, 0x53, 0x0e, 0x6d, 0x0f, 0x3d, 0xf5, 0xe6, 0x16, 0x01, 0x8a, 0x02, 0xb9, 0xb4, 0x05, - 0xfa, 0x17, 0x14, 0xe8, 0xa5, 0x28, 0x66, 0x76, 0x97, 0xda, 0x5d, 0x92, 0x96, 0x69, 0x07, 0xb9, - 0x48, 0x3b, 0x33, 0xbf, 0xd7, 0xfc, 0xde, 0xbf, 0x21, 0xd0, 0xc8, 0x13, 0x6c, 0xda, 0x75, 0xe2, - 0xaa, 0xb6, 0x43, 0x19, 0x55, 0x83, 0xa5, 0x5d, 0x52, 0xf1, 0x76, 0xc9, 0x60, 0xdb, 0xb4, 0xba, - 0x4d, 0xf6, 0x88, 0xd3, 0x60, 0x35, 0xc3, 0xda, 0xc9, 0x0b, 0x18, 0x38, 0xb7, 0xe3, 0xd8, 0xe5, - 0xfc, 0x0e, 0x66, 0xe4, 0x31, 0x6e,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x67, 0xda, 0x2c, 0x7e, 0x37, 0x84, 0xd3, 0x27, 0x5a, 0x28, 0x3e, 0x91, 0x07, - 0xa0, 0xe5, 0x49, 0xd1, 0x60, 0x9b, 0x45, 0x72, 0xcf, 0x79, 0x61, 0x2a, 0x24, 0xd4, 0x0a, 0xac, - 0xcc, 0xef, 0x24, 0x30, 0x18, 0xd4, 0x35, 0x08, 0xfa, 0x2d, 0x6c, 0x12, 0xbf, 0xae, 0xe9, 0xe2, - 0x1b, 0x9e, 0x00, 0x83, 0xd8, 0xa4, 0x9e, 0xc5, 0x66, 0x52, 0x22, 0x51, 0x05, 0x2b, 0x78, 0x1b, - 0xa4, 0xe8, 0xae, 0x28, 0x1f, 0x13, 0x5a, 0xf1, 0x45, 0xab, 0x52, 0x7e, 0x8d, 0x10, 0x5b, 0x08, - 0x96, 0xa2, 0xbb, 0xd9, 0x39, 0x30, 0x1c, 0xae, 0xe1, 0x08, 0x18, 0xb8, 0x52, 0xbc, 0x71, 0x67, - 0x3d, 0xdd, 0x07, 0x87, 0x41, 0xff, 0x5d, 0xfd, 0xc3, 0xf5, 0xb4, 0x54, 0x38, 0x79, 0x50, 0x3c, - 0xa6, 0x41, 0x98, 0xde, 0x47, 0x59, 0xba, 0x9b, 0x2d, 0xa0, 0x2c, 0xdf, 0xcf, 0xa2, 0x66, 0xc6, - 0x00, 0xe3, 0x31, 0x8f, 0x85, 0x69, 0x20, 0xef, 0x92, 0x46, 0x70, 0x11, 0xfe, 0x09, 0x57, 0xc0, - 0x80, 0xaf, 0xb6, 0xd4, 0x0b, 0xa4, 0x53, 0x1f, 0xb5, 0x90, 0xba, 0x28, 0x65, 0xd6, 0xc0, 0x89, - 0xce, 0x4e, 0xdb, 0x81, 0xe7, 0xb1, 0x28, 0xcf, 0x91, 0x28, 0x95, 0xff, 0x0b, 0xa9, 0x24, 0x1d, - 0xb0, 0x03, 0x95, 0xcd, 0x28, 0x95, 0x97, 0x69, 0x01, 0x0e, 0xf9, 0x17, 0x7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, 0x81, 0xb2, 0x11, 0xd3, 0xcd, - 0x61, 0x4f, 0x76, 0x19, 0xcc, 0x26, 0x74, 0x13, 0x37, 0xca, 0x38, 0x92, 0x95, 0x49, 0xfd, 0x54, - 0x4c, 0x3b, 0xb1, 0x6e, 0xad, 0x0b, 0x81, 0x96, 0x53, 0x4c, 0x20, 0x59, 0x49, 0x77, 0x22, 0xd0, - 0xd5, 0x99, 0x63, 0x5d, 0xdd, 0x24, 0x92, 0x95, 0xa9, 0x84, 0x75, 0x22, 0x5a, 0xea, 0x88, 0x1c, - 0xe9, 0x1b, 0x65, 0x05, 0xb6, 0x23, 0x07, 0x9c, 0x0b, 0xb5, 0x83, 0x22, 0xd1, 0xca, 0x10, 0xef, - 0xa3, 0x6c, 0x37, 0xc7, 0xca, 0x16, 0xd0, 0xc7, 0xcc, 0xf1, 0xc8, 0x79, 0xe4, 0xff, 0xad, 0xe2, - 0xba, 0x1b, 0x2c, 0x1e, 0x9e, 0x4f, 0xa2, 0x45, 0xe4, 0xe6, 0x78, 0x8b, 0xe7, 0x91, 0x76, 0x1e, - 0x2d, 0x3d, 0x44, 0xcd, 0x6c, 0x06, 0xf4, 0xaf, 0xd0, 0x4a, 0xa3, 0x53, 0x75, 0xce, 0x3e, 0x00, - 0x93, 0x41, 0x33, 0xfd, 0xdf, 0x06, 0xab, 0x09, 0xb0, 0x09, 0x90, 0x0a, 0x47, 0x53, 0x3d, 0x65, - 0xf0, 0x14, 0xd5, 0x5f, 0xc1, 0x0c, 0x07, 0xd5, 0xe3, 0xf5, 0x23, 0xed, 0xce, 0x89, 0xe8, 0x02, - 0x25, 0xfb, 0x85, 0x04, 0x26, 0x3f, 0xb4, 0x2b, 0x98, 0x91, 0x7b, 0x9a, 0x4e, 0x3e, 0xf5, 0x88, - 0xcb, 0xe0, 0x2a, 0x90, 0x71, 0xc9, 0x17, 0x62, 0x54, 0x5b, 0xec, 0xb9, 0x16, 0xe9, 0x1c, 0x1b, - 0xbe, 0x0b, 0x46,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85, - 0x36, 0x8c, 0x18, 0x5c, 0xa5, 0xd8, 0x63, 0x35, 0x95, 0xff, 0xa1, 0x8e, 0xf1, 0x3f, 0xa4, 0x30, - 0xd7, 0x1d, 0x88, 0xd1, 0x5d, 0x62, 0xad, 0xfc, 0x3f, 0xc8, 0xf8, 0x03, 0x07, 0x84, 0x57, 0x1d, - 0x6c, 0x31, 0x17, 0xf1, 0x45, 0xa0, 0x3d, 0x30, 0x1b, 0x8c, 0x21, 0x70, 0x3a, 0x38, 0x14, 0xab, - 0xf0, 0x74, 0x15, 0x0c, 0xe0, 0x8a, 0x69, 0x58, 0xb0, 0x10, 0x43, 0xb5, 0x2a, 0x31, 0x30, 0x61, - 0x0c, 0x0e, 0x66, 0xb8, 0x8c, 0x57, 0xa2, 0x3d, 0x82, 0x0c, 0xab, 0x4a, 0x1d, 0x53, 0xd8, 0xbb, - 0x34, 0x07, 0xc6, 0xa3, 0xaa, 0xe8, 0x4b, 0x8e, 0x46, 0xa5, 0x73, 0x5d, 0x87, 0xa3, 0x24, 0xa8, - 0xb3, 0x01, 0x4e, 0xde, 0x3c, 0xcc, 0x3e, 0xd1, 0x98, 0xea, 0x35, 0x96, 0xee, 0x8f, 0xb4, 0x2c, - 0x57, 0x1a, 0x14, 0xf1, 0xbc, 0xf4, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xec, 0x8b, 0x0d, 0x32, - 0x91, 0x24, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_ba3a130ee49bb615) +} + +var fileDescriptor_a_bit_of_everything_ba3a130ee49bb615 = []byte{ + // 3247 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x5a, 0xdb, 0x73, 0xdb, 0xc6, + 0xd5, 0x17, 0x08, 0xea, 0xb6, 0xba, 0x51, 0x2b, 0x5f, 0x24, 0x5a, 0xb6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x80, 0x21, 0x6f, 0x07, 0x31, 0xc4, 0xbf, + 0xd2, 0x0e, 0x3c, 0x39, 0xf0, 0x3d, 0x30, 0x56, 0xa9, 0x11, 0x85, 0xee, 0x1e, 0x28, 0x35, 0x1b, + 0xcf, 0xf2, 0x88, 0x13, 0x62, 0x85, 0x0b, 0x87, 0xf9, 0xd7, 0xa5, 0xe9, 0x4d, 0x67, 0x1e, 0xb1, + 0x79, 0xc4, 0x3c, 0x2c, 0xc7, 0x2f, 0x66, 0xa5, 0x67, 0x5c, 0x90, 0x41, 0x06, 0x6c, 0x70, 0xdf, + 0xf9, 0x86, 0x67, 0xc1, 0x78, 0x99, 0xd8, 0xc5, 0x1a, 0xf6, 0x84, 0xc5, 0x11, 0x27, 0x70, 0xf2, + 0x98, 0x3b, 0xe7, 0x92, 0x2c, 0x80, 0x31, 0x55, 0xa7, 0x97, 0x57, 0x3c, 0x8a, 0x41, 0xc4, 0x09, + 0xbc, 0x0c, 0xd8, 0x54, 0x4b, 0x86, 0x1d, 0xa4, 0x18, 0x42, 0x9c, 0x10, 0x97, 0xc7, 0xec, 0x00, + 0x89, 0x2b, 0x63, 0x59, 0xf2, 0x28, 0x86, 0x11, 0x27, 0x0c, 0x32, 0x19, 0xcb, 0x92, 0x4b, 0x70, + 0x0e, 0x4c, 0x54, 0xd4, 0xa7, 0xb8, 0xdc, 0x12, 0x32, 0x82, 0x38, 0x61, 0x48, 0x1e, 0xf7, 0x26, + 0xc3, 0x44, 0x2d, 0x39, 0xa3, 0x88, 0x13, 0x86, 0x3d, 0x22, 0x5f, 0xd2, 0x69, 0x00, 0x8a, 0x84, + 0xd4, 0x3c, 0x0a, 0x80, 0x38, 0x61, 0x44, 0x1e, 0x75, 0x66, 0x5a, 0xca, 0x5a, 0xd4, 0x54, 0xf5, + 0x3d, 0x8f, 0x60, 0xcc, 0x71, 0x00, 0x79, 0xcc, 0x9d, 0x6b, 0x29, 0x5b, 0xac, 0x53, 0x6c, 0x79, + 0x14, 0xa7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c3, 0x69, 0x8b, 0x38, 0xf9, 0x64, 0x90, 0x77, 0x3d, 0xd0, 0x7e, 0x74, 0xe0, 0x06, 0x2b, 0x3a, + 0x1e, 0xf1, 0x02, 0x1f, 0xc6, 0xdd, 0x6a, 0x17, 0x77, 0x1d, 0xb8, 0xa1, 0x36, 0x25, 0x8e, 0x78, + 0x21, 0x1e, 0xc6, 0x7d, 0x3f, 0x50, 0x19, 0x76, 0xc3, 0x6d, 0x15, 0x9b, 0x83, 0x88, 0x17, 0x06, + 0x3b, 0x70, 0xfd, 0xba, 0xf3, 0x1d, 0x70, 0x2a, 0x62, 0xaa, 0x50, 0x39, 0x3b, 0x84, 0x78, 0x61, + 0x48, 0x9e, 0x0d, 0x19, 0x2b, 0x58, 0xd9, 0x76, 0x67, 0x0f, 0x34, 0x4f, 0xbc, 0x30, 0xdc, 0x85, + 0xdd, 0x47, 0x7f, 0x0b, 0xcc, 0x86, 0xd9, 0x03, 0xed, 0xd0, 0x08, 0xe2, 0x85, 0x11, 0xf9, 0x78, + 0x90, 0xb7, 0xd0, 0x6a, 0x8d, 0x3a, 0xcc, 0x15, 0x2a, 0x10, 0x47, 0x59, 0x41, 0x1c, 0x32, 0x57, + 0xb8, 0x28, 0x8e, 0x98, 0x2b, 0xd8, 0x42, 0x01, 0xc4, 0x0b, 0xe3, 0x61, 0x73, 0x15, 0xda, 0xed, + 0x54, 0xd7, 0x63, 0x6a, 0x6d, 0x77, 0x0c, 0xf1, 0xc2, 0x44, 0xe7, 0x31, 0xf9, 0xbb, 0xc5, 0xd1, + 0xdd, 0x06, 0xca, 0xab, 0xf1, 0x97, 0x28, 0xaf, 0x42, 0xb6, 0x69, 0x97, 0x58, 0x57, 0xc1, 0x7c, + 0xc4, 0x36, 0xe1, 0x43, 0x99, 0x40, 0xbc, 0x30, 0x25, 0xcf, 0x85, 0xac, 0x13, 0xea, 0x6a, 0x7a, + 0x08, 0x68, 0x39, 0xc5, 0x24, 0xe2, 0x85, 0x44, 0x37, 0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 0x4e, 0x0b, 0xc4, 0xb2, 0x50, 0x1e, 0x80, 0x6d, 0x52, 0x50, 0xf5, 0xb2, + 0xaa, 0xef, 0x59, 0x70, 0xae, 0x23, 0x82, 0xaf, 0x7b, 0xff, 0x31, 0xa0, 0x67, 0x70, 0x1f, 0x80, + 0xf7, 0xc1, 0xf0, 0x3d, 0x55, 0xc3, 0xc4, 0xa6, 0xb0, 0x07, 0x51, 0x4f, 0xe6, 0x53, 0x4c, 0xfd, + 0xe3, 0x70, 0x26, 0x68, 0x4f, 0xea, 0x09, 0xab, 0x82, 0xc4, 0x86, 0x69, 0x12, 0xd3, 0x49, 0xdf, + 0xeb, 0x98, 0x2a, 0x6a, 0xcd, 0xea, 0x1b, 0xe0, 0x3c, 0x03, 0x38, 0x03, 0xe7, 0x43, 0x07, 0xe6, + 0x48, 0x7d, 0xa2, 0xd2, 0x6a, 0xd9, 0x93, 0xfa, 0x1d, 0x0e, 0xc0, 0x6b, 0x98, 0x46, 0xfb, 0xc1, + 0xa3, 0x6b, 0x84, 0x08, 0x47, 0x4f, 0x35, 0xde, 0x60, 0x6a, 0x9c, 0x4d, 0xcd, 0x05, 0xd5, 0x70, + 0x34, 0x28, 0x92, 0x72, 0x5d, 0x6c, 0x38, 0x15, 0x01, 0xeb, 0x1b, 0xe1, 0xb7, 0x38, 0x30, 0xbd, + 0x43, 0x2c, 0xea, 0x48, 0x64, 0xac, 0x4c, 0x91, 0x17, 0x6b, 0x3d, 0x7b, 0xa2, 0x8b, 0x0c, 0xfd, + 0x42, 0xea, 0x7c, 0x10, 0xdd, 0x20, 0x16, 0x75, 0x34, 0x60, 0x3f, 0x3a, 0xba, 0x6a, 0xf8, 0x4e, + 0x91, 0xfc, 0x35, 0x77, 0x98, 0xff, 0x82, 0x83, 0x95, 0x1e, 0x9d, 0x60, 0xf0, 0x5d, 0x1c, 0x65, + 0x32, 0xe8, 0x49, 0x55, 0x2d, 0x55, 0x91, 0x55, 0x25, 0x76, 0xad, 0xcc, 0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0x4d, 0x44, 0xc9, 0x3e, 0xd6, + 0x0b, 0xff, 0x0f, 0x92, 0x6e, 0xc3, 0x01, 0xe1, 0x35, 0x53, 0xd1, 0xa9, 0x85, 0x9c, 0x81, 0x67, + 0x3d, 0x30, 0xef, 0xb5, 0x21, 0x70, 0xc6, 0x5b, 0x64, 0x23, 0x7f, 0x75, 0x0d, 0x0c, 0x2a, 0x65, + 0x4d, 0xd5, 0x61, 0x2e, 0xc4, 0xaa, 0x97, 0x43, 0x64, 0xec, 0x30, 0x1c, 0x32, 0xd5, 0xa2, 0x4e, + 0x26, 0x3a, 0xc0, 0x48, 0xd5, 0x2b, 0xc4, 0xd4, 0xd8, 0x79, 0x17, 0x17, 0xc0, 0x44, 0xd0, 0x14, + 0x03, 0xd1, 0xd6, 0xa8, 0x78, 0xa1, 0x67, 0x73, 0x14, 0x25, 0x35, 0xb7, 0xc0, 0xc9, 0x5b, 0xed, + 0xe8, 0x13, 0xbc, 0x53, 0xfd, 0xde, 0xa5, 0x07, 0xa3, 0xad, 0x93, 0x2b, 0x0e, 0xb1, 0xfb, 0xbc, + 0xfc, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x13, 0x85, 0x60, 0x25, 0x28, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index 2d9070eef8d..b7e7c012e57 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -33,7 +33,7 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var ( - filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14, "enum_value": 15, "path_enum_value": 16, "nested_path_enum_value": 17}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}} + filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14, "enum_value": 15, "path_enum_value": 16, "nested_path_enum_value": 17, "repeated_enum_value": 18, "repeated_enum_value_annotation": 19, "enum_value_annotation": 20, "repeated_string_annotation": 21}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}} ) func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -43,6 +43,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run var ( val string e int32 + es []int32 ok bool err error _ = err @@ -252,6 +253,64 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.NestedPathEnumValue = pathenum.MessagePathEnum_NestedPathEnum(e) + val, ok = pathParams["repeated_enum_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "repeated_enum_value") + } + + es, err = runtime.EnumSlice(val, ",", NumericEnum_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "repeated_enum_value", err) + } + + s := make([]NumericEnum, len(es)) + for i, v := range es { + s[i] = NumericEnum(v) + } + protoReq.RepeatedEnumValue = s + + val, ok = pathParams["repeated_enum_value_annotation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "repeated_enum_value_annotation") + } + + es, err = runtime.EnumSlice(val, ",", NumericEnum_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "repeated_enum_value_annotation", err) + } + + s := make([]NumericEnum, len(es)) + for i, v := range es { + s[i] = NumericEnum(v) + } + protoReq.RepeatedEnumValueAnnotation = s + + val, ok = pathParams["enum_value_annotation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "enum_value_annotation") + } + + e, err = runtime.Enum(val, NumericEnum_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "enum_value_annotation", err) + } + + protoReq.EnumValueAnnotation = NumericEnum(e) + + val, ok = pathParams["repeated_string_annotation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "repeated_string_annotation") + } + + protoReq.RepeatedStringAnnotation, err = runtime.StringSlice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "repeated_string_annotation", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Create_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -1329,7 +1388,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt } var ( - pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19, 1, 0, 4, 1, 5, 20, 1, 0, 4, 1, 5, 21, 1, 0, 4, 1, 5, 22}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue", "enum_value", "path_enum_value", "nested_path_enum_value"}, "")) + pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19, 1, 0, 4, 1, 5, 20, 1, 0, 4, 1, 5, 21, 1, 0, 4, 1, 5, 22, 1, 0, 4, 1, 5, 23, 1, 0, 4, 1, 5, 24, 1, 0, 4, 1, 5, 25, 1, 0, 4, 1, 5, 26}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue", "enum_value", "path_enum_value", "nested_path_enum_value", "repeated_enum_value", "repeated_enum_value_annotation", "enum_value_annotation", "repeated_string_annotation"}, "")) pattern_ABitOfEverythingService_CreateBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 9533cad3e5e..82af8e0414f 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -202,6 +202,21 @@ message ABitOfEverything { // repeated enum value. it is comma-separated in query repeated NumericEnum repeated_enum_value = 28; + + // repeated numeric enum comment (This comment is overridden by the field annotation) + repeated NumericEnum repeated_enum_value_annotation = 32 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {title: "Repeated numeric enum title", description: "Repeated numeric enum description."}]; + + // numeric enum comment (This comment is overridden by the field annotation) + NumericEnum enum_value_annotation = 33 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {title: "Numeric enum title", description: "Numeric enum description."}]; + + // repeated string comment (This comment is overridden by the field annotation) + repeated string repeated_string_annotation = 34 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {title: "Repeated string title", description: "Repeated string description."}]; + + // repeated nested object comment (This comment is overridden by the field annotation) + repeated Nested repeated_nested_annotation = 35 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {title: "Repeated nested object title", description: "Repeated nested object description."}]; + + // nested object comments (This comment is overridden by the field annotation) + Nested nested_annotation = 36 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {title: "Nested object title", description: "Nested object description."}]; } // ABitOfEverythingRepeated is used to validate repeated path parameter functionality @@ -270,7 +285,7 @@ service ABitOfEverythingService { // This API creates a new ABitOfEverything rpc Create(ABitOfEverything) returns (ABitOfEverything) { 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}/{enum_value}/{path_enum_value}/{nested_path_enum_value}" + 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}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{repeated_enum_value_annotation}/{enum_value_annotation}/{repeated_string_annotation}" }; } rpc CreateBody(ABitOfEverything) returns (ABitOfEverything) { diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 3e246b63c78..48a97db32a9 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -362,6 +362,68 @@ "ONE" ] } + }, + { + "name": "repeated_enum_value_annotation", + "description": "Repeated numeric enum title. Repeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + } + }, + { + "name": "enum_value_annotation", + "description": "Numeric enum title. Numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "ZERO", + "ONE" + ], + "default": "ZERO" + }, + { + "name": "repeated_string_annotation", + "description": "Repeated string title. Repeated string description.", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + } + }, + { + "name": "nested_annotation.name", + "description": "name is nested field.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "nested_annotation.amount", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "nested_annotation.ok", + "description": " - FALSE: FALSE is false.\n - TRUE: TRUE is true.", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "FALSE", + "TRUE" + ], + "default": "FALSE" } ], "tags": [ @@ -375,7 +437,7 @@ } } }, - "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}": { + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{repeated_enum_value_annotation}/{enum_value_annotation}/{repeated_string_annotation}": { "post": { "summary": "Create a new ABitOfEverything", "description": "This API creates a new ABitOfEverything", @@ -539,6 +601,61 @@ "GHI", "JKL" ] + }, + { + "name": "repeated_enum_value", + "description": "repeated enum value. it is comma-separated in query", + "in": "path", + "required": true, + "type": "array", + "items": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + }, + "collectionFormat": "csv", + "minItems": 1 + }, + { + "name": "repeated_enum_value_annotation", + "description": "Repeated numeric enum description.", + "in": "path", + "required": true, + "type": "array", + "items": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + }, + "collectionFormat": "csv", + "minItems": 1 + }, + { + "name": "enum_value_annotation", + "description": "Numeric enum description.", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + }, + { + "name": "repeated_string_annotation", + "description": "Repeated string description.", + "in": "path", + "required": true, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "minItems": 1 } ], "tags": [ @@ -1570,6 +1687,40 @@ "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" + }, + "repeated_enum_value_annotation": { + "type": "array", + "items": { + "$ref": "#/definitions/examplepbNumericEnum" + }, + "description": "Repeated numeric enum description.", + "title": "Repeated numeric enum title" + }, + "enum_value_annotation": { + "$ref": "#/definitions/examplepbNumericEnum", + "description": "Numeric enum description.", + "title": "Numeric enum title" + }, + "repeated_string_annotation": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Repeated string description.", + "title": "Repeated string title" + }, + "repeated_nested_annotation": { + "type": "array", + "items": { + "$ref": "#/definitions/ABitOfEverythingNested" + }, + "description": "Repeated nested object description.", + "title": "Repeated nested object title" + }, + "nested_annotation": { + "$ref": "#/definitions/ABitOfEverythingNested", + "description": "Nested object description.", + "title": "Nested object title" } }, "description": "Intentionaly complicated message type to cover many features of Protobuf.", diff --git a/examples/proto/examplepb/echo_service.swagger.json b/examples/proto/examplepb/echo_service.swagger.json index f1687bccf64..bc9feb32160 100644 --- a/examples/proto/examplepb/echo_service.swagger.json +++ b/examples/proto/examplepb/echo_service.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "Echo Service", + "title": "examples/proto/examplepb/echo_service.proto", "description": "Echo Service API consists of a single service which returns\na message.", "version": "version not set" }, diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index 7739b3ea13d..581ae1fd2f1 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -260,6 +260,40 @@ "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" + }, + "repeated_enum_value_annotation": { + "type": "array", + "items": { + "$ref": "#/definitions/examplepbNumericEnum" + }, + "description": "Repeated numeric enum description.", + "title": "Repeated numeric enum title" + }, + "enum_value_annotation": { + "$ref": "#/definitions/examplepbNumericEnum", + "description": "Numeric enum description.", + "title": "Numeric enum title" + }, + "repeated_string_annotation": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Repeated string description.", + "title": "Repeated string title" + }, + "repeated_nested_annotation": { + "type": "array", + "items": { + "$ref": "#/definitions/ABitOfEverythingNested" + }, + "description": "Repeated nested object description.", + "title": "Repeated nested object title" + }, + "nested_annotation": { + "$ref": "#/definitions/ABitOfEverythingNested", + "description": "Nested object description.", + "title": "Nested object title" } }, "description": "Intentionaly complicated message type to cover many features of Protobuf.", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index fcc98b1f51f..e1c9eca76a0 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -408,31 +408,35 @@ func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) s } } + ret := swaggerSchemaObject{} + switch aggregate { case array: - return swaggerSchemaObject{ + ret = swaggerSchemaObject{ schemaCore: schemaCore{ Type: "array", Items: (*swaggerItemsObject)(&core), }, } case object: - return swaggerSchemaObject{ + ret = swaggerSchemaObject{ schemaCore: schemaCore{ Type: "object", }, AdditionalProperties: &swaggerSchemaObject{Properties: props, schemaCore: core}, } default: - ret := swaggerSchemaObject{ + ret = swaggerSchemaObject{ schemaCore: core, Properties: props, } - if j, err := extractJSONSchemaFromFieldDescriptor(fd); err == nil { - updateSwaggerObjectFromJSONSchema(&ret, j) - } - return ret } + + if j, err := extractJSONSchemaFromFieldDescriptor(fd); err == nil { + updateSwaggerObjectFromJSONSchema(&ret, j) + } + + return ret } // primitiveSchema returns a pair of "Type" and "Format" in JSON Schema for @@ -680,6 +684,9 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re return err } enumNames = listEnumNames(enum) + schema := schemaOfField(parameter.Target, reg, customRefs) + desc = schema.Description + defaultValue = schema.Default default: var ok bool paramType, paramFormat, ok = primitiveSchema(pt) @@ -1214,26 +1221,32 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er paragraphs := strings.Split(comment, "\n\n") - // If there is a summary (or summary-equivalent), use the first + // If there is a summary (or summary-equivalent) and its empty, use the first // paragraph as summary, and the rest as description. if summaryValue.CanSet() { summary := strings.TrimSpace(paragraphs[0]) description := strings.TrimSpace(strings.Join(paragraphs[1:], "\n\n")) if !usingTitle || (len(summary) > 0 && summary[len(summary)-1] != '.') { - summaryValue.Set(reflect.ValueOf(summary)) + // overrides the schema value only if it's empty + if summaryValue.Len() == 0 { + summaryValue.Set(reflect.ValueOf(summary)) + } if len(description) > 0 { if !descriptionValue.CanSet() { return fmt.Errorf("Encountered object type with a summary, but no description") } - descriptionValue.Set(reflect.ValueOf(description)) + // overrides the schema value only if it's empty + if descriptionValue.Len() == 0 { + descriptionValue.Set(reflect.ValueOf(description)) + } } return nil } } // There was no summary field on the swaggerObject. Try to apply the - // whole comment into description. - if descriptionValue.CanSet() { + // whole comment into description if the swagger object description is empty. + if descriptionValue.CanSet() && descriptionValue.Len() == 0 { descriptionValue.Set(reflect.ValueOf(strings.Join(paragraphs, "\n\n"))) return nil } From 573776478d3f7bcad8fa626766478e009bba14c3 Mon Sep 17 00:00:00 2001 From: fahernandez Date: Mon, 11 Feb 2019 16:02:37 -0600 Subject: [PATCH 360/552] 863 fixing swagger generation --- .../abe/a_bit_of_everything_service_api.go | 14 +- .../abe/examplepb_a_bit_of_everything.go | 2 +- .../proto/examplepb/a_bit_of_everything.pb.go | 439 +++++++++--------- .../examplepb/a_bit_of_everything.pb.gw.go | 21 +- .../proto/examplepb/a_bit_of_everything.proto | 4 +- .../a_bit_of_everything.swagger.json | 22 +- examples/proto/examplepb/stream.swagger.json | 2 +- 7 files changed, 235 insertions(+), 269 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 21971cc14fc..de167d3cd16 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -61,16 +61,15 @@ func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythin * @param pathEnumValue * @param nestedPathEnumValue * @param repeatedEnumValue repeated enum value. it is comma-separated in query - * @param repeatedEnumValueAnnotation Repeated numeric enum description. * @param enumValueAnnotation Numeric enum description. * @param repeatedStringAnnotation Repeated string description. * @return *ExamplepbABitOfEverything */ -func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, repeatedEnumValue []string, repeatedEnumValueAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string) (*ExamplepbABitOfEverything, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, repeatedEnumValue []string, enumValueAnnotation string, repeatedStringAnnotation []string) (*ExamplepbABitOfEverything, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables - localVarPath := a.Configuration.BasePath + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{repeated_enum_value_annotation}/{enum_value_annotation}/{repeated_string_annotation}" + localVarPath := a.Configuration.BasePath + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{enum_value_annotation}/{repeated_string_annotation}" localVarPath = strings.Replace(localVarPath, "{"+"float_value"+"}", fmt.Sprintf("%v", floatValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"double_value"+"}", fmt.Sprintf("%v", doubleValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"int64_value"+"}", fmt.Sprintf("%v", int64Value), -1) @@ -90,7 +89,6 @@ func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float localVarPath = strings.Replace(localVarPath, "{"+"path_enum_value"+"}", fmt.Sprintf("%v", pathEnumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"nested_path_enum_value"+"}", fmt.Sprintf("%v", nestedPathEnumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"repeated_enum_value"+"}", fmt.Sprintf("%v", repeatedEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"repeated_enum_value_annotation"+"}", fmt.Sprintf("%v", repeatedEnumValueAnnotation), -1) localVarPath = strings.Replace(localVarPath, "{"+"enum_value_annotation"+"}", fmt.Sprintf("%v", enumValueAnnotation), -1) localVarPath = strings.Replace(localVarPath, "{"+"repeated_string_annotation"+"}", fmt.Sprintf("%v", repeatedStringAnnotation), -1) @@ -555,7 +553,7 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param nonConventionalNameValue * @param timestampValue * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param repeatedEnumValueAnnotation Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param repeatedEnumAnnotation Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param enumValueAnnotation Numeric enum title. Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param repeatedStringAnnotation Repeated string title. Repeated string description. * @param nestedAnnotationName name is nested field. @@ -563,7 +561,7 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param nestedAnnotationOk - FALSE: FALSE is false. - TRUE: TRUE is true. * @return *interface{} */ -func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, singleNestedName string, singleNestedAmount int64, singleNestedOk string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumValueAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationName string, nestedAnnotationAmount int64, nestedAnnotationOk string) (*interface{}, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, singleNestedName string, singleNestedAmount int64, singleNestedOk string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationName string, nestedAnnotationAmount int64, nestedAnnotationOk string) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables @@ -610,8 +608,8 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, si var repeatedEnumValueCollectionFormat = "csv" localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) - var repeatedEnumValueAnnotationCollectionFormat = "csv" - localVarQueryParams.Add("repeated_enum_value_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumValueAnnotation, repeatedEnumValueAnnotationCollectionFormat)) + var repeatedEnumAnnotationCollectionFormat = "csv" + localVarQueryParams.Add("repeated_enum_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumAnnotation, repeatedEnumAnnotationCollectionFormat)) localVarQueryParams.Add("enum_value_annotation", a.Configuration.APIClient.ParameterToString(enumValueAnnotation, "")) var repeatedStringAnnotationCollectionFormat = "csv" diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go index 74ec2f41000..2190507a464 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -79,7 +79,7 @@ type ExamplepbABitOfEverything struct { RepeatedEnumValue []ExamplepbNumericEnum `json:"repeated_enum_value,omitempty"` // Repeated numeric enum description. - RepeatedEnumValueAnnotation []ExamplepbNumericEnum `json:"repeated_enum_value_annotation,omitempty"` + RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeated_enum_annotation,omitempty"` // Numeric enum description. EnumValueAnnotation ExamplepbNumericEnum `json:"enum_value_annotation,omitempty"` diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 9f5eed795a3..2e0ace34871 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{0} + return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -121,7 +121,7 @@ type ABitOfEverything struct { // repeated enum value. it is comma-separated in query RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` // repeated numeric enum comment (This comment is overridden by the field annotation) - RepeatedEnumValueAnnotation []NumericEnum `protobuf:"varint,32,rep,packed,name=repeated_enum_value_annotation,json=repeatedEnumValueAnnotation,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value_annotation,omitempty"` + RepeatedEnumAnnotation []NumericEnum `protobuf:"varint,32,rep,packed,name=repeated_enum_annotation,json=repeatedEnumAnnotation,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_annotation,omitempty"` // numeric enum comment (This comment is overridden by the field annotation) EnumValueAnnotation NumericEnum `protobuf:"varint,33,opt,name=enum_value_annotation,json=enumValueAnnotation,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value_annotation,omitempty"` // repeated string comment (This comment is overridden by the field annotation) @@ -139,7 +139,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{0} + return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -392,9 +392,9 @@ func (m *ABitOfEverything) GetRepeatedEnumValue() []NumericEnum { return nil } -func (m *ABitOfEverything) GetRepeatedEnumValueAnnotation() []NumericEnum { +func (m *ABitOfEverything) GetRepeatedEnumAnnotation() []NumericEnum { if m != nil { - return m.RepeatedEnumValueAnnotation + return m.RepeatedEnumAnnotation } return nil } @@ -512,7 +512,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{0, 0} + return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -581,7 +581,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{1} + return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -724,7 +724,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{2} + return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -763,7 +763,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{3} + return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -810,7 +810,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_ba3a130ee49bb615, []int{4} + return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1574,212 +1574,213 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_ba3a130ee49bb615) -} - -var fileDescriptor_a_bit_of_everything_ba3a130ee49bb615 = []byte{ - // 3247 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x5a, 0xdb, 0x73, 0xdb, 0xc6, - 0xd5, 0x17, 0x08, 0xea, 0xb6, 0xba, 0x51, 0x2b, 0x5f, 0x24, 0x5a, 0xb6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x80, 0x21, 0x6f, 0x07, 0x31, 0xc4, 0xbf, - 0xd2, 0x0e, 0x3c, 0x39, 0xf0, 0x3d, 0x30, 0x56, 0xa9, 0x11, 0x85, 0xee, 0x1e, 0x28, 0x35, 0x1b, - 0xcf, 0xf2, 0x88, 0x13, 0x62, 0x85, 0x0b, 0x87, 0xf9, 0xd7, 0xa5, 0xe9, 0x4d, 0x67, 0x1e, 0xb1, - 0x79, 0xc4, 0x3c, 0x2c, 0xc7, 0x2f, 0x66, 0xa5, 0x67, 0x5c, 0x90, 0x41, 0x06, 0x6c, 0x70, 0xdf, - 0xf9, 0x86, 0x67, 0xc1, 0x78, 0x99, 0xd8, 0xc5, 0x1a, 0xf6, 0x84, 0xc5, 0x11, 0x27, 0x70, 0xf2, - 0x98, 0x3b, 0xe7, 0x92, 0x2c, 0x80, 0x31, 0x55, 0xa7, 0x97, 0x57, 0x3c, 0x8a, 0x41, 0xc4, 0x09, - 0xbc, 0x0c, 0xd8, 0x54, 0x4b, 0x86, 0x1d, 0xa4, 0x18, 0x42, 0x9c, 0x10, 0x97, 0xc7, 0xec, 0x00, - 0x89, 0x2b, 0x63, 0x59, 0xf2, 0x28, 0x86, 0x11, 0x27, 0x0c, 0x32, 0x19, 0xcb, 0x92, 0x4b, 0x70, - 0x0e, 0x4c, 0x54, 0xd4, 0xa7, 0xb8, 0xdc, 0x12, 0x32, 0x82, 0x38, 0x61, 0x48, 0x1e, 0xf7, 0x26, - 0xc3, 0x44, 0x2d, 0x39, 0xa3, 0x88, 0x13, 0x86, 0x3d, 0x22, 0x5f, 0xd2, 0x69, 0x00, 0x8a, 0x84, - 0xd4, 0x3c, 0x0a, 0x80, 0x38, 0x61, 0x44, 0x1e, 0x75, 0x66, 0x5a, 0xca, 0x5a, 0xd4, 0x54, 0xf5, - 0x3d, 0x8f, 0x60, 0xcc, 0x71, 0x00, 0x79, 0xcc, 0x9d, 0x6b, 0x29, 0x5b, 0xac, 0x53, 0x6c, 0x79, - 0x14, 0xa7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c3, 0x69, 0x8b, 0x38, 0xf9, 0x64, 0x90, 0x77, 0x3d, 0xd0, 0x7e, 0x74, 0xe0, 0x06, 0x2b, 0x3a, - 0x1e, 0xf1, 0x02, 0x1f, 0xc6, 0xdd, 0x6a, 0x17, 0x77, 0x1d, 0xb8, 0xa1, 0x36, 0x25, 0x8e, 0x78, - 0x21, 0x1e, 0xc6, 0x7d, 0x3f, 0x50, 0x19, 0x76, 0xc3, 0x6d, 0x15, 0x9b, 0x83, 0x88, 0x17, 0x06, - 0x3b, 0x70, 0xfd, 0xba, 0xf3, 0x1d, 0x70, 0x2a, 0x62, 0xaa, 0x50, 0x39, 0x3b, 0x84, 0x78, 0x61, - 0x48, 0x9e, 0x0d, 0x19, 0x2b, 0x58, 0xd9, 0x76, 0x67, 0x0f, 0x34, 0x4f, 0xbc, 0x30, 0xdc, 0x85, - 0xdd, 0x47, 0x7f, 0x0b, 0xcc, 0x86, 0xd9, 0x03, 0xed, 0xd0, 0x08, 0xe2, 0x85, 0x11, 0xf9, 0x78, - 0x90, 0xb7, 0xd0, 0x6a, 0x8d, 0x3a, 0xcc, 0x15, 0x2a, 0x10, 0x47, 0x59, 0x41, 0x1c, 0x32, 0x57, - 0xb8, 0x28, 0x8e, 0x98, 0x2b, 0xd8, 0x42, 0x01, 0xc4, 0x0b, 0xe3, 0x61, 0x73, 0x15, 0xda, 0xed, - 0x54, 0xd7, 0x63, 0x6a, 0x6d, 0x77, 0x0c, 0xf1, 0xc2, 0x44, 0xe7, 0x31, 0xf9, 0xbb, 0xc5, 0xd1, - 0xdd, 0x06, 0xca, 0xab, 0xf1, 0x97, 0x28, 0xaf, 0x42, 0xb6, 0x69, 0x97, 0x58, 0x57, 0xc1, 0x7c, - 0xc4, 0x36, 0xe1, 0x43, 0x99, 0x40, 0xbc, 0x30, 0x25, 0xcf, 0x85, 0xac, 0x13, 0xea, 0x6a, 0x7a, - 0x08, 0x68, 0x39, 0xc5, 0x24, 0xe2, 0x85, 0x44, 0x37, 0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 0x4e, 0x0b, 0xc4, 0xb2, 0x50, 0x1e, 0x80, 0x6d, 0x52, 0x50, 0xf5, 0xb2, - 0xaa, 0xef, 0x59, 0x70, 0xae, 0x23, 0x82, 0xaf, 0x7b, 0xff, 0x31, 0xa0, 0x67, 0x70, 0x1f, 0x80, - 0xf7, 0xc1, 0xf0, 0x3d, 0x55, 0xc3, 0xc4, 0xa6, 0xb0, 0x07, 0x51, 0x4f, 0xe6, 0x53, 0x4c, 0xfd, - 0xe3, 0x70, 0x26, 0x68, 0x4f, 0xea, 0x09, 0xab, 0x82, 0xc4, 0x86, 0x69, 0x12, 0xd3, 0x49, 0xdf, - 0xeb, 0x98, 0x2a, 0x6a, 0xcd, 0xea, 0x1b, 0xe0, 0x3c, 0x03, 0x38, 0x03, 0xe7, 0x43, 0x07, 0xe6, - 0x48, 0x7d, 0xa2, 0xd2, 0x6a, 0xd9, 0x93, 0xfa, 0x1d, 0x0e, 0xc0, 0x6b, 0x98, 0x46, 0xfb, 0xc1, - 0xa3, 0x6b, 0x84, 0x08, 0x47, 0x4f, 0x35, 0xde, 0x60, 0x6a, 0x9c, 0x4d, 0xcd, 0x05, 0xd5, 0x70, - 0x34, 0x28, 0x92, 0x72, 0x5d, 0x6c, 0x38, 0x15, 0x01, 0xeb, 0x1b, 0xe1, 0xb7, 0x38, 0x30, 0xbd, - 0x43, 0x2c, 0xea, 0x48, 0x64, 0xac, 0x4c, 0x91, 0x17, 0x6b, 0x3d, 0x7b, 0xa2, 0x8b, 0x0c, 0xfd, - 0x42, 0xea, 0x7c, 0x10, 0xdd, 0x20, 0x16, 0x75, 0x34, 0x60, 0x3f, 0x3a, 0xba, 0x6a, 0xf8, 0x4e, - 0x91, 0xfc, 0x35, 0x77, 0x98, 0xff, 0x82, 0x83, 0x95, 0x1e, 0x9d, 0x60, 0xf0, 0x5d, 0x1c, 0x65, - 0x32, 0xe8, 0x49, 0x55, 0x2d, 0x55, 0x91, 0x55, 0x25, 0x76, 0xad, 0xcc, 0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0x4d, 0x44, 0xc9, 0x3e, 0xd6, - 0x0b, 0xff, 0x0f, 0x92, 0x6e, 0xc3, 0x01, 0xe1, 0x35, 0x53, 0xd1, 0xa9, 0x85, 0x9c, 0x81, 0x67, - 0x3d, 0x30, 0xef, 0xb5, 0x21, 0x70, 0xc6, 0x5b, 0x64, 0x23, 0x7f, 0x75, 0x0d, 0x0c, 0x2a, 0x65, - 0x4d, 0xd5, 0x61, 0x2e, 0xc4, 0xaa, 0x97, 0x43, 0x64, 0xec, 0x30, 0x1c, 0x32, 0xd5, 0xa2, 0x4e, - 0x26, 0x3a, 0xc0, 0x48, 0xd5, 0x2b, 0xc4, 0xd4, 0xd8, 0x79, 0x17, 0x17, 0xc0, 0x44, 0xd0, 0x14, - 0x03, 0xd1, 0xd6, 0xa8, 0x78, 0xa1, 0x67, 0x73, 0x14, 0x25, 0x35, 0xb7, 0xc0, 0xc9, 0x5b, 0xed, - 0xe8, 0x13, 0xbc, 0x53, 0xfd, 0xde, 0xa5, 0x07, 0xa3, 0xad, 0x93, 0x2b, 0x0e, 0xb1, 0xfb, 0xbc, - 0xfc, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x13, 0x85, 0x60, 0x25, 0x28, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_68327cc2832b2df4) +} + +var fileDescriptor_a_bit_of_everything_68327cc2832b2df4 = []byte{ + // 3251 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xcb, 0x6f, 0x1b, 0x47, + 0x9a, 0x57, 0xb3, 0xa9, 0x57, 0xe9, 0x45, 0x95, 0x6c, 0x99, 0xa2, 0xe5, 0xa8, 0x4c, 0x3b, 0x49, + 0x9b, 0x31, 0xd9, 0x52, 0x4b, 0x76, 0x64, 0x06, 0x89, 0x97, 0xd4, 0xc3, 0x56, 0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a2, 0x68, 0xc4, 0xd6, 0x69, 0x32, 0xc6, 0xb2, 0xb8, 0x37, 0x82, 0xf7, + 0x40, 0x8c, 0x1c, 0xb2, 0xda, 0x6a, 0x5a, 0x2a, 0xbc, 0xee, 0x26, 0x72, 0x9b, 0x18, 0x1b, 0xec, + 0xd6, 0xc6, 0xc8, 0x61, 0x7a, 0x09, 0x8c, 0xf9, 0x63, 0x38, 0x0e, 0x86, 0xb7, 0x0b, 0xb7, 0xef, + 0x6f, 0x25, 0x86, 0xe0, 0x18, 0x88, 0x3f, 0x90, 0x3f, 0xd9, 0x4a, 0x70, 0xf9, 0x33, 0xc7, 0x85, + 0x53, 0x12, 0x84, 0x89, 0x26, 0x4a, 0x93, 0xc3, 0x74, 0x1e, 0xa5, 0x9d, 0xf9, 0x34, 0x6a, 0xa5, + 0x54, 0x30, 0x15, 0x0a, 0xe7, 0x30, 0x01, 0xf8, 0x43, 0xdc, 0xf0, 0x36, 0xe2, 0x7c, 0xc2, 0x22, + 0x18, 0x76, 0x63, 0x4a, 0xec, 0x35, 0x6a, 0x0d, 0x97, 0x35, 0x1f, 0x5b, 0xe7, 0x52, 0x9b, 0x60, + 0xbe, 0x77, 0x44, 0xef, 0x81, 0x79, 0x2a, 0x88, 0x39, 0x1e, 0x94, 0xf2, 0x57, 0xbe, 0x94, 0x68, + 0x74, 0xee, 0x21, 0x65, 0x37, 0x28, 0xe5, 0x4d, 0xea, 0xe3, 0x0e, 0x7e, 0xfe, 0xdf, 0x63, 0xc7, + 0x85, 0x7f, 0x8b, 0x81, 0xbf, 0xe7, 0x32, 0x73, 0x05, 0x54, 0x52, 0x29, 0x22, 0x55, 0xd4, 0x69, + 0xe9, 0xa4, 0x9d, 0x1d, 0x9d, 0xfa, 0x91, 0xbe, 0x81, 0xca, 0x44, 0x33, 0xea, 0x6a, 0x99, 0x5d, + 0x00, 0xaf, 0xd1, 0x41, 0xb4, 0x61, 0x60, 0x44, 0x09, 0x2a, 0x93, 0x23, 0x6c, 0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x36, 0x1c, 0x10, 0xde, 0x30, 0x15, 0x9d, + 0x5a, 0xc8, 0x19, 0x78, 0xd6, 0x03, 0x8b, 0x5e, 0x1b, 0x02, 0xe7, 0xbc, 0x45, 0x36, 0xf2, 0x57, + 0x37, 0xc0, 0xb0, 0x52, 0xd1, 0x54, 0x1d, 0xe6, 0x43, 0xac, 0x7a, 0x25, 0x44, 0xc6, 0x0e, 0xc3, + 0x21, 0x53, 0x2d, 0xea, 0x64, 0xa2, 0x23, 0x8c, 0x54, 0xbd, 0x4a, 0x4c, 0x8d, 0x9d, 0x77, 0x69, + 0x09, 0x4c, 0x05, 0x4d, 0x31, 0x14, 0x6d, 0x8d, 0x4a, 0x97, 0xfa, 0x36, 0x47, 0x51, 0x52, 0x73, + 0x07, 0x9c, 0xb9, 0xd3, 0x89, 0x3e, 0xc1, 0x3b, 0x35, 0xe8, 0x5d, 0x7a, 0x34, 0xde, 0x3e, 0xb9, + 0xd2, 0x08, 0xbb, 0xcf, 0xab, 0x7f, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x54, 0x0b, 0x85, 0xbe, 0xf9, + 0x27, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index b7e7c012e57..e9e8855f877 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -33,7 +33,7 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var ( - filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14, "enum_value": 15, "path_enum_value": 16, "nested_path_enum_value": 17, "repeated_enum_value": 18, "repeated_enum_value_annotation": 19, "enum_value_annotation": 20, "repeated_string_annotation": 21}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}} + filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14, "enum_value": 15, "path_enum_value": 16, "nested_path_enum_value": 17, "repeated_enum_value": 18, "enum_value_annotation": 19, "repeated_string_annotation": 20}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22}} ) func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -270,23 +270,6 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run } protoReq.RepeatedEnumValue = s - val, ok = pathParams["repeated_enum_value_annotation"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "repeated_enum_value_annotation") - } - - es, err = runtime.EnumSlice(val, ",", NumericEnum_value) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "repeated_enum_value_annotation", err) - } - - s := make([]NumericEnum, len(es)) - for i, v := range es { - s[i] = NumericEnum(v) - } - protoReq.RepeatedEnumValueAnnotation = s - val, ok = pathParams["enum_value_annotation"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "enum_value_annotation") @@ -1388,7 +1371,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt } var ( - pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19, 1, 0, 4, 1, 5, 20, 1, 0, 4, 1, 5, 21, 1, 0, 4, 1, 5, 22, 1, 0, 4, 1, 5, 23, 1, 0, 4, 1, 5, 24, 1, 0, 4, 1, 5, 25, 1, 0, 4, 1, 5, 26}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue", "enum_value", "path_enum_value", "nested_path_enum_value", "repeated_enum_value", "repeated_enum_value_annotation", "enum_value_annotation", "repeated_string_annotation"}, "")) + pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19, 1, 0, 4, 1, 5, 20, 1, 0, 4, 1, 5, 21, 1, 0, 4, 1, 5, 22, 1, 0, 4, 1, 5, 23, 1, 0, 4, 1, 5, 24, 1, 0, 4, 1, 5, 25}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue", "enum_value", "path_enum_value", "nested_path_enum_value", "repeated_enum_value", "enum_value_annotation", "repeated_string_annotation"}, "")) pattern_ABitOfEverythingService_CreateBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 82af8e0414f..1fd471575a5 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -204,7 +204,7 @@ message ABitOfEverything { repeated NumericEnum repeated_enum_value = 28; // repeated numeric enum comment (This comment is overridden by the field annotation) - repeated NumericEnum repeated_enum_value_annotation = 32 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {title: "Repeated numeric enum title", description: "Repeated numeric enum description."}]; + repeated NumericEnum repeated_enum_annotation = 32 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {title: "Repeated numeric enum title", description: "Repeated numeric enum description."}]; // numeric enum comment (This comment is overridden by the field annotation) NumericEnum enum_value_annotation = 33 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {title: "Numeric enum title", description: "Numeric enum description."}]; @@ -285,7 +285,7 @@ service ABitOfEverythingService { // This API creates a new ABitOfEverything rpc Create(ABitOfEverything) returns (ABitOfEverything) { 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}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{repeated_enum_value_annotation}/{enum_value_annotation}/{repeated_string_annotation}" + 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}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{enum_value_annotation}/{repeated_string_annotation}" }; } rpc CreateBody(ABitOfEverything) returns (ABitOfEverything) { diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 48a97db32a9..af0b88fd77c 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -364,7 +364,7 @@ } }, { - "name": "repeated_enum_value_annotation", + "name": "repeated_enum_annotation", "description": "Repeated numeric enum title. Repeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", "in": "query", "required": false, @@ -437,7 +437,7 @@ } } }, - "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{repeated_enum_value_annotation}/{enum_value_annotation}/{repeated_string_annotation}": { + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{enum_value_annotation}/{repeated_string_annotation}": { "post": { "summary": "Create a new ABitOfEverything", "description": "This API creates a new ABitOfEverything", @@ -618,22 +618,6 @@ "collectionFormat": "csv", "minItems": 1 }, - { - "name": "repeated_enum_value_annotation", - "description": "Repeated numeric enum description.", - "in": "path", - "required": true, - "type": "array", - "items": { - "type": "string", - "enum": [ - "ZERO", - "ONE" - ] - }, - "collectionFormat": "csv", - "minItems": 1 - }, { "name": "enum_value_annotation", "description": "Numeric enum description.", @@ -1688,7 +1672,7 @@ }, "title": "repeated enum value. it is comma-separated in query" }, - "repeated_enum_value_annotation": { + "repeated_enum_annotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index 581ae1fd2f1..4418cbb5ce3 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -261,7 +261,7 @@ }, "title": "repeated enum value. it is comma-separated in query" }, - "repeated_enum_value_annotation": { + "repeated_enum_annotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" From 550a016df1fb5e66e0832f8599cac6d8cbeab90e Mon Sep 17 00:00:00 2001 From: fahernandez Date: Mon, 11 Feb 2019 17:47:00 -0600 Subject: [PATCH 361/552] 863 fixing swagger generation test --- .../abe/a_bit_of_everything_service_api.go | 8 +- examples/clients/echo/api_client.go | 2 +- examples/clients/echo/api_response.go | 2 +- examples/clients/echo/configuration.go | 2 +- examples/clients/echo/echo_service_api.go | 2 +- examples/clients/echo/examplepb_embedded.go | 2 +- .../clients/echo/examplepb_simple_message.go | 2 +- examples/integration/client_test.go | 2 + examples/integration/integration_test.go | 49 +- .../proto/examplepb/a_bit_of_everything.pb.go | 433 +++++++++--------- .../examplepb/a_bit_of_everything.pb.gw.go | 33 +- .../proto/examplepb/a_bit_of_everything.proto | 2 +- .../a_bit_of_everything.swagger.json | 30 +- protoc-gen-swagger/genswagger/template.go | 2 +- runtime/marshal_jsonpb_test.go | 10 + 15 files changed, 289 insertions(+), 292 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index de167d3cd16..5cbf25f0071 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -60,16 +60,14 @@ func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythin * @param enumValue * @param pathEnumValue * @param nestedPathEnumValue - * @param repeatedEnumValue repeated enum value. it is comma-separated in query * @param enumValueAnnotation Numeric enum description. - * @param repeatedStringAnnotation Repeated string description. * @return *ExamplepbABitOfEverything */ -func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, repeatedEnumValue []string, enumValueAnnotation string, repeatedStringAnnotation []string) (*ExamplepbABitOfEverything, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, enumValueAnnotation string) (*ExamplepbABitOfEverything, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables - localVarPath := a.Configuration.BasePath + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{enum_value_annotation}/{repeated_string_annotation}" + localVarPath := a.Configuration.BasePath + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{enum_value_annotation}" localVarPath = strings.Replace(localVarPath, "{"+"float_value"+"}", fmt.Sprintf("%v", floatValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"double_value"+"}", fmt.Sprintf("%v", doubleValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"int64_value"+"}", fmt.Sprintf("%v", int64Value), -1) @@ -88,9 +86,7 @@ func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float localVarPath = strings.Replace(localVarPath, "{"+"enum_value"+"}", fmt.Sprintf("%v", enumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"path_enum_value"+"}", fmt.Sprintf("%v", pathEnumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"nested_path_enum_value"+"}", fmt.Sprintf("%v", nestedPathEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"repeated_enum_value"+"}", fmt.Sprintf("%v", repeatedEnumValue), -1) localVarPath = strings.Replace(localVarPath, "{"+"enum_value_annotation"+"}", fmt.Sprintf("%v", enumValueAnnotation), -1) - localVarPath = strings.Replace(localVarPath, "{"+"repeated_string_annotation"+"}", fmt.Sprintf("%v", repeatedStringAnnotation), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} diff --git a/examples/clients/echo/api_client.go b/examples/clients/echo/api_client.go index d54e3e68565..7a517148026 100644 --- a/examples/clients/echo/api_client.go +++ b/examples/clients/echo/api_client.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/api_response.go b/examples/clients/echo/api_response.go index a4f0ab08001..8b0d07c4a13 100644 --- a/examples/clients/echo/api_response.go +++ b/examples/clients/echo/api_response.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/configuration.go b/examples/clients/echo/configuration.go index 6441b8dc698..9a75a30aeec 100644 --- a/examples/clients/echo/configuration.go +++ b/examples/clients/echo/configuration.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/echo_service_api.go b/examples/clients/echo/echo_service_api.go index 7625bc9eec8..6ae7cf85a32 100644 --- a/examples/clients/echo/echo_service_api.go +++ b/examples/clients/echo/echo_service_api.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/examplepb_embedded.go b/examples/clients/echo/examplepb_embedded.go index ad76336c25b..4b5fe265ac9 100644 --- a/examples/clients/echo/examplepb_embedded.go +++ b/examples/clients/echo/examplepb_embedded.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/examplepb_simple_message.go b/examples/clients/echo/examplepb_simple_message.go index 2b9b366e57e..366a6876665 100644 --- a/examples/clients/echo/examplepb_simple_message.go +++ b/examples/clients/echo/examplepb_simple_message.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/integration/client_test.go b/examples/integration/client_test.go index bbcfed59cb2..90431625380 100644 --- a/examples/integration/client_test.go +++ b/examples/integration/client_test.go @@ -76,6 +76,7 @@ func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { EnumValue: abe.ExamplepbNumericEnum{}, PathEnumValue: abe.PathenumPathEnum{}, NestedPathEnumValue: abe.MessagePathEnumNestedPathEnum{}, + EnumValueAnnotation: abe.ExamplepbNumericEnum{}, } resp, _, err := cl.Create( want.FloatValue, @@ -96,6 +97,7 @@ func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { want.EnumValue.String(), want.PathEnumValue.String(), want.NestedPathEnumValue.String(), + want.EnumValueAnnotation.String(), ) if err != nil { t.Errorf("cl.Create(%#v) failed with %v; want success", want, err) diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index b0e8926a82c..fd1a3655a9a 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -291,8 +291,9 @@ func testABECreate(t *testing.T, port int) { EnumValue: gw.NumericEnum_ZERO, PathEnumValue: pathenum.PathEnum_DEF, NestedPathEnumValue: pathenum.MessagePathEnum_JKL, + EnumValueAnnotation: gw.NumericEnum_ONE, } - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/%f/%f/%d/separator/%d/%d/%d/%d/%v/%s/%d/%d/%d/%d/%d/%s/%s/%s/%s", port, want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue, want.EnumValue, want.PathEnumValue, want.NestedPathEnumValue) + url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/%f/%f/%d/separator/%d/%d/%d/%d/%v/%s/%d/%d/%d/%d/%d/%s/%s/%s/%s/%s", port, want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue, want.EnumValue, want.PathEnumValue, want.NestedPathEnumValue, want.EnumValueAnnotation) resp, err := http.Post(url, "application/json", strings.NewReader("{}")) if err != nil { @@ -372,6 +373,29 @@ func testABECreateBody(t *testing.T, port int) { "a": {Name: "x", Amount: 1}, "b": {Name: "y", Amount: 2}, }, + RepeatedEnumAnnotation: []gw.NumericEnum{ + gw.NumericEnum_ONE, + gw.NumericEnum_ZERO, + }, + EnumValueAnnotation: gw.NumericEnum_ONE, + RepeatedStringAnnotation: []string{ + "a", + "b", + }, + RepeatedNestedAnnotation: []*gw.ABitOfEverything_Nested{ + { + Name: "hoge", + Amount: 10, + }, + { + Name: "fuga", + Amount: 20, + }, + }, + NestedAnnotation: &gw.ABitOfEverything_Nested{ + Name: "hoge", + Amount: 10, + }, } url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) var m jsonpb.Marshaler @@ -453,6 +477,29 @@ func testABEBulkCreate(t *testing.T, port int) { Amount: 20, }, }, + RepeatedEnumAnnotation: []gw.NumericEnum{ + gw.NumericEnum_ONE, + gw.NumericEnum_ZERO, + }, + EnumValueAnnotation: gw.NumericEnum_ONE, + RepeatedStringAnnotation: []string{ + "a", + "b", + }, + RepeatedNestedAnnotation: []*gw.ABitOfEverything_Nested{ + { + Name: "hoge", + Amount: 10, + }, + { + Name: "fuga", + Amount: 20, + }, + }, + NestedAnnotation: &gw.ABitOfEverything_Nested{ + Name: "hoge", + Amount: 10, + }, } var m jsonpb.Marshaler if err := m.Marshal(w, &want); err != nil { diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 2e0ace34871..4aee105fdf8 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{0} + return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -139,7 +139,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{0} + return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -512,7 +512,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{0, 0} + return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -581,7 +581,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{1} + return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -724,7 +724,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{2} + return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -763,7 +763,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{3} + return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -810,7 +810,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_68327cc2832b2df4, []int{4} + return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1574,213 +1574,212 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_68327cc2832b2df4) -} - -var fileDescriptor_a_bit_of_everything_68327cc2832b2df4 = []byte{ - // 3251 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xcb, 0x6f, 0x1b, 0x47, - 0x9a, 0x57, 0xb3, 0xa9, 0x57, 0xe9, 0x45, 0x95, 0x6c, 0x99, 0xa2, 0xe5, 0xa8, 0x4c, 0x3b, 0x49, - 0x9b, 0x31, 0xd9, 0x52, 0x4b, 0x76, 0x64, 0x06, 0x89, 0x97, 0xd4, 0xc3, 0x56, 0x6c, 0xcb, 0x72, - 0xdb, 0xf1, 0x06, 0x8e, 0x1d, 0xa1, 0x49, 0x16, 0xc5, 0xb6, 0xd8, 0x5d, 0x9d, 0xee, 0x6a, 0xd9, - 0x5c, 0x2e, 0x77, 0xb3, 0x0f, 0xec, 0x62, 0x37, 0x87, 0x05, 0x94, 0xdd, 0xc3, 0x3e, 0xb0, 0xc0, - 0x02, 0x8b, 0x05, 0x16, 0xc8, 0x61, 0x2e, 0x73, 0x0a, 0x30, 0x8f, 0xc3, 0x9c, 0xe6, 0xe6, 0x19, - 0xcc, 0x3f, 0x30, 0x73, 0x98, 0xbf,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8f, - 0x69, 0xde, 0x10, 0x3e, 0x07, 0x73, 0x9a, 0x62, 0x18, 0xd1, 0xfd, 0x9e, 0x61, 0x38, 0x37, 0x5f, - 0x0b, 0xc7, 0x08, 0xd9, 0xc7, 0x05, 0x9c, 0xd5, 0xa2, 0xf3, 0x01, 0x64, 0xcf, 0xf7, 0x5c, 0xe4, - 0xe4, 0x9b, 0x21, 0xbb, 0x9e, 0xd7, 0x8d, 0x1c, 0x98, 0x87, 0x79, 0x90, 0xd4, 0x89, 0xbe, 0x41, - 0xf4, 0x23, 0xac, 0x3b, 0x99, 0x47, 0xa9, 0xef, 0x2a, 0x9a, 0x1b, 0xde, 0x92, 0x29, 0x16, 0x00, - 0xfa, 0xae, 0xc3, 0x0d, 0x30, 0xd3, 0x4e, 0x6f, 0x9e, 0xc6, 0x67, 0xd9, 0x89, 0xa7, 0xba, 0x4e, - 0xfc, 0x81, 0x4f, 0x27, 0x4f, 0xb7, 0x59, 0x5c, 0x21, 0x8f, 0x41, 0xdb, 0x93, 0x82, 0x97, 0x6d, - 0x11, 0xf1, 0x03, 0xc7, 0x85, 0x59, 0x5f, 0x50, 0xe7, 0x62, 0x7d, 0xc3, 0x81, 0x64, 0x58, 0x7c, - 0x27, 0xc9, 0x26, 0xd1, 0xe0, 0x18, 0xc5, 0xcd, 0xe3, 0x42, 0x21, 0x73, 0x56, 0xf6, 0x44, 0x22, - 0xdd, 0x5d, 0x42, 0x8e, 0x68, 0x44, 0x55, 0x5a, 0xc7, 0x52, 0xba, 0xf7, 0x62, 0x05, 0x5b, 0x65, - 0x53, 0x65, 0x99, 0x3e, 0x27, 0xcf, 0x07, 0x35, 0x2d, 0xb4, 0x35, 0x82, 0xff, 0xca, 0x81, 0xd3, - 0x1d, 0x23, 0x04, 0x75, 0x3d, 0x3f, 0x78, 0x9c, 0x2c, 0x4a, 0xc7, 0x05, 0x31, 0x03, 0x77, 0xbb, - 0x55, 0x5c, 0xd8, 0xed, 0xab, 0xd9, 0x5c, 0x3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, 0xc7, 0x85, - 0x53, 0x12, 0x84, 0x89, 0x26, 0x4a, 0x93, 0xc3, 0x74, 0x1e, 0xa5, 0x9d, 0xf9, 0x34, 0x6a, 0xa5, - 0x54, 0x30, 0x15, 0x0a, 0xe7, 0x30, 0x01, 0xf8, 0x43, 0xdc, 0xf0, 0x36, 0xe2, 0x7c, 0xc2, 0x22, - 0x18, 0x76, 0x63, 0x4a, 0xec, 0x35, 0x6a, 0x0d, 0x97, 0x35, 0x1f, 0x5b, 0xe7, 0x52, 0x9b, 0x60, - 0xbe, 0x77, 0x44, 0xef, 0x81, 0x79, 0x2a, 0x88, 0x39, 0x1e, 0x94, 0xf2, 0x57, 0xbe, 0x94, 0x68, - 0x74, 0xee, 0x21, 0x65, 0x37, 0x28, 0xe5, 0x4d, 0xea, 0xe3, 0x0e, 0x7e, 0xfe, 0xdf, 0x63, 0xc7, - 0x85, 0x7f, 0x8b, 0x81, 0xbf, 0xe7, 0x32, 0x73, 0x05, 0x54, 0x52, 0x29, 0x22, 0x55, 0xd4, 0x69, - 0xe9, 0xa4, 0x9d, 0x1d, 0x9d, 0xfa, 0x91, 0xbe, 0x81, 0xca, 0x44, 0x33, 0xea, 0x6a, 0x99, 0x5d, - 0x00, 0xaf, 0xd1, 0x41, 0xb4, 0x61, 0x60, 0x44, 0x09, 0x2a, 0x93, 0x23, 0x6c, 0x22, 0x4d, 0xd1, - 0x1b, 0xa8, 0x8a, 0x15, 0x6a, 0x9b, 0xd8, 0x72, 0x64, 0xed, 0xf9, 0x21, 0xff, 0x05, 0xc7, 0xaa, - 0xfc, 0x17, 0x5c, 0xb0, 0x46, 0x7e, 0xc1, 0x85, 0x8a, 0xea, 0xcc, 0x43, 0x70, 0x71, 0x5b, 0xd5, - 0x2b, 0x88, 0xd8, 0x14, 0x69, 0xc4, 0xc4, 0x48, 0x29, 0x39, 0x9f, 0x5d, 0x3d, 0x4f, 0xae, 0x46, - 0xa9, 0x61, 0xe5, 0x45, 0xf1, 0x40, 0xa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19, 0xcc, 0x08, 0x2d, 0xb1, 0x19, 0xf0, - 0xce, 0x96, 0x68, 0x61, 0x43, 0x31, 0x15, 0x4a, 0x4c, 0xb1, 0x69, 0x87, 0x16, 0x9a, 0x01, 0x4f, - 0x6a, 0x89, 0xcd, 0xd0, 0x85, 0xf2, 0xc7, 0x81, 0xf5, 0x8e, 0xbb, 0xb6, 0xc4, 0x66, 0x30, 0xb6, - 0x7d, 0x68, 0x51, 0xd3, 0x30, 0x71, 0x55, 0x7d, 0x2e, 0x66, 0x5a, 0x2e, 0x48, 0x80, 0xcd, 0x8a, - 0xca, 0xb1, 0xa2, 0x40, 0x56, 0x84, 0x21, 0xac, 0x64, 0xbf, 0x76, 0xb2, 0x25, 0x36, 0x3b, 0xb1, - 0xaa, 0x25, 0x36, 0x23, 0xcf, 0x2f, 0x0e, 0x67, 0xcf, 0x77, 0x99, 0x96, 0xd8, 0xec, 0x11, 0xec, - 0x42, 0xd2, 0x02, 0xc5, 0x77, 0x90, 0xba, 0xab, 0x95, 0x69, 0xc1, 0xff, 0xe6, 0x00, 0x70, 0x7d, - 0x84, 0xdd, 0xa8, 0xef, 0xc7, 0x4f, 0x32, 0xcc, 0x4d, 0x2e, 0xa6, 0x97, 0x4e, 0x70, 0x92, 0x3c, - 0x97, 0x81, 0x7f, 0x09, 0x46, 0x6e, 0x13, 0x72, 0x68, 0x1b, 0x70, 0x26, 0x67, 0xd9, 0x25, 0x29, - 0xb7, 0x53, 0xf1, 0xc2, 0xc0, 0xeb, 0x20, 0xe7, 0x18, 0xb2, 0x00, 0xdf, 0x39, 0xd1, 0x3d, 0x9d, - 0x52, 0xaa, 0x05, 0xff, 0x81, 0x03, 0x23, 0x6e, 0x58, 0x78, 0x1d, 0xd3, 0xf4, 0x79, 0x08, 0x4a, - 0xaf, 0x30, 0x2d, 0xde, 0x4b, 0xbd, 0xa2, 0x16, 0x8e, 0x19, 0x7e, 0xc2, 0x81, 0x31, 0x3f, 0x3e, - 0xc1, 0xe5, 0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0x4d, 0x31, 0x14, 0x6d, 0x8d, 0x4a, 0x97, 0xfa, 0x36, 0x47, 0x51, 0x52, 0x73, - 0x07, 0x9c, 0xb9, 0xd3, 0x89, 0x3e, 0xc1, 0x3b, 0x35, 0xe8, 0x5d, 0x7a, 0x34, 0xde, 0x3e, 0xb9, - 0xd2, 0x08, 0xbb, 0xcf, 0xab, 0x7f, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x54, 0x0b, 0x85, 0xbe, 0xf9, - 0x27, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3) +} + +var fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3 = []byte{ + // 3233 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0x5b, 0x6f, 0x1b, 0xc7, + 0xb9, 0x5a, 0xae, 0xae, 0xa3, 0x1b, 0x35, 0xb2, 0x65, 0x8a, 0x56, 0xa2, 0x31, 0xed, 0x24, 0x6b, + 0xc6, 0xe4, 0x4a, 0x2b, 0xd9, 0x91, 0x19, 0x24, 0x3e, 0xa4, 0x2e, 0xb6, 0x62, 0x5b, 0x96, 0xd7, + 0x8e, 0x4f, 0xe0, 0xd8, 0x11, 0x96, 0xe4, 0x50, 0x5c, 0x8b, 0xbb, 0xb3, 0xd9, 0x9d, 0x95, 0xcd, + 0xa3, 0xc3, 0x73, 0xd2, 0x0b, 0x5a, 0xb4, 0x79, 0x28, 0xc0, 0xb4, 0x0f, 0xbd, 0xa0, 0xbf, 0x20, + 0xaf, 0x7d, 0x0a, 0xd0, 0xcb, 0x43, 0x9f, 0xfa, 0xe6, 0x16, 0xfd, 0x03, 0xed, 0x43, 0x9f, 0x0a, + 0x14, 0x05, 0x02, 0x14, 0x45, 0x8b, 0x62, 0x67, 0x77, 0xc9, 0xdd, 0x25, 0x69, 0x99, 0x76,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 0x0c, 0xd8, 0x56, + 0x8b, 0x86, 0x1d, 0x84, 0x18, 0x46, 0x9c, 0x30, 0x28, 0x8f, 0xdb, 0x01, 0x10, 0x97, 0xc6, 0x8a, + 0xe4, 0x41, 0x8c, 0x20, 0x4e, 0x18, 0x62, 0x34, 0x56, 0x24, 0x17, 0xe0, 0x2c, 0x98, 0xac, 0xa8, + 0x4f, 0x70, 0xb9, 0x45, 0x64, 0x14, 0x71, 0xc2, 0xb0, 0x3c, 0xe1, 0x6d, 0x86, 0x81, 0x5a, 0x74, + 0xc6, 0x10, 0x27, 0x8c, 0x78, 0x40, 0x3e, 0xa5, 0x57, 0x00, 0x28, 0x12, 0x52, 0xf3, 0x20, 0x00, + 0xe2, 0x84, 0x51, 0x79, 0xcc, 0xd9, 0x69, 0x09, 0x6b, 0x51, 0x53, 0xd5, 0xf7, 0x3d, 0x80, 0x71, + 0x27, 0x00, 0xe4, 0x71, 0x77, 0xaf, 0x25, 0x6c, 0xb1, 0x4e, 0xb1, 0xe5, 0x41, 0xbc, 0x82, 0x38, + 0x61, 0x42, 0x06, 0x6c, 0x2b, 0xa4, 0x70, 0x4b, 0x8c, 0x49, 0xc4, 0x09, 0x93, 0xae, 0xc2, 0xbe, + 0x14, 0xd7, 0x01, 0x70, 0x6e, 0x9d, 0x07, 0x30, 0x85, 0x38, 0x61, 0x4a, 0xba, 0x70, 0xac, 0xe7, + 0x77, 0x6c, 0x0d, 0x9b, 0x6a, 0x69, 0x53, 0xb7, 0x35, 0x79, 0xcc, 0xc1, 0x77, 0x89, 0xed, 0x82, + 0xe9, 0xd6, 0x3d, 0xf6, 0x28, 0xbe, 0xca, 0x28, 0x0a, 0x3d, 0x28, 0xfa, 0xd7, 0x3f, 0xbb, 0xab, + 0xd0, 0x2a, 0xa3, 0x36, 0x69, 0x78, 0x5f, 0x2e, 0x45, 0x0b, 0xcc, 0xb9, 0xc1, 0xb4, 0x17, 0x25, + 0xbc, 0xc8, 0x08, 0xbf, 0x7b, 0x1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+ 0xdb, 0x48, 0xab, 0x50, 0x3a, 0x42, 0x29, 0x87, 0xbf, 0x13, 0x2c, 0x4b, 0xa5, 0xca, 0xca, 0xa5, + 0x65, 0xbc, 0x9c, 0x59, 0x2d, 0xae, 0xae, 0x66, 0x56, 0xd7, 0x56, 0xca, 0x19, 0x65, 0xf9, 0xe2, + 0xe5, 0xcc, 0xc5, 0xd5, 0xb2, 0x52, 0x2c, 0x57, 0xde, 0xc2, 0x6b, 0xcb, 0xab, 0x29, 0xd4, 0x28, + 0x4c, 0xfa, 0xed, 0x0b, 0x13, 0x2e, 0xf5, 0xef, 0x51, 0x90, 0x88, 0x4a, 0xe2, 0xe7, 0x03, 0x78, + 0x19, 0xcc, 0xb3, 0x06, 0xb1, 0x95, 0x9f, 0x82, 0x83, 0x07, 0x87, 0x78, 0x21, 0x26, 0xcf, 0x39, + 0x00, 0x3e, 0xc2, 0x56, 0x7b, 0xb2, 0x78, 0x1b, 0x24, 0xc3, 0xa8, 0xa1, 0x39, 0xc3, 0x99, 0x85, + 0x38, 0xf9, 0x54, 0x10, 0x77, 0x23, 0x30, 0x73, 0x74, 0xf0, 0x0d, 0xb6, 0x71, 0x3c, 0xe2, 0x05, + 0x3e, 0xcc, 0x77, 0xbb, 0xdd, 0xd1, 0x75, 0xf0, 0x0d, 0xcd, 0x26, 0x83, 0x88, 0x17, 0x06, 0xc3, + 0x7c, 0xdf, 0x0f, 0xb4, 0x83, 0xdd, 0xf8, 0xb6, 0x3a, 0xcc, 0x21, 0xc4, 0x0b, 0x43, 0x1d, 0x7c, + 0xfd, 0x66, 0xf3, 0x1d, 0x70, 0x3a, 0x62, 0xaa, 0x50, 0x0f, 0x3b, 0x8c, 0x78, 0x61, 0x58, 0x4e, + 0x84, 0x8c, 0x15, 0x6c, 0x67, 0xbb, 0xa3, 0x07, 0x26, 0x26, 0x5e, 0x18, 0xe9, 0x82, 0xee, 0x73, + 0x7f, 0x0b, 0x24, 0xc2, 0xe8, 0x81, 0x19, 0x68,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x49, 0xcd, + 0x07, 0xc5, 0x70, 0x24, 0x28, 0x92, 0x72, 0x5d, 0x3c, 0x72, 0x3a, 0x02, 0x36, 0xe3, 0xc1, 0x6f, + 0x71, 0x60, 0x66, 0x97, 0x58, 0xd4, 0xa1, 0xc8, 0x50, 0x99, 0x20, 0xcf, 0x37, 0x26, 0xf6, 0xe4, + 0x2e, 0x32, 0xee, 0xe7, 0x53, 0xe7, 0x82, 0xdc, 0x0d, 0x62, 0x51, 0x47, 0x02, 0xf6, 0xab, 0xa0, + 0x2b, 0x86, 0x1f, 0x14, 0xc9, 0x5f, 0x71, 0xcd, 0xfc, 0x17, 0x1c, 0xac, 0xf4, 0x98, 0xda, 0x82, + 0x6f, 0xd8, 0x28, 0x93, 0x41, 0x8f, 0xab, 0x6a, 0xa9, 0x8a, 0xac, 0x2a, 0xb1, 0x6b, 0x65, 0x76, + 0xfd, 0x8a, 0x18, 0xd9, 0x16, 0x2e, 0x23, 0x55, 0x47, 0x46, 0x4d, 0x29, 0x61, 0x44, 0x2a, 0xec, + 0xa2, 0x96, 0x49, 0xc9, 0xd6, 0xb0, 0xee, 0xce, 0x02, 0xa8, 0x44, 0x34, 0x67, 0x71, 0x26, 0x79, + 0x1b, 0x2c, 0x76, 0xeb, 0x0c, 0x9c, 0x6b, 0xe4, 0xcf, 0x89, 0xfd, 0xbe, 0x35, 0x3e, 0x02, 0x27, + 0x4a, 0x8a, 0x86, 0x6b, 0xeb, 0x8a, 0x85, 0x3d, 0x1a, 0xce, 0x50, 0x03, 0x65, 0x30, 0xe4, 0xfe, + 0xb4, 0xd9, 0x6f, 0x20, 0xcd, 0x33, 0x1b, 0xce, 0xc2, 0x99, 0x50, 0x20, 0x39, 0x47, 0xd2, 0x47, + 0x60, 0x21, 0xaf, 0x13, 0x5a, 0xc5, 0xa6, 0xc7, 0xc9, 0x71, 0x5e, 0xe0, 0x52, 0xbd, 0x1b, 0xba, + 0x62, 0xfd, 0x32, 0x1e, 0x28, 0x7c, 0x31,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0x48, 0x41, + 0x14, 0x2b, 0x06, 0xa1, 0x59, 0xb8, 0x04, 0xb2, 0xc9, 0xbe, 0x9e, 0xff, 0xee, 0x7f, 0x2f, 0x06, + 0xa6, 0xc1, 0x58, 0x41, 0xb1, 0xd4, 0x12, 0xeb, 0xff, 0x63, 0xa3, 0x1c, 0x78, 0x25, 0x34, 0x11, + 0x4c, 0x8f, 0xc6, 0x92, 0x63, 0x1f, 0x64, 0xf2, 0xbb, 0xdb, 0x99, 0xeb, 0xb8, 0x8e, 0x62, 0xe0, + 0x8f, 0x5c, 0x6b, 0x42, 0xf8, 0x1d, 0x37, 0xca, 0x0b, 0x83, 0xd2, 0x59, 0xdf, 0x87, 0x01, 0x87, + 0x8b, 0x44, 0xb1, 0x69, 0x55, 0x74, 0xfe, 0x10, 0x53, 0xfd, 0x1f, 0x9c, 0x5b, 0xec, 0x0d, 0x44, + 0xc9, 0x01, 0xd6, 0x0b, 0xff, 0x0f, 0x92, 0xee, 0xc0, 0x01, 0xe1, 0x55, 0x53, 0xd1, 0xa9, 0x85, + 0x9c, 0x85, 0x67, 0x3d, 0xb0, 0xe0, 0x8d, 0x21, 0x70, 0xd6, 0x3b, 0x64, 0x2b, 0xff, 0x74, 0x1d, + 0x0c, 0x29, 0x65, 0x4d, 0xd5, 0x61, 0x2e, 0x84, 0xaa, 0x97, 0x43, 0x60, 0xcc, 0x19, 0x0e, 0x98, + 0x6a, 0x51, 0xa7, 0x12, 0x1d, 0x62, 0xa4, 0xea, 0x15, 0x62, 0x6a, 0xcc, 0xdf, 0xc5, 0x45, 0x30, + 0x19, 0x34, 0xc5, 0x40, 0x74, 0x34, 0x2a, 0x9e, 0xef, 0x39, 0x1c, 0x45, 0x41, 0xcd, 0x6d, 0x70, + 0xea, 0x66, 0x3b, 0xfb, 0x04, 0xef, 0x54, 0xbf, 0x77, 0xe9, 0xfe, 0x58, 0xcb, 0x73, 0xc5, 0x61, + 0x76, 0x9f, 0x57, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0x35, 0xba, 0x1f, 0xec, 0xc6, 0x27, 0x00, + 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index e9e8855f877..49621b876cc 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -33,7 +33,7 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var ( - filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14, "enum_value": 15, "path_enum_value": 16, "nested_path_enum_value": 17, "repeated_enum_value": 18, "enum_value_annotation": 19, "repeated_string_annotation": 20}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22}} + filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14, "enum_value": 15, "path_enum_value": 16, "nested_path_enum_value": 17, "enum_value_annotation": 18}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}} ) func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -43,7 +43,6 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run var ( val string e int32 - es []int32 ok bool err error _ = err @@ -253,23 +252,6 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.NestedPathEnumValue = pathenum.MessagePathEnum_NestedPathEnum(e) - val, ok = pathParams["repeated_enum_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "repeated_enum_value") - } - - es, err = runtime.EnumSlice(val, ",", NumericEnum_value) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "repeated_enum_value", err) - } - - s := make([]NumericEnum, len(es)) - for i, v := range es { - s[i] = NumericEnum(v) - } - protoReq.RepeatedEnumValue = s - val, ok = pathParams["enum_value_annotation"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "enum_value_annotation") @@ -283,17 +265,6 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.EnumValueAnnotation = NumericEnum(e) - val, ok = pathParams["repeated_string_annotation"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "repeated_string_annotation") - } - - protoReq.RepeatedStringAnnotation, err = runtime.StringSlice(val, ",") - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "repeated_string_annotation", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Create_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -1371,7 +1342,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt } var ( - pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19, 1, 0, 4, 1, 5, 20, 1, 0, 4, 1, 5, 21, 1, 0, 4, 1, 5, 22, 1, 0, 4, 1, 5, 23, 1, 0, 4, 1, 5, 24, 1, 0, 4, 1, 5, 25}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue", "enum_value", "path_enum_value", "nested_path_enum_value", "repeated_enum_value", "enum_value_annotation", "repeated_string_annotation"}, "")) + pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19, 1, 0, 4, 1, 5, 20, 1, 0, 4, 1, 5, 21, 1, 0, 4, 1, 5, 22, 1, 0, 4, 1, 5, 23}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue", "enum_value", "path_enum_value", "nested_path_enum_value", "enum_value_annotation"}, "")) pattern_ABitOfEverythingService_CreateBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 1fd471575a5..9a73797c510 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -285,7 +285,7 @@ service ABitOfEverythingService { // This API creates a new ABitOfEverything rpc Create(ABitOfEverything) returns (ABitOfEverything) { 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}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{enum_value_annotation}/{repeated_string_annotation}" + 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}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{enum_value_annotation}" }; } rpc CreateBody(ABitOfEverything) returns (ABitOfEverything) { diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index af0b88fd77c..b8639ec204f 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -437,7 +437,7 @@ } } }, - "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{repeated_enum_value}/{enum_value_annotation}/{repeated_string_annotation}": { + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{enum_value_annotation}": { "post": { "summary": "Create a new ABitOfEverything", "description": "This API creates a new ABitOfEverything", @@ -602,22 +602,6 @@ "JKL" ] }, - { - "name": "repeated_enum_value", - "description": "repeated enum value. it is comma-separated in query", - "in": "path", - "required": true, - "type": "array", - "items": { - "type": "string", - "enum": [ - "ZERO", - "ONE" - ] - }, - "collectionFormat": "csv", - "minItems": 1 - }, { "name": "enum_value_annotation", "description": "Numeric enum description.", @@ -628,18 +612,6 @@ "ZERO", "ONE" ] - }, - { - "name": "repeated_string_annotation", - "description": "Repeated string description.", - "in": "path", - "required": true, - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "csv", - "minItems": 1 } ], "tags": [ diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index e1c9eca76a0..54b9ce6ba12 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1221,7 +1221,7 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er paragraphs := strings.Split(comment, "\n\n") - // If there is a summary (or summary-equivalent) and its empty, use the first + // If there is a summary (or summary-equivalent) and it's empty, use the first // paragraph as summary, and the rest as description. if summaryValue.CanSet() { summary := strings.TrimSpace(paragraphs[0]) diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index cec41bda914..77da0550b6c 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -42,6 +42,11 @@ func TestJSONPbMarshal(t *testing.T) { "a": examplepb.NumericEnum_ONE, "b": examplepb.NumericEnum_ZERO, }, + RepeatedEnumAnnotation: []examplepb.NumericEnum{}, + EnumValueAnnotation: examplepb.NumericEnum_ONE, + RepeatedStringAnnotation: []string{}, + RepeatedNestedAnnotation: []*examplepb.ABitOfEverything_Nested{}, + NestedAnnotation: &examplepb.ABitOfEverything_Nested{}, } for i, spec := range []struct { @@ -258,6 +263,11 @@ func TestJSONPbEncoder(t *testing.T) { "a": examplepb.NumericEnum_ONE, "b": examplepb.NumericEnum_ZERO, }, + RepeatedEnumAnnotation: []examplepb.NumericEnum{}, + EnumValueAnnotation: examplepb.NumericEnum_ONE, + RepeatedStringAnnotation: []string{}, + RepeatedNestedAnnotation: []*examplepb.ABitOfEverything_Nested{}, + NestedAnnotation: &examplepb.ABitOfEverything_Nested{}, } for i, spec := range []struct { From 2cb361aab7d86f87b4c8d41d479d343d8df66f12 Mon Sep 17 00:00:00 2001 From: fahernandez Date: Mon, 11 Feb 2019 17:48:40 -0600 Subject: [PATCH 362/552] 863 removed unused code --- examples/proto/examplepb/echo_service.swagger.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/proto/examplepb/echo_service.swagger.json b/examples/proto/examplepb/echo_service.swagger.json index bc9feb32160..f1687bccf64 100644 --- a/examples/proto/examplepb/echo_service.swagger.json +++ b/examples/proto/examplepb/echo_service.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "examples/proto/examplepb/echo_service.proto", + "title": "Echo Service", "description": "Echo Service API consists of a single service which returns\na message.", "version": "version not set" }, From 154b1ceec2ab34a2929f7d6574e9fa856fe79f15 Mon Sep 17 00:00:00 2001 From: fahernandez Date: Mon, 11 Feb 2019 17:54:35 -0600 Subject: [PATCH 363/552] 863 completing proto documentation --- examples/clients/echo/api_client.go | 2 +- examples/clients/echo/api_response.go | 2 +- examples/clients/echo/configuration.go | 2 +- examples/clients/echo/echo_service_api.go | 2 +- examples/clients/echo/examplepb_embedded.go | 2 +- examples/clients/echo/examplepb_simple_message.go | 2 +- examples/proto/examplepb/echo_service.swagger.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/clients/echo/api_client.go b/examples/clients/echo/api_client.go index 7a517148026..d54e3e68565 100644 --- a/examples/clients/echo/api_client.go +++ b/examples/clients/echo/api_client.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/api_response.go b/examples/clients/echo/api_response.go index 8b0d07c4a13..a4f0ab08001 100644 --- a/examples/clients/echo/api_response.go +++ b/examples/clients/echo/api_response.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/configuration.go b/examples/clients/echo/configuration.go index 9a75a30aeec..6441b8dc698 100644 --- a/examples/clients/echo/configuration.go +++ b/examples/clients/echo/configuration.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/echo_service_api.go b/examples/clients/echo/echo_service_api.go index 6ae7cf85a32..7625bc9eec8 100644 --- a/examples/clients/echo/echo_service_api.go +++ b/examples/clients/echo/echo_service_api.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/examplepb_embedded.go b/examples/clients/echo/examplepb_embedded.go index 4b5fe265ac9..ad76336c25b 100644 --- a/examples/clients/echo/examplepb_embedded.go +++ b/examples/clients/echo/examplepb_embedded.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/examplepb_simple_message.go b/examples/clients/echo/examplepb_simple_message.go index 366a6876665..2b9b366e57e 100644 --- a/examples/clients/echo/examplepb_simple_message.go +++ b/examples/clients/echo/examplepb_simple_message.go @@ -1,5 +1,5 @@ /* - * Echo Service + * examples/proto/examplepb/echo_service.proto * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/proto/examplepb/echo_service.swagger.json b/examples/proto/examplepb/echo_service.swagger.json index f1687bccf64..bc9feb32160 100644 --- a/examples/proto/examplepb/echo_service.swagger.json +++ b/examples/proto/examplepb/echo_service.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "Echo Service", + "title": "examples/proto/examplepb/echo_service.proto", "description": "Echo Service API consists of a single service which returns\na message.", "version": "version not set" }, From bdfada057eb6d1b648c258d893e8054fc1dce453 Mon Sep 17 00:00:00 2001 From: fahernandez Date: Mon, 11 Feb 2019 18:01:31 -0600 Subject: [PATCH 364/552] 863 fixing node test --- examples/browser/a_bit_of_everything_service.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/browser/a_bit_of_everything_service.spec.js b/examples/browser/a_bit_of_everything_service.spec.js index 5d8e792fda9..21512ab78aa 100644 --- a/examples/browser/a_bit_of_everything_service.spec.js +++ b/examples/browser/a_bit_of_everything_service.spec.js @@ -37,6 +37,7 @@ describe('ABitOfEverythingService', function() { enum_value: "ONE", path_enum_value: "DEF", nested_path_enum_value: "JKL", + enum_value_annotation: "ONE", }; beforeEach(function(done) { From 8f930245bfb2446017ef0a3980170de3236f2be3 Mon Sep 17 00:00:00 2001 From: fahernandez Date: Tue, 12 Feb 2019 10:46:17 -0600 Subject: [PATCH 365/552] 863 keeping comment precendece on swagger package definition --- examples/clients/echo/api_client.go | 2 +- examples/clients/echo/api_response.go | 2 +- examples/clients/echo/configuration.go | 2 +- examples/clients/echo/echo_service_api.go | 2 +- examples/clients/echo/examplepb_embedded.go | 2 +- .../clients/echo/examplepb_simple_message.go | 2 +- .../proto/examplepb/echo_service.swagger.json | 2 +- protoc-gen-swagger/genswagger/template.go | 20 ++++++++++--------- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/examples/clients/echo/api_client.go b/examples/clients/echo/api_client.go index d54e3e68565..7a517148026 100644 --- a/examples/clients/echo/api_client.go +++ b/examples/clients/echo/api_client.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/api_response.go b/examples/clients/echo/api_response.go index a4f0ab08001..8b0d07c4a13 100644 --- a/examples/clients/echo/api_response.go +++ b/examples/clients/echo/api_response.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/configuration.go b/examples/clients/echo/configuration.go index 6441b8dc698..9a75a30aeec 100644 --- a/examples/clients/echo/configuration.go +++ b/examples/clients/echo/configuration.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/echo_service_api.go b/examples/clients/echo/echo_service_api.go index 7625bc9eec8..6ae7cf85a32 100644 --- a/examples/clients/echo/echo_service_api.go +++ b/examples/clients/echo/echo_service_api.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/examplepb_embedded.go b/examples/clients/echo/examplepb_embedded.go index ad76336c25b..4b5fe265ac9 100644 --- a/examples/clients/echo/examplepb_embedded.go +++ b/examples/clients/echo/examplepb_embedded.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/echo/examplepb_simple_message.go b/examples/clients/echo/examplepb_simple_message.go index 2b9b366e57e..366a6876665 100644 --- a/examples/clients/echo/examplepb_simple_message.go +++ b/examples/clients/echo/examplepb_simple_message.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/echo_service.proto + * Echo Service * * Echo Service API consists of a single service which returns a message. * diff --git a/examples/proto/examplepb/echo_service.swagger.json b/examples/proto/examplepb/echo_service.swagger.json index bc9feb32160..f1687bccf64 100644 --- a/examples/proto/examplepb/echo_service.swagger.json +++ b/examples/proto/examplepb/echo_service.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "examples/proto/examplepb/echo_service.proto", + "title": "Echo Service", "description": "Echo Service API consists of a single service which returns\na message.", "version": "version not set" }, diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 54b9ce6ba12..e779542736a 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -103,7 +103,7 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st fieldType := field.GetTypeName() if message.File != nil { comments := fieldProtoComments(reg, message, field) - if err := updateSwaggerDataFromComments(&schema, comments); err != nil { + if err := updateSwaggerDataFromComments(&schema, comments, "MessageType"); err != nil { return nil, err } } @@ -258,7 +258,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, }, } msgComments := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index)) - if err := updateSwaggerDataFromComments(&schema, msgComments); err != nil { + if err := updateSwaggerDataFromComments(&schema, msgComments, "MessageType"); err != nil { panic(err) } opts, err := extractSchemaOptionFromMessageDescriptor(msg.DescriptorProto) @@ -302,7 +302,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, for _, f := range msg.Fields { fieldValue := schemaOfField(f, reg, customRefs) comments := fieldProtoComments(reg, msg, f) - if err := updateSwaggerDataFromComments(&fieldValue, comments); err != nil { + if err := updateSwaggerDataFromComments(&fieldValue, comments, "MessageType"); err != nil { panic(err) } @@ -507,7 +507,7 @@ func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, r Default: defaultValue, }, } - if err := updateSwaggerDataFromComments(&enumSchemaObject, enumComments); err != nil { + if err := updateSwaggerDataFromComments(&enumSchemaObject, enumComments, "EnumType"); err != nil { panic(err) } @@ -858,7 +858,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } methComments := protoComments(reg, svc.File, nil, "Method", int32(svcIdx), methProtoPath, int32(methIdx)) - if err := updateSwaggerDataFromComments(operationObject, methComments); err != nil { + if err := updateSwaggerDataFromComments(operationObject, methComments, "Method"); err != nil { panic(err) } @@ -982,7 +982,7 @@ func applyTemplate(p param) (*swaggerObject, error) { // File itself might have some comments and metadata. packageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") packageComments := protoComments(p.reg, p.File, nil, "Package", packageProtoPath) - if err := updateSwaggerDataFromComments(&s, packageComments); err != nil { + if err := updateSwaggerDataFromComments(&s, packageComments, "Package"); err != nil { panic(err) } @@ -1196,7 +1196,7 @@ func applyTemplate(p param) (*swaggerObject, error) { // // If there is no 'Summary', the same behavior will be attempted on 'Title', // but only if the last character is not a period. -func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) error { +func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, typeName string) error { if len(comment) == 0 { return nil } @@ -1228,7 +1228,8 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er description := strings.TrimSpace(strings.Join(paragraphs[1:], "\n\n")) if !usingTitle || (len(summary) > 0 && summary[len(summary)-1] != '.') { // overrides the schema value only if it's empty - if summaryValue.Len() == 0 { + // keep the comment precedence when updating the package definition + if summaryValue.Len() == 0 || typeName == "Package" { summaryValue.Set(reflect.ValueOf(summary)) } if len(description) > 0 { @@ -1236,7 +1237,8 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er return fmt.Errorf("Encountered object type with a summary, but no description") } // overrides the schema value only if it's empty - if descriptionValue.Len() == 0 { + // keep the comment precedence when updating the package definition + if descriptionValue.Len() == 0 || typeName == "Package" { descriptionValue.Set(reflect.ValueOf(description)) } } From dc09cf8af1d4a3849db712f5d5e02a2f71bab49c Mon Sep 17 00:00:00 2001 From: fahernandez Date: Tue, 12 Feb 2019 11:05:40 -0600 Subject: [PATCH 366/552] 863 fixing code format --- protoc-gen-swagger/genswagger/template.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index e779542736a..8f440e729a6 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1238,9 +1238,9 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, ty } // overrides the schema value only if it's empty // keep the comment precedence when updating the package definition - if descriptionValue.Len() == 0 || typeName == "Package" { + if descriptionValue.Len() == 0 || typeName == "Package" { descriptionValue.Set(reflect.ValueOf(description)) - } + } } return nil } From ba8874a75ae673348431029ed957c37947846b95 Mon Sep 17 00:00:00 2001 From: fahernandez Date: Tue, 12 Feb 2019 13:04:38 -0600 Subject: [PATCH 367/552] 863 changing field options override behavior for schema package object --- protoc-gen-swagger/genswagger/template.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 8f440e729a6..ccaee513be6 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -103,7 +103,7 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st fieldType := field.GetTypeName() if message.File != nil { comments := fieldProtoComments(reg, message, field) - if err := updateSwaggerDataFromComments(&schema, comments, "MessageType"); err != nil { + if err := updateSwaggerDataFromComments(&schema, comments, false); err != nil { return nil, err } } @@ -258,7 +258,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, }, } msgComments := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index)) - if err := updateSwaggerDataFromComments(&schema, msgComments, "MessageType"); err != nil { + if err := updateSwaggerDataFromComments(&schema, msgComments, false); err != nil { panic(err) } opts, err := extractSchemaOptionFromMessageDescriptor(msg.DescriptorProto) @@ -302,7 +302,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, for _, f := range msg.Fields { fieldValue := schemaOfField(f, reg, customRefs) comments := fieldProtoComments(reg, msg, f) - if err := updateSwaggerDataFromComments(&fieldValue, comments, "MessageType"); err != nil { + if err := updateSwaggerDataFromComments(&fieldValue, comments, false); err != nil { panic(err) } @@ -507,7 +507,7 @@ func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, r Default: defaultValue, }, } - if err := updateSwaggerDataFromComments(&enumSchemaObject, enumComments, "EnumType"); err != nil { + if err := updateSwaggerDataFromComments(&enumSchemaObject, enumComments, false); err != nil { panic(err) } @@ -858,7 +858,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } methComments := protoComments(reg, svc.File, nil, "Method", int32(svcIdx), methProtoPath, int32(methIdx)) - if err := updateSwaggerDataFromComments(operationObject, methComments, "Method"); err != nil { + if err := updateSwaggerDataFromComments(operationObject, methComments, false); err != nil { panic(err) } @@ -982,7 +982,7 @@ func applyTemplate(p param) (*swaggerObject, error) { // File itself might have some comments and metadata. packageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") packageComments := protoComments(p.reg, p.File, nil, "Package", packageProtoPath) - if err := updateSwaggerDataFromComments(&s, packageComments, "Package"); err != nil { + if err := updateSwaggerDataFromComments(&s, packageComments, true); err != nil { panic(err) } @@ -1196,7 +1196,7 @@ func applyTemplate(p param) (*swaggerObject, error) { // // If there is no 'Summary', the same behavior will be attempted on 'Title', // but only if the last character is not a period. -func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, typeName string) error { +func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, isPackageObject bool) error { if len(comment) == 0 { return nil } @@ -1229,7 +1229,7 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, ty if !usingTitle || (len(summary) > 0 && summary[len(summary)-1] != '.') { // overrides the schema value only if it's empty // keep the comment precedence when updating the package definition - if summaryValue.Len() == 0 || typeName == "Package" { + if summaryValue.Len() == 0 || isPackageObject { summaryValue.Set(reflect.ValueOf(summary)) } if len(description) > 0 { @@ -1238,7 +1238,7 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, ty } // overrides the schema value only if it's empty // keep the comment precedence when updating the package definition - if descriptionValue.Len() == 0 || typeName == "Package" { + if descriptionValue.Len() == 0 || isPackageObject { descriptionValue.Set(reflect.ValueOf(description)) } } @@ -1248,7 +1248,7 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, ty // There was no summary field on the swaggerObject. Try to apply the // whole comment into description if the swagger object description is empty. - if descriptionValue.CanSet() && descriptionValue.Len() == 0 { + if descriptionValue.CanSet() && (descriptionValue.Len() == 0 || isPackageObject){ descriptionValue.Set(reflect.ValueOf(strings.Join(paragraphs, "\n\n"))) return nil } From b649504d5f4e2c20f16d0e1232c09a9cc52291a2 Mon Sep 17 00:00:00 2001 From: Vibhav Bobade Date: Wed, 13 Feb 2019 01:10:56 +0530 Subject: [PATCH 368/552] Updated Service, Method, Message Identifiers to be CamelCased The incompatibility caused between the generated .pb.gw.go and .pb.go files due to inconsistent identifier capitalization has been fixed here. Logic from protoc-gen-go for the Message, Service and Method Names is ported to protoc-gen-grpc-gateway. Have made changes in the template.go file and have written a test so we don't regress this in the future. This fixes https://github.com/grpc-ecosystem/grpc-gateway/issues/683 --- .../gengateway/template.go | 10 +- .../gengateway/template_test.go | 95 +++++++++++++++++++ 2 files changed, 102 insertions(+), 3 deletions(-) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index fd5fc1157d9..12c02ae9f9f 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -112,7 +112,6 @@ func (b binding) FieldMaskField() string { fieldMaskField = f } } - if fieldMaskField != nil { return generator2.CamelCase(fieldMaskField.GetName()) } @@ -145,13 +144,18 @@ func applyTemplate(p param, reg *descriptor.Registry) (string, error) { return "", err } var targetServices []*descriptor.Service + + for _, msg := range p.Messages { + msgName := generator2.CamelCase(*msg.Name) + msg.Name = &msgName + } for _, svc := range p.Services { var methodWithBindingsSeen bool - svcName := strings.Title(*svc.Name) + svcName := generator2.CamelCase(*svc.Name) svc.Name = &svcName for _, meth := range svc.Methods { glog.V(2).Infof("Processing %s.%s", svc.GetName(), meth.GetName()) - methName := strings.Title(*meth.Name) + methName := generator2.CamelCase(*meth.Name) meth.Name = &methName for _, b := range meth.Bindings { methodWithBindingsSeen = true diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index 33c28eb1586..ba941d095dd 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -481,3 +481,98 @@ func TestAllowPatchFeature(t *testing.T) { } } } + +func TestIdentifierCapitalization(t *testing.T){ + msgdesc1 := &protodescriptor.DescriptorProto{ + Name: proto.String("Exam_pleRequest"), + } + msgdesc2 := &protodescriptor.DescriptorProto{ + Name: proto.String("example_response"), + } + meth1 := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("ExampleGe2t"), + InputType: proto.String("Exam_pleRequest"), + OutputType: proto.String("example_response"), + } + meth2 := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Exampl_eGet"), + InputType: proto.String("Exam_pleRequest"), + OutputType: proto.String("example_response"), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("Example"), + Method: []*protodescriptor.MethodDescriptorProto{meth1, meth2}, + } + msg1 := &descriptor.Message{ + DescriptorProto: msgdesc1, + } + msg2 := &descriptor.Message{ + DescriptorProto: msgdesc2, + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, + MessageType: []*protodescriptor.DescriptorProto{msgdesc1, msgdesc2}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg1, msg2}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth1, + RequestType: msg1, + ResponseType: msg1, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + Body: &descriptor.Body{FieldPath: nil}, + }, + }, + }, + }, + }, + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth2, + RequestType: msg2, + ResponseType: msg2, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + Body: &descriptor.Body{FieldPath: nil}, + }, + }, + }, + }, + }, + }, + } + + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + if want := `msg, err := client.ExampleGe2T(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `msg, err := client.ExamplEGet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD)`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `var protoReq ExamPleRequest`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `var protoReq ExampleResponse`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } +} From b90a79b29a648a758886b9d56feaf3b9a65e13de Mon Sep 17 00:00:00 2001 From: Fabian Hernandez Date: Mon, 18 Feb 2019 12:43:27 -0600 Subject: [PATCH 369/552] 868 improving README with AWS API gateway findings (#869) * 868 improving README with AWS API gateway findings * 868 adding review feedback * 868 fixing typos related to aws documentation tips * Update docs/_docs/aws.md Co-Authored-By: fahernandez --- docs/_docs/aws.md | 14 ++++++++++++++ docs/index.md | 1 + 2 files changed, 15 insertions(+) create mode 100644 docs/_docs/aws.md diff --git a/docs/_docs/aws.md b/docs/_docs/aws.md new file mode 100644 index 00000000000..96e98c089b6 --- /dev/null +++ b/docs/_docs/aws.md @@ -0,0 +1,14 @@ +--- +category: documentation +--- + +# AWS + +## Import swagger documentation into AWS API Gateway +The AWS API gateway service allows importing of an OpenAPI specification to create a REST API. The process is very straightforward and can be found [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html). +Here are some tips to consider when importing the documentation: + +1. Remove any circular dependencies (these aren't supported by the parser). +2. Remove security-related annotations (These annotations aren't well supported by the parser). +3. Max length of fields are reviewed by the parser but the errors aren't self-explanatory. Review the [specification](https://swagger.io/specification/v2/) to verify that the requirements are met. +4. API gateway errors aren't great, but you can use this [page](https://apidevtools.org/swagger-parser/online/) for structure validation. diff --git a/docs/index.md b/docs/index.md index 59e3047c87a..57b23e1add0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,6 +17,7 @@ To learn more about us check out our documentation on: * [Installation and usage](_docs/usage.md) * [Examples](_docs/examples.md) * [Features](_docs/features.md) +* [AWS API Gateway tips](_docs/aws.md) # Contribution From 7430a73933e1f0d9222b3d16c9e0dc478018b5ab Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 18 Feb 2019 22:53:18 +0000 Subject: [PATCH 370/552] Switch to go modules --- .circleci/config.yml | 28 +++---- .gitignore | 3 + CONTRIBUTING.md | 4 +- Gopkg.lock | 192 ------------------------------------------- Gopkg.toml | 66 --------------- Makefile | 41 +++++---- README.md | 143 +++++++++++++++++++------------- go.mod | 18 ++++ go.sum | 43 ++++++++++ 9 files changed, 184 insertions(+), 354 deletions(-) delete mode 100644 Gopkg.lock delete mode 100644 Gopkg.toml create mode 100644 go.mod create mode 100644 go.sum diff --git a/.circleci/config.yml b/.circleci/config.yml index 68dd572a8ca..cac9aa698e0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,29 +3,27 @@ jobs: build: docker: - image: jfbrandhorst/grpc-gateway-build-env - working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + working_directory: /src/grpc-gateway steps: - checkout - - run: dep ensure --vendor-only - run: go build ./... test: docker: - image: jfbrandhorst/grpc-gateway-build-env - working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + working_directory: /src/grpc-gateway environment: - GLOG_logtostderr: "1" + GLOG_logtostderr: '1' steps: - checkout - - run: dep ensure --vendor-only - run: go test -race -coverprofile=coverage.txt ./... - run: bash <(curl -s https://codecov.io/bash) node_test: docker: - image: jfbrandhorst/grpc-gateway-build-env - working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + working_directory: /src/grpc-gateway steps: - checkout - - run: dep ensure --vendor-only + - run: go mod vendor - run: > . $HOME/.nvm/nvm.sh && cd examples/browser && @@ -35,25 +33,25 @@ jobs: generate: docker: - image: jfbrandhorst/grpc-gateway-build-env - working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + working_directory: /src/grpc-gateway steps: - checkout - run: make realclean - run: make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}" # Set in Docker image + - run: go mod tidy - run: git diff --exit-code lint: docker: - image: jfbrandhorst/grpc-gateway-build-env - working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + working_directory: /src/grpc-gateway steps: - checkout - - run: dep ensure --vendor-only - run: go get golang.org/x/lint/golint - run: make lint bazel: docker: - image: l.gcr.io/google/bazel:latest - working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + working_directory: /src/grpc-gateway steps: - checkout - run: @@ -67,22 +65,22 @@ jobs: - run: name: Check that Bazel BUILD files are up-to-date command: 'test -z "$(bazel run //:gazelle_diff)" || - (echo "ERROR: Bazel files out-of-date, please run \`bazel run :gazelle_fix\`" >&2; exit 1)' + (echo "ERROR: Bazel files out-of-date, please run \`bazel run :gazelle_fix\`" >&2; exit 1)' - run: name: Run tests with Bazel command: bazel test //... - run: name: Check formatting of Bazel BUILD files command: 'bazel run //:buildifier_check || - (echo "ERROR: Bazel files not formatted, please run \`bazel run :buildifier\`" >&2; exit 1)' + (echo "ERROR: Bazel files not formatted, please run \`bazel run :buildifier\`" >&2; exit 1)' when: always release: docker: - image: jfbrandhorst/grpc-gateway-build-env - working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway + working_directory: /src/grpc-gateway steps: - checkout - - run: dep ensure --vendor-only + - run: go mod vendor - run: curl -sL https://git.io/goreleaser | bash workflows: version: 2 diff --git a/.gitignore b/.gitignore index 7c349d62a43..2a59512090f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ bazel-testlogs # Go vendor directory vendor + +# Generated travis files +.travis.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a7d09ce6cb0..04fc20639c9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,8 +24,8 @@ All submissions, including submissions by project members, require review. Great, it should be as simple as thus (run from the root of the directory): ```bash -docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env \ - /bin/bash -c 'cd /go/src/github.com/grpc-ecosystem/grpc-gateway && \ +docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env \ + /bin/bash -c 'cd /src/grpc-gateway && \ make realclean && \ make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' docker run -itv $(pwd):/grpc-gateway -w /grpc-gateway --entrypoint /bin/bash --rm \ diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 4e9da479903..00000000000 --- a/Gopkg.lock +++ /dev/null @@ -1,192 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - digest = "1:2cd7915ab26ede7d95b8749e6b1f933f1c6d5398030684e6505940a10f31cfda" - name = "github.com/ghodss/yaml" - packages = ["."] - pruneopts = "UT" - revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7" - -[[projects]] - digest = "1:5cae6c173646d9230aecf8074c171edb4fb9a37f074c5c89ba2fece20b6703b6" - name = "github.com/go-resty/resty" - packages = ["."] - pruneopts = "UT" - revision = "f8815663de1e64d57cdd4ee9e2b2fa96977a030e" - -[[projects]] - digest = "1:1ba1d79f2810270045c328ae5d674321db34e3aae468eb4233883b473c5c0467" - name = "github.com/golang/glog" - packages = ["."] - pruneopts = "UT" - revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" - -[[projects]] - digest = "1:329b943e12961fb0c0db5bc18858433e569183178edfd0a8d99033ce032c62cc" - name = "github.com/golang/protobuf" - packages = [ - "descriptor", - "jsonpb", - "proto", - "protoc-gen-go", - "protoc-gen-go/descriptor", - "protoc-gen-go/generator", - "protoc-gen-go/generator/internal/remap", - "protoc-gen-go/grpc", - "protoc-gen-go/plugin", - "ptypes", - "ptypes/any", - "ptypes/duration", - "ptypes/empty", - "ptypes/struct", - "ptypes/timestamp", - "ptypes/wrappers", - ] - pruneopts = "UT" - revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" - -[[projects]] - digest = "1:d673e95129a1107bfd04e093751a5e1267faabc27d218d824fb013f57ac08f55" - name = "github.com/rogpeppe/fastuuid" - packages = ["."] - pruneopts = "UT" - revision = "6724a57986aff9bff1a1770e9347036def7c89f6" - -[[projects]] - digest = "1:c0b7af9789502fec69b7ab40035a2180e43b9663c32101084ba51c844ea416e9" - name = "golang.org/x/net" - packages = [ - "context", - "http/httpguts", - "http2", - "http2/hpack", - "idna", - "internal/timeseries", - "publicsuffix", - "trace", - ] - pruneopts = "UT" - revision = "4dfa2610cdf3b287375bbba5b8f2a14d3b01d8de" - -[[projects]] - branch = "master" - digest = "1:7ba061af4131fb44b30448572acd0d6fefbf63a61b97b7ef1dea0be5871c2742" - name = "golang.org/x/sys" - packages = ["unix"] - pruneopts = "UT" - revision = "66b7b1311ac80bbafcd2daeef9a5e6e2cd1e2399" - -[[projects]] - digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18" - name = "golang.org/x/text" - packages = [ - "collate", - "collate/build", - "internal/colltab", - "internal/gen", - "internal/tag", - "internal/triegen", - "internal/ucd", - "language", - "secure/bidirule", - "transform", - "unicode/bidi", - "unicode/cldr", - "unicode/norm", - "unicode/rangetable", - ] - pruneopts = "UT" - revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" - version = "v0.3.0" - -[[projects]] - digest = "1:46be2f6b4d4e4b89f8102668902e68013234da1684fc78da602da95e745f285d" - name = "google.golang.org/genproto" - packages = [ - "googleapis/api/annotations", - "googleapis/rpc/errdetails", - "googleapis/rpc/status", - "protobuf/field_mask", - ] - pruneopts = "UT" - revision = "383e8b2c3b9e36c4076b235b32537292176bae20" - -[[projects]] - digest = "1:c3ad9841823db6da420a5625b367913b4ff54bbe60e8e3c98bd20e243e62e2d2" - name = "google.golang.org/grpc" - packages = [ - ".", - "balancer", - "balancer/base", - "balancer/roundrobin", - "codes", - "connectivity", - "credentials", - "encoding", - "encoding/proto", - "grpclog", - "internal", - "internal/backoff", - "internal/channelz", - "internal/envconfig", - "internal/grpcrand", - "internal/transport", - "keepalive", - "metadata", - "naming", - "peer", - "resolver", - "resolver/dns", - "resolver/passthrough", - "stats", - "status", - "tap", - ] - pruneopts = "UT" - revision = "2e463a05d100327ca47ac218281906921038fd95" - version = "v1.16.0" - -[[projects]] - digest = "1:6570992c02a2137a20be83990a979b6fe892e20ecdc6b756449989b2a7efb8ae" - name = "gopkg.in/yaml.v2" - packages = ["."] - pruneopts = "UT" - revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/ghodss/yaml", - "github.com/go-resty/resty", - "github.com/golang/glog", - "github.com/golang/protobuf/descriptor", - "github.com/golang/protobuf/jsonpb", - "github.com/golang/protobuf/proto", - "github.com/golang/protobuf/protoc-gen-go", - "github.com/golang/protobuf/protoc-gen-go/descriptor", - "github.com/golang/protobuf/protoc-gen-go/generator", - "github.com/golang/protobuf/protoc-gen-go/plugin", - "github.com/golang/protobuf/ptypes", - "github.com/golang/protobuf/ptypes/any", - "github.com/golang/protobuf/ptypes/duration", - "github.com/golang/protobuf/ptypes/empty", - "github.com/golang/protobuf/ptypes/struct", - "github.com/golang/protobuf/ptypes/timestamp", - "github.com/golang/protobuf/ptypes/wrappers", - "github.com/rogpeppe/fastuuid", - "golang.org/x/net/context", - "google.golang.org/genproto/googleapis/api/annotations", - "google.golang.org/genproto/googleapis/rpc/errdetails", - "google.golang.org/genproto/googleapis/rpc/status", - "google.golang.org/genproto/protobuf/field_mask", - "google.golang.org/grpc", - "google.golang.org/grpc/codes", - "google.golang.org/grpc/connectivity", - "google.golang.org/grpc/grpclog", - "google.golang.org/grpc/metadata", - "google.golang.org/grpc/status", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index e4c78e94a90..00000000000 --- a/Gopkg.toml +++ /dev/null @@ -1,66 +0,0 @@ -required = [ - "github.com/golang/protobuf/protoc-gen-go", -] - -[prune] - go-tests = true - unused-packages = true - -# Constrained versions that are defined in WORKSPACE are at the top - -[[constraint]] - # Also defined in WORKSPACE - revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7" - name = "github.com/ghodss/yaml" - -[[constraint]] - # Also defined in WORKSPACE - revision = "f8815663de1e64d57cdd4ee9e2b2fa96977a030e" - name = "github.com/go-resty/resty" - -[[constraint]] - # Also defined in WORKSPACE - revision = "6724a57986aff9bff1a1770e9347036def7c89f6" - name = "github.com/rogpeppe/fastuuid" - -[[constraint]] - # Also defined in WORKSPACE - revision = "383e8b2c3b9e36c4076b235b32537292176bae20" - name = "google.golang.org/genproto" - -[[override]] - # Also defined in WORKSPACE - revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f" - name = "gopkg.in/yaml.v2" - -# These versions are constrained transitively by bazelbuild/rules_go - -[[constraint]] - # Also defined in bazelbuild/rules_go - # https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L52 - revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" - name = "github.com/golang/protobuf" - -[[constraint]] - # Also defined in bazelbuild/rules_go - # https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L96 - revision = "4dfa2610cdf3b287375bbba5b8f2a14d3b01d8de" - name = "golang.org/x/net" - -[[constraint]] - # Also defined in bazelbuild/rules_go - # https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L123 - version = "1.15.0" - name = "google.golang.org/grpc" - -[[constraint]] - # Also defined in bazelbuild/rules_go - # https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L160 - revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" - name = "github.com/golang/glog" - -[[override]] - # Also defined in bazelbuild/rules_go - # https://github.com/bazelbuild/rules_go/blob/109c520465fcb418f2c4be967f3744d959ad66d3/go/private/repositories.bzl#L117 - version = "0.3.0" - name = "golang.org/x/text" diff --git a/Makefile b/Makefile index ba923e91f9c..b141347681a 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ # You don't have to rebuild these targets by yourself unless you develop # grpc-gateway itself. -PKG=github.com/grpc-ecosystem/grpc-gateway GO_PLUGIN=bin/protoc-gen-go GO_PROTOBUF_REPO=github.com/golang/protobuf GO_PLUGIN_PKG=$(GO_PROTOBUF_REPO)/protoc-gen-go @@ -15,9 +14,9 @@ SWAGGER_PLUGIN_SRC= utilities/doc.go \ protoc-gen-swagger/genswagger/generator.go \ protoc-gen-swagger/genswagger/template.go \ protoc-gen-swagger/main.go -SWAGGER_PLUGIN_PKG=$(PKG)/protoc-gen-swagger +SWAGGER_PLUGIN_PKG=./protoc-gen-swagger GATEWAY_PLUGIN=bin/protoc-gen-grpc-gateway -GATEWAY_PLUGIN_PKG=$(PKG)/protoc-gen-grpc-gateway +GATEWAY_PLUGIN_PKG=./protoc-gen-grpc-gateway GATEWAY_PLUGIN_SRC= utilities/doc.go \ utilities/pattern.go \ utilities/trie.go \ @@ -51,7 +50,7 @@ RUNTIME_GO=$(RUNTIME_PROTO:.proto=.pb.go) OPENAPIV2_PROTO=protoc-gen-swagger/options/openapiv2.proto protoc-gen-swagger/options/annotations.proto OPENAPIV2_GO=$(OPENAPIV2_PROTO:.proto=.pb.go) -PKGMAP=Mgoogle/protobuf/field_mask.proto=google.golang.org/genproto/protobuf/field_mask,Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mexamples/proto/sub/message.proto=$(PKG)/examples/proto/sub +PKGMAP=Mgoogle/protobuf/field_mask.proto=google.golang.org/genproto/protobuf/field_mask,Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mexamples/proto/sub/message.proto=github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub ADDITIONAL_GW_FLAGS= ifneq "$(GATEWAY_PLUGIN_FLAGS)" "" ADDITIONAL_GW_FLAGS=,$(GATEWAY_PLUGIN_FLAGS) @@ -126,14 +125,14 @@ generate: $(RUNTIME_GO) .SUFFIXES: .go .proto $(GO_PLUGIN): - dep ensure -vendor-only - go build -o $@ ./vendor/$(GO_PLUGIN_PKG) + go build -o $(GO_PLUGIN) $(GO_PLUGIN_PKG) $(RUNTIME_GO): $(RUNTIME_PROTO) $(GO_PLUGIN) - protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I $(GOPATH)/src/$(GO_PTYPES_ANY_PKG) -I. --go_out=$(PKGMAP):. $(RUNTIME_PROTO) + go mod vendor + protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I ./vendor/$(GO_PTYPES_ANY_PKG) -I. --go_out=$(PKGMAP),paths=source_relative:. $(RUNTIME_PROTO) $(OPENAPIV2_GO): $(OPENAPIV2_PROTO) $(GO_PLUGIN) - protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP):$(GOPATH)/src $(OPENAPIV2_PROTO) + protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP),paths=source_relative:. $(OPENAPIV2_PROTO) $(GATEWAY_PLUGIN): $(RUNTIME_GO) $(GATEWAY_PLUGIN_SRC) go build -o $@ $(GATEWAY_PLUGIN_PKG) @@ -142,11 +141,11 @@ $(SWAGGER_PLUGIN): $(SWAGGER_PLUGIN_SRC) $(OPENAPIV2_GO) go build -o $@ $(SWAGGER_PLUGIN_PKG) $(EXAMPLE_SVCSRCS): $(GO_PLUGIN) $(EXAMPLES) - protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP),plugins=grpc:. $(EXAMPLES) + protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP),plugins=grpc,paths=source_relative:. $(EXAMPLES) $(EXAMPLE_DEPSRCS): $(GO_PLUGIN) $(EXAMPLE_DEPS) mkdir -p $(OUTPUT_DIR) - protoc -I $(PROTOC_INC_PATH) -I. --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP),plugins=grpc:$(OUTPUT_DIR) $(@:.pb.go=.proto) - cp $(OUTPUT_DIR)/$(PKG)/$@ $@ || cp $(OUTPUT_DIR)/$@ $@ + protoc -I $(PROTOC_INC_PATH) -I. --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP),plugins=grpc,paths=source_relative:$(OUTPUT_DIR) $(@:.pb.go=.proto) + cp $(OUTPUT_DIR)/$@ $@ || cp $(OUTPUT_DIR)/$@ $@ $(EXAMPLE_GWSRCS): ADDITIONAL_GW_FLAGS:=$(ADDITIONAL_GW_FLAGS),grpc_api_configuration=examples/proto/examplepb/unannotated_echo_service.yaml $(EXAMPLE_GWSRCS): $(GATEWAY_PLUGIN) $(EXAMPLES) @@ -179,8 +178,8 @@ $(RESPONSE_BODY_EXAMPLE_SRCS): $(RESPONSE_BODY_EXAMPLE_SPEC) examples: $(EXAMPLE_DEPSRCS) $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) test: examples - go test -race $(PKG)/... - go test -race $(PKG)/examples/integration -args -network=unix -endpoint=test.sock + go test -race ... + go test -race examples/integration -args -network=unix -endpoint=test.sock changelog: docker run --rm \ --interactive \ @@ -196,14 +195,14 @@ changelog: --unreleased-label "**Next release**" \ --future-release=v1.7.0 lint: - golint --set_exit_status $(PKG)/runtime - golint --set_exit_status $(PKG)/utilities/... - golint --set_exit_status $(PKG)/protoc-gen-grpc-gateway/... - golint --set_exit_status $(PKG)/protoc-gen-swagger/... - go vet $(PKG)/runtime || true - go vet $(PKG)/utilities/... - go vet $(PKG)/protoc-gen-grpc-gateway/... - go vet $(PKG)/protoc-gen-swagger/... + golint --set_exit_status ./runtime + golint --set_exit_status ./utilities/... + golint --set_exit_status ./protoc-gen-grpc-gateway/... + golint --set_exit_status ./protoc-gen-swagger/... + go vet ./runtime || true + go vet ./utilities/... + go vet ./protoc-gen-grpc-gateway/... + go vet ./protoc-gen-swagger/... clean: rm -f $(GATEWAY_PLUGIN) $(SWAGGER_PLUGIN) diff --git a/README.md b/README.md index a780964be08..d87501ec8f5 100644 --- a/README.md +++ b/README.md @@ -2,39 +2,40 @@ [![CircleCI](https://circleci.com/gh/grpc-ecosystem/grpc-gateway.svg?style=svg)](https://circleci.com/gh/grpc-ecosystem/grpc-gateway) -grpc-gateway is a plugin of [protoc](http://github.com/google/protobuf). -It reads [gRPC](http://github.com/grpc/grpc-common) service definition, -and generates a reverse-proxy server which translates a RESTful JSON API into gRPC. -This server is generated according to the +The grpc-gateway is a plugin of the Google protocol buffers compiler +[protoc](https://github.com/protocolbuffers/protobuf). +It reads protobuf service definitions and generates a reverse-proxy server which +translates a RESTful JSON API into gRPC. This server is generated according to the [`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) -annotation in your gRPC service definition. +annotations in your service definitions. -It helps you to provide your APIs in both gRPC and RESTful style at the same time. +It helps you provide your APIs in both gRPC and RESTful style at the same time. ![architecture introduction diagram](https://docs.google.com/drawings/d/12hp4CPqrNPFhattL_cIoJptFvlAqm5wLQ0ggqI5mkCg/pub?w=749&h=370) ## Check out our [documentation](https://grpc-ecosystem.github.io/grpc-gateway/)! ## Background -gRPC is great -- it generates API clients and server stubs in many programming languages, it is fast, easy-to-use, bandwidth-efficient and its design is combat-proven by Google. -However, you might still want to provide a traditional RESTful API as well. Reasons can range from maintaining backwards-compatibility, supporting languages or clients not well supported by gRPC to simply maintaining the aesthetics and tooling involved with a RESTful architecture. - -This project aims to provide that HTTP+JSON interface to your gRPC service. A small amount of configuration in your service to attach HTTP semantics is all that's needed to generate a reverse-proxy with this library. +gRPC is great -- it generates API clients and server stubs in many programming +languages, it is fast, easy-to-use, bandwidth-efficient and its design is +combat-proven by Google. However, you might still want to provide a traditional +RESTful JSON API as well. Reasons can range from maintaining +backwards-compatibility, supporting languages or clients not well supported by +gRPC to simply maintaining the aesthetics and tooling involved with a RESTful +JSON architecture. + +This project aims to provide that HTTP+JSON interface to your gRPC service. +A small amount of configuration in your service to attach HTTP semantics is all +that's needed to generate a reverse-proxy with this library. ## Installation -First you need to install ProtocolBuffers 3.0.0 or later. -```sh -mkdir tmp -cd tmp -git clone https://github.com/protocolbuffers/protobuf -cd protobuf -./autogen.sh -./configure -make -make check -sudo make install -``` +The grpc-gateway requires a local installation of the Google protocol buffers +compiler `protoc` v3.0.0 or above. Please install this via your local package +manager or by downloading one of the releases from the official repository: + +https://github.com/protocolbuffers/protobuf/releases + Then, `go get -u` as usual the following packages: @@ -44,8 +45,15 @@ go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger go get -u github.com/golang/protobuf/protoc-gen-go ``` +This will place three binaries in your `$GOBIN`; + +* `protoc-gen-grpc-gateway` +* `protoc-gen-grpc-swagger` +* `protoc-gen-go` + +Make sure that your `$GOBIN` is in your `$PATH`. + ## Usage -Make sure that your `$GOPATH/bin` is in your `$PATH`. 1. Define your service in gRPC @@ -61,7 +69,8 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. rpc Echo(StringMessage) returns (StringMessage) {} } ``` -2. Add a [`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) to your .proto file +2. Add a [`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) +annotation to your .proto file your_service.proto: ```diff @@ -85,7 +94,11 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. } ``` - If you do not want to modify the proto file for use with grpc-gateway you can alternatively use an external [gRPC Service Configuration](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config) file. [Check our documentation](https://grpc-ecosystem.github.io/grpc-gateway/docs/grpcapiconfiguration.html) for more information. + If you do not want to modify the proto file for use with grpc-gateway you can + alternatively use an external + [gRPC Service Configuration](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config) file. + [Check our documentation](https://grpc-ecosystem.github.io/grpc-gateway/docs/grpcapiconfiguration.html) + for more information. 3. Generate gRPC stub @@ -131,8 +144,6 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. It will generate a reverse proxy `path/to/your_service.pb.gw.go`. - Note: After generating the code for each of the stubs, in order to build the code, you will want to run ```go get .``` from the directory containing the stubs. - 6. Write an entrypoint Now you need to write an entrypoint of the proxy server. @@ -191,13 +202,18 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. ``` ## Parameters and flags -`protoc-gen-grpc-gateway` supports custom mapping from Protobuf `import` to Golang import path. -They are compatible to [the parameters with same names in `protoc-gen-go`](https://github.com/golang/protobuf#parameters). +`protoc-gen-grpc-gateway` supports custom mapping from Protobuf `import` to +Golang import paths. They are compatible to +[the parameters with same names in `protoc-gen-go`](https://github.com/golang/protobuf#parameters) +(except `source_relative`). -In addition we also support the `request_context` parameter in order to use the `http.Request`'s Context (only for Go 1.7 and above). -This parameter can be useful to pass request scoped context between the gateway and the gRPC service. +In addition we also support the `request_context` parameter in order to use the +`http.Request`'s Context (only for Go 1.7 and above). This parameter can be +useful to pass request scoped context between the gateway and the gRPC service. -`protoc-gen-grpc-gateway` also supports some more command line flags to control logging. You can give these flags together with parameters above. Run `protoc-gen-grpc-gateway --help` for more details about the flags. +`protoc-gen-grpc-gateway` also supports some more command line flags to control +logging. You can give these flags together with parameters above. Run +`protoc-gen-grpc-gateway --help` for more details about the flags. ## More Examples More examples are available under `examples` directory. @@ -208,43 +224,54 @@ More examples are available under `examples` directory. * `server/main.go`: service implementation * `main.go`: entrypoint of the generated reverse proxy -To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRPC-gateway, and a gRPC server, see [this code example by CoreOS](https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go) (and its accompanying [blog post](https://coreos.com/blog/gRPC-protobufs-swagger.html)) +To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), +gRPC-gateway, and a gRPC server, see +[this code example by CoreOS](https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go) +(and its accompanying [blog post](https://coreos.com/blog/gRPC-protobufs-swagger.html)). ## Features + ### Supported -* Generating JSON API handlers -* Method parameters in request body -* Method parameters in request path -* Method parameters in query string + +* Generating JSON API handlers. +* Method parameters in request body. +* Method parameters in request path. +* Method parameters in query string. * Enum fields in path parameter (including repeated enum fields). -* Mapping streaming APIs to newline-delimited JSON streams +* Mapping streaming APIs to newline-delimited JSON streams. * Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata (prefixed with `grpcgateway-`) -* Optionally emitting API definition for [Swagger](http://swagger.io). -* Setting [gRPC timeouts](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests) through inbound HTTP `Grpc-Timeout` header. -* Partial support for [gRPC API Configuration]((https://cloud.google.com/endpoints/docs/grpc/grpc-service-config)) files as an alternative to annotation. - -### Want to support -But not yet. -* Optionally generating the entrypoint. #8 -* `import_path` parameter +* Optionally emitting API definitions for +[OpenAPI (Swagger) v2](https://swagger.io/docs/specification/2-0/basic-structure/). +* Setting [gRPC timeouts](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests) +through inbound HTTP `Grpc-Timeout` header. +* Partial support for [gRPC API Configuration](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config) +files as an alternative to annotation. +* Automatically translating PATCH requests into Field Mask gRPC requests. See +[the docs](https://grpc-ecosystem.github.io/grpc-gateway/docs/patch.html) +for more information. ### No plan to support But patch is welcome. -* Method parameters in HTTP headers -* Handling trailer metadata -* Encoding request/response body in XML -* True bi-directional streaming. (Probably impossible?) +* Method parameters in HTTP headers. +* Handling trailer metadata. +* Encoding request/response body in XML. +* True bi-directional streaming. # Mapping gRPC to HTTP -* [How gRPC error codes map to HTTP status codes in the response](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15) -* HTTP request source IP is added as `X-Forwarded-For` gRPC request header -* HTTP request host is added as `X-Forwarded-Host` gRPC request header -* HTTP `Authorization` header is added as `authorization` gRPC request header -* Remaining Permanent HTTP header keys (as specified by the IANA [here](http://www.iana.org/assignments/message-headers/message-headers.xhtml) are prefixed with `grpcgateway-` and added with their values to gRPC request header -* HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata (prefixed with `grpcgateway-`) -* While configurable, the default {un,}marshaling uses [jsonpb](https://godoc.org/github.com/golang/protobuf/jsonpb) with `OrigName: true`. - +* [How gRPC error codes map to HTTP status codes in the response](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15). +* HTTP request source IP is added as `X-Forwarded-For` gRPC request header. +* HTTP request host is added as `X-Forwarded-Host` gRPC request header. +* HTTP `Authorization` header is added as `authorization` gRPC request header. +* Remaining Permanent HTTP header keys (as specified by the IANA +[here](http://www.iana.org/assignments/message-headers/message-headers.xhtml) +are prefixed with `grpcgateway-` and added with their values to gRPC request +header. +* HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata +(prefixed with `grpcgateway-`). +* While configurable, the default {un,}marshaling uses +[jsonpb](https://godoc.org/github.com/golang/protobuf/jsonpb) with +`OrigName: true`. # Contribution See [CONTRIBUTING.md](http://github.com/grpc-ecosystem/grpc-gateway/blob/master/CONTRIBUTING.md). diff --git a/go.mod b/go.mod new file mode 100644 index 00000000000..4c1a2ae7173 --- /dev/null +++ b/go.mod @@ -0,0 +1,18 @@ +module github.com/grpc-ecosystem/grpc-gateway + +require ( + github.com/ghodss/yaml v1.0.0 + github.com/go-resty/resty v1.9.0 + github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b + github.com/golang/protobuf v1.2.0 + github.com/kr/pretty v0.1.0 // indirect + github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af + golang.org/x/net v0.0.0-20181220203305-927f97764cc3 + golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect + google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 + google.golang.org/grpc v1.16.0 + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 // indirect +) + +replace github.com/go-resty/resty => gopkg.in/resty.v1 v1.9.0 diff --git a/go.sum b/go.sum new file mode 100644 index 00000000000..ceb099f3428 --- /dev/null +++ b/go.sum @@ -0,0 +1,43 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3 h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 h1:YoY1wS6JYVRpIfFngRf2HHo9R9dAne3xbkGOQ5rJXjU= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.16.0 h1:dz5IJGuC2BB7qXR5AyHNwAUBhZscK2xVez7mznh72sY= +google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/resty.v1 v1.9.0/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 h1:+t9dhfO+GNOIGJof6kPOAenx7YgrZMTdRPV+EsnPabk= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 68f65d94b9342ba436606dda61a072822e10cb94 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sat, 23 Feb 2019 00:37:53 -0700 Subject: [PATCH 371/552] Upgrade to rules_go 0.17.0 Also fixes #873 --- BUILD | 13 ++----------- WORKSPACE | 12 +++--------- protoc-gen-swagger/defs.bzl | 10 ++++++---- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/BUILD b/BUILD index a9997cb5a0e..27944f25764 100644 --- a/BUILD +++ b/BUILD @@ -12,18 +12,9 @@ buildifier( # gazelle:exclude third_party # gazelle:exclude vendor +# gazelle:prefix github.com/grpc-ecosystem/grpc-gateway -gazelle( - name = "gazelle_diff", - mode = "diff", - prefix = "github.com/grpc-ecosystem/grpc-gateway", -) - -gazelle( - name = "gazelle_fix", - mode = "fix", - prefix = "github.com/grpc-ecosystem/grpc-gateway", -) +gazelle(name = "gazelle") package_group( name = "generators", diff --git a/WORKSPACE b/WORKSPACE index e74086a7aff..d6c2c00c395 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -5,8 +5,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - sha256 = "7be7dc01f1e0afdba6c8eb2b43d2fa01c743be1b9273ab1eaf6c233df078d705", - urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.16.5/rules_go-0.16.5.tar.gz"], + sha256 = "492c3ac68ed9dcf527a07e6a1b2dcbf199c6bf8b35517951467ac32e421c06c1", + urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.0/rules_go-0.17.0.tar.gz"], ) http_archive( @@ -15,7 +15,7 @@ http_archive( urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"], ) -load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies") +load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains") go_rules_dependencies() @@ -25,12 +25,6 @@ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") gazelle_dependencies() -load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies") - -go_rules_dependencies() - -go_register_toolchains() - load("@bazel_gazelle//:deps.bzl", "go_repository") # Also define in Gopkg.toml diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index d049ce596af..186178d8892 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -38,7 +38,8 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action sibling = proto, ) - inputs = direct_proto_srcs + transitive_proto_srcs + [protoc_gen_swagger] + inputs = direct_proto_srcs + transitive_proto_srcs + tools = [protoc_gen_swagger] options = ["logtostderr=true", "allow_repeated_fields_in_body=true"] if grpc_api_configuration: @@ -50,12 +51,13 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action args = actions.args() args.add("--plugin=%s" % protoc_gen_swagger.path) args.add("--swagger_out=%s:%s" % (",".join(options), ctx.bin_dir.path)) - args.add(["-I%s" % include for include in includes]) + args.add_all(["-I%s" % include for include in includes]) args.add(proto.path) actions.run( executable = protoc, inputs = inputs, + tools = tools, outputs = [swagger_file], arguments = [args], ) @@ -68,7 +70,7 @@ def _proto_gen_swagger_impl(ctx): proto = ctx.attr.proto.proto grpc_api_configuration = ctx.file.grpc_api_configuration - return struct( + return [DefaultInfo( files = depset( _run_proto_gen_swagger( ctx, @@ -80,7 +82,7 @@ def _proto_gen_swagger_impl(ctx): grpc_api_configuration = grpc_api_configuration, ), ), - ) + )] protoc_gen_swagger = rule( attrs = { From 08a343c8e81122648c34c066d95ee1d7b999f7f7 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sat, 23 Feb 2019 16:59:37 -0700 Subject: [PATCH 372/552] Run buildifer on WORKSPACE --- WORKSPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index d6c2c00c395..4ba250819c1 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -15,7 +15,7 @@ http_archive( urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"], ) -load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains") +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") go_rules_dependencies() From 3127962b8ec819b67745849301f334194e7262ee Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Mon, 25 Feb 2019 14:12:16 +0100 Subject: [PATCH 373/552] protoc-gen-grpc-gateway: use context package from stdlib --- examples/proto/examplepb/a_bit_of_everything.pb.gw.go | 2 +- examples/proto/examplepb/echo_service.pb.gw.go | 2 +- examples/proto/examplepb/flow_combination.pb.gw.go | 2 +- examples/proto/examplepb/response_body_service.pb.gw.go | 2 +- examples/proto/examplepb/stream.pb.gw.go | 2 +- examples/proto/examplepb/unannotated_echo_service.pb.gw.go | 2 +- examples/proto/examplepb/wrappers.pb.gw.go | 2 +- protoc-gen-grpc-gateway/gengateway/generator.go | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index 49621b876cc..23ae923228d 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -9,6 +9,7 @@ It translates gRPC into RESTful JSON APIs. package examplepb import ( + "context" "io" "net/http" @@ -19,7 +20,6 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index 5e9efc9beac..6995d2afc57 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -9,13 +9,13 @@ It translates gRPC into RESTful JSON APIs. package examplepb import ( + "context" "io" "net/http" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index b4ae06a19d7..70844205596 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -9,13 +9,13 @@ It translates gRPC into RESTful JSON APIs. package examplepb import ( + "context" "io" "net/http" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index 804a4815442..35b4f766884 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -9,13 +9,13 @@ It translates gRPC into RESTful JSON APIs. package examplepb import ( + "context" "io" "net/http" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index f43c517b17e..fb4c8fcae45 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -9,6 +9,7 @@ It translates gRPC into RESTful JSON APIs. package examplepb import ( + "context" "io" "net/http" @@ -17,7 +18,6 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index 01764c0f9e6..19c6664ecb2 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -9,13 +9,13 @@ It translates gRPC into RESTful JSON APIs. package examplepb import ( + "context" "io" "net/http" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index 703f2e604fb..3b1478554aa 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -9,6 +9,7 @@ It translates gRPC into RESTful JSON APIs. package examplepb import ( + "context" "io" "net/http" @@ -17,7 +18,6 @@ import ( "github.com/golang/protobuf/ptypes/wrappers" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index fa1adc3470f..43943f95643 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -39,12 +39,12 @@ type generator struct { func New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix, pathTypeString string, allowPatchFeature bool) gen.Generator { var imports []descriptor.GoPackage for _, pkgpath := range []string{ + "context", "io", "net/http", "github.com/grpc-ecosystem/grpc-gateway/runtime", "github.com/grpc-ecosystem/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", From 03c84e755b4205d58f3548f6c0f2b80b3083e9c3 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Thu, 28 Feb 2019 14:04:22 +0100 Subject: [PATCH 374/552] Fix Swagger parameter names when using JSON names. (#879) * Fix parameter names when using JSON names. * Add test. Fix fallback when `json_name` is unset (query params). * Remove fallback. See https://github.com/grpc-ecosystem/grpc-gateway/pull/879#issuecomment-468261505. --- protoc-gen-swagger/genswagger/template.go | 7 +- .../genswagger/template_test.go | 74 +++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index ccaee513be6..2b74d5f164f 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -132,7 +132,6 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st } param := swaggerParameterObject{ - Name: prefix + field.GetName(), Description: desc, In: "query", Default: schema.Default, @@ -142,6 +141,12 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st Required: required, } + if reg.GetUseJSONNamesForFields() { + param.Name = prefix + field.GetJsonName() + } else { + param.Name = prefix + field.GetName() + } + if isEnum { enum, err := reg.LookupEnum("", fieldType) if err != nil { diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 4e20a3ccd25..76b1e830e0e 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -197,6 +197,80 @@ func TestMessageToQueryParameters(t *testing.T) { } } +func TestMessageToQueryParametersWithJsonName(t *testing.T) { + type test struct { + MsgDescs []*protodescriptor.DescriptorProto + Message string + Params []swaggerParameterObject + } + + tests := []test{ + { + MsgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("test_field_a"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + JsonName: proto.String("testFieldA"), + }, + }, + }, + }, + Message: "ExampleMessage", + Params: []swaggerParameterObject{ + swaggerParameterObject{ + Name: "testFieldA", + In: "query", + Required: false, + Type: "string", + }, + }, + }, + } + + for _, test := range tests { + reg := descriptor.NewRegistry() + reg.SetUseJSONNamesForFields(true) + msgs := []*descriptor.Message{} + for _, msgdesc := range test.MsgDescs { + msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{}, + MessageType: test.MsgDescs, + Service: []*protodescriptor.ServiceDescriptorProto{}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: msgs, + } + reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}, + }) + + message, err := reg.LookupMsg("", ".example."+test.Message) + if err != nil { + t.Fatalf("failed to lookup message: %s", err) + } + params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}) + if err != nil { + t.Fatalf("failed to convert message to query parameters: %s", err) + } + if !reflect.DeepEqual(params, test.Params) { + t.Errorf("expected %v, got %v", test.Params, params) + } + } +} + func TestApplyTemplateSimple(t *testing.T) { msgdesc := &protodescriptor.DescriptorProto{ Name: proto.String("ExampleMessage"), From 08b713e6bf12f6afba43e2869cc821acc6d79a2b Mon Sep 17 00:00:00 2001 From: klimov sergey Date: Thu, 28 Feb 2019 16:37:52 +0300 Subject: [PATCH 375/552] go.mod: update grpc from v1.16.0 to v1.17.0 --- go.mod | 2 +- go.sum | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 4c1a2ae7173..2e12ba3899a 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( golang.org/x/net v0.0.0-20181220203305-927f97764cc3 golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 - google.golang.org/grpc v1.16.0 + google.golang.org/grpc v1.17.0 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 // indirect ) diff --git a/go.sum b/go.sum index ceb099f3428..19c3d5fa952 100644 --- a/go.sum +++ b/go.sum @@ -4,7 +4,6 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -16,7 +15,7 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3 h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis= @@ -33,8 +32,8 @@ golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGm google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.16.0 h1:dz5IJGuC2BB7qXR5AyHNwAUBhZscK2xVez7mznh72sY= -google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/resty.v1 v1.9.0/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= From 36744c122f47594ab73c452507435f71cfedc95f Mon Sep 17 00:00:00 2001 From: klimov sergey Date: Thu, 28 Feb 2019 17:21:56 +0300 Subject: [PATCH 376/552] go.mod: update grpc from v1.17.0 to v1.19.0 --- go.mod | 2 +- go.sum | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 2e12ba3899a..9284d871c75 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( golang.org/x/net v0.0.0-20181220203305-927f97764cc3 golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 - google.golang.org/grpc v1.17.0 + google.golang.org/grpc v1.19.0 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 // indirect ) diff --git a/go.sum b/go.sum index 19c3d5fa952..78191e96227 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,5 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -7,7 +8,6 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -28,15 +28,15 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 h1:YoY1wS6JYVRpIfFngRf2HHo9R golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/resty.v1 v1.9.0/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 h1:+t9dhfO+GNOIGJof6kPOAenx7YgrZMTdRPV+EsnPabk= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 2dcbacaea43f5788f9224af1da6a2fe05a1853fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20JACQUES?= Date: Fri, 1 Mar 2019 10:19:03 +0100 Subject: [PATCH 377/552] protoc-gen-swagger: add fqn_for_swagger_name option Adds a new option fqn_for_swagger_name. This uses the protobuf FQN in the generated swagger specification. --- .../descriptor/registry.go | 16 ++++++++++++ protoc-gen-swagger/genswagger/template.go | 25 +++++++++++-------- .../genswagger/template_test.go | 22 +++++++++++++--- protoc-gen-swagger/main.go | 2 ++ protoc-gen-swagger/main_test.go | 25 ++++++++++++++++--- 5 files changed, 73 insertions(+), 17 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index 510ab253830..1131ca453f9 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -61,6 +61,12 @@ type Registry struct { // otherwise the original proto name is used. It's helpful for synchronizing the swagger definition // with grpc-gateway response, if it uses json tags for marshaling. useJSONNamesForFields bool + + // useFQNForSwaggerName if true swagger names will use the full qualified name (FQN) from proto definition, + // and generate a dot-separated swagger name concatenating all elements from the proto FQN. + // If false, the default behavior is to concat the last 2 elements of the FQN if they are unique, otherwise concat + // all the elements of the FQN without any separator + useFQNForSwaggerName bool } type repeatedFieldSeparator struct { @@ -411,6 +417,16 @@ func (r *Registry) GetUseJSONNamesForFields() bool { return r.useJSONNamesForFields } +// SetUseFQNForSwaggerName sets useFQNForSwaggerName +func (r *Registry) SetUseFQNForSwaggerName(use bool) { + r.useFQNForSwaggerName = use +} + +// GetUseFQNForSwaggerName returns useFQNForSwaggerName +func (r *Registry) GetUseFQNForSwaggerName() bool { + return r.useFQNForSwaggerName +} + // GetMergeFileName return the target merge swagger file name func (r *Registry) GetMergeFileName() string { return r.mergeFileName diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 2b74d5f164f..74f53394cae 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -527,7 +527,7 @@ func fullyQualifiedNameToSwaggerName(fqn string, reg *descriptor.Registry) strin if mapping, present := registriesSeen[reg]; present { return mapping[fqn] } - mapping := resolveFullyQualifiedNameToSwaggerNames(append(reg.GetAllFQMNs(), reg.GetAllFQENs()...)) + mapping := resolveFullyQualifiedNameToSwaggerNames(append(reg.GetAllFQMNs(), reg.GetAllFQENs()...), reg.GetUseFQNForSwaggerName()) registriesSeen[reg] = mapping return mapping[fqn] } @@ -544,7 +544,7 @@ var registriesSeenMutex sync.Mutex // This likely could be made better. This will always generate the same names // but may not always produce optimal names. This is a reasonably close // approximation of what they should look like in most cases. -func resolveFullyQualifiedNameToSwaggerNames(messages []string) map[string]string { +func resolveFullyQualifiedNameToSwaggerNames(messages []string, useFQNForSwaggerName bool) map[string]string { packagesByDepth := make(map[int][][]string) uniqueNames := make(map[string]string) @@ -573,14 +573,19 @@ func resolveFullyQualifiedNameToSwaggerNames(messages []string) map[string]strin } for _, p := range messages { - h := hierarchy(p) - for depth := 0; depth < len(h); depth++ { - if count(packagesByDepth[depth], h[len(h)-depth:]) == 1 { - uniqueNames[p] = strings.Join(h[len(h)-depth-1:], "") - break - } - if depth == len(h)-1 { - uniqueNames[p] = strings.Join(h, "") + if useFQNForSwaggerName { + // strip leading dot from proto fqn + uniqueNames[p] = p[1:] + } else { + h := hierarchy(p) + for depth := 0; depth < len(h); depth++ { + if count(packagesByDepth[depth], h[len(h)-depth:]) == 1 { + uniqueNames[p] = strings.Join(h[len(h)-depth-1:], "") + break + } + if depth == len(h)-1 { + uniqueNames[p] = strings.Join(h, "") + } } } } diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 76b1e830e0e..f11246bf1a0 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -853,9 +853,10 @@ func TestTemplateToSwaggerPath(t *testing.T) { func TestResolveFullyQualifiedNameToSwaggerName(t *testing.T) { var tests = []struct { - input string - output string - listOfFQMNs []string + input string + output string + listOfFQMNs []string + useFQNForSwaggerName bool }{ { ".a.b.C", @@ -863,6 +864,7 @@ func TestResolveFullyQualifiedNameToSwaggerName(t *testing.T) { []string{ ".a.b.C", }, + false, }, { ".a.b.C", @@ -871,6 +873,7 @@ func TestResolveFullyQualifiedNameToSwaggerName(t *testing.T) { ".a.C", ".a.b.C", }, + false, }, { ".a.b.C", @@ -880,11 +883,22 @@ func TestResolveFullyQualifiedNameToSwaggerName(t *testing.T) { ".a.C", ".a.b.C", }, + false, + }, + { + ".a.b.C", + "a.b.C", + []string{ + ".C", + ".a.C", + ".a.b.C", + }, + true, }, } for _, data := range tests { - names := resolveFullyQualifiedNameToSwaggerNames(data.listOfFQMNs) + names := resolveFullyQualifiedNameToSwaggerNames(data.listOfFQMNs, data.useFQNForSwaggerName) output := names[data.input] if output != data.output { t.Errorf("Expected fullyQualifiedNameToSwaggerName(%v) to be %s but got %s", diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index 16ce528b709..237e4604983 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -26,6 +26,7 @@ var ( versionFlag = flag.Bool("version", false, "print the current verison") allowRepeatedFieldsInBody = flag.Bool("allow_repeated_fields_in_body", false, "allows to use repeated field in `body` and `response_body` field of `google.api.http` annotation option") includePackageInTags = flag.Bool("include_package_in_tags", false, "if unset, the gRPC service name is added to the `Tags` field of each operation. if set and the `package` directive is shown in the proto file, the package name will be prepended to the service name") + useFQNForSwaggerName = flag.Bool("fqn_for_swagger_name", false, "if set, the object's swagger names will use the fully qualify name from the proto definition (ie my.package.MyMessage.MyInnerMessage") ) // Variables set by goreleaser at build time @@ -76,6 +77,7 @@ func main() { reg.SetUseJSONNamesForFields(*useJSONNamesForFields) reg.SetAllowRepeatedFieldsInBody(*allowRepeatedFieldsInBody) reg.SetIncludePackageInTags(*includePackageInTags) + reg.SetUseFQNForSwaggerName(*useFQNForSwaggerName) if err := reg.SetRepeatedPathParamSeparator(*repeatedPathParamSeparator); err != nil { emitError(err) return diff --git a/protoc-gen-swagger/main_test.go b/protoc-gen-swagger/main_test.go index b5ebda041a2..2c6eec129d4 100644 --- a/protoc-gen-swagger/main_test.go +++ b/protoc-gen-swagger/main_test.go @@ -21,6 +21,7 @@ func TestParseReqParam(t *testing.T) { fileV string importPathV string mergeFileNameV string + useFQNForSwaggerNameV bool }{ { // this one must be first - with no leading clearFlags call it @@ -99,6 +100,21 @@ func TestParseReqParam(t *testing.T) { allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, + { + name: "Test 10", + expected: map[string]string{}, + request: "fqn_for_swagger_name=3", + expectedError: errors.New(`Cannot set flag fqn_for_swagger_name=3: strconv.ParseBool: parsing "3": invalid syntax`), + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, useFQNForSwaggerNameV: false, + fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", + }, + { + name: "Test 11", + expected: map[string]string{}, + request: "fqn_for_swagger_name=true", + allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, useFQNForSwaggerNameV: true, + fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", + }, } for i, tc := range testcases { @@ -124,7 +140,7 @@ func TestParseReqParam(t *testing.T) { tt.Errorf("expected error malformed, expected %q, got %q", tc.expectedError.Error(), err.Error()) } } - checkFlags(tc.allowDeleteBodyV, tc.allowMergeV, tc.allowRepeatedFieldsInBodyV, tc.includePackageInTagsV, tc.fileV, tc.importPathV, tc.mergeFileNameV, tt, i) + checkFlags(tc.allowDeleteBodyV, tc.allowMergeV, tc.allowRepeatedFieldsInBodyV, tc.includePackageInTagsV, tc.useFQNForSwaggerNameV, tc.fileV, tc.importPathV, tc.mergeFileNameV, tt, i) clearFlags() }) @@ -132,7 +148,7 @@ func TestParseReqParam(t *testing.T) { } -func checkFlags(allowDeleteV, allowMergeV, allowRepeatedFieldsInBodyV, includePackageInTagsV bool, fileV, importPathV, mergeFileNameV string, t *testing.T, tid int) { +func checkFlags(allowDeleteV, allowMergeV, allowRepeatedFieldsInBodyV, includePackageInTagsV bool, useFQNForSwaggerNameV bool, fileV, importPathV, mergeFileNameV string, t *testing.T, tid int) { if *importPrefix != importPathV { t.Errorf("Test %v: import_prefix misparsed, expected '%v', got '%v'", tid, importPathV, *importPrefix) } @@ -152,7 +168,10 @@ func checkFlags(allowDeleteV, allowMergeV, allowRepeatedFieldsInBodyV, includePa t.Errorf("Test %v: allow_repeated_fields_in_body misparsed, expected '%v', got '%v'", tid, allowRepeatedFieldsInBodyV, *allowRepeatedFieldsInBody) } if *includePackageInTags != includePackageInTagsV { - t.Errorf("Test %v: allow_repeated_fields_in_body misparsed, expected '%v', got '%v'", tid, includePackageInTagsV, *includePackageInTags) + t.Errorf("Test %v: include_package_in_tags misparsed, expected '%v', got '%v'", tid, includePackageInTagsV, *includePackageInTags) + } + if *useFQNForSwaggerName != useFQNForSwaggerNameV { + t.Errorf("Test %v: fqn_for_swagger_name misparsed, expected '%v', got '%v'", tid, useFQNForSwaggerNameV, *useFQNForSwaggerName) } } From dd942080f5435c5be92c895acfe432715a9dc450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20JACQUES?= Date: Fri, 1 Mar 2019 15:18:51 +0100 Subject: [PATCH 378/552] Add read-only support to protoc-gen-swagger output (#882) Can be set via: * explicit swagger option on the field * Implicit comment "Output only." on the field --- protoc-gen-swagger/genswagger/template.go | 8 + .../genswagger/template_test.go | 135 +++++++++ protoc-gen-swagger/genswagger/types.go | 1 + protoc-gen-swagger/options/openapiv2.pb.go | 269 +++++++++--------- protoc-gen-swagger/options/openapiv2.proto | 3 +- 5 files changed, 284 insertions(+), 132 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 74f53394cae..484ca971643 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -275,6 +275,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, // Warning: Make sure not to overwrite any fields already set on the schema type. schema.ExternalDocs = protoSchema.ExternalDocs + schema.ReadOnly = protoSchema.ReadOnly schema.MultipleOf = protoSchema.MultipleOf schema.Maximum = protoSchema.Maximum schema.ExclusiveMaximum = protoSchema.ExclusiveMaximum @@ -1223,6 +1224,12 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, is // Figure out which properties to update. summaryValue := infoObjectValue.FieldByName("Summary") descriptionValue := infoObjectValue.FieldByName("Description") + readOnlyValue := infoObjectValue.FieldByName("ReadOnly") + + if readOnlyValue.Kind() == reflect.Bool && readOnlyValue.CanSet() && strings.Contains(comment, "Output only.") { + readOnlyValue.Set(reflect.ValueOf(true)) + } + usingTitle := false if !summaryValue.CanSet() { summaryValue = infoObjectValue.FieldByName("Title") @@ -1539,6 +1546,7 @@ func protoJSONSchemaToSwaggerSchemaCore(j *swagger_options.JSONSchema, reg *desc func updateSwaggerObjectFromJSONSchema(s *swaggerSchemaObject, j *swagger_options.JSONSchema) { s.Title = j.GetTitle() s.Description = j.GetDescription() + s.ReadOnly = j.GetReadOnly() s.MultipleOf = j.GetMultipleOf() s.Maximum = j.GetMaximum() s.ExclusiveMaximum = j.GetExclusiveMaximum() diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index f11246bf1a0..603e2ed8feb 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -2,6 +2,7 @@ package genswagger import ( "encoding/json" + "errors" "fmt" "reflect" "testing" @@ -1274,6 +1275,7 @@ func TestRenderMessagesAsDefinition(t *testing.T) { MaxProperties: 33, MinProperties: 22, Required: []string{"req"}, + ReadOnly: true, }, }, }, @@ -1298,6 +1300,7 @@ func TestRenderMessagesAsDefinition(t *testing.T) { MaxProperties: 33, MinProperties: 22, Required: []string{"req"}, + ReadOnly: true, }, }, }, @@ -1498,3 +1501,135 @@ func TestProtoComments(t *testing.T) { } } } + +func TestUpdateSwaggerDataFromComments(t *testing.T) { + + tests := []struct { + descr string + swaggerObject interface{} + comments string + expectedError error + expectedSwaggerObject interface{} + }{ + { + descr: "empty comments", + swaggerObject: nil, + expectedSwaggerObject: nil, + comments: "", + expectedError: nil, + }, + { + descr: "set field to read only", + swaggerObject: &swaggerSchemaObject{}, + expectedSwaggerObject: &swaggerSchemaObject{ + ReadOnly: true, + Description: "... Output only. ...", + }, + comments: "... Output only. ...", + expectedError: nil, + }, + { + descr: "set title", + swaggerObject: &swaggerSchemaObject{}, + expectedSwaggerObject: &swaggerSchemaObject{ + Title: "Comment with no trailing dot", + }, + comments: "Comment with no trailing dot", + expectedError: nil, + }, + { + descr: "set description", + swaggerObject: &swaggerSchemaObject{}, + expectedSwaggerObject: &swaggerSchemaObject{ + Description: "Comment with trailing dot.", + }, + comments: "Comment with trailing dot.", + expectedError: nil, + }, + { + descr: "use info object", + swaggerObject: &swaggerObject{ + Info: swaggerInfoObject{ + }, + }, + expectedSwaggerObject: &swaggerObject{ + Info: swaggerInfoObject{ + Description: "Comment with trailing dot.", + }, + }, + comments: "Comment with trailing dot.", + expectedError: nil, + }, + { + descr: "multi line comment with title", + swaggerObject: &swaggerSchemaObject{}, + expectedSwaggerObject: &swaggerSchemaObject { + Title: "First line", + Description: "Second line", + }, + comments: "First line\n\nSecond line", + expectedError: nil, + }, + { + descr: "multi line comment no title", + swaggerObject: &swaggerSchemaObject{}, + expectedSwaggerObject: &swaggerSchemaObject { + Description: "First line.\n\nSecond line", + }, + comments: "First line.\n\nSecond line", + expectedError: nil, + }, + { + descr: "multi line comment with summary with dot", + swaggerObject: &swaggerOperationObject{}, + expectedSwaggerObject: &swaggerOperationObject { + Summary: "First line.", + Description: "Second line", + }, + comments: "First line.\n\nSecond line", + expectedError: nil, + }, + { + descr: "multi line comment with summary no dot", + swaggerObject: &swaggerOperationObject{}, + expectedSwaggerObject: &swaggerOperationObject { + Summary: "First line", + Description: "Second line", + }, + comments: "First line\n\nSecond line", + expectedError: nil, + }, + { + descr: "multi line comment with summary no dot", + swaggerObject: &schemaCore{}, + expectedSwaggerObject: &schemaCore{}, + comments: "Any comment", + expectedError: errors.New("no description nor summary property"), + }, + } + + for _, test := range tests { + t.Run(test.descr, func(t *testing.T) { + err := updateSwaggerDataFromComments(test.swaggerObject, test.comments, false) + + if test.expectedError == nil { + if err != nil { + t.Errorf("unexpected error '%v'", err) + } + if !reflect.DeepEqual(test.swaggerObject, test.expectedSwaggerObject) { + t.Errorf("swaggerObject was not updated corretly, expected '%+v', got '%+v'", test.expectedSwaggerObject, test.swaggerObject) + } + } else { + if err == nil { + t.Error("expected update error not returned") + } + if !reflect.DeepEqual(test.swaggerObject, test.expectedSwaggerObject) { + t.Errorf("swaggerObject was not updated corretly, expected '%+v', got '%+v'", test.expectedSwaggerObject, test.swaggerObject) + } + if err.Error() != test.expectedError.Error() { + t.Errorf("expected error malformed, expected %q, got %q", test.expectedError.Error(), err.Error()) + } + } + }) + } +} \ No newline at end of file diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index d2bed9aa92c..6599937dc69 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -209,6 +209,7 @@ type swaggerSchemaObject struct { ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` + ReadOnly bool `json:"readOnly,omitempty"` MultipleOf float64 `json:"multipleOf,omitempty"` Maximum float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index ccdb18fe08b..dd6cfd5d072 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -48,7 +48,7 @@ func (x Swagger_SwaggerScheme) String() string { return proto.EnumName(Swagger_SwaggerScheme_name, int32(x)) } func (Swagger_SwaggerScheme) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{0, 0} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{0, 0} } type JSONSchema_JSONSchemaSimpleTypes int32 @@ -89,7 +89,7 @@ func (x JSONSchema_JSONSchemaSimpleTypes) String() string { return proto.EnumName(JSONSchema_JSONSchemaSimpleTypes_name, int32(x)) } func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{8, 0} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{8, 0} } // Required. The type of the security scheme. Valid values are "basic", @@ -120,7 +120,7 @@ func (x SecurityScheme_Type) String() string { return proto.EnumName(SecurityScheme_Type_name, int32(x)) } func (SecurityScheme_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{11, 0} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{11, 0} } // Required. The location of the API key. Valid values are "query" or "header". @@ -147,7 +147,7 @@ func (x SecurityScheme_In) String() string { return proto.EnumName(SecurityScheme_In_name, int32(x)) } func (SecurityScheme_In) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{11, 1} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{11, 1} } // Required. The flow used by the OAuth2 security scheme. Valid values are @@ -181,7 +181,7 @@ func (x SecurityScheme_Flow) String() string { return proto.EnumName(SecurityScheme_Flow_name, int32(x)) } func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{11, 2} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{11, 2} } // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. @@ -210,7 +210,7 @@ func (m *Swagger) Reset() { *m = Swagger{} } func (m *Swagger) String() string { return proto.CompactTextString(m) } func (*Swagger) ProtoMessage() {} func (*Swagger) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{0} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{0} } func (m *Swagger) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Swagger.Unmarshal(m, b) @@ -333,7 +333,7 @@ func (m *Operation) Reset() { *m = Operation{} } func (m *Operation) String() string { return proto.CompactTextString(m) } func (*Operation) ProtoMessage() {} func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{1} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{1} } func (m *Operation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Operation.Unmarshal(m, b) @@ -450,7 +450,7 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{2} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{2} } func (m *Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Response.Unmarshal(m, b) @@ -505,7 +505,7 @@ func (m *Info) Reset() { *m = Info{} } func (m *Info) String() string { return proto.CompactTextString(m) } func (*Info) ProtoMessage() {} func (*Info) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{3} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{3} } func (m *Info) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Info.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *Contact) Reset() { *m = Contact{} } func (m *Contact) String() string { return proto.CompactTextString(m) } func (*Contact) ProtoMessage() {} func (*Contact) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{4} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{4} } func (m *Contact) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Contact.Unmarshal(m, b) @@ -644,7 +644,7 @@ func (m *License) Reset() { *m = License{} } func (m *License) String() string { return proto.CompactTextString(m) } func (*License) ProtoMessage() {} func (*License) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{5} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{5} } func (m *License) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_License.Unmarshal(m, b) @@ -696,7 +696,7 @@ func (m *ExternalDocumentation) Reset() { *m = ExternalDocumentation{} } func (m *ExternalDocumentation) String() string { return proto.CompactTextString(m) } func (*ExternalDocumentation) ProtoMessage() {} func (*ExternalDocumentation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{6} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{6} } func (m *ExternalDocumentation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExternalDocumentation.Unmarshal(m, b) @@ -750,7 +750,7 @@ func (m *Schema) Reset() { *m = Schema{} } func (m *Schema) String() string { return proto.CompactTextString(m) } func (*Schema) ProtoMessage() {} func (*Schema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{7} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{7} } func (m *Schema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Schema.Unmarshal(m, b) @@ -827,6 +827,7 @@ type JSONSchema struct { Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` Default string `protobuf:"bytes,7,opt,name=default,proto3" json:"default,omitempty"` + ReadOnly bool `protobuf:"varint,8,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` MultipleOf float64 `protobuf:"fixed64,10,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` @@ -853,7 +854,7 @@ func (m *JSONSchema) Reset() { *m = JSONSchema{} } func (m *JSONSchema) String() string { return proto.CompactTextString(m) } func (*JSONSchema) ProtoMessage() {} func (*JSONSchema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{8} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{8} } func (m *JSONSchema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JSONSchema.Unmarshal(m, b) @@ -901,6 +902,13 @@ func (m *JSONSchema) GetDefault() string { return "" } +func (m *JSONSchema) GetReadOnly() bool { + if m != nil { + return m.ReadOnly + } + return false +} + func (m *JSONSchema) GetMultipleOf() float64 { if m != nil { return m.MultipleOf @@ -1032,7 +1040,7 @@ func (m *Tag) Reset() { *m = Tag{} } func (m *Tag) String() string { return proto.CompactTextString(m) } func (*Tag) ProtoMessage() {} func (*Tag) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{9} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{9} } func (m *Tag) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Tag.Unmarshal(m, b) @@ -1086,7 +1094,7 @@ func (m *SecurityDefinitions) Reset() { *m = SecurityDefinitions{} } func (m *SecurityDefinitions) String() string { return proto.CompactTextString(m) } func (*SecurityDefinitions) ProtoMessage() {} func (*SecurityDefinitions) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{10} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{10} } func (m *SecurityDefinitions) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityDefinitions.Unmarshal(m, b) @@ -1164,7 +1172,7 @@ func (m *SecurityScheme) Reset() { *m = SecurityScheme{} } func (m *SecurityScheme) String() string { return proto.CompactTextString(m) } func (*SecurityScheme) ProtoMessage() {} func (*SecurityScheme) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{11} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{11} } func (m *SecurityScheme) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityScheme.Unmarshal(m, b) @@ -1266,7 +1274,7 @@ func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} } func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) } func (*SecurityRequirement) ProtoMessage() {} func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{12} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{12} } func (m *SecurityRequirement) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement.Unmarshal(m, b) @@ -1311,7 +1319,7 @@ func (m *SecurityRequirement_SecurityRequirementValue) String() string { } func (*SecurityRequirement_SecurityRequirementValue) ProtoMessage() {} func (*SecurityRequirement_SecurityRequirementValue) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{12, 0} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{12, 0} } func (m *SecurityRequirement_SecurityRequirementValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Unmarshal(m, b) @@ -1356,7 +1364,7 @@ func (m *Scopes) Reset() { *m = Scopes{} } func (m *Scopes) String() string { return proto.CompactTextString(m) } func (*Scopes) ProtoMessage() {} func (*Scopes) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_ae281b352364822e, []int{13} + return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{13} } func (m *Scopes) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Scopes.Unmarshal(m, b) @@ -1412,120 +1420,121 @@ func init() { } func init() { - proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_ae281b352364822e) + proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_11f010f5fecc79bc) } -var fileDescriptor_openapiv2_ae281b352364822e = []byte{ - // 1773 bytes of a gzipped FileDescriptorProto +var fileDescriptor_openapiv2_11f010f5fecc79bc = []byte{ + // 1777 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x73, 0xdb, 0xc6, 0x11, 0x0f, 0x48, 0x90, 0x04, 0x97, 0x22, 0x73, 0x3e, 0xcb, 0x2d, 0xa2, 0xc4, 0xae, 0xc2, 0xa6, 0x53, 0x8d, 0x3d, 0xa6, 0x12, 0xe5, 0xa1, 0x99, 0x4c, 0xa7, 0x1d, 0x4a, 0x62, 0x6c, 0xc0, 0x32, 0xc9, 0x82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, 0xde, 0x87, 0x9a, 0xdc, 0x74, - 0x33, 0x98, 0xf6, 0x33, 0xb8, 0xb7, 0xf6, 0x1a, 0xd8, 0xa0, 0x48, 0x6e, 0x82, 0xfd, 0xab, 0x04, - 0x55, 0x51, 0x00, 0x78, 0x0c, 0x8d, 0xef, 0x92, 0x90, 0xda, 0xb2, 0x8c, 0x14, 0x9e, 0xb9, 0xcf, - 0x37, 0xce, 0x9c, 0x39, 0x1a, 0xf4, 0x65, 0x29, 0x01, 0xc3, 0x91, 0xa8, 0x9f, 0x40, 0x73, 0xe2, - 0x31, 0x0f, 0x02, 0x8f, 0x3a, 0x69, 0x18, 0xcb, 0xcd, 0x57, 0x99, 0x6c, 0xf6, 0x88, 0x89, 0x33, - 0xb1, 0x43, 0xea, 0xcf, 0x79, 0x7a, 0x34, 0x4b, 0x63, 0x8c, 0x01, 0xf5, 0xd7, 0xbc, 0x5f, 0x95, - 0x77, 0x70, 0x6b, 0x76, 0xa0, 0x46, 0xae, 0x9c, 0x20, 0xf2, 0x09, 0x3f, 0xe7, 0xc6, 0xc1, 0x76, - 0x47, 0xcc, 0x69, 0x9d, 0x7c, 0x4e, 0xeb, 0x74, 0xe9, 0xdc, 0xca, 0x95, 0x64, 0x83, 0xfc, 0xa9, - 0x06, 0xb0, 0x0c, 0x9c, 0xe5, 0x37, 0x26, 0x53, 0x79, 0xbe, 0x6c, 0xb9, 0x6c, 0x9c, 0xca, 0x8f, - 0x34, 0x4e, 0xf5, 0xe6, 0x49, 0xe9, 0x50, 0x9b, 0x90, 0xa9, 0x93, 0xf9, 0xa9, 0x5e, 0x13, 0x65, - 0x27, 0x49, 0xfc, 0x33, 0x68, 0x04, 0x99, 0x9f, 0x7a, 0x91, 0x4f, 0xec, 0x70, 0xaa, 0xc3, 0xae, - 0xb2, 0xa7, 0x58, 0x90, 0xb3, 0x06, 0x53, 0x66, 0x1a, 0x38, 0x57, 0x5e, 0x90, 0x05, 0xfc, 0x9a, - 0x54, 0xac, 0x9c,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0x17, 0x4f, 0x06, 0x5a, 0x11, 0x9c, 0xc6, 0x3e, 0xbb, 0xdc, 0xd2, 0xf0, 0x15, + 0x11, 0x4a, 0xe2, 0xe5, 0xd0, 0x38, 0x83, 0x09, 0xf9, 0x8c, 0x18, 0x46, 0x24, 0xe1, 0xef, 0xc6, + 0xed, 0x66, 0x44, 0x66, 0x66, 0x49, 0xf3, 0xf6, 0x33, 0x50, 0x59, 0xd2, 0x31, 0x82, 0xad, 0xf1, + 0x8b, 0x61, 0xcf, 0x36, 0xfa, 0x5f, 0x77, 0x4f, 0x8c, 0x63, 0xf4, 0x1e, 0x6e, 0x01, 0x70, 0xce, + 0x61, 0x77, 0x64, 0x1c, 0x21, 0x65, 0xa1, 0xd1, 0x1d, 0x1a, 0xf6, 0xb3, 0xde, 0x0b, 0x54, 0xc2, + 0xef, 0x43, 0x83, 0x73, 0x06, 0xdd, 0xd3, 0xf1, 0xd3, 0x03, 0x54, 0x6e, 0x7f, 0x06, 0x25, 0x83, + 0x32, 0x43, 0xa3, 0x5f, 0x00, 0xda, 0x02, 0xcd, 0xe8, 0xdb, 0x7f, 0x38, 0xed, 0x59, 0xec, 0x8e, + 0x69, 0x42, 0xdd, 0xe8, 0xdb, 0x4f, 0x7b, 0xdd, 0xe3, 0x9e, 0x85, 0x4a, 0xed, 0xef, 0x40, 0x65, + 0x09, 0x62, 0xe8, 0x5f, 0x9d, 0x0c, 0xce, 0x0a, 0x66, 0x77, 0xa0, 0x29, 0x38, 0xcf, 0x87, 0x27, + 0xc6, 0x91, 0x31, 0x46, 0xca, 0x82, 0x35, 0xec, 0x8e, 0x46, 0x67, 0x03, 0xeb, 0x18, 0x95, 0xf0, + 0x36, 0x20, 0xce, 0xea, 0x0e, 0x99, 0x56, 0x77, 0x6c, 0x0c, 0xfa, 0xa8, 0xbc, 0xe4, 0x1e, 0x1d, + 0xf5, 0x46, 0x23, 0xfb, 0x68, 0x70, 0xdc, 0x43, 0x6a, 0xfb, 0xdf, 0xa5, 0x65, 0xb7, 0x16, 0x3e, + 0x10, 0xf0, 0x5f, 0x95, 0xc2, 0x3f, 0x04, 0xf1, 0x52, 0x20, 0x5b, 0xf7, 0xf4, 0x4d, 0xbe, 0x3e, + 0xd6, 0xf1, 0x44, 0x17, 0x2f, 0xfe, 0x3a, 0x28, 0x48, 0x76, 0x3e, 0x05, 0x7d, 0x8d, 0xc1, 0xd7, + 0xac, 0xf5, 0xd8, 0x1b, 0xc2, 0x0f, 0x4d, 0x7e, 0xc3, 0x0a, 0x62, 0xe7, 0x07, 0x65, 0xad, 0xc9, + 0x8f, 0x5d, 0x07, 0xaf, 0x56, 0xaf, 0x83, 0xb7, 0x1e, 0x1b, 0x77, 0xb5, 0x78, 0x59, 0xfc, 0x5d, + 0x61, 0x63, 0x29, 0xab, 0x35, 0x3c, 0x2c, 0x06, 0xd0, 0xb8, 0x4d, 0x7f, 0x72, 0x7b, 0xf1, 0x23, + 0x92, 0x27, 0x83, 0xff, 0x02, 0x60, 0xc9, 0x5c, 0x13, 0xed, 0x76, 0x31, 0xda, 0x7a, 0xc1, 0xad, + 0xc3, 0xa3, 0x3f, 0x76, 0x67, 0x5e, 0x7a, 0x9e, 0xbd, 0xec, 0xb8, 0x61, 0xb0, 0xcf, 0x1c, 0x79, + 0x4c, 0xdc, 0x30, 0x99, 0x27, 0x29, 0x91, 0xa4, 0xf4, 0x6b, 0xff, 0xc7, 0xff, 0x38, 0x7c, 0x59, + 0xe5, 0xb2, 0xcf, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xb3, 0xec, 0xbb, 0xdf, 0x5d, 0x14, 0x00, + 0x00, } diff --git a/protoc-gen-swagger/options/openapiv2.proto b/protoc-gen-swagger/options/openapiv2.proto index 18b6c89dae0..105f8feb41d 100644 --- a/protoc-gen-swagger/options/openapiv2.proto +++ b/protoc-gen-swagger/options/openapiv2.proto @@ -169,8 +169,7 @@ message JSONSchema { string title = 5; string description = 6; string default = 7; - // field 8 is reserved for 'readOnly', which has an OpenAPI v2-specific meaning and is defined there. - reserved 8; + bool read_only = 8; // field 9 is reserved for 'examples', which is omitted from OpenAPI v2 in favor of 'example' field. reserved 9; double multiple_of = 10; From c4bb0473ed3925ba254285269298041c12a1c1f4 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 1 Mar 2019 16:04:05 +0000 Subject: [PATCH 379/552] Generate changelog for 1.8.0 (#883) --- CHANGELOG.md | 42 ++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7cc4cb3def..70911432dd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,46 @@ # Change Log +## [v1.8.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.0) (2019-03-01) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.7.0...v1.8.0) + +**Implemented enhancements:** + +- Cleaner Swagger-generated schema names \(omitting prefixes\) [\#877](https://github.com/grpc-ecosystem/grpc-gateway/issues/877) +- Support swagger annotations for default and required fields [\#851](https://github.com/grpc-ecosystem/grpc-gateway/issues/851) +- Support go modules [\#755](https://github.com/grpc-ecosystem/grpc-gateway/issues/755) + +**Fixed bugs:** + +- inconsistent identifier capitalization between protoc-gen-go and protoc-gen-grpc-gateway [\#683](https://github.com/grpc-ecosystem/grpc-gateway/issues/683) + +**Closed issues:** + +- Bazel incompatible changes [\#873](https://github.com/grpc-ecosystem/grpc-gateway/issues/873) +- Swagger has not existed for four years [\#872](https://github.com/grpc-ecosystem/grpc-gateway/issues/872) +- Improve README with AWS API Gateway findings [\#868](https://github.com/grpc-ecosystem/grpc-gateway/issues/868) +- swagger error [\#867](https://github.com/grpc-ecosystem/grpc-gateway/issues/867) +- A question about generating file protoc-gen-grpc-gateway/gengateway/template.go [\#864](https://github.com/grpc-ecosystem/grpc-gateway/issues/864) +- Repeated field documentation is overwritten by fields comments [\#863](https://github.com/grpc-ecosystem/grpc-gateway/issues/863) +- Using dep to depend on specific revision of golang/protobuf is causing transative dependency problems for users [\#829](https://github.com/grpc-ecosystem/grpc-gateway/issues/829) +- Mac OS X - Note about your tutorial [\#787](https://github.com/grpc-ecosystem/grpc-gateway/issues/787) +- Returning 302 redirect as response [\#607](https://github.com/grpc-ecosystem/grpc-gateway/issues/607) + +**Merged pull requests:** + +- Read only support [\#882](https://github.com/grpc-ecosystem/grpc-gateway/pull/882) ([hypnoce](https://github.com/hypnoce)) +- Add fqn\_for\_swagger\_name option [\#881](https://github.com/grpc-ecosystem/grpc-gateway/pull/881) ([hypnoce](https://github.com/hypnoce)) +- go.mod: update grpc from v1.16.0 to v1.17.0 [\#880](https://github.com/grpc-ecosystem/grpc-gateway/pull/880) ([klim0v](https://github.com/klim0v)) +- Fix parameter names when using JSON names. [\#879](https://github.com/grpc-ecosystem/grpc-gateway/pull/879) ([brocaar](https://github.com/brocaar)) +- protoc-gen-grpc-gateway: use context package from stdlib [\#876](https://github.com/grpc-ecosystem/grpc-gateway/pull/876) ([simonpasquier](https://github.com/simonpasquier)) +- Run buildifer on WORKSPACE [\#875](https://github.com/grpc-ecosystem/grpc-gateway/pull/875) ([achew22](https://github.com/achew22)) +- Upgrade to rules\_go 0.17.0 [\#874](https://github.com/grpc-ecosystem/grpc-gateway/pull/874) ([achew22](https://github.com/achew22)) +- Switch to go modules [\#870](https://github.com/grpc-ecosystem/grpc-gateway/pull/870) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- 868 improving README with AWS API gateway findings [\#869](https://github.com/grpc-ecosystem/grpc-gateway/pull/869) ([fahernandez](https://github.com/fahernandez)) +- Updated Service, Method, Message Identifiers to be CamelCased [\#866](https://github.com/grpc-ecosystem/grpc-gateway/pull/866) ([waveywaves](https://github.com/waveywaves)) +- 863 adding swagger annotation support for enum and nested objects [\#865](https://github.com/grpc-ecosystem/grpc-gateway/pull/865) ([fahernandez](https://github.com/fahernandez)) +- Update CI badge link in documentation [\#862](https://github.com/grpc-ecosystem/grpc-gateway/pull/862) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- protoc-gen-swagger: add the package name to the tags field of each endpoint if the package name exists in the proto file [\#860](https://github.com/grpc-ecosystem/grpc-gateway/pull/860) ([zwcn](https://github.com/zwcn)) + ## [v1.7.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.7.0) (2019-01-23) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.6.4...v1.7.0) @@ -10,6 +51,7 @@ **Merged pull requests:** +- Generate changelog for 1.7.0 [\#858](https://github.com/grpc-ecosystem/grpc-gateway/pull/858) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Use github.com/golang/protobuf/descriptor ForMessage and fix CI from not rebasing [\#857](https://github.com/grpc-ecosystem/grpc-gateway/pull/857) ([mechinn](https://github.com/mechinn)) - marshal\_jsonpb: add check for slice sub types implementing proto.Message [\#856](https://github.com/grpc-ecosystem/grpc-gateway/pull/856) ([abice](https://github.com/abice)) - Added WithDisablePathLengthFallback option \(to fix issue \#447\) [\#855](https://github.com/grpc-ecosystem/grpc-gateway/pull/855) ([UladzimirTrehubenka](https://github.com/UladzimirTrehubenka)) diff --git a/Makefile b/Makefile index b141347681a..f25e14d7cde 100644 --- a/Makefile +++ b/Makefile @@ -193,7 +193,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.7.0 + --future-release=v1.8.0 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 21db267e05b62f723f3c519068e33bcef66cdac6 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 1 Mar 2019 23:46:58 +0000 Subject: [PATCH 380/552] CI: fix release builds (#884) * CI: fix release builds * Solve resty issue once and for all with sed magic --- .circleci/Dockerfile | 7 +------ .circleci/config.yml | 4 ++-- CONTRIBUTING.md | 2 +- Makefile | 1 + WORKSPACE | 10 ++++------ examples/clients/abe/BUILD.bazel | 2 +- examples/clients/abe/api_client.go | 2 +- examples/clients/echo/BUILD.bazel | 2 +- examples/clients/echo/api_client.go | 2 +- examples/clients/responsebody/BUILD.bazel | 2 +- examples/clients/responsebody/api_client.go | 2 +- examples/clients/unannotatedecho/BUILD.bazel | 2 +- examples/clients/unannotatedecho/api_client.go | 2 +- examples/proto/examplepb/BUILD.bazel | 1 - go.mod | 4 +--- go.sum | 4 ++-- 16 files changed, 20 insertions(+), 29 deletions(-) diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile index 9285342ec0f..10ee4847f30 100644 --- a/.circleci/Dockerfile +++ b/.circleci/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:latest +FROM golang:1.11 ## Warm apt cache RUN apt-get update @@ -26,11 +26,6 @@ RUN apt-get install -y wget bzip2 && \ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash && \ apt-get remove -y wget -# Install dep -RUN apt-get install -y wget && \ - wget -qO- https://raw.githubusercontent.com/golang/dep/master/install.sh | sh && \ - apt-get remove -y wget - # Clean up RUN apt-get autoremove -y && \ rm -rf /var/lib/apt/lists/* diff --git a/.circleci/config.yml b/.circleci/config.yml index cac9aa698e0..3a172fabb9c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -64,8 +64,8 @@ jobs: EOF - run: name: Check that Bazel BUILD files are up-to-date - command: 'test -z "$(bazel run //:gazelle_diff)" || - (echo "ERROR: Bazel files out-of-date, please run \`bazel run :gazelle_fix\`" >&2; exit 1)' + command: 'bazel run //:gazelle || + (echo "ERROR: Bazel files out-of-date, please run \`bazel run :gazelle\`" >&2; exit 1)' - run: name: Run tests with Bazel command: bazel test //... diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 04fc20639c9..0c4e8287ca8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env make realclean && \ make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' docker run -itv $(pwd):/grpc-gateway -w /grpc-gateway --entrypoint /bin/bash --rm \ - l.gcr.io/google/bazel -c 'bazel run :gazelle_fix; bazel run :buildifier' + l.gcr.io/google/bazel -c 'bazel run :gazelle; bazel run :buildifier' ``` If this has resulted in some file changes in the repo, please ensure you check those in with your merge request. diff --git a/Makefile b/Makefile index f25e14d7cde..7ca298961a7 100644 --- a/Makefile +++ b/Makefile @@ -177,6 +177,7 @@ $(RESPONSE_BODY_EXAMPLE_SRCS): $(RESPONSE_BODY_EXAMPLE_SPEC) $(EXAMPLE_CLIENT_DIR)/responsebody/git_push.sh examples: $(EXAMPLE_DEPSRCS) $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) + find -type f -name *.go -exec sed -s -i 's;github.com/go-resty/resty;gopkg.in/resty.v1;g' {} + test: examples go test -race ... go test -race examples/integration -args -network=unix -endpoint=test.sock diff --git a/WORKSPACE b/WORKSPACE index 4ba250819c1..66c7f2061ef 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -21,12 +21,10 @@ go_rules_dependencies() go_register_toolchains() -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") gazelle_dependencies() -load("@bazel_gazelle//:deps.bzl", "go_repository") - # Also define in Gopkg.toml go_repository( name = "org_golang_google_genproto", @@ -43,9 +41,9 @@ go_repository( # Also define in Gopkg.toml go_repository( - name = "com_github_go_resty_resty", - commit = "f8815663de1e64d57cdd4ee9e2b2fa96977a030e", - importpath = "github.com/go-resty/resty", + name = "in_gopkg_resty_v1", + commit = "fa5875c0caa5c260ab78acec5a244215a730247f", + importpath = "gopkg.in/resty.v1", ) # Also define in Gopkg.toml diff --git a/examples/clients/abe/BUILD.bazel b/examples/clients/abe/BUILD.bazel index 4d3c3546e93..4c28ed28d6a 100644 --- a/examples/clients/abe/BUILD.bazel +++ b/examples/clients/abe/BUILD.bazel @@ -30,6 +30,6 @@ go_library( "//examples/proto/examplepb:go_default_library", "//examples/proto/pathenum:go_default_library", "//runtime:go_default_library", - "@com_github_go_resty_resty//:go_default_library", + "@in_gopkg_resty_v1//:go_default_library", ], ) diff --git a/examples/clients/abe/api_client.go b/examples/clients/abe/api_client.go index bf3e21a9fb1..d6bc762e9bd 100644 --- a/examples/clients/abe/api_client.go +++ b/examples/clients/abe/api_client.go @@ -18,7 +18,7 @@ import ( "strings" "net/url" "io/ioutil" - "github.com/go-resty/resty" + "gopkg.in/resty.v1" ) type APIClient struct { diff --git a/examples/clients/echo/BUILD.bazel b/examples/clients/echo/BUILD.bazel index 090b56aafab..97f3f317ba5 100644 --- a/examples/clients/echo/BUILD.bazel +++ b/examples/clients/echo/BUILD.bazel @@ -13,5 +13,5 @@ go_library( "examplepb_simple_message.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo", - deps = ["@com_github_go_resty_resty//:go_default_library"], + deps = ["@in_gopkg_resty_v1//:go_default_library"], ) diff --git a/examples/clients/echo/api_client.go b/examples/clients/echo/api_client.go index 7a517148026..d3facaa4633 100644 --- a/examples/clients/echo/api_client.go +++ b/examples/clients/echo/api_client.go @@ -18,7 +18,7 @@ import ( "strings" "net/url" "io/ioutil" - "github.com/go-resty/resty" + "gopkg.in/resty.v1" ) type APIClient struct { diff --git a/examples/clients/responsebody/BUILD.bazel b/examples/clients/responsebody/BUILD.bazel index e621bea6960..0f7ce09fc40 100644 --- a/examples/clients/responsebody/BUILD.bazel +++ b/examples/clients/responsebody/BUILD.bazel @@ -19,5 +19,5 @@ go_library( ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/responsebody", visibility = ["//visibility:public"], - deps = ["@com_github_go_resty_resty//:go_default_library"], + deps = ["@in_gopkg_resty_v1//:go_default_library"], ) diff --git a/examples/clients/responsebody/api_client.go b/examples/clients/responsebody/api_client.go index 1f7354b61dc..1ac422ec895 100644 --- a/examples/clients/responsebody/api_client.go +++ b/examples/clients/responsebody/api_client.go @@ -18,7 +18,7 @@ import ( "strings" "net/url" "io/ioutil" - "github.com/go-resty/resty" + "gopkg.in/resty.v1" ) type APIClient struct { diff --git a/examples/clients/unannotatedecho/BUILD.bazel b/examples/clients/unannotatedecho/BUILD.bazel index 611c6c7052d..c7c60503b9c 100644 --- a/examples/clients/unannotatedecho/BUILD.bazel +++ b/examples/clients/unannotatedecho/BUILD.bazel @@ -12,5 +12,5 @@ go_library( "unannotated_echo_service_api.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/unannotatedecho", - deps = ["@com_github_go_resty_resty//:go_default_library"], + deps = ["@in_gopkg_resty_v1//:go_default_library"], ) diff --git a/examples/clients/unannotatedecho/api_client.go b/examples/clients/unannotatedecho/api_client.go index aa4c1f14e42..c898727e74b 100644 --- a/examples/clients/unannotatedecho/api_client.go +++ b/examples/clients/unannotatedecho/api_client.go @@ -18,7 +18,7 @@ import ( "strings" "net/url" "io/ioutil" - "github.com/go-resty/resty" + "gopkg.in/resty.v1" ) type APIClient struct { diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index f819a9472dd..abff1fb6d90 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -66,7 +66,6 @@ go_library( "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//grpclog:go_default_library", "@org_golang_google_grpc//status:go_default_library", - "@org_golang_x_net//context:go_default_library", ], ) diff --git a/go.mod b/go.mod index 9284d871c75..e63e264f1b9 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,6 @@ module github.com/grpc-ecosystem/grpc-gateway require ( github.com/ghodss/yaml v1.0.0 - github.com/go-resty/resty v1.9.0 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/protobuf v1.2.0 github.com/kr/pretty v0.1.0 // indirect @@ -12,7 +11,6 @@ require ( google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 google.golang.org/grpc v1.19.0 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + gopkg.in/resty.v1 v1.12.0 gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 // indirect ) - -replace github.com/go-resty/resty => gopkg.in/resty.v1 v1.9.0 diff --git a/go.sum b/go.sum index 78191e96227..186bc4101fc 100644 --- a/go.sum +++ b/go.sum @@ -16,7 +16,6 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3 h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -36,7 +35,8 @@ google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/resty.v1 v1.9.0/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= +gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 h1:+t9dhfO+GNOIGJof6kPOAenx7YgrZMTdRPV+EsnPabk= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 4c0a13d1082dbeba260775d025a0d3fdf1344bf0 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Sat, 2 Mar 2019 00:04:28 +0000 Subject: [PATCH 381/552] Generate changelog for v1.8.1 (#887) --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70911432dd2..0e7aa10b741 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## [v1.8.1-pre1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.1-pre1) (2019-03-01) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.0...v1.8.1-pre1) + +**Merged pull requests:** + +- CI: fix release builds [\#884](https://github.com/grpc-ecosystem/grpc-gateway/pull/884) ([johanbrandhorst](https://github.com/johanbrandhorst)) + ## [v1.8.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.0) (2019-03-01) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.7.0...v1.8.0) @@ -27,6 +34,7 @@ **Merged pull requests:** +- Generate changelog for 1.8.0 [\#883](https://github.com/grpc-ecosystem/grpc-gateway/pull/883) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Read only support [\#882](https://github.com/grpc-ecosystem/grpc-gateway/pull/882) ([hypnoce](https://github.com/hypnoce)) - Add fqn\_for\_swagger\_name option [\#881](https://github.com/grpc-ecosystem/grpc-gateway/pull/881) ([hypnoce](https://github.com/hypnoce)) - go.mod: update grpc from v1.16.0 to v1.17.0 [\#880](https://github.com/grpc-ecosystem/grpc-gateway/pull/880) ([klim0v](https://github.com/klim0v)) From 6d4a3401022a156ccd52d6279d05ff8dd0efcd1c Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Sat, 2 Mar 2019 18:42:12 +0000 Subject: [PATCH 382/552] README: Add some nicer looking badges (#890) I felt inspired by another repo I found. These badges look great! --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d87501ec8f5..4dc4733234b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # grpc-gateway -[![CircleCI](https://circleci.com/gh/grpc-ecosystem/grpc-gateway.svg?style=svg)](https://circleci.com/gh/grpc-ecosystem/grpc-gateway) +[![release](https://img.shields.io/github/release/grpc-ecosystem/grpc-gateway.svg?style=flat-square)](https://github.com/grpc-ecosystem/grpc-gateway/releases) [![CircleCI](https://img.shields.io/circleci/project/github/grpc-ecosystem/grpc-gateway/master.svg?style=flat-square)](https://circleci.com/gh/grpc-ecosystem/grpc-gateway) [![coverage](https://img.shields.io/codecov/c/github/grpc-ecosystem/grpc-gateway/master.svg?style=flat-square)](https://codecov.io/gh/grpc-ecosystem/grpc-gateway) [![license](https://img.shields.io/github/license/grpc-ecosystem/grpc-gateway.svg?style=flat-square)](LICENSE.txt) The grpc-gateway is a plugin of the Google protocol buffers compiler [protoc](https://github.com/protocolbuffers/protobuf). From c317ef5ea973a8b942c0e035713622340d9cf449 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Sat, 2 Mar 2019 20:17:21 +0000 Subject: [PATCH 383/552] Upgrade generator and runtime versions (#889) * Upgrade generator and runtime versions Go 1.12 Node 10.15.2 Protoc 3.7.0 Swagger Codegen 2.4.2 * Fix vet error discovered by Go 1.12 * Regenerate protofiles with protoc 3.7.0 * Update expected error in when specifying incorrect flags Apparently this message changed with Go 1.12 * Use explicit versioning of build environment in docker commands --- .circleci/Dockerfile | 6 +-- .circleci/README.md | 2 +- .circleci/config.yml | 12 ++--- CONTRIBUTING.md | 2 +- WORKSPACE | 8 ++-- examples/clients/abe/protobuf_field_mask.go | 2 +- examples/proto/examplepb/BUILD.bazel | 2 +- .../proto/examplepb/a_bit_of_everything.pb.go | 20 ++++----- .../a_bit_of_everything.swagger.json | 2 +- examples/proto/examplepb/echo_service.pb.go | 8 ++-- .../proto/examplepb/flow_combination.pb.go | 14 +++--- .../examplepb/response_body_service.pb.go | 18 ++++---- examples/proto/examplepb/stream.pb.go | 4 +- examples/proto/examplepb/stream.swagger.json | 4 +- .../examplepb/unannotated_echo_service.pb.go | 6 +-- examples/proto/examplepb/wrappers.pb.go | 6 +-- examples/proto/pathenum/path_enum.pb.go | 10 ++--- examples/proto/sub/message.pb.go | 6 +-- examples/proto/sub2/message.pb.go | 6 +-- internal/stream_chunk.pb.go | 6 +-- .../descriptor/services_test.go | 4 +- protoc-gen-swagger/main_test.go | 6 +-- protoc-gen-swagger/options/annotations.pb.go | 4 +- protoc-gen-swagger/options/openapiv2.pb.go | 44 +++++++++---------- 24 files changed, 101 insertions(+), 101 deletions(-) diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile index 10ee4847f30..1343053c0e6 100644 --- a/.circleci/Dockerfile +++ b/.circleci/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.11 +FROM golang:1.12 ## Warm apt cache RUN apt-get update @@ -12,7 +12,7 @@ RUN apt-get install -y openjdk-8-jre wget && \ ENV SWAGGER_CODEGEN="java -jar /usr/local/bin/swagger-codegen-cli.jar" # Install protoc -ENV PROTOC_VERSION=3.1.0 +ENV PROTOC_VERSION=3.7.0 RUN apt-get install -y wget unzip && \ wget https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \ -O /protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ @@ -21,7 +21,7 @@ RUN apt-get install -y wget unzip && \ apt-get remove -y unzip wget # Install node -ENV NODE_VERSION=v6.1 +ENV NODE_VERSION=v10.15.2 RUN apt-get install -y wget bzip2 && \ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash && \ apt-get remove -y wget diff --git a/.circleci/README.md b/.circleci/README.md index 6fe89053bbe..4aa13589bed 100644 --- a/.circleci/README.md +++ b/.circleci/README.md @@ -7,7 +7,7 @@ Contained within is the CI test setup for the Gateway. It runs on Circle CI. Great, it should be as simple as thus (run from the root of the directory): ```bash -$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env \ +$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.12 \ /bin/bash -c 'cd /go/src/github.com/grpc-ecosystem/grpc-gateway && \ make realclean && \ make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' diff --git a/.circleci/config.yml b/.circleci/config.yml index 3a172fabb9c..964063f8f1e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,14 +2,14 @@ version: 2 jobs: build: docker: - - image: jfbrandhorst/grpc-gateway-build-env + - image: jfbrandhorst/grpc-gateway-build-env:1.12 working_directory: /src/grpc-gateway steps: - checkout - run: go build ./... test: docker: - - image: jfbrandhorst/grpc-gateway-build-env + - image: jfbrandhorst/grpc-gateway-build-env:1.12 working_directory: /src/grpc-gateway environment: GLOG_logtostderr: '1' @@ -19,7 +19,7 @@ jobs: - run: bash <(curl -s https://codecov.io/bash) node_test: docker: - - image: jfbrandhorst/grpc-gateway-build-env + - image: jfbrandhorst/grpc-gateway-build-env:1.12 working_directory: /src/grpc-gateway steps: - checkout @@ -32,7 +32,7 @@ jobs: ./node_modules/.bin/gulp generate: docker: - - image: jfbrandhorst/grpc-gateway-build-env + - image: jfbrandhorst/grpc-gateway-build-env:1.12 working_directory: /src/grpc-gateway steps: - checkout @@ -42,7 +42,7 @@ jobs: - run: git diff --exit-code lint: docker: - - image: jfbrandhorst/grpc-gateway-build-env + - image: jfbrandhorst/grpc-gateway-build-env:1.12 working_directory: /src/grpc-gateway steps: - checkout @@ -76,7 +76,7 @@ jobs: when: always release: docker: - - image: jfbrandhorst/grpc-gateway-build-env + - image: jfbrandhorst/grpc-gateway-build-env:1.12 working_directory: /src/grpc-gateway steps: - checkout diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0c4e8287ca8..c2ac49c2bb1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ All submissions, including submissions by project members, require review. Great, it should be as simple as thus (run from the root of the directory): ```bash -docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env \ +docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.12 \ /bin/bash -c 'cd /src/grpc-gateway && \ make realclean && \ make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' diff --git a/WORKSPACE b/WORKSPACE index 66c7f2061ef..7c2f93819b5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -5,14 +5,14 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - sha256 = "492c3ac68ed9dcf527a07e6a1b2dcbf199c6bf8b35517951467ac32e421c06c1", - urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.0/rules_go-0.17.0.tar.gz"], + sha256 = "6776d68ebb897625dead17ae510eac3d5f6342367327875210df44dbe2aeeb19", + urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.1/rules_go-0.17.1.tar.gz"], ) http_archive( name = "bazel_gazelle", - sha256 = "7949fc6cc17b5b191103e97481cf8889217263acf52e00b560683413af204fcb", - urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"], + sha256 = "3c681998538231a2d24d0c07ed5a7658cb72bfb5fd4bf9911157c0e9ac6a2687", + urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.17.0/bazel-gazelle-0.17.0.tar.gz"], ) load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") diff --git a/examples/clients/abe/protobuf_field_mask.go b/examples/clients/abe/protobuf_field_mask.go index f30f2531765..2e21bc72874 100644 --- a/examples/clients/abe/protobuf_field_mask.go +++ b/examples/clients/abe/protobuf_field_mask.go @@ -10,7 +10,7 @@ package abe -// paths: \"f.a\" paths: \"f.b.d\" Here `f` represents a field in some root message, `a` and `b` fields in the message found in `f`, and `d` a field found in the message in `f.b`. Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below). # Field Masks in Projections When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows: f { a : 22 b { d : 1 x : 2 } y : 13 } z: 8 The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output): f { a : 22 b { d : 1 } } A repeated field is not allowed except at the last position of a paths string. If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified). Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs. # Field Masks in Update Operations A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask. If a repeated field is specified for an update operation, the existing repeated values in the target resource will be overwritten by the new values. Note that a repeated field is only allowed in the last position of a `paths` string. If a sub-message is specified in the last position of the field mask for an update operation, then the existing sub-message in the target resource is overwritten. Given the target message: f { b { d : 1 x : 2 } c : 1 } And an update message: f { b { d : 10 } } then if the field mask is: paths: \"f.b\" then the result will be: f { b { d : 10 } c : 1 } However, if the update mask was: paths: \"f.b.d\" then the result would be: f { b { d : 10 x : 2 } c : 1 } In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below. If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not. As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API. ## Considerations for HTTP REST The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates). # JSON Encoding of Field Masks In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions. As an example, consider the following message declarations: message Profile { User user = 1; Photo photo = 2; } message User { string display_name = 1; string address = 2; } In proto a field mask for `Profile` may look as such: mask { paths: \"user.display_name\" paths: \"photo\" } In JSON, the same mask is represented as below: { mask: \"user.displayName,photo\" } # Field Masks and Oneof Fields Field masks treat fields in oneofs just as regular fields. Consider the following message: message SampleMessage { oneof test_oneof { string name = 4; SubMessage sub_message = 9; } } The field mask can be: mask { paths: \"name\" } Or: mask { paths: \"sub_message\" } Note that oneof type names (\"test_oneof\" in this case) cannot be used in paths. +// paths: \"f.a\" paths: \"f.b.d\" Here `f` represents a field in some root message, `a` and `b` fields in the message found in `f`, and `d` a field found in the message in `f.b`. Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below). # Field Masks in Projections When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows: f { a : 22 b { d : 1 x : 2 } y : 13 } z: 8 The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output): f { a : 22 b { d : 1 } } A repeated field is not allowed except at the last position of a paths string. If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified). Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs. # Field Masks in Update Operations A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask. If a repeated field is specified for an update operation, new values will be appended to the existing repeated field in the target resource. Note that a repeated field is only allowed in the last position of a `paths` string. If a sub-message is specified in the last position of the field mask for an update operation, then new value will be merged into the existing sub-message in the target resource. For example, given the target message: f { b { d: 1 x: 2 } c: [1] } And an update message: f { b { d: 10 } c: [2] } then if the field mask is: paths: [\"f.b\", \"f.c\"] then the result will be: f { b { d: 10 x: 2 } c: [1, 2] } An implementation may provide options to override this default behavior for repeated and message fields. In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below. If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not. As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API. ## Considerations for HTTP REST The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates). # JSON Encoding of Field Masks In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions. As an example, consider the following message declarations: message Profile { User user = 1; Photo photo = 2; } message User { string display_name = 1; string address = 2; } In proto a field mask for `Profile` may look as such: mask { paths: \"user.display_name\" paths: \"photo\" } In JSON, the same mask is represented as below: { mask: \"user.displayName,photo\" } # Field Masks and Oneof Fields Field masks treat fields in oneofs just as regular fields. Consider the following message: message SampleMessage { oneof test_oneof { string name = 4; SubMessage sub_message = 9; } } The field mask can be: mask { paths: \"name\" } Or: mask { paths: \"sub_message\" } Note that oneof type names (\"test_oneof\" in this case) cannot be used in paths. ## Field Mask Verification The implementation of any API method which has a FieldMask type field in the request should verify the included field paths, and return an `INVALID_ARGUMENT` error if any path is duplicated or unmappable. type ProtobufFieldMask struct { // The set of field mask paths. diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index abff1fb6d90..f5aa149eb8e 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -40,7 +40,7 @@ go_proto_library( name = "examplepb_go_proto", compilers = [ "@io_bazel_rules_go//proto:go_grpc", - "//protoc-gen-grpc-gateway:go_gen_grpc_gateway", + "//protoc-gen-grpc-gateway:go_gen_grpc_gateway", # keep ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb", proto = ":examplepb_proto", diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 4aee105fdf8..78a9e6610a0 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{0} + return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -139,7 +139,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{0} + return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -512,7 +512,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{0, 0} + return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -581,7 +581,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{1} + return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -724,7 +724,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{2} + return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -763,7 +763,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{3} + return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -810,7 +810,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3, []int{4} + return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1574,10 +1574,10 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3) + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_355f53a87bca58c1) } -var fileDescriptor_a_bit_of_everything_13e92efa8be5f8b3 = []byte{ +var fileDescriptor_a_bit_of_everything_355f53a87bca58c1 = []byte{ // 3233 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0x5b, 0x6f, 0x1b, 0xc7, 0xb9, 0x5a, 0xae, 0xae, 0xa3, 0x1b, 0x35, 0xb2, 0x65, 0x8a, 0x56, 0xa2, 0x31, 0xed, 0x24, 0x6b, diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index b8639ec204f..f786e898f00 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -1869,7 +1869,7 @@ "description": "The set of field mask paths." } }, - "description": "paths: \"f.a\"\n paths: \"f.b.d\"\n\nHere `f` represents a field in some root message, `a` and `b`\nfields in the message found in `f`, and `d` a field found in the\nmessage in `f.b`.\n\nField masks are used to specify a subset of fields that should be\nreturned by a get operation or modified by an update operation.\nField masks also have a custom JSON encoding (see below).\n\n# Field Masks in Projections\n\nWhen used in the context of a projection, a response message or\nsub-message is filtered by the API to only contain those fields as\nspecified in the mask. For example, if the mask in the previous\nexample is applied to a response message as follows:\n\n f {\n a : 22\n b {\n d : 1\n x : 2\n }\n y : 13\n }\n z: 8\n\nThe result will not contain specific values for fields x,y and z\n(their value will be set to the default, and omitted in proto text\noutput):\n\n\n f {\n a : 22\n b {\n d : 1\n }\n }\n\nA repeated field is not allowed except at the last position of a\npaths string.\n\nIf a FieldMask object is not present in a get operation, the\noperation applies to all fields (as if a FieldMask of all fields\nhad been specified).\n\nNote that a field mask does not necessarily apply to the\ntop-level response message. In case of a REST get operation, the\nfield mask applies directly to the response, but in case of a REST\nlist operation, the mask instead applies to each individual message\nin the returned resource list. In case of a REST custom method,\nother definitions may be used. Where the mask applies will be\nclearly documented together with its declaration in the API. In\nany case, the effect on the returned resource/resources is required\nbehavior for APIs.\n\n# Field Masks in Update Operations\n\nA field mask in update operations specifies which fields of the\ntargeted resource are going to be updated. The API is required\nto only change the values of the fields as specified in the mask\nand leave the others untouched. If a resource is passed in to\ndescribe the updated values, the API ignores the values of all\nfields not covered by the mask.\n\nIf a repeated field is specified for an update operation, the existing\nrepeated values in the target resource will be overwritten by the new values.\nNote that a repeated field is only allowed in the last position of a `paths`\nstring.\n\nIf a sub-message is specified in the last position of the field mask for an\nupdate operation, then the existing sub-message in the target resource is\noverwritten. Given the target message:\n\n f {\n b {\n d : 1\n x : 2\n }\n c : 1\n }\n\nAnd an update message:\n\n f {\n b {\n d : 10\n }\n }\n\nthen if the field mask is:\n\n paths: \"f.b\"\n\nthen the result will be:\n\n f {\n b {\n d : 10\n }\n c : 1\n }\n\nHowever, if the update mask was:\n\n paths: \"f.b.d\"\n\nthen the result would be:\n\n f {\n b {\n d : 10\n x : 2\n }\n c : 1\n }\n\nIn order to reset a field's value to the default, the field must\nbe in the mask and set to the default value in the provided resource.\nHence, in order to reset all fields of a resource, provide a default\ninstance of the resource and set all fields in the mask, or do\nnot provide a mask as described below.\n\nIf a field mask is not present on update, the operation applies to\nall fields (as if a field mask of all fields has been specified).\nNote that in the presence of schema evolution, this may mean that\nfields the client does not know and has therefore not filled into\nthe request will be reset to their default. If this is unwanted\nbehavior, a specific service may require a client to always specify\na field mask, producing an error if not.\n\nAs with get operations, the location of the resource which\ndescribes the updated values in the request message depends on the\noperation kind. In any case, the effect of the field mask is\nrequired to be honored by the API.\n\n## Considerations for HTTP REST\n\nThe HTTP kind of an update operation which uses a field mask must\nbe set to PATCH instead of PUT in order to satisfy HTTP semantics\n(PUT must only be used for full updates).\n\n# JSON Encoding of Field Masks\n\nIn JSON, a field mask is encoded as a single string where paths are\nseparated by a comma. Fields name in each path are converted\nto/from lower-camel naming conventions.\n\nAs an example, consider the following message declarations:\n\n message Profile {\n User user = 1;\n Photo photo = 2;\n }\n message User {\n string display_name = 1;\n string address = 2;\n }\n\nIn proto a field mask for `Profile` may look as such:\n\n mask {\n paths: \"user.display_name\"\n paths: \"photo\"\n }\n\nIn JSON, the same mask is represented as below:\n\n {\n mask: \"user.displayName,photo\"\n }\n\n# Field Masks and Oneof Fields\n\nField masks treat fields in oneofs just as regular fields. Consider the\nfollowing message:\n\n message SampleMessage {\n oneof test_oneof {\n string name = 4;\n SubMessage sub_message = 9;\n }\n }\n\nThe field mask can be:\n\n mask {\n paths: \"name\"\n }\n\nOr:\n\n mask {\n paths: \"sub_message\"\n }\n\nNote that oneof type names (\"test_oneof\" in this case) cannot be used in\npaths.", + "description": "paths: \"f.a\"\n paths: \"f.b.d\"\n\nHere `f` represents a field in some root message, `a` and `b`\nfields in the message found in `f`, and `d` a field found in the\nmessage in `f.b`.\n\nField masks are used to specify a subset of fields that should be\nreturned by a get operation or modified by an update operation.\nField masks also have a custom JSON encoding (see below).\n\n# Field Masks in Projections\n\nWhen used in the context of a projection, a response message or\nsub-message is filtered by the API to only contain those fields as\nspecified in the mask. For example, if the mask in the previous\nexample is applied to a response message as follows:\n\n f {\n a : 22\n b {\n d : 1\n x : 2\n }\n y : 13\n }\n z: 8\n\nThe result will not contain specific values for fields x,y and z\n(their value will be set to the default, and omitted in proto text\noutput):\n\n\n f {\n a : 22\n b {\n d : 1\n }\n }\n\nA repeated field is not allowed except at the last position of a\npaths string.\n\nIf a FieldMask object is not present in a get operation, the\noperation applies to all fields (as if a FieldMask of all fields\nhad been specified).\n\nNote that a field mask does not necessarily apply to the\ntop-level response message. In case of a REST get operation, the\nfield mask applies directly to the response, but in case of a REST\nlist operation, the mask instead applies to each individual message\nin the returned resource list. In case of a REST custom method,\nother definitions may be used. Where the mask applies will be\nclearly documented together with its declaration in the API. In\nany case, the effect on the returned resource/resources is required\nbehavior for APIs.\n\n# Field Masks in Update Operations\n\nA field mask in update operations specifies which fields of the\ntargeted resource are going to be updated. The API is required\nto only change the values of the fields as specified in the mask\nand leave the others untouched. If a resource is passed in to\ndescribe the updated values, the API ignores the values of all\nfields not covered by the mask.\n\nIf a repeated field is specified for an update operation, new values will\nbe appended to the existing repeated field in the target resource. Note that\na repeated field is only allowed in the last position of a `paths` string.\n\nIf a sub-message is specified in the last position of the field mask for an\nupdate operation, then new value will be merged into the existing sub-message\nin the target resource.\n\nFor example, given the target message:\n\n f {\n b {\n d: 1\n x: 2\n }\n c: [1]\n }\n\nAnd an update message:\n\n f {\n b {\n d: 10\n }\n c: [2]\n }\n\nthen if the field mask is:\n\n paths: [\"f.b\", \"f.c\"]\n\nthen the result will be:\n\n f {\n b {\n d: 10\n x: 2\n }\n c: [1, 2]\n }\n\nAn implementation may provide options to override this default behavior for\nrepeated and message fields.\n\nIn order to reset a field's value to the default, the field must\nbe in the mask and set to the default value in the provided resource.\nHence, in order to reset all fields of a resource, provide a default\ninstance of the resource and set all fields in the mask, or do\nnot provide a mask as described below.\n\nIf a field mask is not present on update, the operation applies to\nall fields (as if a field mask of all fields has been specified).\nNote that in the presence of schema evolution, this may mean that\nfields the client does not know and has therefore not filled into\nthe request will be reset to their default. If this is unwanted\nbehavior, a specific service may require a client to always specify\na field mask, producing an error if not.\n\nAs with get operations, the location of the resource which\ndescribes the updated values in the request message depends on the\noperation kind. In any case, the effect of the field mask is\nrequired to be honored by the API.\n\n## Considerations for HTTP REST\n\nThe HTTP kind of an update operation which uses a field mask must\nbe set to PATCH instead of PUT in order to satisfy HTTP semantics\n(PUT must only be used for full updates).\n\n# JSON Encoding of Field Masks\n\nIn JSON, a field mask is encoded as a single string where paths are\nseparated by a comma. Fields name in each path are converted\nto/from lower-camel naming conventions.\n\nAs an example, consider the following message declarations:\n\n message Profile {\n User user = 1;\n Photo photo = 2;\n }\n message User {\n string display_name = 1;\n string address = 2;\n }\n\nIn proto a field mask for `Profile` may look as such:\n\n mask {\n paths: \"user.display_name\"\n paths: \"photo\"\n }\n\nIn JSON, the same mask is represented as below:\n\n {\n mask: \"user.displayName,photo\"\n }\n\n# Field Masks and Oneof Fields\n\nField masks treat fields in oneofs just as regular fields. Consider the\nfollowing message:\n\n message SampleMessage {\n oneof test_oneof {\n string name = 4;\n SubMessage sub_message = 9;\n }\n }\n\nThe field mask can be:\n\n mask {\n paths: \"name\"\n }\n\nOr:\n\n mask {\n paths: \"sub_message\"\n }\n\nNote that oneof type names (\"test_oneof\" in this case) cannot be used in\npaths.\n\n## Field Mask Verification\n\nThe implementation of any API method which has a FieldMask type field in the\nrequest should verify the included field paths, and return an\n`INVALID_ARGUMENT` error if any path is duplicated or unmappable.", "title": "`FieldMask` represents a set of symbolic field paths, for example:" }, "subStringMessage": { diff --git a/examples/proto/examplepb/echo_service.pb.go b/examples/proto/examplepb/echo_service.pb.go index da8af13fbf9..5c1500fb2e5 100644 --- a/examples/proto/examplepb/echo_service.pb.go +++ b/examples/proto/examplepb/echo_service.pb.go @@ -46,7 +46,7 @@ func (m *Embedded) Reset() { *m = Embedded{} } func (m *Embedded) String() string { return proto.CompactTextString(m) } func (*Embedded) ProtoMessage() {} func (*Embedded) Descriptor() ([]byte, []int) { - return fileDescriptor_echo_service_c13a64d5f1f0c068, []int{0} + return fileDescriptor_echo_service_8fe0ac1ad649faf8, []int{0} } func (m *Embedded) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Embedded.Unmarshal(m, b) @@ -191,7 +191,7 @@ func (m *SimpleMessage) Reset() { *m = SimpleMessage{} } func (m *SimpleMessage) String() string { return proto.CompactTextString(m) } func (*SimpleMessage) ProtoMessage() {} func (*SimpleMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_echo_service_c13a64d5f1f0c068, []int{1} + return fileDescriptor_echo_service_8fe0ac1ad649faf8, []int{1} } func (m *SimpleMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleMessage.Unmarshal(m, b) @@ -572,10 +572,10 @@ var _EchoService_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/echo_service.proto", fileDescriptor_echo_service_c13a64d5f1f0c068) + proto.RegisterFile("examples/proto/examplepb/echo_service.proto", fileDescriptor_echo_service_8fe0ac1ad649faf8) } -var fileDescriptor_echo_service_c13a64d5f1f0c068 = []byte{ +var fileDescriptor_echo_service_8fe0ac1ad649faf8 = []byte{ // 470 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x3f, 0x6f, 0xd3, 0x40, 0x14, 0xef, 0xd9, 0x6e, 0x9a, 0xbc, 0x08, 0x54, 0x9d, 0x40, 0x98, 0xb4, 0xa8, 0x91, 0xc5, 0x10, diff --git a/examples/proto/examplepb/flow_combination.pb.go b/examples/proto/examplepb/flow_combination.pb.go index 25e2b775e50..f50fe51ba5c 100644 --- a/examples/proto/examplepb/flow_combination.pb.go +++ b/examples/proto/examplepb/flow_combination.pb.go @@ -34,7 +34,7 @@ func (m *EmptyProto) Reset() { *m = EmptyProto{} } func (m *EmptyProto) String() string { return proto.CompactTextString(m) } func (*EmptyProto) ProtoMessage() {} func (*EmptyProto) Descriptor() ([]byte, []int) { - return fileDescriptor_flow_combination_40371c0acedc1fc5, []int{0} + return fileDescriptor_flow_combination_63ace3110e4bd00b, []int{0} } func (m *EmptyProto) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyProto.Unmarshal(m, b) @@ -67,7 +67,7 @@ func (m *NonEmptyProto) Reset() { *m = NonEmptyProto{} } func (m *NonEmptyProto) String() string { return proto.CompactTextString(m) } func (*NonEmptyProto) ProtoMessage() {} func (*NonEmptyProto) Descriptor() ([]byte, []int) { - return fileDescriptor_flow_combination_40371c0acedc1fc5, []int{1} + return fileDescriptor_flow_combination_63ace3110e4bd00b, []int{1} } func (m *NonEmptyProto) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonEmptyProto.Unmarshal(m, b) @@ -119,7 +119,7 @@ func (m *UnaryProto) Reset() { *m = UnaryProto{} } func (m *UnaryProto) String() string { return proto.CompactTextString(m) } func (*UnaryProto) ProtoMessage() {} func (*UnaryProto) Descriptor() ([]byte, []int) { - return fileDescriptor_flow_combination_40371c0acedc1fc5, []int{2} + return fileDescriptor_flow_combination_63ace3110e4bd00b, []int{2} } func (m *UnaryProto) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UnaryProto.Unmarshal(m, b) @@ -159,7 +159,7 @@ func (m *NestedProto) Reset() { *m = NestedProto{} } func (m *NestedProto) String() string { return proto.CompactTextString(m) } func (*NestedProto) ProtoMessage() {} func (*NestedProto) Descriptor() ([]byte, []int) { - return fileDescriptor_flow_combination_40371c0acedc1fc5, []int{3} + return fileDescriptor_flow_combination_63ace3110e4bd00b, []int{3} } func (m *NestedProto) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NestedProto.Unmarshal(m, b) @@ -211,7 +211,7 @@ func (m *SingleNestedProto) Reset() { *m = SingleNestedProto{} } func (m *SingleNestedProto) String() string { return proto.CompactTextString(m) } func (*SingleNestedProto) ProtoMessage() {} func (*SingleNestedProto) Descriptor() ([]byte, []int) { - return fileDescriptor_flow_combination_40371c0acedc1fc5, []int{4} + return fileDescriptor_flow_combination_63ace3110e4bd00b, []int{4} } func (m *SingleNestedProto) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SingleNestedProto.Unmarshal(m, b) @@ -791,10 +791,10 @@ var _FlowCombination_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/flow_combination.proto", fileDescriptor_flow_combination_40371c0acedc1fc5) + proto.RegisterFile("examples/proto/examplepb/flow_combination.proto", fileDescriptor_flow_combination_63ace3110e4bd00b) } -var fileDescriptor_flow_combination_40371c0acedc1fc5 = []byte{ +var fileDescriptor_flow_combination_63ace3110e4bd00b = []byte{ // 655 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0xbf, 0x8f, 0x12, 0x41, 0x14, 0xc7, 0xf3, 0xb8, 0xc4, 0xe4, 0x86, 0xfb, 0xc1, 0x2d, 0x06, 0x81, 0xc3, 0xe3, 0x6e, 0xbc, diff --git a/examples/proto/examplepb/response_body_service.pb.go b/examples/proto/examplepb/response_body_service.pb.go index ba11d58bb78..ed7ead481db 100644 --- a/examples/proto/examplepb/response_body_service.pb.go +++ b/examples/proto/examplepb/response_body_service.pb.go @@ -50,7 +50,7 @@ func (x RepeatedResponseBodyOut_Response_ResponseType) String() string { return proto.EnumName(RepeatedResponseBodyOut_Response_ResponseType_name, int32(x)) } func (RepeatedResponseBodyOut_Response_ResponseType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{2, 0, 0} + return fileDescriptor_response_body_service_d3778d99bb1173be, []int{2, 0, 0} } type ResponseBodyIn struct { @@ -64,7 +64,7 @@ func (m *ResponseBodyIn) Reset() { *m = ResponseBodyIn{} } func (m *ResponseBodyIn) String() string { return proto.CompactTextString(m) } func (*ResponseBodyIn) ProtoMessage() {} func (*ResponseBodyIn) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{0} + return fileDescriptor_response_body_service_d3778d99bb1173be, []int{0} } func (m *ResponseBodyIn) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyIn.Unmarshal(m, b) @@ -102,7 +102,7 @@ func (m *ResponseBodyOut) Reset() { *m = ResponseBodyOut{} } func (m *ResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut) ProtoMessage() {} func (*ResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{1} + return fileDescriptor_response_body_service_d3778d99bb1173be, []int{1} } func (m *ResponseBodyOut) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyOut.Unmarshal(m, b) @@ -140,7 +140,7 @@ func (m *ResponseBodyOut_Response) Reset() { *m = ResponseBodyOut_Respon func (m *ResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut_Response) ProtoMessage() {} func (*ResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{1, 0} + return fileDescriptor_response_body_service_d3778d99bb1173be, []int{1, 0} } func (m *ResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyOut_Response.Unmarshal(m, b) @@ -178,7 +178,7 @@ func (m *RepeatedResponseBodyOut) Reset() { *m = RepeatedResponseBodyOut func (m *RepeatedResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseBodyOut) ProtoMessage() {} func (*RepeatedResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{2} + return fileDescriptor_response_body_service_d3778d99bb1173be, []int{2} } func (m *RepeatedResponseBodyOut) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseBodyOut.Unmarshal(m, b) @@ -217,7 +217,7 @@ func (m *RepeatedResponseBodyOut_Response) Reset() { *m = RepeatedRespon func (m *RepeatedResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseBodyOut_Response) ProtoMessage() {} func (*RepeatedResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{2, 0} + return fileDescriptor_response_body_service_d3778d99bb1173be, []int{2, 0} } func (m *RepeatedResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseBodyOut_Response.Unmarshal(m, b) @@ -262,7 +262,7 @@ func (m *RepeatedResponseStrings) Reset() { *m = RepeatedResponseStrings func (m *RepeatedResponseStrings) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseStrings) ProtoMessage() {} func (*RepeatedResponseStrings) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_811d1d707fc0d3aa, []int{3} + return fileDescriptor_response_body_service_d3778d99bb1173be, []int{3} } func (m *RepeatedResponseStrings) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseStrings.Unmarshal(m, b) @@ -438,10 +438,10 @@ var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_response_body_service_811d1d707fc0d3aa) + proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_response_body_service_d3778d99bb1173be) } -var fileDescriptor_response_body_service_811d1d707fc0d3aa = []byte{ +var fileDescriptor_response_body_service_d3778d99bb1173be = []byte{ // 441 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0xcf, 0xaa, 0xd3, 0x40, 0x14, 0xc6, 0x9d, 0xb4, 0x5e, 0x6f, 0x27, 0x72, 0x6f, 0x99, 0x2b, 0xf7, 0x86, 0x22, 0x1a, 0x07, diff --git a/examples/proto/examplepb/stream.pb.go b/examples/proto/examplepb/stream.pb.go index cc0c274c8ea..8c1cd2e920b 100644 --- a/examples/proto/examplepb/stream.pb.go +++ b/examples/proto/examplepb/stream.pb.go @@ -258,10 +258,10 @@ var _StreamService_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/stream.proto", fileDescriptor_stream_0929397c5d8d3331) + proto.RegisterFile("examples/proto/examplepb/stream.proto", fileDescriptor_stream_44f32a4fe5bf6004) } -var fileDescriptor_stream_0929397c5d8d3331 = []byte{ +var fileDescriptor_stream_44f32a4fe5bf6004 = []byte{ // 319 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xb1, 0x4e, 0xc3, 0x30, 0x10, 0x86, 0x15, 0x40, 0x08, 0x8c, 0x58, 0x3c, 0x30, 0x04, 0xa4, 0x42, 0x05, 0xa2, 0x30, 0xd8, diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index 4418cbb5ce3..259900180bb 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -330,7 +330,7 @@ "properties": { "type_url": { "type": "string", - "description": "A URL/resource name whose content describes the type of the\nserialized protocol buffer message.\n\nFor URLs which use the scheme `http`, `https`, or no scheme, the\nfollowing restrictions and interpretations apply:\n\n* If no scheme is provided, `https` is assumed.\n* The last segment of the URL's path must represent the fully\n qualified name of the type (as in `path/google.protobuf.Duration`).\n The name should be in a canonical form (e.g., leading \".\" is\n not accepted).\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." }, "value": { "type": "string", @@ -338,7 +338,7 @@ "description": "Must be a valid serialized protocol buffer of the above specified type." } }, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n ...\n foo := \u0026pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "runtimeStreamError": { "type": "object", diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.go b/examples/proto/examplepb/unannotated_echo_service.pb.go index 28f0d7311d0..73699e5c602 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.go @@ -49,7 +49,7 @@ func (m *UnannotatedSimpleMessage) Reset() { *m = UnannotatedSimpleMessa func (m *UnannotatedSimpleMessage) String() string { return proto.CompactTextString(m) } func (*UnannotatedSimpleMessage) ProtoMessage() {} func (*UnannotatedSimpleMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_unannotated_echo_service_33987b03bf51a339, []int{0} + return fileDescriptor_unannotated_echo_service_ca2b904682e29806, []int{0} } func (m *UnannotatedSimpleMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UnannotatedSimpleMessage.Unmarshal(m, b) @@ -245,10 +245,10 @@ var _UnannotatedEchoService_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/unannotated_echo_service.proto", fileDescriptor_unannotated_echo_service_33987b03bf51a339) + proto.RegisterFile("examples/proto/examplepb/unannotated_echo_service.proto", fileDescriptor_unannotated_echo_service_ca2b904682e29806) } -var fileDescriptor_unannotated_echo_service_33987b03bf51a339 = []byte{ +var fileDescriptor_unannotated_echo_service_ca2b904682e29806 = []byte{ // 268 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4f, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x72, 0x0b, 0x92, 0xf4, diff --git a/examples/proto/examplepb/wrappers.pb.go b/examples/proto/examplepb/wrappers.pb.go index 0b0616ee60c..48462f92b92 100644 --- a/examples/proto/examplepb/wrappers.pb.go +++ b/examples/proto/examplepb/wrappers.pb.go @@ -45,7 +45,7 @@ func (m *Wrappers) Reset() { *m = Wrappers{} } func (m *Wrappers) String() string { return proto.CompactTextString(m) } func (*Wrappers) ProtoMessage() {} func (*Wrappers) Descriptor() ([]byte, []int) { - return fileDescriptor_wrappers_3d2e9c7780d635b4, []int{0} + return fileDescriptor_wrappers_1614a2b17737abd3, []int{0} } func (m *Wrappers) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Wrappers.Unmarshal(m, b) @@ -535,10 +535,10 @@ var _WrappersService_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/wrappers.proto", fileDescriptor_wrappers_3d2e9c7780d635b4) + proto.RegisterFile("examples/proto/examplepb/wrappers.proto", fileDescriptor_wrappers_1614a2b17737abd3) } -var fileDescriptor_wrappers_3d2e9c7780d635b4 = []byte{ +var fileDescriptor_wrappers_1614a2b17737abd3 = []byte{ // 578 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0xdd, 0x6e, 0xd3, 0x30, 0x14, 0xc7, 0xd5, 0x31, 0xca, 0xea, 0x0c, 0xc6, 0x0c, 0x82, 0xcd, 0x9b, 0x18, 0xca, 0x0d, 0xb0, diff --git a/examples/proto/pathenum/path_enum.pb.go b/examples/proto/pathenum/path_enum.pb.go index 6de95037484..a3daa1953d4 100644 --- a/examples/proto/pathenum/path_enum.pb.go +++ b/examples/proto/pathenum/path_enum.pb.go @@ -38,7 +38,7 @@ func (x PathEnum) String() string { return proto.EnumName(PathEnum_name, int32(x)) } func (PathEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_path_enum_f14abf5268452f40, []int{0} + return fileDescriptor_path_enum_802d5f52757a97bd, []int{0} } type MessagePathEnum_NestedPathEnum int32 @@ -61,7 +61,7 @@ func (x MessagePathEnum_NestedPathEnum) String() string { return proto.EnumName(MessagePathEnum_NestedPathEnum_name, int32(x)) } func (MessagePathEnum_NestedPathEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_path_enum_f14abf5268452f40, []int{0, 0} + return fileDescriptor_path_enum_802d5f52757a97bd, []int{0, 0} } type MessagePathEnum struct { @@ -74,7 +74,7 @@ func (m *MessagePathEnum) Reset() { *m = MessagePathEnum{} } func (m *MessagePathEnum) String() string { return proto.CompactTextString(m) } func (*MessagePathEnum) ProtoMessage() {} func (*MessagePathEnum) Descriptor() ([]byte, []int) { - return fileDescriptor_path_enum_f14abf5268452f40, []int{0} + return fileDescriptor_path_enum_802d5f52757a97bd, []int{0} } func (m *MessagePathEnum) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessagePathEnum.Unmarshal(m, b) @@ -101,10 +101,10 @@ func init() { } func init() { - proto.RegisterFile("examples/proto/pathenum/path_enum.proto", fileDescriptor_path_enum_f14abf5268452f40) + proto.RegisterFile("examples/proto/pathenum/path_enum.proto", fileDescriptor_path_enum_802d5f52757a97bd) } -var fileDescriptor_path_enum_f14abf5268452f40 = []byte{ +var fileDescriptor_path_enum_802d5f52757a97bd = []byte{ // 175 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4f, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x48, 0x2c, 0xc9, 0x48, diff --git a/examples/proto/sub/message.pb.go b/examples/proto/sub/message.pb.go index 81612434029..cc5381674f7 100644 --- a/examples/proto/sub/message.pb.go +++ b/examples/proto/sub/message.pb.go @@ -29,7 +29,7 @@ func (m *StringMessage) Reset() { *m = StringMessage{} } func (m *StringMessage) String() string { return proto.CompactTextString(m) } func (*StringMessage) ProtoMessage() {} func (*StringMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_message_c180d3d1a4bbfe02, []int{0} + return fileDescriptor_message_6a35c3d524a65df7, []int{0} } func (m *StringMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StringMessage.Unmarshal(m, b) @@ -61,10 +61,10 @@ func init() { } func init() { - proto.RegisterFile("examples/proto/sub/message.proto", fileDescriptor_message_c180d3d1a4bbfe02) + proto.RegisterFile("examples/proto/sub/message.proto", fileDescriptor_message_6a35c3d524a65df7) } -var fileDescriptor_message_c180d3d1a4bbfe02 = []byte{ +var fileDescriptor_message_6a35c3d524a65df7 = []byte{ // 114 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x2e, 0x4d, 0xd2, 0xcf, diff --git a/examples/proto/sub2/message.pb.go b/examples/proto/sub2/message.pb.go index 6819b67ae3c..586c6440b98 100644 --- a/examples/proto/sub2/message.pb.go +++ b/examples/proto/sub2/message.pb.go @@ -29,7 +29,7 @@ func (m *IdMessage) Reset() { *m = IdMessage{} } func (m *IdMessage) String() string { return proto.CompactTextString(m) } func (*IdMessage) ProtoMessage() {} func (*IdMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_message_1fa155de06adc960, []int{0} + return fileDescriptor_message_9619dbc3ad374621, []int{0} } func (m *IdMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IdMessage.Unmarshal(m, b) @@ -61,10 +61,10 @@ func init() { } func init() { - proto.RegisterFile("examples/proto/sub2/message.proto", fileDescriptor_message_1fa155de06adc960) + proto.RegisterFile("examples/proto/sub2/message.proto", fileDescriptor_message_9619dbc3ad374621) } -var fileDescriptor_message_1fa155de06adc960 = []byte{ +var fileDescriptor_message_9619dbc3ad374621 = []byte{ // 130 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, diff --git a/internal/stream_chunk.pb.go b/internal/stream_chunk.pb.go index c6cfb5c1c02..8858f069046 100644 --- a/internal/stream_chunk.pb.go +++ b/internal/stream_chunk.pb.go @@ -36,7 +36,7 @@ func (m *StreamError) Reset() { *m = StreamError{} } func (m *StreamError) String() string { return proto.CompactTextString(m) } func (*StreamError) ProtoMessage() {} func (*StreamError) Descriptor() ([]byte, []int) { - return fileDescriptor_stream_chunk_cac6867f460b29a5, []int{0} + return fileDescriptor_stream_chunk_a2afb657504565d7, []int{0} } func (m *StreamError) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamError.Unmarshal(m, b) @@ -96,10 +96,10 @@ func init() { } func init() { - proto.RegisterFile("internal/stream_chunk.proto", fileDescriptor_stream_chunk_cac6867f460b29a5) + proto.RegisterFile("internal/stream_chunk.proto", fileDescriptor_stream_chunk_a2afb657504565d7) } -var fileDescriptor_stream_chunk_cac6867f460b29a5 = []byte{ +var fileDescriptor_stream_chunk_a2afb657504565d7 = []byte{ // 223 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x41, 0x4e, 0xc3, 0x30, 0x10, 0x45, 0x15, 0x4a, 0x69, 0x3b, 0xd9, 0x45, 0x5d, 0x18, 0xba, 0x20, 0x62, 0x95, 0x95, 0x23, diff --git a/protoc-gen-grpc-gateway/descriptor/services_test.go b/protoc-gen-grpc-gateway/descriptor/services_test.go index 355ce6099fc..1ccb8fbef0a 100644 --- a/protoc-gen-grpc-gateway/descriptor/services_test.go +++ b/protoc-gen-grpc-gateway/descriptor/services_test.go @@ -99,11 +99,11 @@ func testExtractServices(t *testing.T, input []*descriptor.FileDescriptorProto, } for ; k < len(meth.Bindings); k++ { got := meth.Bindings[k] - t.Errorf("svcs[%d].Methods[%d].Bindings[%d] = %q; want it to be missing; input = %v", i, j, k, got, input) + t.Errorf("svcs[%d].Methods[%d].Bindings[%d] = %v; want it to be missing; input = %v", i, j, k, got, input) } for ; k < len(wantMeth.Bindings); k++ { want := wantMeth.Bindings[k] - t.Errorf("svcs[%d].Methods[%d].Bindings[%d] missing; want %q; input = %v", i, j, k, want, input) + t.Errorf("svcs[%d].Methods[%d].Bindings[%d] missing; want %v; input = %v", i, j, k, want, input) } } for ; j < len(svc.Methods); j++ { diff --git a/protoc-gen-swagger/main_test.go b/protoc-gen-swagger/main_test.go index 2c6eec129d4..7dcbf0c0bb5 100644 --- a/protoc-gen-swagger/main_test.go +++ b/protoc-gen-swagger/main_test.go @@ -88,7 +88,7 @@ func TestParseReqParam(t *testing.T) { name: "Test 8", expected: map[string]string{}, request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body=3,merge_file_name", - expectedError: errors.New(`Cannot set flag allow_repeated_fields_in_body=3: strconv.ParseBool: parsing "3": invalid syntax`), + expectedError: errors.New(`Cannot set flag allow_repeated_fields_in_body=3: parse error`), allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, fileV: "", importPathV: "", mergeFileNameV: "apidocs", }, @@ -96,7 +96,7 @@ func TestParseReqParam(t *testing.T) { name: "Test 9", expected: map[string]string{}, request: "include_package_in_tags=3", - expectedError: errors.New(`Cannot set flag include_package_in_tags=3: strconv.ParseBool: parsing "3": invalid syntax`), + expectedError: errors.New(`Cannot set flag include_package_in_tags=3: parse error`), allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, @@ -104,7 +104,7 @@ func TestParseReqParam(t *testing.T) { name: "Test 10", expected: map[string]string{}, request: "fqn_for_swagger_name=3", - expectedError: errors.New(`Cannot set flag fqn_for_swagger_name=3: strconv.ParseBool: parsing "3": invalid syntax`), + expectedError: errors.New(`Cannot set flag fqn_for_swagger_name=3: parse error`), allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, useFQNForSwaggerNameV: false, fileV: "stdin", importPathV: "", mergeFileNameV: "apidocs", }, diff --git a/protoc-gen-swagger/options/annotations.pb.go b/protoc-gen-swagger/options/annotations.pb.go index a743078b45c..9fc282bb7bd 100644 --- a/protoc-gen-swagger/options/annotations.pb.go +++ b/protoc-gen-swagger/options/annotations.pb.go @@ -73,10 +73,10 @@ func init() { } func init() { - proto.RegisterFile("protoc-gen-swagger/options/annotations.proto", fileDescriptor_annotations_24d91a1b8877b604) + proto.RegisterFile("protoc-gen-swagger/options/annotations.proto", fileDescriptor_annotations_8378bd63c2853a5a) } -var fileDescriptor_annotations_24d91a1b8877b604 = []byte{ +var fileDescriptor_annotations_8378bd63c2853a5a = []byte{ // 346 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x4f, 0xea, 0x40, 0x14, 0xc5, 0xc3, 0xe6, 0xe5, 0xa5, 0xef, 0xa9, 0x58, 0x37, 0x86, 0xf8, 0x87, 0x9d, 0xc6, 0xc0, diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index dd6cfd5d072..8bf40b05e6a 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -48,7 +48,7 @@ func (x Swagger_SwaggerScheme) String() string { return proto.EnumName(Swagger_SwaggerScheme_name, int32(x)) } func (Swagger_SwaggerScheme) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{0, 0} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{0, 0} } type JSONSchema_JSONSchemaSimpleTypes int32 @@ -89,7 +89,7 @@ func (x JSONSchema_JSONSchemaSimpleTypes) String() string { return proto.EnumName(JSONSchema_JSONSchemaSimpleTypes_name, int32(x)) } func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{8, 0} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{8, 0} } // Required. The type of the security scheme. Valid values are "basic", @@ -120,7 +120,7 @@ func (x SecurityScheme_Type) String() string { return proto.EnumName(SecurityScheme_Type_name, int32(x)) } func (SecurityScheme_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{11, 0} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{11, 0} } // Required. The location of the API key. Valid values are "query" or "header". @@ -147,7 +147,7 @@ func (x SecurityScheme_In) String() string { return proto.EnumName(SecurityScheme_In_name, int32(x)) } func (SecurityScheme_In) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{11, 1} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{11, 1} } // Required. The flow used by the OAuth2 security scheme. Valid values are @@ -181,7 +181,7 @@ func (x SecurityScheme_Flow) String() string { return proto.EnumName(SecurityScheme_Flow_name, int32(x)) } func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{11, 2} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{11, 2} } // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. @@ -210,7 +210,7 @@ func (m *Swagger) Reset() { *m = Swagger{} } func (m *Swagger) String() string { return proto.CompactTextString(m) } func (*Swagger) ProtoMessage() {} func (*Swagger) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{0} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{0} } func (m *Swagger) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Swagger.Unmarshal(m, b) @@ -333,7 +333,7 @@ func (m *Operation) Reset() { *m = Operation{} } func (m *Operation) String() string { return proto.CompactTextString(m) } func (*Operation) ProtoMessage() {} func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{1} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{1} } func (m *Operation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Operation.Unmarshal(m, b) @@ -450,7 +450,7 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{2} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{2} } func (m *Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Response.Unmarshal(m, b) @@ -505,7 +505,7 @@ func (m *Info) Reset() { *m = Info{} } func (m *Info) String() string { return proto.CompactTextString(m) } func (*Info) ProtoMessage() {} func (*Info) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{3} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{3} } func (m *Info) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Info.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *Contact) Reset() { *m = Contact{} } func (m *Contact) String() string { return proto.CompactTextString(m) } func (*Contact) ProtoMessage() {} func (*Contact) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{4} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{4} } func (m *Contact) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Contact.Unmarshal(m, b) @@ -644,7 +644,7 @@ func (m *License) Reset() { *m = License{} } func (m *License) String() string { return proto.CompactTextString(m) } func (*License) ProtoMessage() {} func (*License) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{5} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{5} } func (m *License) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_License.Unmarshal(m, b) @@ -696,7 +696,7 @@ func (m *ExternalDocumentation) Reset() { *m = ExternalDocumentation{} } func (m *ExternalDocumentation) String() string { return proto.CompactTextString(m) } func (*ExternalDocumentation) ProtoMessage() {} func (*ExternalDocumentation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{6} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{6} } func (m *ExternalDocumentation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExternalDocumentation.Unmarshal(m, b) @@ -750,7 +750,7 @@ func (m *Schema) Reset() { *m = Schema{} } func (m *Schema) String() string { return proto.CompactTextString(m) } func (*Schema) ProtoMessage() {} func (*Schema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{7} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{7} } func (m *Schema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Schema.Unmarshal(m, b) @@ -854,7 +854,7 @@ func (m *JSONSchema) Reset() { *m = JSONSchema{} } func (m *JSONSchema) String() string { return proto.CompactTextString(m) } func (*JSONSchema) ProtoMessage() {} func (*JSONSchema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{8} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{8} } func (m *JSONSchema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JSONSchema.Unmarshal(m, b) @@ -1040,7 +1040,7 @@ func (m *Tag) Reset() { *m = Tag{} } func (m *Tag) String() string { return proto.CompactTextString(m) } func (*Tag) ProtoMessage() {} func (*Tag) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{9} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{9} } func (m *Tag) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Tag.Unmarshal(m, b) @@ -1094,7 +1094,7 @@ func (m *SecurityDefinitions) Reset() { *m = SecurityDefinitions{} } func (m *SecurityDefinitions) String() string { return proto.CompactTextString(m) } func (*SecurityDefinitions) ProtoMessage() {} func (*SecurityDefinitions) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{10} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{10} } func (m *SecurityDefinitions) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityDefinitions.Unmarshal(m, b) @@ -1172,7 +1172,7 @@ func (m *SecurityScheme) Reset() { *m = SecurityScheme{} } func (m *SecurityScheme) String() string { return proto.CompactTextString(m) } func (*SecurityScheme) ProtoMessage() {} func (*SecurityScheme) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{11} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{11} } func (m *SecurityScheme) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityScheme.Unmarshal(m, b) @@ -1274,7 +1274,7 @@ func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} } func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) } func (*SecurityRequirement) ProtoMessage() {} func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{12} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{12} } func (m *SecurityRequirement) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement.Unmarshal(m, b) @@ -1319,7 +1319,7 @@ func (m *SecurityRequirement_SecurityRequirementValue) String() string { } func (*SecurityRequirement_SecurityRequirementValue) ProtoMessage() {} func (*SecurityRequirement_SecurityRequirementValue) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{12, 0} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{12, 0} } func (m *SecurityRequirement_SecurityRequirementValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Unmarshal(m, b) @@ -1364,7 +1364,7 @@ func (m *Scopes) Reset() { *m = Scopes{} } func (m *Scopes) String() string { return proto.CompactTextString(m) } func (*Scopes) ProtoMessage() {} func (*Scopes) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_11f010f5fecc79bc, []int{13} + return fileDescriptor_openapiv2_29cfb415de848cf5, []int{13} } func (m *Scopes) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Scopes.Unmarshal(m, b) @@ -1420,10 +1420,10 @@ func init() { } func init() { - proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_11f010f5fecc79bc) + proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_29cfb415de848cf5) } -var fileDescriptor_openapiv2_11f010f5fecc79bc = []byte{ +var fileDescriptor_openapiv2_29cfb415de848cf5 = []byte{ // 1777 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x73, 0xdb, 0xc6, 0x11, 0x0f, 0x48, 0x90, 0x04, 0x97, 0x22, 0x73, 0x3e, 0xcb, 0x2d, 0xa2, 0xc4, 0xae, 0xc2, 0xa6, From ee8c991307cdae6e4bb84c98f06f9b0de851834c Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Mon, 4 Mar 2019 17:32:43 +0100 Subject: [PATCH 384/552] bazel: Use new ProtoInfo provider The old `.proto` provider will be removed in a future Bazel release: https://github.com/bazelbuild/bazel/issues/7152 The Bazel build now requires Bazel 0.22.0 or newer. --- protoc-gen-swagger/defs.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index 186178d8892..75a055530f6 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -67,7 +67,7 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action return swagger_files def _proto_gen_swagger_impl(ctx): - proto = ctx.attr.proto.proto + proto = ctx.attr.proto[ProtoInfo] grpc_api_configuration = ctx.file.grpc_api_configuration return [DefaultInfo( From c10b0a53ee024dc12957a1f1524b2de846960d6f Mon Sep 17 00:00:00 2001 From: Alok Parlikar Date: Wed, 6 Mar 2019 22:59:20 +0530 Subject: [PATCH 385/552] Disable IOReaderFactory for streaming requests (#896) An IOReaderFactory was being used to wrap request body for client/bidi streaming requests. This was causing the requests to be fully buffered before being sent to the grpc server, thereby breaking streaming. This commit changes that to directly use request body. Fixes #894 --- .../proto/examplepb/flow_combination.pb.gw.go | 12 ++---------- examples/proto/examplepb/stream.pb.gw.go | 12 ++---------- protoc-gen-grpc-gateway/gengateway/template.go | 16 ++++------------ .../gengateway/template_test.go | 9 +++------ 4 files changed, 11 insertions(+), 38 deletions(-) diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index 70844205596..b34314fe7d1 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -61,11 +61,7 @@ func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler run grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - dec := marshaler.NewDecoder(newReader()) + dec := marshaler.NewDecoder(req.Body) for { var protoReq EmptyProto err = dec.Decode(&protoReq) @@ -106,11 +102,7 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, berr - } - dec := marshaler.NewDecoder(newReader()) + dec := marshaler.NewDecoder(req.Body) handleSend := func() error { var protoReq EmptyProto err := dec.Decode(&protoReq) diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index fb4c8fcae45..afda301f0ca 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -37,11 +37,7 @@ func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.M grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - dec := marshaler.NewDecoder(newReader()) + dec := marshaler.NewDecoder(req.Body) for { var protoReq ABitOfEverything err = dec.Decode(&protoReq) @@ -99,11 +95,7 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, berr - } - dec := marshaler.NewDecoder(newReader()) + dec := marshaler.NewDecoder(req.Body) handleSend := func() error { var protoReq sub.StringMessage err := dec.Decode(&protoReq) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 12c02ae9f9f..d376ccdb255 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -236,11 +236,7 @@ func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx cont grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - dec := marshaler.NewDecoder(newReader()) + dec := marshaler.NewDecoder(req.Body) for { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} err = dec.Decode(&protoReq) @@ -303,8 +299,8 @@ var ( return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.{{.FieldMaskField}} = fieldMask - } - } {{end}} + } + } {{end}} {{end}} {{end}} {{if .PathParams}} @@ -378,11 +374,7 @@ var ( grpclog.Infof("Failed to start streaming: %v", err) return nil, metadata, err } - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, berr - } - dec := marshaler.NewDecoder(newReader()) + dec := marshaler.NewDecoder(req.Body) handleSend := func() error { var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} err := dec.Decode(&protoReq) diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index ba941d095dd..5e287a680d1 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -391,9 +391,6 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { if want := spec.sigWant; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `marshaler.NewDecoder(newReader()`; !strings.Contains(got, want) { - t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) - } if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } @@ -482,7 +479,7 @@ func TestAllowPatchFeature(t *testing.T) { } } -func TestIdentifierCapitalization(t *testing.T){ +func TestIdentifierCapitalization(t *testing.T) { msgdesc1 := &protodescriptor.DescriptorProto{ Name: proto.String("Exam_pleRequest"), } @@ -492,12 +489,12 @@ func TestIdentifierCapitalization(t *testing.T){ meth1 := &protodescriptor.MethodDescriptorProto{ Name: proto.String("ExampleGe2t"), InputType: proto.String("Exam_pleRequest"), - OutputType: proto.String("example_response"), + OutputType: proto.String("example_response"), } meth2 := &protodescriptor.MethodDescriptorProto{ Name: proto.String("Exampl_eGet"), InputType: proto.String("Exam_pleRequest"), - OutputType: proto.String("example_response"), + OutputType: proto.String("example_response"), } svc := &protodescriptor.ServiceDescriptorProto{ Name: proto.String("Example"), From 0a1978c59ddfcf8fa59e6819af75417b05799624 Mon Sep 17 00:00:00 2001 From: Fabian Hernandez Date: Thu, 7 Mar 2019 03:31:47 -0600 Subject: [PATCH 386/552] Fix problem while generating swagger documentation for enum messages containing a dot (#898) Fixes #898 --- .../clients/abe/a_bit_of_everything_nested.go | 1 + .../abe/a_bit_of_everything_service_api.go | 4 +- .../proto/examplepb/a_bit_of_everything.pb.go | 437 +++++++++--------- .../proto/examplepb/a_bit_of_everything.proto | 4 +- .../a_bit_of_everything.swagger.json | 7 +- examples/proto/examplepb/stream.swagger.json | 3 +- protoc-gen-swagger/genswagger/template.go | 6 +- 7 files changed, 235 insertions(+), 227 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_nested.go b/examples/clients/abe/a_bit_of_everything_nested.go index 095e8c5f118..c5b1dc53c75 100644 --- a/examples/clients/abe/a_bit_of_everything_nested.go +++ b/examples/clients/abe/a_bit_of_everything_nested.go @@ -18,5 +18,6 @@ type ABitOfEverythingNested struct { Amount int64 `json:"amount,omitempty"` + // DeepEnum description. Ok NestedDeepEnum `json:"ok,omitempty"` } diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 5cbf25f0071..ce7c5d817ba 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -526,7 +526,7 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param floatValue Float value field * @param singleNestedName name is nested field. * @param singleNestedAmount - * @param singleNestedOk - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param singleNestedOk DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param doubleValue * @param int64Value * @param uint64Value @@ -554,7 +554,7 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param repeatedStringAnnotation Repeated string title. Repeated string description. * @param nestedAnnotationName name is nested field. * @param nestedAnnotationAmount - * @param nestedAnnotationOk - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param nestedAnnotationOk DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @return *interface{} */ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, singleNestedName string, singleNestedAmount int64, singleNestedOk string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationName string, nestedAnnotationAmount int64, nestedAnnotationOk string) (*interface{}, *APIResponse, error) { diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 78a9e6610a0..7b8ee6672ef 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{0} + return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -139,7 +139,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{0} + return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -500,8 +500,9 @@ func _ABitOfEverything_OneofSizer(msg proto.Message) (n int) { // Nested is nested type. type ABitOfEverything_Nested struct { // name is nested field. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Amount uint32 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Amount uint32 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + // DeepEnum comment. Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,proto3,enum=grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -512,7 +513,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{0, 0} + return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -581,7 +582,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{1} + return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -724,7 +725,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{2} + return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -763,7 +764,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{3} + return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -810,7 +811,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_355f53a87bca58c1, []int{4} + return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1574,212 +1575,212 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_355f53a87bca58c1) -} - -var fileDescriptor_a_bit_of_everything_355f53a87bca58c1 = []byte{ - // 3233 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0x5b, 0x6f, 0x1b, 0xc7, - 0xb9, 0x5a, 0xae, 0xae, 0xa3, 0x1b, 0x35, 0xb2, 0x65, 0x8a, 0x56, 0xa2, 0x31, 0xed, 0x24, 0x6b, - 0xc6, 0xe4, 0x4a, 0x2b, 0xd9, 0x91, 0x19, 0x24, 0x3e, 0xa4, 0x2e, 0xb6, 0x62, 0x5b, 0x96, 0xd7, - 0x8e, 0x4f, 0xe0, 0xd8, 0x11, 0x96, 0xe4, 0x50, 0x5c, 0x8b, 0xbb, 0xb3, 0xd9, 0x9d, 0x95, 0xcd, - 0xa3, 0xc3, 0x73, 0xd2, 0x0b, 0x5a, 0xb4, 0x79, 0x28, 0xc0, 0xb4, 0x0f, 0xbd, 0xa0, 0xbf, 0x20, - 0xaf, 0x7d, 0x0a, 0xd0, 0xcb, 0x43, 0x9f, 0xfa, 0xe6, 0x16, 0xfd, 0x03, 0xed, 0x43, 0x9f, 0x0a, - 0x14, 0x05, 0x02, 0x14, 0x45, 0x8b, 0x62, 0x67, 0x77, 0xc9, 0xdd, 0x25, 0x69, 0x99, 0x76, 0x90, - 0x17, 0x69, 0x67, 0xe6, 0xbb, 0x7f, 0xdf, 0x7c, 0x97, 0x21, 0x90, 0xf0, 0x13, 0x45, 0x33, 0x6a, - 0xd8, 0x12, 0x0d, 0x93, 0x50, 0x22, 0x7a, 0x4b, 0xa3, 0x28, 0x2a, 0x7b, 0x45, 0x95, 0xee, 0x91, - 0xca, 0x1e, 0x3e, 0xc4, 0x66, 0x9d, 0x56, 0x55, 0x7d, 0x3f, 0xcb, 0x60, 0xe0, 0xe2, 0xbe, 0x69, - 0x94, 0xb2, 0xfb, 0x0a, 0xc5, 0x8f, 0x95, 0x7a, 0xd6, 0x27, 0x90, 0x6d, 0xa1, 0x26, 0x17, 0xf6, - 0x09, 0xd9, 0xaf, 0x61, 0x51, 0x31, 0x54, 0x51, 0xd1, 0x75, 0x42, 0x15, 0xaa, 0x12, 0xdd, 0x72, - 0xd1, 0x93, 0xc8, 0x3b, 0x65, 0xab, 0xa2, 0x5d, 0x11, 0x2b, 0x2a, 0xae, 0x95, 0xf7, 0x34, 0xc5, - 0x3a, 0xf0, 0x20, 0x4e, 0x47, 0x21, 0xb0, 0x66, 0xd0, 0xba, 0x77, 0xf8, 0x6a, 0xf4, 0xb0, 0x6c, - 0x9b, 0x8c, 0xbe, 0x77, 0xfe, 0x46, 0x44, 0x23, 0x43, 0xa1, 0x55, 0xac, 0xdb, 0x1a, 0xfb, 0xd8, - 0x73, 0xbe, 0x7c, 0x39, 0x22, 0x80, 0x96, 0x5d, 0x14, 0x35, 0x6c, 0x59, 0xca, 0x3e, 0xf6, 0x20, - 0xce, 0x74, 0x42, 0x48, 0x11, 0x90, 0xc5, 0xa8, 0x34, 0x54, 0xd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 0xa2, 0x4c, 0xec, 0x62, 0x0d, 0x7b, 0xc4, 0x06, 0x11, 0x27, 0x70, 0xf2, 0xb8, 0xbb, 0xe7, 0x82, - 0x2c, 0x82, 0x71, 0x55, 0xa7, 0x97, 0x56, 0x3d, 0x88, 0x21, 0xc4, 0x09, 0xbc, 0x0c, 0xd8, 0x56, - 0x8b, 0x86, 0x1d, 0x84, 0x18, 0x46, 0x9c, 0x30, 0x28, 0x8f, 0xdb, 0x01, 0x10, 0x97, 0xc6, 0x8a, - 0xe4, 0x41, 0x8c, 0x20, 0x4e, 0x18, 0x62, 0x34, 0x56, 0x24, 0x17, 0xe0, 0x2c, 0x98, 0xac, 0xa8, - 0x4f, 0x70, 0xb9, 0x45, 0x64, 0x14, 0x71, 0xc2, 0xb0, 0x3c, 0xe1, 0x6d, 0x86, 0x81, 0x5a, 0x74, - 0xc6, 0x10, 0x27, 0x8c, 0x78, 0x40, 0x3e, 0xa5, 0x57, 0x00, 0x28, 0x12, 0x52, 0xf3, 0x20, 0x00, - 0xe2, 0x84, 0x51, 0x79, 0xcc, 0xd9, 0x69, 0x09, 0x6b, 0x51, 0x53, 0xd5, 0xf7, 0x3d, 0x80, 0x71, - 0x27, 0x00, 0xe4, 0x71, 0x77, 0xaf, 0x25, 0x6c, 0xb1, 0x4e, 0xb1, 0xe5, 0x41, 0xbc, 0x82, 0x38, - 0x61, 0x42, 0x06, 0x6c, 0x2b, 0xa4, 0x70, 0x4b, 0x8c, 0x49, 0xc4, 0x09, 0x93, 0xae, 0xc2, 0xbe, - 0x14, 0xd7, 0x01, 0x70, 0x6e, 0x9d, 0x07, 0x30, 0x85, 0x38, 0x61, 0x4a, 0xba, 0x70, 0xac, 0xe7, - 0x77, 0x6c, 0x0d, 0x9b, 0x6a, 0x69, 0x53, 0xb7, 0x35, 0x79, 0xcc, 0xc1, 0x77, 0x89, 0xed, 0x82, - 0xe9, 0xd6, 0x3d, 0xf6, 0x28, 0xbe, 0xca, 0x28, 0x0a, 0x3d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, 0x8c, 0x78, 0x61, 0x58, 0x4e, - 0x84, 0x8c, 0x15, 0x6c, 0x67, 0xbb, 0xa3, 0x07, 0x26, 0x26, 0x5e, 0x18, 0xe9, 0x82, 0xee, 0x73, - 0x7f, 0x0b, 0x24, 0xc2, 0xe8, 0x81, 0x19, 0x68, 0x14, 0xf1, 0xc2, 0xa8, 0x7c, 0x32, 0x88, 0x5b, - 0x68, 0xcd, 0x43, 0x1d, 0xe6, 0x0a, 0x75, 0x85, 0x63, 0xac, 0x0b, 0x0e, 0x99, 0x2b, 0xdc, 0x09, - 0x47, 0xcc, 0x15, 0x9c, 0x9b, 0x00, 0xe2, 0x85, 0x89, 0xb0, 0xb9, 0x0a, 0xed, 0x19, 0xaa, 0xab, - 0x9b, 0x5a, 0xea, 0x8e, 0x23, 0x5e, 0x98, 0xec, 0x74, 0x93, 0xaf, 0x2d, 0x8e, 0x6a, 0x1b, 0xe8, - 0xa9, 0x26, 0x5e, 0xa0, 0xa7, 0x0a, 0xd9, 0xa6, 0xdd, 0x57, 0x5d, 0x01, 0x0b, 0x11, 0xdb, 0x84, - 0x9d, 0x32, 0x89, 0x78, 0x61, 0x5a, 0x9e, 0x0f, 0x59, 0x27, 0x34, 0xca, 0xf4, 0x20, 0xd0, 0x0a, - 0x8a, 0x29, 0xc4, 0x0b, 0xf1, 0x6e, 0x04, 0x7a, 0x06, 0x73, 0x68, 0xe4, 0x99, 0x46, 0xbc, 0x30, - 0x13, 0xf1, 0x4e, 0xc0, 0x4a, 0x5d, 0x91, 0x03, 0x43, 0x15, 0x2f, 0xc0, 0x4e, 0x64, 0x8f, 0x73, - 0xae, 0xda, 0xcc, 0x63, 0xa9, 0x04, 0x95, 0x23, 0x94, 0xea, 0x15, 0x58, 0xa9, 0x1c, 0xfa, 0x90, - 0x9a, 0x36, 0xbe, 0x80, 0xdc, 0xbf, 0x15, 0xa5, 0x66, 0x79, 0x8b, 0x87, 0x17, 0xa2, 0x68, 0x01, - 0xb9, 0x1d, 0xb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c, 0xe6, 0x50, 0x7d, 0xac, 0xd2, 0x6a, 0xd9, 0xa3, 0xfa, 0x5d, 0x0e, 0xc0, 0xab, 0x98, - 0x46, 0x67, 0xb7, 0xe3, 0x7b, 0x84, 0x08, 0x46, 0x4f, 0x31, 0xde, 0x60, 0x62, 0x9c, 0x49, 0xcd, - 0x07, 0xc5, 0x70, 0x24, 0x28, 0x92, 0x72, 0x5d, 0x3c, 0x72, 0x3a, 0x02, 0x36, 0xe3, 0xc1, 0x6f, - 0x71, 0x60, 0x66, 0x97, 0x58, 0xd4, 0xa1, 0xc8, 0x50, 0x99, 0x20, 0xcf, 0x37, 0x26, 0xf6, 0xe4, - 0x2e, 0x32, 0xee, 0xe7, 0x53, 0xe7, 0x82, 0xdc, 0x0d, 0x62, 0x51, 0x47, 0x02, 0xf6, 0xab, 0xa0, - 0x2b, 0x86, 0x1f, 0x14, 0xc9, 0x5f, 0x71, 0xcd, 0xfc, 0x17, 0x1c, 0xac, 0xf4, 0x98, 0xda, 0x82, - 0x6f, 0xd8, 0x28, 0x93, 0x41, 0x8f, 0xab, 0x6a, 0xa9, 0x8a, 0xac, 0x2a, 0xb1, 0x6b, 0x65, 0x76, - 0xfd, 0x8a, 0x18, 0xd9, 0x16, 0x2e, 0x23, 0x55, 0x47, 0x46, 0x4d, 0x29, 0x61, 0x44, 0x2a, 0xec, - 0xa2, 0x96, 0x49, 0xc9, 0xd6, 0xb0, 0xee, 0xce, 0x02, 0xa8, 0x44, 0x34, 0x67, 0x71, 0x26, 0x79, - 0x1b, 0x2c, 0x76, 0xeb, 0x0c, 0x9c, 0x6b, 0xe4, 0xcf, 0x89, 0xfd, 0xbe, 0x35, 0x3e, 0x02, 0x27, - 0x4a, 0x8a, 0x86, 0x6b, 0xeb, 0x8a, 0x85, 0x3d, 0x1a, 0xce, 0x50, 0x03, 0x65, 0x30, 0xe4, 0xfe, - 0xb4, 0xd9, 0x6f, 0x20, 0xcd, 0x33, 0x1b, 0xce, 0xc2, 0x99, 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, 0x09, 0x4c, 0x4a, 0x90, 0x52, 0x2a, 0x61, 0xcb, 0x0a, 0x55, 0x97, 0xac, 0xfc, 0x12, 0x35, - 0x68, 0x44, 0xbe, 0x06, 0xf8, 0xd5, 0xe5, 0x35, 0x98, 0x07, 0x93, 0xdb, 0x6f, 0x68, 0x48, 0x41, - 0x14, 0x2b, 0x06, 0xa1, 0x59, 0xb8, 0x04, 0xb2, 0xc9, 0xbe, 0x9e, 0xff, 0xee, 0x7f, 0x2f, 0x06, - 0xa6, 0xc1, 0x58, 0x41, 0xb1, 0xd4, 0x12, 0xeb, 0xff, 0x63, 0xa3, 0x1c, 0x78, 0x25, 0x34, 0x11, - 0x4c, 0x8f, 0xc6, 0x92, 0x63, 0x1f, 0x64, 0xf2, 0xbb, 0xdb, 0x99, 0xeb, 0xb8, 0x8e, 0x62, 0xe0, - 0x8f, 0x5c, 0x6b, 0x42, 0xf8, 0x1d, 0x37, 0xca, 0x0b, 0x83, 0xd2, 0x59, 0xdf, 0x87, 0x01, 0x87, - 0x8b, 0x44, 0xb1, 0x69, 0x55, 0x74, 0xfe, 0x10, 0x53, 0xfd, 0x1f, 0x9c, 0x5b, 0xec, 0x0d, 0x44, - 0xc9, 0x01, 0xd6, 0x0b, 0xff, 0x0f, 0x92, 0xee, 0xc0, 0x01, 0xe1, 0x55, 0x53, 0xd1, 0xa9, 0x85, - 0x9c, 0x85, 0x67, 0x3d, 0xb0, 0xe0, 0x8d, 0x21, 0x70, 0xd6, 0x3b, 0x64, 0x2b, 0xff, 0x74, 0x1d, - 0x0c, 0x29, 0x65, 0x4d, 0xd5, 0x61, 0x2e, 0x84, 0xaa, 0x97, 0x43, 0x60, 0xcc, 0x19, 0x0e, 0x98, - 0x6a, 0x51, 0xa7, 0x12, 0x1d, 0x62, 0xa4, 0xea, 0x15, 0x62, 0x6a, 0xcc, 0xdf, 0xc5, 0x45, 0x30, - 0x19, 0x34, 0xc5, 0x40, 0x74, 0x34, 0x2a, 0x9e, 0xef, 0x39, 0x1c, 0x45, 0x41, 0xcd, 0x6d, 0x70, - 0xea, 0x66, 0x3b, 0xfb, 0x04, 0xef, 0x54, 0xbf, 0x77, 0xe9, 0xfe, 0x58, 0xcb, 0x73, 0xc5, 0x61, - 0x76, 0x9f, 0x57, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0x35, 0xba, 0x1f, 0xec, 0xc6, 0x27, 0x00, - 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_75cdf8204f309306) +} + +var fileDescriptor_a_bit_of_everything_75cdf8204f309306 = []byte{ + // 3241 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0xcb, 0x6f, 0x1b, 0xc7, + 0xf9, 0x5a, 0xae, 0x9e, 0xa3, 0x17, 0x35, 0xb2, 0x65, 0x8a, 0x56, 0xa2, 0x31, 0xed, 0x24, 0x6b, + 0xc6, 0xe4, 0x4a, 0x2b, 0xd9, 0x91, 0x19, 0x24, 0xfe, 0x91, 0x7a, 0xd8, 0x8a, 0x6d, 0x59, 0x59, + 0x3b, 0xfe, 0x05, 0x8e, 0x1d, 0x61, 0x49, 0x0e, 0xc5, 0xb5, 0xb8, 0x3b, 0x9b, 0xdd, 0x59, 0xd9, + 0xac, 0xca, 0x36, 0x7d, 0xa0, 0x45, 0x9b, 0x43, 0x01, 0xa6, 0x45, 0xd1, 0x07, 0xfa, 0x17, 0xe4, + 0xda, 0x53, 0x80, 0xb6, 0x97, 0x9e, 0x7a, 0x73, 0x8b, 0xde, 0x7a, 0x6a, 0x0f, 0x3d, 0x15, 0x28, + 0x0a, 0x04, 0xe8, 0xa1, 0x45, 0xb1, 0xb3, 0xbb, 0xe4, 0xee, 0x92, 0xb4, 0x4c, 0x3b, 0xc8, 0x45, + 0xda, 0x99, 0xf9, 0xde, 0xdf, 0x37, 0xdf, 0x63, 0x08, 0x24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x42, 0xb4, 0xc5, 0x6e, + 0x56, 0x0f, 0xad, 0x5d, 0xa6, 0xaf, 0x80, 0x29, 0x2b, 0xec, 0xbf, 0x69, 0xc4, 0x09, 0xd3, 0xf2, + 0xa4, 0x15, 0x72, 0x60, 0x0b, 0xac, 0x15, 0x0b, 0x71, 0xc4, 0x09, 0x71, 0x1f, 0x2c, 0x10, 0x75, + 0x56, 0xd0, 0x09, 0x33, 0x88, 0x13, 0x66, 0xe4, 0x71, 0x2b, 0xe0, 0x04, 0x0f, 0xa4, 0x45, 0x07, + 0x22, 0x4e, 0x80, 0x2e, 0x88, 0x4f, 0x45, 0x02, 0x27, 0x4d, 0x6c, 0x60, 0xc5, 0x31, 0x45, 0x28, + 0x2e, 0x66, 0x11, 0x2f, 0x8c, 0xc9, 0xb3, 0xfe, 0xe1, 0xed, 0x40, 0x7c, 0x5c, 0x06, 0xe3, 0x44, + 0xc7, 0x4e, 0x91, 0x70, 0x32, 0x74, 0xe2, 0x04, 0x4b, 0x4c, 0x73, 0x59, 0x37, 0x29, 0x66, 0xfd, + 0xa4, 0x98, 0xdd, 0x74, 0x4e, 0xaf, 0x0d, 0xc8, 0x80, 0x01, 0xb3, 0x15, 0x3c, 0x0b, 0x26, 0x5c, + 0x54, 0x97, 0x57, 0xe2, 0xa4, 0x13, 0x7d, 0xd7, 0x06, 0x64, 0x97, 0xa0, 0xcb, 0x04, 0xde, 0x07, + 0x63, 0x9a, 0x62, 0x78, 0x72, 0xcc, 0xb1, 0xa4, 0x71, 0xa5, 0xff, 0xa4, 0x71, 0x53, 0x31, 0x98, + 0xb8, 0x9b, 0x3a, 0x35, 0xeb, 0xf2, 0xa8, 0xe6, 0x2d, 0xe1, 0x63, 0x30, 0xab, 0x29, 0x86, 0x11, + 0xd5, 0xf7, 0x14, 0xe3, 0x73, 0xed, 0xb9, 0xf8, 0x18, 0x21, 0xfb, 0xb8, 0x0c, 0x67, 0xb4, 0xe8, + 0x7e, 0x80, 0xb3, 0x17, 0x7b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xcf, 0x2b, 0xff, 0x0b, 0x00, 0x00, 0xff, + 0xff, 0xce, 0xfe, 0xb9, 0x59, 0xe2, 0x27, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 9a73797c510..5a4e525ff8c 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -162,7 +162,9 @@ message ABitOfEverything { // TRUE is true. TRUE = 1; } - DeepEnum ok = 3; + + // DeepEnum comment. + DeepEnum ok = 3 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {description: "DeepEnum description."}]; } Nested single_nested = 25; diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index f786e898f00..048fa8da4b3 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -171,7 +171,7 @@ }, { "name": "single_nested.ok", - "description": " - FALSE: FALSE is false.\n - TRUE: TRUE is true.", + "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", @@ -415,7 +415,7 @@ }, { "name": "nested_annotation.ok", - "description": " - FALSE: FALSE is false.\n - TRUE: TRUE is true.", + "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", "in": "query", "required": false, "type": "string", @@ -1485,7 +1485,8 @@ "format": "int64" }, "ok": { - "$ref": "#/definitions/NestedDeepEnum" + "$ref": "#/definitions/NestedDeepEnum", + "description": "DeepEnum description." } }, "description": "Nested is nested type." diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index 259900180bb..d67b6d24496 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -102,7 +102,8 @@ "format": "int64" }, "ok": { - "$ref": "#/definitions/NestedDeepEnum" + "$ref": "#/definitions/NestedDeepEnum", + "description": "DeepEnum description." } }, "description": "Nested is nested type." diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 484ca971643..55f42093b59 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1265,8 +1265,10 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, is // There was no summary field on the swaggerObject. Try to apply the // whole comment into description if the swagger object description is empty. - if descriptionValue.CanSet() && (descriptionValue.Len() == 0 || isPackageObject){ - descriptionValue.Set(reflect.ValueOf(strings.Join(paragraphs, "\n\n"))) + if descriptionValue.CanSet() { + if descriptionValue.Len() == 0 || isPackageObject { + descriptionValue.Set(reflect.ValueOf(strings.Join(paragraphs, "\n\n"))) + } return nil } From a0b1534d81d022bf15773feb0a4a08f0f0d350fb Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Thu, 7 Mar 2019 09:51:26 +0000 Subject: [PATCH 387/552] Regenerate changelog for 1.8.2 --- CHANGELOG.md | 32 +++++++++++++++++++++++++++++++- Makefile | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e7aa10b741..06c555b2ee5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # Change Log +## [v1.8.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.2) (2019-03-07) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.1...v1.8.2) + +**Implemented enhancements:** + +- Update the build environment Dockerfile to Go 1.12 [\#885](https://github.com/grpc-ecosystem/grpc-gateway/issues/885) + +**Fixed bugs:** + +- Change in behavior of streaming request body \(1.4.1 vs 1.8.1\) [\#894](https://github.com/grpc-ecosystem/grpc-gateway/issues/894) +- Cannot download 1.8.0 with modules [\#886](https://github.com/grpc-ecosystem/grpc-gateway/issues/886) + +**Closed issues:** + +- Description and title ignored when field is not a scaler value type [\#892](https://github.com/grpc-ecosystem/grpc-gateway/issues/892) + +**Merged pull requests:** + +- 897 fixing problem while generating swagger documentation for enum messages [\#898](https://github.com/grpc-ecosystem/grpc-gateway/pull/898) ([fahernandez](https://github.com/fahernandez)) +- bugfix: disable IOReaderFactory for streaming requests [\#896](https://github.com/grpc-ecosystem/grpc-gateway/pull/896) ([happyalu](https://github.com/happyalu)) +- bazel: Use new ProtoInfo provider [\#893](https://github.com/grpc-ecosystem/grpc-gateway/pull/893) ([drigz](https://github.com/drigz)) +- README: Add some nicer looking badges [\#890](https://github.com/grpc-ecosystem/grpc-gateway/pull/890) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Upgrade generator and runtime versions [\#889](https://github.com/grpc-ecosystem/grpc-gateway/pull/889) ([johanbrandhorst](https://github.com/johanbrandhorst)) + +## [v1.8.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.1) (2019-03-02) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.1-pre1...v1.8.1) + +**Merged pull requests:** + +- Generate changelog for v1.8.1 [\#887](https://github.com/grpc-ecosystem/grpc-gateway/pull/887) ([johanbrandhorst](https://github.com/johanbrandhorst)) + ## [v1.8.1-pre1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.1-pre1) (2019-03-01) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.0...v1.8.1-pre1) @@ -12,7 +43,6 @@ **Implemented enhancements:** -- Cleaner Swagger-generated schema names \(omitting prefixes\) [\#877](https://github.com/grpc-ecosystem/grpc-gateway/issues/877) - Support swagger annotations for default and required fields [\#851](https://github.com/grpc-ecosystem/grpc-gateway/issues/851) - Support go modules [\#755](https://github.com/grpc-ecosystem/grpc-gateway/issues/755) diff --git a/Makefile b/Makefile index 7ca298961a7..c1d8ec93227 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.8.0 + --future-release=v1.8.2 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 6c38131008e4520ba48491786d72e5f318eb78e7 Mon Sep 17 00:00:00 2001 From: Elliot Shepherd Date: Wed, 27 Feb 2019 14:24:19 +1100 Subject: [PATCH 388/552] protoc-gen-swagger: return error when encoding swagger file Previously, the error was being ignored --- protoc-gen-swagger/genswagger/generator.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go index a7bc905b672..749ff4b0d28 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/genswagger/generator.go @@ -67,11 +67,13 @@ func mergeTargetFile(targets []*wrapper, mergeFileName string) *wrapper { } // convert swagger file obj to plugin.CodeGeneratorResponse_File -func encodeSwagger(file *wrapper) *plugin.CodeGeneratorResponse_File { +func encodeSwagger(file *wrapper) (*plugin.CodeGeneratorResponse_File, error) { var formatted bytes.Buffer enc := json.NewEncoder(&formatted) enc.SetIndent("", " ") - enc.Encode(*file.swagger) + if err := enc.Encode(*file.swagger); err != nil { + return nil, err + } name := file.fileName ext := filepath.Ext(name) base := strings.TrimSuffix(name, ext) @@ -79,7 +81,7 @@ func encodeSwagger(file *wrapper) *plugin.CodeGeneratorResponse_File { return &plugin.CodeGeneratorResponse_File{ Name: proto.String(output), Content: proto.String(formatted.String()), - } + }, nil } func (g *generator) Generate(targets []*descriptor.File) ([]*plugin.CodeGeneratorResponse_File, error) { @@ -127,11 +129,19 @@ func (g *generator) Generate(targets []*descriptor.File) ([]*plugin.CodeGenerato if g.reg.IsAllowMerge() { targetSwagger := mergeTargetFile(swaggers, g.reg.GetMergeFileName()) - files = append(files, encodeSwagger(targetSwagger)) + f, err := encodeSwagger(targetSwagger) + if err != nil { + return nil, fmt.Errorf("failed to encode swagger for %s: %s", g.reg.GetMergeFileName(), err) + } + files = append(files, f) glog.V(1).Infof("New swagger file will emit") } else { for _, file := range swaggers { - files = append(files, encodeSwagger(file)) + f, err := encodeSwagger(file) + if err != nil { + return nil, fmt.Errorf("failed to encode swagger for %s: %s", file.fileName, err) + } + files = append(files, f) glog.V(1).Infof("New swagger file will emit") } } From 34920fcab4b7ba3fb056be4e2cbdf28ed084157b Mon Sep 17 00:00:00 2001 From: Brent Date: Sun, 10 Mar 2019 11:59:07 -0500 Subject: [PATCH 389/552] Use collectionFormat multi for query params of repeated fields (#902) * Use collectionFormat multi for query params of repeated fields Fixes #756 . Also formats protoc-gen-swagger/genswagger/template_test.go according to go fmt. --- .../abe/a_bit_of_everything_service_api.go | 8 +- .../a_bit_of_everything.swagger.json | 81 ++++++++++------ .../response_body_service.swagger.json | 12 ++- examples/proto/examplepb/stream.swagger.json | 21 +++-- protoc-gen-swagger/genswagger/template.go | 20 ++-- .../genswagger/template_test.go | 94 +++++++++++-------- protoc-gen-swagger/genswagger/types.go | 1 + 7 files changed, 147 insertions(+), 90 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index ce7c5d817ba..415243210cd 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -595,20 +595,20 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, si localVarQueryParams.Add("sfixed64_value", a.Configuration.APIClient.ParameterToString(sfixed64Value, "")) localVarQueryParams.Add("sint32_value", a.Configuration.APIClient.ParameterToString(sint32Value, "")) localVarQueryParams.Add("sint64_value", a.Configuration.APIClient.ParameterToString(sint64Value, "")) - var repeatedStringValueCollectionFormat = "csv" + var repeatedStringValueCollectionFormat = "multi" localVarQueryParams.Add("repeated_string_value", a.Configuration.APIClient.ParameterToString(repeatedStringValue, repeatedStringValueCollectionFormat)) localVarQueryParams.Add("oneof_string", a.Configuration.APIClient.ParameterToString(oneofString, "")) localVarQueryParams.Add("nonConventionalNameValue", a.Configuration.APIClient.ParameterToString(nonConventionalNameValue, "")) localVarQueryParams.Add("timestamp_value", a.Configuration.APIClient.ParameterToString(timestampValue, "")) - var repeatedEnumValueCollectionFormat = "csv" + var repeatedEnumValueCollectionFormat = "multi" localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) - var repeatedEnumAnnotationCollectionFormat = "csv" + var repeatedEnumAnnotationCollectionFormat = "multi" localVarQueryParams.Add("repeated_enum_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumAnnotation, repeatedEnumAnnotationCollectionFormat)) localVarQueryParams.Add("enum_value_annotation", a.Configuration.APIClient.ParameterToString(enumValueAnnotation, "")) - var repeatedStringAnnotationCollectionFormat = "csv" + var repeatedStringAnnotationCollectionFormat = "multi" localVarQueryParams.Add("repeated_string_annotation", a.Configuration.APIClient.ParameterToString(repeatedStringAnnotation, repeatedStringAnnotationCollectionFormat)) localVarQueryParams.Add("nested_annotation.name", a.Configuration.APIClient.ParameterToString(nestedAnnotationName, "")) diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 048fa8da4b3..0bbb58038e2 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -328,7 +328,8 @@ "type": "array", "items": { "type": "string" - } + }, + "collectionFormat": "multi" }, { "name": "oneof_string", @@ -361,7 +362,8 @@ "ZERO", "ONE" ] - } + }, + "collectionFormat": "multi" }, { "name": "repeated_enum_annotation", @@ -375,7 +377,8 @@ "ZERO", "ONE" ] - } + }, + "collectionFormat": "multi" }, { "name": "enum_value_annotation", @@ -397,7 +400,8 @@ "type": "array", "items": { "type": "string" - } + }, + "collectionFormat": "multi" }, { "name": "nested_annotation.name", @@ -1526,7 +1530,8 @@ "type": "array", "items": { "$ref": "#/definitions/ABitOfEverythingNested" - } + }, + "collectionFormat": "multi" }, "float_value": { "type": "number", @@ -1605,7 +1610,8 @@ "type": "array", "items": { "type": "string" - } + }, + "collectionFormat": "multi" }, "oneof_empty": { "properties": {} @@ -1643,7 +1649,8 @@ "items": { "$ref": "#/definitions/examplepbNumericEnum" }, - "title": "repeated enum value. it is comma-separated in query" + "title": "repeated enum value. it is comma-separated in query", + "collectionFormat": "multi" }, "repeated_enum_annotation": { "type": "array", @@ -1651,7 +1658,8 @@ "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", - "title": "Repeated numeric enum title" + "title": "Repeated numeric enum title", + "collectionFormat": "multi" }, "enum_value_annotation": { "$ref": "#/definitions/examplepbNumericEnum", @@ -1664,7 +1672,8 @@ "type": "string" }, "description": "Repeated string description.", - "title": "Repeated string title" + "title": "Repeated string title", + "collectionFormat": "multi" }, "repeated_nested_annotation": { "type": "array", @@ -1672,7 +1681,8 @@ "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", - "title": "Repeated nested object title" + "title": "Repeated nested object title", + "collectionFormat": "multi" }, "nested_annotation": { "$ref": "#/definitions/ABitOfEverythingNested", @@ -1714,110 +1724,126 @@ "type": "number", "format": "float" }, - "title": "repeated values. they are comma-separated in path" + "title": "repeated values. they are comma-separated in path", + "collectionFormat": "multi" }, "path_repeated_double_value": { "type": "array", "items": { "type": "number", "format": "double" - } + }, + "collectionFormat": "multi" }, "path_repeated_int64_value": { "type": "array", "items": { "type": "string", "format": "int64" - } + }, + "collectionFormat": "multi" }, "path_repeated_uint64_value": { "type": "array", "items": { "type": "string", "format": "uint64" - } + }, + "collectionFormat": "multi" }, "path_repeated_int32_value": { "type": "array", "items": { "type": "integer", "format": "int32" - } + }, + "collectionFormat": "multi" }, "path_repeated_fixed64_value": { "type": "array", "items": { "type": "string", "format": "uint64" - } + }, + "collectionFormat": "multi" }, "path_repeated_fixed32_value": { "type": "array", "items": { "type": "integer", "format": "int64" - } + }, + "collectionFormat": "multi" }, "path_repeated_bool_value": { "type": "array", "items": { "type": "boolean", "format": "boolean" - } + }, + "collectionFormat": "multi" }, "path_repeated_string_value": { "type": "array", "items": { "type": "string" - } + }, + "collectionFormat": "multi" }, "path_repeated_bytes_value": { "type": "array", "items": { "type": "string", "format": "byte" - } + }, + "collectionFormat": "multi" }, "path_repeated_uint32_value": { "type": "array", "items": { "type": "integer", "format": "int64" - } + }, + "collectionFormat": "multi" }, "path_repeated_enum_value": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" - } + }, + "collectionFormat": "multi" }, "path_repeated_sfixed32_value": { "type": "array", "items": { "type": "integer", "format": "int32" - } + }, + "collectionFormat": "multi" }, "path_repeated_sfixed64_value": { "type": "array", "items": { "type": "string", "format": "int64" - } + }, + "collectionFormat": "multi" }, "path_repeated_sint32_value": { "type": "array", "items": { "type": "integer", "format": "int32" - } + }, + "collectionFormat": "multi" }, "path_repeated_sint64_value": { "type": "array", "items": { "type": "string", "format": "int64" - } + }, + "collectionFormat": "multi" } }, "title": "ABitOfEverythingRepeated is used to validate repeated path parameter functionality" @@ -1867,7 +1893,8 @@ "items": { "type": "string" }, - "description": "The set of field mask paths." + "description": "The set of field mask paths.", + "collectionFormat": "multi" } }, "description": "paths: \"f.a\"\n paths: \"f.b.d\"\n\nHere `f` represents a field in some root message, `a` and `b`\nfields in the message found in `f`, and `d` a field found in the\nmessage in `f.b`.\n\nField masks are used to specify a subset of fields that should be\nreturned by a get operation or modified by an update operation.\nField masks also have a custom JSON encoding (see below).\n\n# Field Masks in Projections\n\nWhen used in the context of a projection, a response message or\nsub-message is filtered by the API to only contain those fields as\nspecified in the mask. For example, if the mask in the previous\nexample is applied to a response message as follows:\n\n f {\n a : 22\n b {\n d : 1\n x : 2\n }\n y : 13\n }\n z: 8\n\nThe result will not contain specific values for fields x,y and z\n(their value will be set to the default, and omitted in proto text\noutput):\n\n\n f {\n a : 22\n b {\n d : 1\n }\n }\n\nA repeated field is not allowed except at the last position of a\npaths string.\n\nIf a FieldMask object is not present in a get operation, the\noperation applies to all fields (as if a FieldMask of all fields\nhad been specified).\n\nNote that a field mask does not necessarily apply to the\ntop-level response message. In case of a REST get operation, the\nfield mask applies directly to the response, but in case of a REST\nlist operation, the mask instead applies to each individual message\nin the returned resource list. In case of a REST custom method,\nother definitions may be used. Where the mask applies will be\nclearly documented together with its declaration in the API. In\nany case, the effect on the returned resource/resources is required\nbehavior for APIs.\n\n# Field Masks in Update Operations\n\nA field mask in update operations specifies which fields of the\ntargeted resource are going to be updated. The API is required\nto only change the values of the fields as specified in the mask\nand leave the others untouched. If a resource is passed in to\ndescribe the updated values, the API ignores the values of all\nfields not covered by the mask.\n\nIf a repeated field is specified for an update operation, new values will\nbe appended to the existing repeated field in the target resource. Note that\na repeated field is only allowed in the last position of a `paths` string.\n\nIf a sub-message is specified in the last position of the field mask for an\nupdate operation, then new value will be merged into the existing sub-message\nin the target resource.\n\nFor example, given the target message:\n\n f {\n b {\n d: 1\n x: 2\n }\n c: [1]\n }\n\nAnd an update message:\n\n f {\n b {\n d: 10\n }\n c: [2]\n }\n\nthen if the field mask is:\n\n paths: [\"f.b\", \"f.c\"]\n\nthen the result will be:\n\n f {\n b {\n d: 10\n x: 2\n }\n c: [1, 2]\n }\n\nAn implementation may provide options to override this default behavior for\nrepeated and message fields.\n\nIn order to reset a field's value to the default, the field must\nbe in the mask and set to the default value in the provided resource.\nHence, in order to reset all fields of a resource, provide a default\ninstance of the resource and set all fields in the mask, or do\nnot provide a mask as described below.\n\nIf a field mask is not present on update, the operation applies to\nall fields (as if a field mask of all fields has been specified).\nNote that in the presence of schema evolution, this may mean that\nfields the client does not know and has therefore not filled into\nthe request will be reset to their default. If this is unwanted\nbehavior, a specific service may require a client to always specify\na field mask, producing an error if not.\n\nAs with get operations, the location of the resource which\ndescribes the updated values in the request message depends on the\noperation kind. In any case, the effect of the field mask is\nrequired to be honored by the API.\n\n## Considerations for HTTP REST\n\nThe HTTP kind of an update operation which uses a field mask must\nbe set to PATCH instead of PUT in order to satisfy HTTP semantics\n(PUT must only be used for full updates).\n\n# JSON Encoding of Field Masks\n\nIn JSON, a field mask is encoded as a single string where paths are\nseparated by a comma. Fields name in each path are converted\nto/from lower-camel naming conventions.\n\nAs an example, consider the following message declarations:\n\n message Profile {\n User user = 1;\n Photo photo = 2;\n }\n message User {\n string display_name = 1;\n string address = 2;\n }\n\nIn proto a field mask for `Profile` may look as such:\n\n mask {\n paths: \"user.display_name\"\n paths: \"photo\"\n }\n\nIn JSON, the same mask is represented as below:\n\n {\n mask: \"user.displayName,photo\"\n }\n\n# Field Masks and Oneof Fields\n\nField masks treat fields in oneofs just as regular fields. Consider the\nfollowing message:\n\n message SampleMessage {\n oneof test_oneof {\n string name = 4;\n SubMessage sub_message = 9;\n }\n }\n\nThe field mask can be:\n\n mask {\n paths: \"name\"\n }\n\nOr:\n\n mask {\n paths: \"sub_message\"\n }\n\nNote that oneof type names (\"test_oneof\" in this case) cannot be used in\npaths.\n\n## Field Mask Verification\n\nThe implementation of any API method which has a FieldMask type field in the\nrequest should verify the included field paths, and return an\n`INVALID_ARGUMENT` error if any path is duplicated or unmappable.", diff --git a/examples/proto/examplepb/response_body_service.swagger.json b/examples/proto/examplepb/response_body_service.swagger.json index 820129e93eb..3150845833c 100644 --- a/examples/proto/examplepb/response_body_service.swagger.json +++ b/examples/proto/examplepb/response_body_service.swagger.json @@ -25,7 +25,8 @@ "type": "array", "items": { "$ref": "#/definitions/examplepbRepeatedResponseBodyOutResponse" - } + }, + "collectionFormat": "multi" } } }, @@ -76,7 +77,8 @@ "type": "array", "items": { "type": "string" - } + }, + "collectionFormat": "multi" } } }, @@ -112,7 +114,8 @@ "type": "array", "items": { "$ref": "#/definitions/examplepbRepeatedResponseBodyOutResponse" - } + }, + "collectionFormat": "multi" } } }, @@ -134,7 +137,8 @@ "type": "array", "items": { "type": "string" - } + }, + "collectionFormat": "multi" } } }, diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index d67b6d24496..e24bd55feb6 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -143,7 +143,8 @@ "type": "array", "items": { "$ref": "#/definitions/ABitOfEverythingNested" - } + }, + "collectionFormat": "multi" }, "float_value": { "type": "number", @@ -222,7 +223,8 @@ "type": "array", "items": { "type": "string" - } + }, + "collectionFormat": "multi" }, "oneof_empty": { "properties": {} @@ -260,7 +262,8 @@ "items": { "$ref": "#/definitions/examplepbNumericEnum" }, - "title": "repeated enum value. it is comma-separated in query" + "title": "repeated enum value. it is comma-separated in query", + "collectionFormat": "multi" }, "repeated_enum_annotation": { "type": "array", @@ -268,7 +271,8 @@ "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", - "title": "Repeated numeric enum title" + "title": "Repeated numeric enum title", + "collectionFormat": "multi" }, "enum_value_annotation": { "$ref": "#/definitions/examplepbNumericEnum", @@ -281,7 +285,8 @@ "type": "string" }, "description": "Repeated string description.", - "title": "Repeated string title" + "title": "Repeated string title", + "collectionFormat": "multi" }, "repeated_nested_annotation": { "type": "array", @@ -289,7 +294,8 @@ "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", - "title": "Repeated nested object title" + "title": "Repeated nested object title", + "collectionFormat": "multi" }, "nested_annotation": { "$ref": "#/definitions/ABitOfEverythingNested", @@ -362,7 +368,8 @@ "type": "array", "items": { "$ref": "#/definitions/protobufAny" - } + }, + "collectionFormat": "multi" } } }, diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 55f42093b59..b4f1b9b8460 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -132,13 +132,14 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st } param := swaggerParameterObject{ - Description: desc, - In: "query", - Default: schema.Default, - Type: schema.Type, - Items: schema.Items, - Format: schema.Format, - Required: required, + Description: desc, + In: "query", + Default: schema.Default, + Type: schema.Type, + Items: schema.Items, + Format: schema.Format, + CollectionFormat: schema.CollectionFormat, + Required: required, } if reg.GetUseJSONNamesForFields() { @@ -423,6 +424,7 @@ func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) s Type: "array", Items: (*swaggerItemsObject)(&core), }, + CollectionFormat: "multi", } case object: ret = swaggerSchemaObject{ @@ -1255,9 +1257,9 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, is } // overrides the schema value only if it's empty // keep the comment precedence when updating the package definition - if descriptionValue.Len() == 0 || isPackageObject { + if descriptionValue.Len() == 0 || isPackageObject { descriptionValue.Set(reflect.ValueOf(description)) - } + } } return nil } diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 603e2ed8feb..d2e4c05b61f 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -58,6 +58,12 @@ func TestMessageToQueryParameters(t *testing.T) { Type: protodescriptor.FieldDescriptorProto_TYPE_DOUBLE.Enum(), Number: proto.Int32(2), }, + { + Name: proto.String("c"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: protodescriptor.FieldDescriptorProto_LABEL_REPEATED.Enum(), + Number: proto.Int32(3), + }, }, }, }, @@ -76,6 +82,13 @@ func TestMessageToQueryParameters(t *testing.T) { Type: "number", Format: "double", }, + swaggerParameterObject{ + Name: "c", + In: "query", + Required: false, + Type: "array", + CollectionFormat: "multi", + }, }, }, { @@ -192,6 +205,10 @@ func TestMessageToQueryParameters(t *testing.T) { if err != nil { t.Fatalf("failed to convert message to query parameters: %s", err) } + // avoid checking Items for array types + for i := range params { + params[i].Items = nil + } if !reflect.DeepEqual(params, test.Params) { t.Errorf("expected %v, got %v", test.Params, params) } @@ -1505,106 +1522,105 @@ func TestProtoComments(t *testing.T) { func TestUpdateSwaggerDataFromComments(t *testing.T) { tests := []struct { - descr string - swaggerObject interface{} - comments string - expectedError error - expectedSwaggerObject interface{} + descr string + swaggerObject interface{} + comments string + expectedError error + expectedSwaggerObject interface{} }{ { - descr: "empty comments", - swaggerObject: nil, + descr: "empty comments", + swaggerObject: nil, expectedSwaggerObject: nil, - comments: "", - expectedError: nil, + comments: "", + expectedError: nil, }, { - descr: "set field to read only", + descr: "set field to read only", swaggerObject: &swaggerSchemaObject{}, expectedSwaggerObject: &swaggerSchemaObject{ - ReadOnly: true, + ReadOnly: true, Description: "... Output only. ...", }, - comments: "... Output only. ...", + comments: "... Output only. ...", expectedError: nil, }, { - descr: "set title", + descr: "set title", swaggerObject: &swaggerSchemaObject{}, expectedSwaggerObject: &swaggerSchemaObject{ Title: "Comment with no trailing dot", }, - comments: "Comment with no trailing dot", + comments: "Comment with no trailing dot", expectedError: nil, }, { - descr: "set description", + descr: "set description", swaggerObject: &swaggerSchemaObject{}, expectedSwaggerObject: &swaggerSchemaObject{ Description: "Comment with trailing dot.", }, - comments: "Comment with trailing dot.", + comments: "Comment with trailing dot.", expectedError: nil, }, { descr: "use info object", swaggerObject: &swaggerObject{ - Info: swaggerInfoObject{ - }, + Info: swaggerInfoObject{}, }, expectedSwaggerObject: &swaggerObject{ Info: swaggerInfoObject{ Description: "Comment with trailing dot.", }, }, - comments: "Comment with trailing dot.", + comments: "Comment with trailing dot.", expectedError: nil, }, { - descr: "multi line comment with title", + descr: "multi line comment with title", swaggerObject: &swaggerSchemaObject{}, - expectedSwaggerObject: &swaggerSchemaObject { - Title: "First line", + expectedSwaggerObject: &swaggerSchemaObject{ + Title: "First line", Description: "Second line", }, - comments: "First line\n\nSecond line", + comments: "First line\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment no title", + descr: "multi line comment no title", swaggerObject: &swaggerSchemaObject{}, - expectedSwaggerObject: &swaggerSchemaObject { + expectedSwaggerObject: &swaggerSchemaObject{ Description: "First line.\n\nSecond line", }, - comments: "First line.\n\nSecond line", + comments: "First line.\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment with summary with dot", + descr: "multi line comment with summary with dot", swaggerObject: &swaggerOperationObject{}, - expectedSwaggerObject: &swaggerOperationObject { - Summary: "First line.", + expectedSwaggerObject: &swaggerOperationObject{ + Summary: "First line.", Description: "Second line", }, - comments: "First line.\n\nSecond line", + comments: "First line.\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment with summary no dot", + descr: "multi line comment with summary no dot", swaggerObject: &swaggerOperationObject{}, - expectedSwaggerObject: &swaggerOperationObject { - Summary: "First line", + expectedSwaggerObject: &swaggerOperationObject{ + Summary: "First line", Description: "Second line", }, - comments: "First line\n\nSecond line", + comments: "First line\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment with summary no dot", - swaggerObject: &schemaCore{}, + descr: "multi line comment with summary no dot", + swaggerObject: &schemaCore{}, expectedSwaggerObject: &schemaCore{}, - comments: "Any comment", - expectedError: errors.New("no description nor summary property"), + comments: "Any comment", + expectedError: errors.New("no description nor summary property"), }, } @@ -1632,4 +1648,4 @@ func TestUpdateSwaggerDataFromComments(t *testing.T) { } }) } -} \ No newline at end of file +} diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 6599937dc69..ddc63167db1 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -224,6 +224,7 @@ type swaggerSchemaObject struct { MaxProperties uint64 `json:"maxProperties,omitempty"` MinProperties uint64 `json:"minProperties,omitempty"` Required []string `json:"required,omitempty"` + CollectionFormat string `json:"collectionFormat,omitempty"` } // http://swagger.io/specification/#referenceObject From 13701eb949845688899cb30e6d1d1bef0857d3ad Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 11 Mar 2019 12:08:51 +0000 Subject: [PATCH 390/552] Regenerate changelog for 1.8.3 --- CHANGELOG.md | 22 ++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c555b2ee5..c047bb966c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Change Log +## [v1.8.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.3) (2019-03-11) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.2...v1.8.3) + +**Implemented enhancements:** + +- Feature request from openapi 3: Allow apiKey in cookie [\#900](https://github.com/grpc-ecosystem/grpc-gateway/issues/900) + +**Fixed bugs:** + +- Error while defining enum comments [\#897](https://github.com/grpc-ecosystem/grpc-gateway/issues/897) + +**Closed issues:** + +- Its impossible to send response with non 200 status code [\#901](https://github.com/grpc-ecosystem/grpc-gateway/issues/901) +- Swagger get query param documentation shows repeated fields incorrectly [\#756](https://github.com/grpc-ecosystem/grpc-gateway/issues/756) + +**Merged pull requests:** + +- Use collectionFormat multi for query params of repeated fields [\#902](https://github.com/grpc-ecosystem/grpc-gateway/pull/902) ([bmperrea](https://github.com/bmperrea)) + ## [v1.8.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.2) (2019-03-07) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.1...v1.8.2) @@ -18,6 +38,7 @@ **Merged pull requests:** +- Regenerate changelog for 1.8.2 [\#899](https://github.com/grpc-ecosystem/grpc-gateway/pull/899) ([johanbrandhorst](https://github.com/johanbrandhorst)) - 897 fixing problem while generating swagger documentation for enum messages [\#898](https://github.com/grpc-ecosystem/grpc-gateway/pull/898) ([fahernandez](https://github.com/fahernandez)) - bugfix: disable IOReaderFactory for streaming requests [\#896](https://github.com/grpc-ecosystem/grpc-gateway/pull/896) ([happyalu](https://github.com/happyalu)) - bazel: Use new ProtoInfo provider [\#893](https://github.com/grpc-ecosystem/grpc-gateway/pull/893) ([drigz](https://github.com/drigz)) @@ -69,6 +90,7 @@ - Add fqn\_for\_swagger\_name option [\#881](https://github.com/grpc-ecosystem/grpc-gateway/pull/881) ([hypnoce](https://github.com/hypnoce)) - go.mod: update grpc from v1.16.0 to v1.17.0 [\#880](https://github.com/grpc-ecosystem/grpc-gateway/pull/880) ([klim0v](https://github.com/klim0v)) - Fix parameter names when using JSON names. [\#879](https://github.com/grpc-ecosystem/grpc-gateway/pull/879) ([brocaar](https://github.com/brocaar)) +- protoc-gen-swagger: return error when encoding swagger file [\#878](https://github.com/grpc-ecosystem/grpc-gateway/pull/878) ([elliots](https://github.com/elliots)) - protoc-gen-grpc-gateway: use context package from stdlib [\#876](https://github.com/grpc-ecosystem/grpc-gateway/pull/876) ([simonpasquier](https://github.com/simonpasquier)) - Run buildifer on WORKSPACE [\#875](https://github.com/grpc-ecosystem/grpc-gateway/pull/875) ([achew22](https://github.com/achew22)) - Upgrade to rules\_go 0.17.0 [\#874](https://github.com/grpc-ecosystem/grpc-gateway/pull/874) ([achew22](https://github.com/achew22)) diff --git a/Makefile b/Makefile index c1d8ec93227..4103c542012 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.8.2 + --future-release=v1.8.3 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 162904ff563225073afcd8cb59bfc6fd6ceaeeb7 Mon Sep 17 00:00:00 2001 From: Wim Spaargaren Date: Mon, 11 Mar 2019 17:25:07 +0100 Subject: [PATCH 391/552] New proposal: support for the google.api.HttpBody (#904) * Implementation of HTTPBody marshaler * Rework HTTPBodyMarshaler fallback marshaler * Added tests. * Fix gomod * Fixed tests and added two new ones. * Added marshal backwards compatibility * Last line modsum was removed. * Embedded Marshaler & fixed import order * Removed inherited methods. * Comment improvements * Added small readme. * Doc enhancements * Identation fix * What's wrong with identation --- docs/_docs/httpbody.md | 43 ++++++++++ runtime/errors.go | 17 +++- runtime/handler.go | 11 ++- runtime/marshal_httpbodyproto.go | 43 ++++++++++ runtime/marshal_httpbodyproto_test.go | 49 ++++++++++++ runtime/proto_errors.go | 15 +++- third_party/googleapis/README.grpc-gateway | 1 + .../googleapis/google/api/httpbody.proto | 78 +++++++++++++++++++ 8 files changed, 249 insertions(+), 8 deletions(-) create mode 100644 docs/_docs/httpbody.md create mode 100644 runtime/marshal_httpbodyproto.go create mode 100644 runtime/marshal_httpbodyproto_test.go create mode 100644 third_party/googleapis/google/api/httpbody.proto diff --git a/docs/_docs/httpbody.md b/docs/_docs/httpbody.md new file mode 100644 index 00000000000..f95148ab336 --- /dev/null +++ b/docs/_docs/httpbody.md @@ -0,0 +1,43 @@ +--- +category: documentation +--- + +# HttpBody message Feature +The [HTTP Body](https://github.com/googleapis/googleapis/blob/master/google/api/httpbody.proto) messages allows a response message to be specified with custom data content and a custom content type header. The values included in the HTTPBody response will be used verbatim in the returned message from the gateway. Make sure you format your response carefully! + +## Example Usage +1. Create a mux with the HTTP Body Marshaler as option. + +```golang + mux := runtime.NewServeMux(runtime.SetHTTPBodyMarshaler) +``` +2. Define your service in gRPC with an httpbody response message + +```golang +import "google/api/httpbody.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; + +service HttpBodyExampleService { + + rpc HelloWorld(google.protobuf.Empty) returns (google.api.HttpBody) { + option (google.api.http) = { + get: "/helloworld" + }; + } + +} +``` +3. Generate gRPC and reverse-proxy stubs and implement your service. + +## Example service implementation + +```golang +func (*HttpBodyExampleService) Helloworld(ctx context.Context, in *empty.Empty) (*httpbody.HttpBody, error) { + return &httpbody.HttpBody{ + ContentType: "text/html", + Data: []byte("Hello World"), + }, nil +} + +``` \ No newline at end of file diff --git a/runtime/errors.go b/runtime/errors.go index b39f55ea824..41d54ef916a 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -65,7 +65,7 @@ var ( ) type errorBody struct { - Error string `protobuf:"bytes,1,name=error" json:"error"` + Error string `protobuf:"bytes,1,name=error" json:"error"` // This is to make the error more compatible with users that expect errors to be Status objects: // https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto // It should be the exact same message as the Error field. @@ -88,14 +88,23 @@ func (*errorBody) ProtoMessage() {} func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) { const fallback = `{"error": "failed to marshal error message"}` - w.Header().Del("Trailer") - w.Header().Set("Content-Type", marshaler.ContentType()) - s, ok := status.FromError(err) if !ok { s = status.New(codes.Unknown, err.Error()) } + w.Header().Del("Trailer") + + contentType := marshaler.ContentType() + // Check marshaler on run time in order to keep backwards compatability + // An interface param needs to be added to the ContentType() function on + // the Marshal interface to be able to remove this check + if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { + pb := s.Proto() + contentType = httpBodyMarshaler.ContentTypeFromMessage(pb) + } + w.Header().Set("Content-Type", contentType) + body := &errorBody{ Error: s.Message(), Message: s.Message(), diff --git a/runtime/handler.go b/runtime/handler.go index 58ba686b81b..1fc63f7f58b 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -121,7 +121,16 @@ func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marsha handleForwardResponseServerMetadata(w, mux, md) handleForwardResponseTrailerHeader(w, md) - w.Header().Set("Content-Type", marshaler.ContentType()) + + contentType := marshaler.ContentType() + // Check marshaler on run time in order to keep backwards compatability + // An interface param needs to be added to the ContentType() function on + // the Marshal interface to be able to remove this check + if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { + contentType = httpBodyMarshaler.ContentTypeFromMessage(resp) + } + w.Header().Set("Content-Type", contentType) + if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { HTTPError(ctx, mux, marshaler, w, req, err) return diff --git a/runtime/marshal_httpbodyproto.go b/runtime/marshal_httpbodyproto.go new file mode 100644 index 00000000000..f55285b5d6c --- /dev/null +++ b/runtime/marshal_httpbodyproto.go @@ -0,0 +1,43 @@ +package runtime + +import ( + "google.golang.org/genproto/googleapis/api/httpbody" +) + +// SetHTTPBodyMarshaler overwrite the default marshaler with the HTTPBodyMarshaler +func SetHTTPBodyMarshaler(serveMux *ServeMux) { + serveMux.marshalers.mimeMap[MIMEWildcard] = &HTTPBodyMarshaler{ + Marshaler: &JSONPb{OrigName: true}, + } +} + +// HTTPBodyMarshaler is a Marshaler which supports marshaling of a +// google.api.HttpBody message as the full response body if it is +// the actual message used as the response. If not, then this will +// simply fallback to the Marshaler specified as its default Marshaler. +type HTTPBodyMarshaler struct { + Marshaler +} + +// ContentType implementation to keep backwards compatability with marshal interface +func (h *HTTPBodyMarshaler) ContentType() string { + return h.ContentTypeFromMessage(nil) +} + +// ContentTypeFromMessage in case v is a google.api.HttpBody message it returns +// its specified content type otherwise fall back to the default Marshaler. +func (h *HTTPBodyMarshaler) ContentTypeFromMessage(v interface{}) string { + if httpBody, ok := v.(*httpbody.HttpBody); ok { + return httpBody.GetContentType() + } + return h.Marshaler.ContentType() +} + +// Marshal marshals "v" by returning the body bytes if v is a +// google.api.HttpBody message, otherwise it falls back to the default Marshaler. +func (h *HTTPBodyMarshaler) Marshal(v interface{}) ([]byte, error) { + if httpBody, ok := v.(*httpbody.HttpBody); ok { + return httpBody.Data, nil + } + return h.Marshaler.Marshal(v) +} diff --git a/runtime/marshal_httpbodyproto_test.go b/runtime/marshal_httpbodyproto_test.go new file mode 100644 index 00000000000..1f07022770a --- /dev/null +++ b/runtime/marshal_httpbodyproto_test.go @@ -0,0 +1,49 @@ +package runtime_test + +import ( + "bytes" + "testing" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "google.golang.org/genproto/googleapis/api/httpbody" +) + +func TestHTTPBodyContentType(t *testing.T) { + m := runtime.HTTPBodyMarshaler{ + &runtime.JSONPb{ + OrigName: true, + }, + } + expected := "CustomContentType" + message := &httpbody.HttpBody{ + ContentType: expected, + } + res := m.ContentType() + if res != "application/json" { + t.Errorf("content type not equal (%q, %q)", res, expected) + } + res = m.ContentTypeFromMessage(message) + if res != expected { + t.Errorf("content type not equal (%q, %q)", res, expected) + } +} + +func TestHTTPBodyMarshal(t *testing.T) { + m := runtime.HTTPBodyMarshaler{ + &runtime.JSONPb{ + OrigName: true, + }, + } + expected := []byte("Some test") + message := &httpbody.HttpBody{ + Data: expected, + } + res, err := m.Marshal(message) + if err != nil { + t.Errorf("m.Marshal(%#v) failed with %v; want success", message, err) + } + if !bytes.Equal(res, expected) { + t.Errorf("Marshalled data not equal (%q, %q)", res, expected) + + } +} diff --git a/runtime/proto_errors.go b/runtime/proto_errors.go index 43fafca7c20..b7fa32e45db 100644 --- a/runtime/proto_errors.go +++ b/runtime/proto_errors.go @@ -26,14 +26,23 @@ func DefaultHTTPProtoErrorHandler(ctx context.Context, mux *ServeMux, marshaler // return Internal when Marshal failed const fallback = `{"code": 13, "message": "failed to marshal error message"}` - w.Header().Del("Trailer") - w.Header().Set("Content-Type", marshaler.ContentType()) - s, ok := status.FromError(err) if !ok { s = status.New(codes.Unknown, err.Error()) } + w.Header().Del("Trailer") + + contentType := marshaler.ContentType() + // Check marshaler on run time in order to keep backwards compatability + // An interface param needs to be added to the ContentType() function on + // the Marshal interface to be able to remove this check + if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { + pb := s.Proto() + contentType = httpBodyMarshaler.ContentTypeFromMessage(pb) + } + w.Header().Set("Content-Type", contentType) + buf, merr := marshaler.Marshal(s.Proto()) if merr != nil { grpclog.Infof("Failed to marshal error message %q: %v", s.Proto(), merr) diff --git a/third_party/googleapis/README.grpc-gateway b/third_party/googleapis/README.grpc-gateway index 5c77aece630..b7d1bea36cd 100644 --- a/third_party/googleapis/README.grpc-gateway +++ b/third_party/googleapis/README.grpc-gateway @@ -12,6 +12,7 @@ Imported Files - google/api/annotations.proto - google/api/http.proto +- google/api/httpbody.proto Generated Files diff --git a/third_party/googleapis/google/api/httpbody.proto b/third_party/googleapis/google/api/httpbody.proto new file mode 100644 index 00000000000..4428515c120 --- /dev/null +++ b/third_party/googleapis/google/api/httpbody.proto @@ -0,0 +1,78 @@ +// Copyright 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.api; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; +option java_multiple_files = true; +option java_outer_classname = "HttpBodyProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Message that represents an arbitrary HTTP body. It should only be used for +// payload formats that can't be represented as JSON, such as raw binary or +// an HTML page. +// +// +// This message can be used both in streaming and non-streaming API methods in +// the request as well as the response. +// +// It can be used as a top-level request field, which is convenient if one +// wants to extract parameters from either the URL or HTTP template into the +// request fields and also want access to the raw HTTP body. +// +// Example: +// +// message GetResourceRequest { +// // A unique request id. +// string request_id = 1; +// +// // The raw HTTP body is bound to this field. +// google.api.HttpBody http_body = 2; +// } +// +// service ResourceService { +// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); +// rpc UpdateResource(google.api.HttpBody) returns +// (google.protobuf.Empty); +// } +// +// Example with streaming methods: +// +// service CaldavService { +// rpc GetCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// rpc UpdateCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// } +// +// Use of this type only changes how the request and response bodies are +// handled, all other features will continue to work unchanged. +message HttpBody { + // The HTTP Content-Type header value specifying the content type of the body. + string content_type = 1; + + // The HTTP request/response body as raw binary. + bytes data = 2; + + // Application specific response metadata. Must be set in the first response + // for streaming APIs. + repeated google.protobuf.Any extensions = 3; +} \ No newline at end of file From 7c6ae15009e46e2bd309e34687685be6def70f02 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 13 Mar 2019 11:11:20 +0000 Subject: [PATCH 392/552] Revert "Use collectionFormat multi for query params of repeated fields (#902)" This reverts commit 2b6cab672e62c65a1bbe3a7c835c7273607e795a. It was found to have introduced a swagger spec violation, see #906. --- .../abe/a_bit_of_everything_service_api.go | 8 +- .../a_bit_of_everything.swagger.json | 81 ++++++---------- .../response_body_service.swagger.json | 12 +-- examples/proto/examplepb/stream.swagger.json | 21 ++--- protoc-gen-swagger/genswagger/template.go | 20 ++-- .../genswagger/template_test.go | 94 ++++++++----------- protoc-gen-swagger/genswagger/types.go | 1 - 7 files changed, 90 insertions(+), 147 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 415243210cd..ce7c5d817ba 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -595,20 +595,20 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, si localVarQueryParams.Add("sfixed64_value", a.Configuration.APIClient.ParameterToString(sfixed64Value, "")) localVarQueryParams.Add("sint32_value", a.Configuration.APIClient.ParameterToString(sint32Value, "")) localVarQueryParams.Add("sint64_value", a.Configuration.APIClient.ParameterToString(sint64Value, "")) - var repeatedStringValueCollectionFormat = "multi" + var repeatedStringValueCollectionFormat = "csv" localVarQueryParams.Add("repeated_string_value", a.Configuration.APIClient.ParameterToString(repeatedStringValue, repeatedStringValueCollectionFormat)) localVarQueryParams.Add("oneof_string", a.Configuration.APIClient.ParameterToString(oneofString, "")) localVarQueryParams.Add("nonConventionalNameValue", a.Configuration.APIClient.ParameterToString(nonConventionalNameValue, "")) localVarQueryParams.Add("timestamp_value", a.Configuration.APIClient.ParameterToString(timestampValue, "")) - var repeatedEnumValueCollectionFormat = "multi" + var repeatedEnumValueCollectionFormat = "csv" localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) - var repeatedEnumAnnotationCollectionFormat = "multi" + var repeatedEnumAnnotationCollectionFormat = "csv" localVarQueryParams.Add("repeated_enum_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumAnnotation, repeatedEnumAnnotationCollectionFormat)) localVarQueryParams.Add("enum_value_annotation", a.Configuration.APIClient.ParameterToString(enumValueAnnotation, "")) - var repeatedStringAnnotationCollectionFormat = "multi" + var repeatedStringAnnotationCollectionFormat = "csv" localVarQueryParams.Add("repeated_string_annotation", a.Configuration.APIClient.ParameterToString(repeatedStringAnnotation, repeatedStringAnnotationCollectionFormat)) localVarQueryParams.Add("nested_annotation.name", a.Configuration.APIClient.ParameterToString(nestedAnnotationName, "")) diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 0bbb58038e2..048fa8da4b3 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -328,8 +328,7 @@ "type": "array", "items": { "type": "string" - }, - "collectionFormat": "multi" + } }, { "name": "oneof_string", @@ -362,8 +361,7 @@ "ZERO", "ONE" ] - }, - "collectionFormat": "multi" + } }, { "name": "repeated_enum_annotation", @@ -377,8 +375,7 @@ "ZERO", "ONE" ] - }, - "collectionFormat": "multi" + } }, { "name": "enum_value_annotation", @@ -400,8 +397,7 @@ "type": "array", "items": { "type": "string" - }, - "collectionFormat": "multi" + } }, { "name": "nested_annotation.name", @@ -1530,8 +1526,7 @@ "type": "array", "items": { "$ref": "#/definitions/ABitOfEverythingNested" - }, - "collectionFormat": "multi" + } }, "float_value": { "type": "number", @@ -1610,8 +1605,7 @@ "type": "array", "items": { "type": "string" - }, - "collectionFormat": "multi" + } }, "oneof_empty": { "properties": {} @@ -1649,8 +1643,7 @@ "items": { "$ref": "#/definitions/examplepbNumericEnum" }, - "title": "repeated enum value. it is comma-separated in query", - "collectionFormat": "multi" + "title": "repeated enum value. it is comma-separated in query" }, "repeated_enum_annotation": { "type": "array", @@ -1658,8 +1651,7 @@ "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", - "title": "Repeated numeric enum title", - "collectionFormat": "multi" + "title": "Repeated numeric enum title" }, "enum_value_annotation": { "$ref": "#/definitions/examplepbNumericEnum", @@ -1672,8 +1664,7 @@ "type": "string" }, "description": "Repeated string description.", - "title": "Repeated string title", - "collectionFormat": "multi" + "title": "Repeated string title" }, "repeated_nested_annotation": { "type": "array", @@ -1681,8 +1672,7 @@ "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", - "title": "Repeated nested object title", - "collectionFormat": "multi" + "title": "Repeated nested object title" }, "nested_annotation": { "$ref": "#/definitions/ABitOfEverythingNested", @@ -1724,126 +1714,110 @@ "type": "number", "format": "float" }, - "title": "repeated values. they are comma-separated in path", - "collectionFormat": "multi" + "title": "repeated values. they are comma-separated in path" }, "path_repeated_double_value": { "type": "array", "items": { "type": "number", "format": "double" - }, - "collectionFormat": "multi" + } }, "path_repeated_int64_value": { "type": "array", "items": { "type": "string", "format": "int64" - }, - "collectionFormat": "multi" + } }, "path_repeated_uint64_value": { "type": "array", "items": { "type": "string", "format": "uint64" - }, - "collectionFormat": "multi" + } }, "path_repeated_int32_value": { "type": "array", "items": { "type": "integer", "format": "int32" - }, - "collectionFormat": "multi" + } }, "path_repeated_fixed64_value": { "type": "array", "items": { "type": "string", "format": "uint64" - }, - "collectionFormat": "multi" + } }, "path_repeated_fixed32_value": { "type": "array", "items": { "type": "integer", "format": "int64" - }, - "collectionFormat": "multi" + } }, "path_repeated_bool_value": { "type": "array", "items": { "type": "boolean", "format": "boolean" - }, - "collectionFormat": "multi" + } }, "path_repeated_string_value": { "type": "array", "items": { "type": "string" - }, - "collectionFormat": "multi" + } }, "path_repeated_bytes_value": { "type": "array", "items": { "type": "string", "format": "byte" - }, - "collectionFormat": "multi" + } }, "path_repeated_uint32_value": { "type": "array", "items": { "type": "integer", "format": "int64" - }, - "collectionFormat": "multi" + } }, "path_repeated_enum_value": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" - }, - "collectionFormat": "multi" + } }, "path_repeated_sfixed32_value": { "type": "array", "items": { "type": "integer", "format": "int32" - }, - "collectionFormat": "multi" + } }, "path_repeated_sfixed64_value": { "type": "array", "items": { "type": "string", "format": "int64" - }, - "collectionFormat": "multi" + } }, "path_repeated_sint32_value": { "type": "array", "items": { "type": "integer", "format": "int32" - }, - "collectionFormat": "multi" + } }, "path_repeated_sint64_value": { "type": "array", "items": { "type": "string", "format": "int64" - }, - "collectionFormat": "multi" + } } }, "title": "ABitOfEverythingRepeated is used to validate repeated path parameter functionality" @@ -1893,8 +1867,7 @@ "items": { "type": "string" }, - "description": "The set of field mask paths.", - "collectionFormat": "multi" + "description": "The set of field mask paths." } }, "description": "paths: \"f.a\"\n paths: \"f.b.d\"\n\nHere `f` represents a field in some root message, `a` and `b`\nfields in the message found in `f`, and `d` a field found in the\nmessage in `f.b`.\n\nField masks are used to specify a subset of fields that should be\nreturned by a get operation or modified by an update operation.\nField masks also have a custom JSON encoding (see below).\n\n# Field Masks in Projections\n\nWhen used in the context of a projection, a response message or\nsub-message is filtered by the API to only contain those fields as\nspecified in the mask. For example, if the mask in the previous\nexample is applied to a response message as follows:\n\n f {\n a : 22\n b {\n d : 1\n x : 2\n }\n y : 13\n }\n z: 8\n\nThe result will not contain specific values for fields x,y and z\n(their value will be set to the default, and omitted in proto text\noutput):\n\n\n f {\n a : 22\n b {\n d : 1\n }\n }\n\nA repeated field is not allowed except at the last position of a\npaths string.\n\nIf a FieldMask object is not present in a get operation, the\noperation applies to all fields (as if a FieldMask of all fields\nhad been specified).\n\nNote that a field mask does not necessarily apply to the\ntop-level response message. In case of a REST get operation, the\nfield mask applies directly to the response, but in case of a REST\nlist operation, the mask instead applies to each individual message\nin the returned resource list. In case of a REST custom method,\nother definitions may be used. Where the mask applies will be\nclearly documented together with its declaration in the API. In\nany case, the effect on the returned resource/resources is required\nbehavior for APIs.\n\n# Field Masks in Update Operations\n\nA field mask in update operations specifies which fields of the\ntargeted resource are going to be updated. The API is required\nto only change the values of the fields as specified in the mask\nand leave the others untouched. If a resource is passed in to\ndescribe the updated values, the API ignores the values of all\nfields not covered by the mask.\n\nIf a repeated field is specified for an update operation, new values will\nbe appended to the existing repeated field in the target resource. Note that\na repeated field is only allowed in the last position of a `paths` string.\n\nIf a sub-message is specified in the last position of the field mask for an\nupdate operation, then new value will be merged into the existing sub-message\nin the target resource.\n\nFor example, given the target message:\n\n f {\n b {\n d: 1\n x: 2\n }\n c: [1]\n }\n\nAnd an update message:\n\n f {\n b {\n d: 10\n }\n c: [2]\n }\n\nthen if the field mask is:\n\n paths: [\"f.b\", \"f.c\"]\n\nthen the result will be:\n\n f {\n b {\n d: 10\n x: 2\n }\n c: [1, 2]\n }\n\nAn implementation may provide options to override this default behavior for\nrepeated and message fields.\n\nIn order to reset a field's value to the default, the field must\nbe in the mask and set to the default value in the provided resource.\nHence, in order to reset all fields of a resource, provide a default\ninstance of the resource and set all fields in the mask, or do\nnot provide a mask as described below.\n\nIf a field mask is not present on update, the operation applies to\nall fields (as if a field mask of all fields has been specified).\nNote that in the presence of schema evolution, this may mean that\nfields the client does not know and has therefore not filled into\nthe request will be reset to their default. If this is unwanted\nbehavior, a specific service may require a client to always specify\na field mask, producing an error if not.\n\nAs with get operations, the location of the resource which\ndescribes the updated values in the request message depends on the\noperation kind. In any case, the effect of the field mask is\nrequired to be honored by the API.\n\n## Considerations for HTTP REST\n\nThe HTTP kind of an update operation which uses a field mask must\nbe set to PATCH instead of PUT in order to satisfy HTTP semantics\n(PUT must only be used for full updates).\n\n# JSON Encoding of Field Masks\n\nIn JSON, a field mask is encoded as a single string where paths are\nseparated by a comma. Fields name in each path are converted\nto/from lower-camel naming conventions.\n\nAs an example, consider the following message declarations:\n\n message Profile {\n User user = 1;\n Photo photo = 2;\n }\n message User {\n string display_name = 1;\n string address = 2;\n }\n\nIn proto a field mask for `Profile` may look as such:\n\n mask {\n paths: \"user.display_name\"\n paths: \"photo\"\n }\n\nIn JSON, the same mask is represented as below:\n\n {\n mask: \"user.displayName,photo\"\n }\n\n# Field Masks and Oneof Fields\n\nField masks treat fields in oneofs just as regular fields. Consider the\nfollowing message:\n\n message SampleMessage {\n oneof test_oneof {\n string name = 4;\n SubMessage sub_message = 9;\n }\n }\n\nThe field mask can be:\n\n mask {\n paths: \"name\"\n }\n\nOr:\n\n mask {\n paths: \"sub_message\"\n }\n\nNote that oneof type names (\"test_oneof\" in this case) cannot be used in\npaths.\n\n## Field Mask Verification\n\nThe implementation of any API method which has a FieldMask type field in the\nrequest should verify the included field paths, and return an\n`INVALID_ARGUMENT` error if any path is duplicated or unmappable.", diff --git a/examples/proto/examplepb/response_body_service.swagger.json b/examples/proto/examplepb/response_body_service.swagger.json index 3150845833c..820129e93eb 100644 --- a/examples/proto/examplepb/response_body_service.swagger.json +++ b/examples/proto/examplepb/response_body_service.swagger.json @@ -25,8 +25,7 @@ "type": "array", "items": { "$ref": "#/definitions/examplepbRepeatedResponseBodyOutResponse" - }, - "collectionFormat": "multi" + } } } }, @@ -77,8 +76,7 @@ "type": "array", "items": { "type": "string" - }, - "collectionFormat": "multi" + } } } }, @@ -114,8 +112,7 @@ "type": "array", "items": { "$ref": "#/definitions/examplepbRepeatedResponseBodyOutResponse" - }, - "collectionFormat": "multi" + } } } }, @@ -137,8 +134,7 @@ "type": "array", "items": { "type": "string" - }, - "collectionFormat": "multi" + } } } }, diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index e24bd55feb6..d67b6d24496 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -143,8 +143,7 @@ "type": "array", "items": { "$ref": "#/definitions/ABitOfEverythingNested" - }, - "collectionFormat": "multi" + } }, "float_value": { "type": "number", @@ -223,8 +222,7 @@ "type": "array", "items": { "type": "string" - }, - "collectionFormat": "multi" + } }, "oneof_empty": { "properties": {} @@ -262,8 +260,7 @@ "items": { "$ref": "#/definitions/examplepbNumericEnum" }, - "title": "repeated enum value. it is comma-separated in query", - "collectionFormat": "multi" + "title": "repeated enum value. it is comma-separated in query" }, "repeated_enum_annotation": { "type": "array", @@ -271,8 +268,7 @@ "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", - "title": "Repeated numeric enum title", - "collectionFormat": "multi" + "title": "Repeated numeric enum title" }, "enum_value_annotation": { "$ref": "#/definitions/examplepbNumericEnum", @@ -285,8 +281,7 @@ "type": "string" }, "description": "Repeated string description.", - "title": "Repeated string title", - "collectionFormat": "multi" + "title": "Repeated string title" }, "repeated_nested_annotation": { "type": "array", @@ -294,8 +289,7 @@ "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", - "title": "Repeated nested object title", - "collectionFormat": "multi" + "title": "Repeated nested object title" }, "nested_annotation": { "$ref": "#/definitions/ABitOfEverythingNested", @@ -368,8 +362,7 @@ "type": "array", "items": { "$ref": "#/definitions/protobufAny" - }, - "collectionFormat": "multi" + } } } }, diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index b4f1b9b8460..55f42093b59 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -132,14 +132,13 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st } param := swaggerParameterObject{ - Description: desc, - In: "query", - Default: schema.Default, - Type: schema.Type, - Items: schema.Items, - Format: schema.Format, - CollectionFormat: schema.CollectionFormat, - Required: required, + Description: desc, + In: "query", + Default: schema.Default, + Type: schema.Type, + Items: schema.Items, + Format: schema.Format, + Required: required, } if reg.GetUseJSONNamesForFields() { @@ -424,7 +423,6 @@ func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) s Type: "array", Items: (*swaggerItemsObject)(&core), }, - CollectionFormat: "multi", } case object: ret = swaggerSchemaObject{ @@ -1257,9 +1255,9 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, is } // overrides the schema value only if it's empty // keep the comment precedence when updating the package definition - if descriptionValue.Len() == 0 || isPackageObject { + if descriptionValue.Len() == 0 || isPackageObject { descriptionValue.Set(reflect.ValueOf(description)) - } + } } return nil } diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index d2e4c05b61f..603e2ed8feb 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -58,12 +58,6 @@ func TestMessageToQueryParameters(t *testing.T) { Type: protodescriptor.FieldDescriptorProto_TYPE_DOUBLE.Enum(), Number: proto.Int32(2), }, - { - Name: proto.String("c"), - Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), - Label: protodescriptor.FieldDescriptorProto_LABEL_REPEATED.Enum(), - Number: proto.Int32(3), - }, }, }, }, @@ -82,13 +76,6 @@ func TestMessageToQueryParameters(t *testing.T) { Type: "number", Format: "double", }, - swaggerParameterObject{ - Name: "c", - In: "query", - Required: false, - Type: "array", - CollectionFormat: "multi", - }, }, }, { @@ -205,10 +192,6 @@ func TestMessageToQueryParameters(t *testing.T) { if err != nil { t.Fatalf("failed to convert message to query parameters: %s", err) } - // avoid checking Items for array types - for i := range params { - params[i].Items = nil - } if !reflect.DeepEqual(params, test.Params) { t.Errorf("expected %v, got %v", test.Params, params) } @@ -1522,105 +1505,106 @@ func TestProtoComments(t *testing.T) { func TestUpdateSwaggerDataFromComments(t *testing.T) { tests := []struct { - descr string - swaggerObject interface{} - comments string - expectedError error - expectedSwaggerObject interface{} + descr string + swaggerObject interface{} + comments string + expectedError error + expectedSwaggerObject interface{} }{ { - descr: "empty comments", - swaggerObject: nil, + descr: "empty comments", + swaggerObject: nil, expectedSwaggerObject: nil, - comments: "", - expectedError: nil, + comments: "", + expectedError: nil, }, { - descr: "set field to read only", + descr: "set field to read only", swaggerObject: &swaggerSchemaObject{}, expectedSwaggerObject: &swaggerSchemaObject{ - ReadOnly: true, + ReadOnly: true, Description: "... Output only. ...", }, - comments: "... Output only. ...", + comments: "... Output only. ...", expectedError: nil, }, { - descr: "set title", + descr: "set title", swaggerObject: &swaggerSchemaObject{}, expectedSwaggerObject: &swaggerSchemaObject{ Title: "Comment with no trailing dot", }, - comments: "Comment with no trailing dot", + comments: "Comment with no trailing dot", expectedError: nil, }, { - descr: "set description", + descr: "set description", swaggerObject: &swaggerSchemaObject{}, expectedSwaggerObject: &swaggerSchemaObject{ Description: "Comment with trailing dot.", }, - comments: "Comment with trailing dot.", + comments: "Comment with trailing dot.", expectedError: nil, }, { descr: "use info object", swaggerObject: &swaggerObject{ - Info: swaggerInfoObject{}, + Info: swaggerInfoObject{ + }, }, expectedSwaggerObject: &swaggerObject{ Info: swaggerInfoObject{ Description: "Comment with trailing dot.", }, }, - comments: "Comment with trailing dot.", + comments: "Comment with trailing dot.", expectedError: nil, }, { - descr: "multi line comment with title", + descr: "multi line comment with title", swaggerObject: &swaggerSchemaObject{}, - expectedSwaggerObject: &swaggerSchemaObject{ - Title: "First line", + expectedSwaggerObject: &swaggerSchemaObject { + Title: "First line", Description: "Second line", }, - comments: "First line\n\nSecond line", + comments: "First line\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment no title", + descr: "multi line comment no title", swaggerObject: &swaggerSchemaObject{}, - expectedSwaggerObject: &swaggerSchemaObject{ + expectedSwaggerObject: &swaggerSchemaObject { Description: "First line.\n\nSecond line", }, - comments: "First line.\n\nSecond line", + comments: "First line.\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment with summary with dot", + descr: "multi line comment with summary with dot", swaggerObject: &swaggerOperationObject{}, - expectedSwaggerObject: &swaggerOperationObject{ - Summary: "First line.", + expectedSwaggerObject: &swaggerOperationObject { + Summary: "First line.", Description: "Second line", }, - comments: "First line.\n\nSecond line", + comments: "First line.\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment with summary no dot", + descr: "multi line comment with summary no dot", swaggerObject: &swaggerOperationObject{}, - expectedSwaggerObject: &swaggerOperationObject{ - Summary: "First line", + expectedSwaggerObject: &swaggerOperationObject { + Summary: "First line", Description: "Second line", }, - comments: "First line\n\nSecond line", + comments: "First line\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment with summary no dot", - swaggerObject: &schemaCore{}, + descr: "multi line comment with summary no dot", + swaggerObject: &schemaCore{}, expectedSwaggerObject: &schemaCore{}, - comments: "Any comment", - expectedError: errors.New("no description nor summary property"), + comments: "Any comment", + expectedError: errors.New("no description nor summary property"), }, } @@ -1648,4 +1632,4 @@ func TestUpdateSwaggerDataFromComments(t *testing.T) { } }) } -} +} \ No newline at end of file diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index ddc63167db1..6599937dc69 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -224,7 +224,6 @@ type swaggerSchemaObject struct { MaxProperties uint64 `json:"maxProperties,omitempty"` MinProperties uint64 `json:"minProperties,omitempty"` Required []string `json:"required,omitempty"` - CollectionFormat string `json:"collectionFormat,omitempty"` } // http://swagger.io/specification/#referenceObject From 7ed803dab61b3475523df9677e90b3e000097b33 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 13 Mar 2019 11:28:13 +0000 Subject: [PATCH 393/552] Generate changelog for 1.8.4 --- CHANGELOG.md | 14 +++++++++++++- Makefile | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c047bb966c0..08ac7c7d518 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## [v1.8.4](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.4) (2019-03-13) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.3...v1.8.4) + +**Closed issues:** + +- Invalid swagger generated for bodies with repeated fields [\#906](https://github.com/grpc-ecosystem/grpc-gateway/issues/906) + +**Merged pull requests:** + +- Revert "Use collectionFormat multi for query params of repeated fields \(\#902\)" [\#907](https://github.com/grpc-ecosystem/grpc-gateway/pull/907) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- New proposal: support for the google.api.HttpBody [\#904](https://github.com/grpc-ecosystem/grpc-gateway/pull/904) ([wimspaargaren](https://github.com/wimspaargaren)) + ## [v1.8.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.3) (2019-03-11) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.2...v1.8.3) @@ -14,10 +26,10 @@ **Closed issues:** - Its impossible to send response with non 200 status code [\#901](https://github.com/grpc-ecosystem/grpc-gateway/issues/901) -- Swagger get query param documentation shows repeated fields incorrectly [\#756](https://github.com/grpc-ecosystem/grpc-gateway/issues/756) **Merged pull requests:** +- Regenerate changelog for 1.8.3 [\#903](https://github.com/grpc-ecosystem/grpc-gateway/pull/903) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Use collectionFormat multi for query params of repeated fields [\#902](https://github.com/grpc-ecosystem/grpc-gateway/pull/902) ([bmperrea](https://github.com/bmperrea)) ## [v1.8.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.2) (2019-03-07) diff --git a/Makefile b/Makefile index 4103c542012..2afdf29bd28 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.8.3 + --future-release=v1.8.4 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 700c9284ad0e7b792872faf0d1ee7012f5161d1a Mon Sep 17 00:00:00 2001 From: Brent Date: Thu, 14 Mar 2019 09:47:37 -0500 Subject: [PATCH 394/552] CollectionFormat multi for query params of repeated fields 2 (#909) * Use collectionFormat multi for query params of repeated fields Fixes #756 . Also formats protoc-gen-swagger/genswagger/template_test.go according to go fmt. * regenerate the files * only specify multi in the method queryParams Fixes #906. * deep equal checks in TestSchemaOfField --- .../abe/a_bit_of_everything_service_api.go | 8 +- .../a_bit_of_everything.swagger.json | 12 +- protoc-gen-swagger/genswagger/template.go | 7 +- .../genswagger/template_test.go | 107 ++++++++++-------- protoc-gen-swagger/genswagger/types.go | 7 -- 5 files changed, 76 insertions(+), 65 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index ce7c5d817ba..415243210cd 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -595,20 +595,20 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, si localVarQueryParams.Add("sfixed64_value", a.Configuration.APIClient.ParameterToString(sfixed64Value, "")) localVarQueryParams.Add("sint32_value", a.Configuration.APIClient.ParameterToString(sint32Value, "")) localVarQueryParams.Add("sint64_value", a.Configuration.APIClient.ParameterToString(sint64Value, "")) - var repeatedStringValueCollectionFormat = "csv" + var repeatedStringValueCollectionFormat = "multi" localVarQueryParams.Add("repeated_string_value", a.Configuration.APIClient.ParameterToString(repeatedStringValue, repeatedStringValueCollectionFormat)) localVarQueryParams.Add("oneof_string", a.Configuration.APIClient.ParameterToString(oneofString, "")) localVarQueryParams.Add("nonConventionalNameValue", a.Configuration.APIClient.ParameterToString(nonConventionalNameValue, "")) localVarQueryParams.Add("timestamp_value", a.Configuration.APIClient.ParameterToString(timestampValue, "")) - var repeatedEnumValueCollectionFormat = "csv" + var repeatedEnumValueCollectionFormat = "multi" localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) - var repeatedEnumAnnotationCollectionFormat = "csv" + var repeatedEnumAnnotationCollectionFormat = "multi" localVarQueryParams.Add("repeated_enum_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumAnnotation, repeatedEnumAnnotationCollectionFormat)) localVarQueryParams.Add("enum_value_annotation", a.Configuration.APIClient.ParameterToString(enumValueAnnotation, "")) - var repeatedStringAnnotationCollectionFormat = "csv" + var repeatedStringAnnotationCollectionFormat = "multi" localVarQueryParams.Add("repeated_string_annotation", a.Configuration.APIClient.ParameterToString(repeatedStringAnnotation, repeatedStringAnnotationCollectionFormat)) localVarQueryParams.Add("nested_annotation.name", a.Configuration.APIClient.ParameterToString(nestedAnnotationName, "")) diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 048fa8da4b3..952baa18492 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -328,7 +328,8 @@ "type": "array", "items": { "type": "string" - } + }, + "collectionFormat": "multi" }, { "name": "oneof_string", @@ -361,7 +362,8 @@ "ZERO", "ONE" ] - } + }, + "collectionFormat": "multi" }, { "name": "repeated_enum_annotation", @@ -375,7 +377,8 @@ "ZERO", "ONE" ] - } + }, + "collectionFormat": "multi" }, { "name": "enum_value_annotation", @@ -397,7 +400,8 @@ "type": "array", "items": { "type": "string" - } + }, + "collectionFormat": "multi" }, { "name": "nested_annotation.name", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 55f42093b59..b802fef186d 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -140,6 +140,9 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st Format: schema.Format, Required: required, } + if param.Type == "array" { + param.CollectionFormat = "multi" + } if reg.GetUseJSONNamesForFields() { param.Name = prefix + field.GetJsonName() @@ -1255,9 +1258,9 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, is } // overrides the schema value only if it's empty // keep the comment precedence when updating the package definition - if descriptionValue.Len() == 0 || isPackageObject { + if descriptionValue.Len() == 0 || isPackageObject { descriptionValue.Set(reflect.ValueOf(description)) - } + } } return nil } diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 603e2ed8feb..6f14e5f268b 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -58,6 +58,12 @@ func TestMessageToQueryParameters(t *testing.T) { Type: protodescriptor.FieldDescriptorProto_TYPE_DOUBLE.Enum(), Number: proto.Int32(2), }, + { + Name: proto.String("c"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: protodescriptor.FieldDescriptorProto_LABEL_REPEATED.Enum(), + Number: proto.Int32(3), + }, }, }, }, @@ -76,6 +82,13 @@ func TestMessageToQueryParameters(t *testing.T) { Type: "number", Format: "double", }, + swaggerParameterObject{ + Name: "c", + In: "query", + Required: false, + Type: "array", + CollectionFormat: "multi", + }, }, }, { @@ -192,6 +205,10 @@ func TestMessageToQueryParameters(t *testing.T) { if err != nil { t.Fatalf("failed to convert message to query parameters: %s", err) } + // avoid checking Items for array types + for i := range params { + params[i].Items = nil + } if !reflect.DeepEqual(params, test.Params) { t.Errorf("expected %v, got %v", test.Params, params) } @@ -1006,7 +1023,7 @@ func TestSchemaOfField(t *testing.T) { refs: make(refMap), expected: schemaCore{ Type: "string", - Format: "bytes", + Format: "byte", }, }, { @@ -1154,14 +1171,9 @@ func TestSchemaOfField(t *testing.T) { for _, test := range tests { refs := make(refMap) actual := schemaOfField(test.field, reg, refs) - if e, a := test.expected.Type, actual.Type; e != a { - t.Errorf("Expected schemaOfField(%v).Type = %s, actual: %s", test.field, e, a) - } - if e, a := test.expected.Ref, actual.Ref; e != a { - t.Errorf("Expected schemaOfField(%v).Ref = %s, actual: %s", test.field, e, a) - } - if e, a := test.expected.Items.getType(), actual.Items.getType(); e != a { - t.Errorf("Expected schemaOfField(%v).Items.Type = %v, actual.Type: %v", test.field, e, a) + expectedSchemaObject := swaggerSchemaObject{schemaCore: test.expected} + if e, a := expectedSchemaObject, actual; !reflect.DeepEqual(a, e) { + t.Errorf("Expected schemaOfField(%v) = %v, actual: %v", test.field, e, a) } if !reflect.DeepEqual(refs, test.refs) { t.Errorf("Expected schemaOfField(%v) to add refs %v, not %v", test.field, test.refs, refs) @@ -1505,106 +1517,105 @@ func TestProtoComments(t *testing.T) { func TestUpdateSwaggerDataFromComments(t *testing.T) { tests := []struct { - descr string - swaggerObject interface{} - comments string - expectedError error - expectedSwaggerObject interface{} + descr string + swaggerObject interface{} + comments string + expectedError error + expectedSwaggerObject interface{} }{ { - descr: "empty comments", - swaggerObject: nil, + descr: "empty comments", + swaggerObject: nil, expectedSwaggerObject: nil, - comments: "", - expectedError: nil, + comments: "", + expectedError: nil, }, { - descr: "set field to read only", + descr: "set field to read only", swaggerObject: &swaggerSchemaObject{}, expectedSwaggerObject: &swaggerSchemaObject{ - ReadOnly: true, + ReadOnly: true, Description: "... Output only. ...", }, - comments: "... Output only. ...", + comments: "... Output only. ...", expectedError: nil, }, { - descr: "set title", + descr: "set title", swaggerObject: &swaggerSchemaObject{}, expectedSwaggerObject: &swaggerSchemaObject{ Title: "Comment with no trailing dot", }, - comments: "Comment with no trailing dot", + comments: "Comment with no trailing dot", expectedError: nil, }, { - descr: "set description", + descr: "set description", swaggerObject: &swaggerSchemaObject{}, expectedSwaggerObject: &swaggerSchemaObject{ Description: "Comment with trailing dot.", }, - comments: "Comment with trailing dot.", + comments: "Comment with trailing dot.", expectedError: nil, }, { descr: "use info object", swaggerObject: &swaggerObject{ - Info: swaggerInfoObject{ - }, + Info: swaggerInfoObject{}, }, expectedSwaggerObject: &swaggerObject{ Info: swaggerInfoObject{ Description: "Comment with trailing dot.", }, }, - comments: "Comment with trailing dot.", + comments: "Comment with trailing dot.", expectedError: nil, }, { - descr: "multi line comment with title", + descr: "multi line comment with title", swaggerObject: &swaggerSchemaObject{}, - expectedSwaggerObject: &swaggerSchemaObject { - Title: "First line", + expectedSwaggerObject: &swaggerSchemaObject{ + Title: "First line", Description: "Second line", }, - comments: "First line\n\nSecond line", + comments: "First line\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment no title", + descr: "multi line comment no title", swaggerObject: &swaggerSchemaObject{}, - expectedSwaggerObject: &swaggerSchemaObject { + expectedSwaggerObject: &swaggerSchemaObject{ Description: "First line.\n\nSecond line", }, - comments: "First line.\n\nSecond line", + comments: "First line.\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment with summary with dot", + descr: "multi line comment with summary with dot", swaggerObject: &swaggerOperationObject{}, - expectedSwaggerObject: &swaggerOperationObject { - Summary: "First line.", + expectedSwaggerObject: &swaggerOperationObject{ + Summary: "First line.", Description: "Second line", }, - comments: "First line.\n\nSecond line", + comments: "First line.\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment with summary no dot", + descr: "multi line comment with summary no dot", swaggerObject: &swaggerOperationObject{}, - expectedSwaggerObject: &swaggerOperationObject { - Summary: "First line", + expectedSwaggerObject: &swaggerOperationObject{ + Summary: "First line", Description: "Second line", }, - comments: "First line\n\nSecond line", + comments: "First line\n\nSecond line", expectedError: nil, }, { - descr: "multi line comment with summary no dot", - swaggerObject: &schemaCore{}, + descr: "multi line comment with summary no dot", + swaggerObject: &schemaCore{}, expectedSwaggerObject: &schemaCore{}, - comments: "Any comment", - expectedError: errors.New("no description nor summary property"), + comments: "Any comment", + expectedError: errors.New("no description nor summary property"), }, } @@ -1632,4 +1643,4 @@ func TestUpdateSwaggerDataFromComments(t *testing.T) { } }) } -} \ No newline at end of file +} diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 6599937dc69..66aaf177d23 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -150,13 +150,6 @@ type schemaCore struct { type swaggerItemsObject schemaCore -func (o *swaggerItemsObject) getType() string { - if o == nil { - return "" - } - return o.Type -} - // http://swagger.io/specification/#responsesObject type swaggerResponsesObject map[string]swaggerResponseObject From 2fa697c5fa9ead0158e421ce2c0bd46bf2426366 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 15 Mar 2019 09:51:02 +0000 Subject: [PATCH 395/552] Generate changelog for 1.8.5 --- CHANGELOG.md | 22 +++++++++++++++++----- Makefile | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08ac7c7d518..5dd1f3ee2f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## [v1.8.5](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.5) (2019-03-15) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.4...v1.8.5) + +**Closed issues:** + +- Swagger get query param documentation shows repeated fields incorrectly [\#756](https://github.com/grpc-ecosystem/grpc-gateway/issues/756) + +**Merged pull requests:** + +- CollectionFormat multi for query params of repeated fields 2 [\#909](https://github.com/grpc-ecosystem/grpc-gateway/pull/909) ([bmperrea](https://github.com/bmperrea)) + ## [v1.8.4](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.4) (2019-03-13) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.3...v1.8.4) @@ -9,6 +20,7 @@ **Merged pull requests:** +- Generate changelog for 1.8.4 [\#908](https://github.com/grpc-ecosystem/grpc-gateway/pull/908) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Revert "Use collectionFormat multi for query params of repeated fields \(\#902\)" [\#907](https://github.com/grpc-ecosystem/grpc-gateway/pull/907) ([johanbrandhorst](https://github.com/johanbrandhorst)) - New proposal: support for the google.api.HttpBody [\#904](https://github.com/grpc-ecosystem/grpc-gateway/pull/904) ([wimspaargaren](https://github.com/wimspaargaren)) @@ -439,7 +451,7 @@ - properly respect file flag for protoc-gen-swagger [\#293](https://github.com/grpc-ecosystem/grpc-gateway/pull/293) ([tmc](https://github.com/tmc)) ## [v1.3.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.1) (2017-12-23) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3.1) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.1) **Implemented enhancements:** @@ -496,11 +508,11 @@ - grpc-gateway/generator: respect full package [\#462](https://github.com/grpc-ecosystem/grpc-gateway/pull/462) ([glerchundi](https://github.com/glerchundi)) - Add proto marshaller for proto-over-http [\#459](https://github.com/grpc-ecosystem/grpc-gateway/pull/459) ([MatthewDolan](https://github.com/MatthewDolan)) -## [v1.3.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.0) - ## [v1.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3) + +## [v1.3.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3.0) **Closed issues:** diff --git a/Makefile b/Makefile index 2afdf29bd28..c6428554a5f 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.8.4 + --future-release=v1.8.5 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From bb43602c8af95a452a798d344c81352799544567 Mon Sep 17 00:00:00 2001 From: brycematheson1234 <44283277+brycematheson1234@users.noreply.github.com> Date: Wed, 27 Mar 2019 19:40:02 +1100 Subject: [PATCH 396/552] Fixed empty path bug (#913) * Removed / from list of disallowed first tokens Fixes #414 * Changed functionality to allow / * Formatting change --- protoc-gen-grpc-gateway/httprule/parse.go | 2 +- protoc-gen-grpc-gateway/httprule/parse_test.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/protoc-gen-grpc-gateway/httprule/parse.go b/protoc-gen-grpc-gateway/httprule/parse.go index 3be742685c6..f933cd85ef2 100644 --- a/protoc-gen-grpc-gateway/httprule/parse.go +++ b/protoc-gen-grpc-gateway/httprule/parse.go @@ -232,7 +232,7 @@ func (p *parser) accept(term termType) (string, error) { t := p.tokens[0] switch term { case "/", "*", "**", ".", "=", "{", "}": - if t != string(term) { + if t != string(term) && t != "/" { return "", fmt.Errorf("expected %q but got %q", term, t) } case typeEOF: diff --git a/protoc-gen-grpc-gateway/httprule/parse_test.go b/protoc-gen-grpc-gateway/httprule/parse_test.go index 6a49c712d62..6508e820c5a 100644 --- a/protoc-gen-grpc-gateway/httprule/parse_test.go +++ b/protoc-gen-grpc-gateway/httprule/parse_test.go @@ -113,6 +113,12 @@ func TestParseSegments(t *testing.T) { literal("v1"), }, }, + { + tokens: []string{"/", eof}, + want: []segment{ + wildcard{}, + }, + }, { tokens: []string{"-._~!$&'()*+,;=:@", eof}, want: []segment{ @@ -247,7 +253,7 @@ func TestParseSegmentsWithErrors(t *testing.T) { }{ { // double slash - tokens: []string{"/", eof}, + tokens: []string{"//", eof}, }, { // invalid literal From fe582df901324a5bd54490eb8dee71160b5c0509 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Sun, 31 Mar 2019 01:18:29 -0600 Subject: [PATCH 397/552] Make gazelle diffs fail the build --- .circleci/config.yml | 2 +- runtime/BUILD.bazel | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 964063f8f1e..373948713d4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -64,7 +64,7 @@ jobs: EOF - run: name: Check that Bazel BUILD files are up-to-date - command: 'bazel run //:gazelle || + command: 'bazel run //:gazelle -- --mode=diff || (echo "ERROR: Bazel files out-of-date, please run \`bazel run :gazelle\`" >&2; exit 1)' - run: name: Run tests with Bazel diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index c99f83e5851..20862228ef8 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -11,6 +11,7 @@ go_library( "errors.go", "fieldmask.go", "handler.go", + "marshal_httpbodyproto.go", "marshal_json.go", "marshal_jsonpb.go", "marshal_proto.go", @@ -29,6 +30,7 @@ go_library( "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", + "@go_googleapis//google/api:httpbody_go_proto", "@io_bazel_rules_go//proto/wkt:any_go_proto", "@io_bazel_rules_go//proto/wkt:duration_go_proto", "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", @@ -49,6 +51,7 @@ go_test( "errors_test.go", "fieldmask_test.go", "handler_test.go", + "marshal_httpbodyproto_test.go", "marshal_json_test.go", "marshal_jsonpb_test.go", "marshal_proto_test.go", @@ -65,6 +68,7 @@ go_test( "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_golang_protobuf//ptypes:go_default_library_gen", + "@go_googleapis//google/api:httpbody_go_proto", "@go_googleapis//google/rpc:errdetails_go_proto", "@io_bazel_rules_go//proto/wkt:duration_go_proto", "@io_bazel_rules_go//proto/wkt:empty_go_proto", From 6d0bd2d2f8b4a4d13f21e06d654bff2597548f4e Mon Sep 17 00:00:00 2001 From: Paul Cody Johnston Date: Sun, 14 Apr 2019 16:19:32 -0600 Subject: [PATCH 398/552] Delete redundant load statement --- WORKSPACE | 1 - 1 file changed, 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index 7c2f93819b5..4084128959d 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,6 +1,5 @@ workspace(name = "grpc_ecosystem_grpc_gateway") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( From 187901ff1ee6925ad7b2c9f1b23e3c681c7db943 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 7 May 2019 16:35:22 +0100 Subject: [PATCH 399/552] Generate changelog for 1.8.6 --- CHANGELOG.md | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dd1f3ee2f6..8124fdf36a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Change Log +## [v1.8.5](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.5) (2019-05-07) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.5...v1.8.5) + +**Fixed bugs:** + +- can't specify an empty path? [\#414](https://github.com/grpc-ecosystem/grpc-gateway/issues/414) + +**Closed issues:** + +- JSON stream response not available [\#926](https://github.com/grpc-ecosystem/grpc-gateway/issues/926) +- why google/api/http.proto annotations.proto Field Numbers is 72295728 ? [\#925](https://github.com/grpc-ecosystem/grpc-gateway/issues/925) +- Documentation: 'base\_path' Swagger attribute confuses users [\#918](https://github.com/grpc-ecosystem/grpc-gateway/issues/918) +- go get: error loading module requirements go 1.11 [\#915](https://github.com/grpc-ecosystem/grpc-gateway/issues/915) +- gateway generation issue on windows [\#911](https://github.com/grpc-ecosystem/grpc-gateway/issues/911) + +**Merged pull requests:** + +- Delete redundant load statement [\#922](https://github.com/grpc-ecosystem/grpc-gateway/pull/922) ([pcj](https://github.com/pcj)) +- Make gazelle diffs fail the build [\#916](https://github.com/grpc-ecosystem/grpc-gateway/pull/916) ([achew22](https://github.com/achew22)) +- Fixed empty path bug [\#913](https://github.com/grpc-ecosystem/grpc-gateway/pull/913) ([brycematheson1234](https://github.com/brycematheson1234)) + ## [v1.8.5](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.5) (2019-03-15) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.4...v1.8.5) @@ -9,6 +30,7 @@ **Merged pull requests:** +- Generate changelog for 1.8.5 [\#910](https://github.com/grpc-ecosystem/grpc-gateway/pull/910) ([johanbrandhorst](https://github.com/johanbrandhorst)) - CollectionFormat multi for query params of repeated fields 2 [\#909](https://github.com/grpc-ecosystem/grpc-gateway/pull/909) ([bmperrea](https://github.com/bmperrea)) ## [v1.8.4](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.4) (2019-03-13) @@ -778,7 +800,7 @@ - Method parameter in query string [\#6](https://github.com/grpc-ecosystem/grpc-gateway/issues/6) - Integrate authentication [\#4](https://github.com/grpc-ecosystem/grpc-gateway/issues/4) - Add swagger support [\#68](https://github.com/grpc-ecosystem/grpc-gateway/pull/68) ([achew22](https://github.com/achew22)) -- Add runtime.WithForwardResponseOption [\#53](https://github.com/grpc-ecosystem/grpc-gateway/pull/53) ([peter-edge](https://github.com/peter-edge)) +- Add runtime.WithForwardResponseOption [\#53](https://github.com/grpc-ecosystem/grpc-gateway/pull/53) ([pedgeio](https://github.com/pedgeio)) **Fixed bugs:** @@ -888,15 +910,15 @@ - Fix broken test [\#76](https://github.com/grpc-ecosystem/grpc-gateway/pull/76) ([yugui](https://github.com/yugui)) - Added missing instruction line in README [\#75](https://github.com/grpc-ecosystem/grpc-gateway/pull/75) ([betrcode](https://github.com/betrcode)) - Fix a complie error in generated go files [\#71](https://github.com/grpc-ecosystem/grpc-gateway/pull/71) ([yugui](https://github.com/yugui)) -- Update generated .pb.go files in third\_party [\#69](https://github.com/grpc-ecosystem/grpc-gateway/pull/69) ([peter-edge](https://github.com/peter-edge)) +- Update generated .pb.go files in third\_party [\#69](https://github.com/grpc-ecosystem/grpc-gateway/pull/69) ([pedgeio](https://github.com/pedgeio)) - Bugfix/handling headers for `Authorization` and `Host` [\#65](https://github.com/grpc-ecosystem/grpc-gateway/pull/65) ([mwitkow](https://github.com/mwitkow)) - Fix `error` field always in chunk response [\#64](https://github.com/grpc-ecosystem/grpc-gateway/pull/64) ([mwitkow](https://github.com/mwitkow)) - Update .pb.go to latest version. [\#63](https://github.com/grpc-ecosystem/grpc-gateway/pull/63) ([johansja](https://github.com/johansja)) - Run more tests in Travis CI [\#60](https://github.com/grpc-ecosystem/grpc-gateway/pull/60) ([yugui](https://github.com/yugui)) - Added http error code and error status for responseStreamChunk error [\#59](https://github.com/grpc-ecosystem/grpc-gateway/pull/59) ([kdima](https://github.com/kdima)) - Fix parsing of verb and final path component. [\#55](https://github.com/grpc-ecosystem/grpc-gateway/pull/55) ([hbchai](https://github.com/hbchai)) -- add grpc.WithInsecure\(\) as option for grpc.Dial call in template [\#52](https://github.com/grpc-ecosystem/grpc-gateway/pull/52) ([peter-edge](https://github.com/peter-edge)) -- update .pb.go files for latest golang proto generation [\#51](https://github.com/grpc-ecosystem/grpc-gateway/pull/51) ([peter-edge](https://github.com/peter-edge)) +- add grpc.WithInsecure\(\) as option for grpc.Dial call in template [\#52](https://github.com/grpc-ecosystem/grpc-gateway/pull/52) ([pedgeio](https://github.com/pedgeio)) +- update .pb.go files for latest golang proto generation [\#51](https://github.com/grpc-ecosystem/grpc-gateway/pull/51) ([pedgeio](https://github.com/pedgeio)) - Fix a build error with the latest protoc-gen-go [\#50](https://github.com/grpc-ecosystem/grpc-gateway/pull/50) ([yugui](https://github.com/yugui)) - Configure Travis CI [\#49](https://github.com/grpc-ecosystem/grpc-gateway/pull/49) ([yugui](https://github.com/yugui)) - Follow a change of go package name convention in protoc-gen-go [\#48](https://github.com/grpc-ecosystem/grpc-gateway/pull/48) ([yugui](https://github.com/yugui)) From 3f5cb50593b3b15b36ddb3c001da80b37c49a57b Mon Sep 17 00:00:00 2001 From: Elena Deneva Date: Thu, 18 Apr 2019 13:59:55 +0200 Subject: [PATCH 400/552] Run proto gen swagger with protos from external repository Currently the protoc_gen_swagger doesn't work with protos from external repositories. The bazel rule because the swagger.json file is not stored at the expected place. Example if the rule for the proto @remote//proto:action_proto is passed to the protoc_gen_swagger, the action.swagger.json file is written to proto/action.swagger.json and is expected to be at the same place as the proto external/remote/proto/action.swagger.json. --- protoc-gen-swagger/defs.bzl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index 75a055530f6..936ca4791fe 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -46,11 +46,15 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action options.append("grpc_api_configuration=%s" % grpc_api_configuration.path) inputs.append(grpc_api_configuration) + output_dir = ctx.bin_dir.path + if proto.owner.workspace_root: + output_dir = "/".join([output_dir, proto.owner.workspace_root]) + includes = _collect_includes(ctx.genfiles_dir.path, direct_proto_srcs + transitive_proto_srcs) args = actions.args() args.add("--plugin=%s" % protoc_gen_swagger.path) - args.add("--swagger_out=%s:%s" % (",".join(options), ctx.bin_dir.path)) + args.add("--swagger_out=%s:%s" % (",".join(options), output_dir)) args.add_all(["-I%s" % include for include in includes]) args.add(proto.path) From bf722199ca584938c4c674e17d4f838a195a99c2 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 7 May 2019 16:51:27 +0100 Subject: [PATCH 401/552] Generate correct changelog version --- CHANGELOG.md | 7 ++++--- Makefile | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8124fdf36a5..606ce495162 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Change Log -## [v1.8.5](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.5) (2019-05-07) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.5...v1.8.5) +## [v1.8.6](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.6) (2019-05-07) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.5...v1.8.6) **Fixed bugs:** @@ -20,6 +20,7 @@ - Delete redundant load statement [\#922](https://github.com/grpc-ecosystem/grpc-gateway/pull/922) ([pcj](https://github.com/pcj)) - Make gazelle diffs fail the build [\#916](https://github.com/grpc-ecosystem/grpc-gateway/pull/916) ([achew22](https://github.com/achew22)) - Fixed empty path bug [\#913](https://github.com/grpc-ecosystem/grpc-gateway/pull/913) ([brycematheson1234](https://github.com/brycematheson1234)) +- Use proto gen swagger with protos from external repository [\#924](https://github.com/grpc-ecosystem/grpc-gateway/pull/924) ([elenadeneva92](https://github.com/elenadeneva92)) ## [v1.8.5](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.5) (2019-03-15) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.4...v1.8.5) @@ -948,4 +949,4 @@ -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/Makefile b/Makefile index c6428554a5f..3a77f72f959 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.8.5 + --future-release=v1.8.6 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From d9416f0e11942fe61c6a814497586dce6017e14c Mon Sep 17 00:00:00 2001 From: Joshua Humphries Date: Thu, 9 May 2019 18:03:18 -0400 Subject: [PATCH 402/552] ability to customize stream errors (#930) * ability to customize stream errors * fix build(?); review feedback * default stream error handler; some other cleanup * don't use ProtoErrorHandlerFunc for any stream calls -- not backwards compatible * add details about stream error handler to docs --- docs/_docs/customizingyourgateway.md | 67 ++++++++++++++++++++++++++ runtime/handler.go | 72 +++++++++++++--------------- runtime/mux.go | 16 +++++++ runtime/proto_errors.go | 40 +++++++++++++++- 4 files changed, 154 insertions(+), 41 deletions(-) diff --git a/docs/_docs/customizingyourgateway.md b/docs/_docs/customizingyourgateway.md index a8071cb1741..31b7794bd55 100644 --- a/docs/_docs/customizingyourgateway.md +++ b/docs/_docs/customizingyourgateway.md @@ -108,6 +108,73 @@ if err := http.ListenAndServe(":8080", tracingWrapper(mux)); err != nil { ## Error handler http://mycodesmells.com/post/grpc-gateway-error-handler +## Stream Error Handler +The error handler described in the previous section applies only +to RPC methods that have a unary response. + +When the method has a streaming response, grpc-gateway handles +that by emitting a newline-separated stream of "chunks". Each +chunk is an envelope that can container either a response message +or an error. Only the last chunk will include an error, and only +when the RPC handler ends abnormally (i.e. with an error code). + +Because of the way the errors are included in the response body, +the other error handler signature is insufficient. So for server +streams, you must install a _different_ error handler: + +```go +mux := runtime.NewServeMux( + runtime.WithStreamErrorHandler(handleStreamError)) +``` + +The signature of the handler is much more rigid because we need +to know the structure of the error payload in order to properly +encode the "chunk" schema into a Swagger/OpenAPI spec. + +So the function must return a `*runtime.StreamError`. The handler +can choose to omit some fields and can filter/transform the original +error, such as stripping stack traces from error messages. + +Here's an example custom handler: +```go +// handleStreamError overrides default behavior for computing an error +// message for a server stream. +// +// It uses a default "502 Bad Gateway" HTTP code; only emits "safe" +// messages; and does not set gRPC code or details fields (so they will +// be omitted from the resulting JSON object that is sent to client). +func handleStreamError(ctx context.Context, err error) *runtime.StreamError { + code := http.StatusBadGateway + msg := "unexpected error" + if s, ok := status.FromError(err); ok { + code = runtime.HTTPStatusFromCode(s.Code()) + // default message, based on the name of the gRPC code + msg = code.String() + // see if error details include "safe" message to send + // to external callers + for _, msg := s.Details() { + if safe, ok := msg.(*SafeMessage); ok { + msg = safe.Text + break + } + } + } + return &runtime.StreamError{ + HttpCode: int32(code), + HttpStatus: http.StatusText(code), + Message: msg, + } +} +``` + +If no custom handler is provided, the default stream error handler +will include any gRPC error attributes (code, message, detail messages), +if the error being reported includes them. If the error does not have +these attributes, a gRPC code of `Unknown` (2) is reported. The default +handler will also include an HTTP code and status, which is derived +from the gRPC code (or set to `"500 Internal Server Error"` when +the source error has no gRPC attributes). + ## Replace a response forwarder per method You might want to keep the behavior of the current marshaler but change only a message forwarding of a certain API method. diff --git a/runtime/handler.go b/runtime/handler.go index 1fc63f7f58b..2af900650dc 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -1,6 +1,7 @@ package runtime import ( + "errors" "fmt" "io" "net/http" @@ -8,13 +9,12 @@ import ( "context" "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/any" "github.com/grpc-ecosystem/grpc-gateway/internal" - "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" ) +var errEmptyResponse = errors.New("empty response") + // ForwardResponseStream forwards the stream from gRPC server to REST client. func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { f, ok := w.(http.Flusher) @@ -53,18 +53,18 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal return } if err != nil { - handleForwardResponseStreamError(wroteHeader, marshaler, w, err) + handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) return } if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { - handleForwardResponseStreamError(wroteHeader, marshaler, w, err) + handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) return } - buf, err := marshaler.Marshal(streamChunk(resp, nil)) + buf, err := marshaler.Marshal(streamChunk(ctx, resp, mux.streamErrorHandler)) if err != nil { grpclog.Infof("Failed to marshal response chunk: %v", err) - handleForwardResponseStreamError(wroteHeader, marshaler, w, err) + handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) return } if _, err = w.Write(buf); err != nil { @@ -124,7 +124,7 @@ func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marsha contentType := marshaler.ContentType() // Check marshaler on run time in order to keep backwards compatability - // An interface param needs to be added to the ContentType() function on + // An interface param needs to be added to the ContentType() function on // the Marshal interface to be able to remove this check if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { contentType = httpBodyMarshaler.ContentTypeFromMessage(resp) @@ -168,48 +168,42 @@ func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, re return nil } -func handleForwardResponseStreamError(wroteHeader bool, marshaler Marshaler, w http.ResponseWriter, err error) { - buf, merr := marshaler.Marshal(streamChunk(nil, err)) +func handleForwardResponseStreamError(ctx context.Context, wroteHeader bool, marshaler Marshaler, w http.ResponseWriter, req *http.Request, mux *ServeMux, err error) { + serr := streamError(ctx, mux.streamErrorHandler, err) + if !wroteHeader { + w.WriteHeader(int(serr.HttpCode)) + } + buf, merr := marshaler.Marshal(errorChunk(serr)) if merr != nil { grpclog.Infof("Failed to marshal an error: %v", merr) return } - if !wroteHeader { - s, ok := status.FromError(err) - if !ok { - s = status.New(codes.Unknown, err.Error()) - } - w.WriteHeader(HTTPStatusFromCode(s.Code())) - } if _, werr := w.Write(buf); werr != nil { grpclog.Infof("Failed to notify error to client: %v", werr) return } } -func streamChunk(result proto.Message, err error) map[string]proto.Message { - if err != nil { - grpcCode := codes.Unknown - grpcMessage := err.Error() - var grpcDetails []*any.Any - if s, ok := status.FromError(err); ok { - grpcCode = s.Code() - grpcMessage = s.Message() - grpcDetails = s.Proto().GetDetails() - } - httpCode := HTTPStatusFromCode(grpcCode) - return map[string]proto.Message{ - "error": &internal.StreamError{ - GrpcCode: int32(grpcCode), - HttpCode: int32(httpCode), - Message: grpcMessage, - HttpStatus: http.StatusText(httpCode), - Details: grpcDetails, - }, - } - } +// streamChunk returns a chunk in a response stream for the given result. The +// given errHandler is used to render an error chunk if result is nil. +func streamChunk(ctx context.Context, result proto.Message, errHandler StreamErrorHandlerFunc) map[string]proto.Message { if result == nil { - return streamChunk(nil, fmt.Errorf("empty response")) + return errorChunk(streamError(ctx, errHandler, errEmptyResponse)) } return map[string]proto.Message{"result": result} } + +// streamError returns the payload for the final message in a response stream +// that represents the given err. +func streamError(ctx context.Context, errHandler StreamErrorHandlerFunc, err error) *StreamError { + serr := errHandler(ctx, err) + if serr != nil { + return serr + } + // TODO: log about misbehaving stream error handler? + return DefaultHTTPStreamErrorHandler(ctx, err) +} + +func errorChunk(err *StreamError) map[string]proto.Message { + return map[string]proto.Message{"error": (*internal.StreamError)(err)} +} diff --git a/runtime/mux.go b/runtime/mux.go index ec81e55b5ef..80f14314002 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -26,6 +26,7 @@ type ServeMux struct { incomingHeaderMatcher HeaderMatcherFunc outgoingHeaderMatcher HeaderMatcherFunc metadataAnnotators []func(context.Context, *http.Request) metadata.MD + streamErrorHandler StreamErrorHandlerFunc protoErrorHandler ProtoErrorHandlerFunc disablePathLengthFallback bool } @@ -110,12 +111,27 @@ func WithDisablePathLengthFallback() ServeMuxOption { } } +// WithStreamErrorHandler returns a ServeMuxOption that will use the given custom stream +// error handler, which allows for customizing the error trailer for server-streaming +// calls. +// +// For stream errors that occur before any response has been written, the mux's +// ProtoErrorHandler will be invoked. However, once data has been written, the errors must +// be handled differently: they must be included in the response body. The response body's +// final message will include the error details returned by the stream error handler. +func WithStreamErrorHandler(fn StreamErrorHandlerFunc) ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.streamErrorHandler = fn + } +} + // NewServeMux returns a new ServeMux whose internal mapping is empty. func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ handlers: make(map[string][]handler), forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), marshalers: makeMarshalerMIMERegistry(), + streamErrorHandler: DefaultHTTPStreamErrorHandler, } for _, opt := range opts { diff --git a/runtime/proto_errors.go b/runtime/proto_errors.go index b7fa32e45db..ca76324efb1 100644 --- a/runtime/proto_errors.go +++ b/runtime/proto_errors.go @@ -1,15 +1,25 @@ package runtime import ( + "context" "io" "net/http" - "context" + "github.com/golang/protobuf/ptypes/any" + "github.com/grpc-ecosystem/grpc-gateway/internal" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" ) +// StreamErrorHandlerFunc accepts an error as a gRPC error generated via status package and translates it into a +// a proto struct used to represent error at the end of a stream. +type StreamErrorHandlerFunc func(context.Context, error) *StreamError + +// StreamError is the payload for the final message in a server stream in the event that the server returns an +// error after a response message has already been sent. +type StreamError internal.StreamError + // ProtoErrorHandlerFunc handles the error as a gRPC error generated via status package and replies to the request. type ProtoErrorHandlerFunc func(context.Context, *ServeMux, Marshaler, http.ResponseWriter, *http.Request, error) @@ -35,7 +45,7 @@ func DefaultHTTPProtoErrorHandler(ctx context.Context, mux *ServeMux, marshaler contentType := marshaler.ContentType() // Check marshaler on run time in order to keep backwards compatability - // An interface param needs to be added to the ContentType() function on + // An interface param needs to be added to the ContentType() function on // the Marshal interface to be able to remove this check if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { pb := s.Proto() @@ -68,3 +78,29 @@ func DefaultHTTPProtoErrorHandler(ctx context.Context, mux *ServeMux, marshaler handleForwardResponseTrailer(w, md) } + +// DefaultHTTPStreamErrorHandler converts the given err into a *StreamError via +// default logic. +// +// It extracts the gRPC status from err if possible. The fields of the status are +// used to populate the returned StreamError, and the HTTP status code is derived +// from the gRPC code via HTTPStatusFromCode. If the given err does not contain a +// gRPC status, an "Unknown" gRPC code is used and "Internal Server Error" HTTP code. +func DefaultHTTPStreamErrorHandler(_ context.Context, err error) *StreamError { + grpcCode := codes.Unknown + grpcMessage := err.Error() + var grpcDetails []*any.Any + if s, ok := status.FromError(err); ok { + grpcCode = s.Code() + grpcMessage = s.Message() + grpcDetails = s.Proto().GetDetails() + } + httpCode := HTTPStatusFromCode(grpcCode) + return &StreamError{ + GrpcCode: int32(grpcCode), + HttpCode: int32(httpCode), + Message: grpcMessage, + HttpStatus: http.StatusText(httpCode), + Details: grpcDetails, + } +} From 6ef67a33381196ebcdcb4df97da338b23904b0e9 Mon Sep 17 00:00:00 2001 From: Joshua Humphries Date: Fri, 10 May 2019 03:24:12 -0400 Subject: [PATCH 403/552] newline between JSON messages (#931) * newline between JSON messages from JSONPb.Encode * use j.Delimiter() * fix jsonpb tests --- runtime/marshal_jsonpb.go | 10 +++++++++- runtime/marshal_jsonpb_test.go | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index 3530dddd0aa..2fbb2628727 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -151,7 +151,15 @@ func (d DecoderWrapper) Decode(v interface{}) error { // NewEncoder returns an Encoder which writes JSON stream into "w". func (j *JSONPb) NewEncoder(w io.Writer) Encoder { - return EncoderFunc(func(v interface{}) error { return j.marshalTo(w, v) }) + return EncoderFunc(func(v interface{}) error { + if err := j.marshalTo(w, v); err != nil { + return err + } + // mimic json.Encoder by adding a newline (makes output + // easier to read when it contains multiple encoded items) + _, err := w.Write(j.Delimiter()) + return err + }) } func unmarshalJSONPb(data []byte, v interface{}) error { diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index 77da0550b6c..00590e94401 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -278,6 +278,9 @@ func TestJSONPbEncoder(t *testing.T) { }{ { verifier: func(json string) { + // remove trailing delimiter before verifying + json = strings.TrimSuffix(json, "\n") + if strings.ContainsAny(json, " \t\r\n") { t.Errorf("strings.ContainsAny(%q, %q) = true; want false", json, " \t\r\n") } @@ -356,7 +359,7 @@ func TestJSONPbEncoderFields(t *testing.T) { if err := enc.Encode(fixt.data); err != nil { t.Errorf("enc.Encode(%#v) failed with %v; want success", fixt.data, err) } - if got, want := buf.String(), fixt.json; got != want { + if got, want := buf.String(), fixt.json + string(m.Delimiter()); got != want { t.Errorf("enc.Encode(%#v) = %q; want %q", fixt.data, got, want) } } From 96073c9e8aef8ca3f1b1b75a85e7c9d8607cd1e3 Mon Sep 17 00:00:00 2001 From: Joshua Humphries Date: Mon, 13 May 2019 12:26:38 -0400 Subject: [PATCH 404/552] use error value for bad URI so custom error handler could treat it special (#932) * use error value for bad URI; so custom error handler could treat it special * add test for ErrUnknownURI being distinct from other 'unimplemented' errors * use status.Convert instead of status.FromError --- runtime/mux.go | 17 +++++++++----- runtime/mux_test.go | 57 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 6 deletions(-) diff --git a/runtime/mux.go b/runtime/mux.go index 80f14314002..093373a204a 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -16,6 +16,14 @@ import ( // A HandlerFunc handles a specific pair of path pattern and HTTP method. type HandlerFunc func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) +// ErrUnknownURI is the error supplied to a custom ProtoErrorHandlerFunc when +// a request is received with a URI path that does not match any registered +// service method. +// +// Since gRPC servers return an "Unimplemented" code for requests with an +// unrecognized URI path, this error also has a gRPC "Unimplemented" code. +var ErrUnknownURI = status.Error(codes.Unimplemented, http.StatusText(http.StatusNotImplemented)) + // ServeMux is a request multiplexer for grpc-gateway. // It matches http requests to patterns and invokes the corresponding handler. type ServeMux struct { @@ -190,8 +198,7 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { if idx := strings.LastIndex(components[l-1], ":"); idx == 0 { if s.protoErrorHandler != nil { _, outboundMarshaler := MarshalerForRequest(s, r) - sterr := status.Error(codes.Unimplemented, http.StatusText(http.StatusNotImplemented)) - s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, ErrUnknownURI) } else { OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound) } @@ -251,8 +258,7 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if s.protoErrorHandler != nil { _, outboundMarshaler := MarshalerForRequest(s, r) - sterr := status.Error(codes.Unimplemented, http.StatusText(http.StatusMethodNotAllowed)) - s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, ErrUnknownURI) } else { OtherErrorHandler(w, r, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) } @@ -262,8 +268,7 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { if s.protoErrorHandler != nil { _, outboundMarshaler := MarshalerForRequest(s, r) - sterr := status.Error(codes.Unimplemented, http.StatusText(http.StatusNotImplemented)) - s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, ErrUnknownURI) } else { OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound) } diff --git a/runtime/mux_test.go b/runtime/mux_test.go index 08ed6cc6806..e033091a885 100644 --- a/runtime/mux_test.go +++ b/runtime/mux_test.go @@ -2,6 +2,7 @@ package runtime_test import ( "bytes" + "context" "fmt" "net/http" "net/http/httptest" @@ -9,6 +10,8 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) func TestMuxServeHTTP(t *testing.T) { @@ -29,6 +32,7 @@ func TestMuxServeHTTP(t *testing.T) { respContent string disablePathLengthFallback bool + errHandler runtime.ProtoErrorHandlerFunc }{ { patterns: nil, @@ -239,11 +243,46 @@ func TestMuxServeHTTP(t *testing.T) { respStatus: http.StatusOK, respContent: "GET /foo/{id=*}:verb", }, + { + // mux identifying invalid path results in 'Not Found' status + // (with custom handler looking for ErrUnknownURI) + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"unimplemented"}, + }, + }, + reqMethod: "GET", + reqPath: "/foobar", + respStatus: http.StatusNotFound, + respContent: "GET /foobar", + errHandler: unknownPathIs404, + }, + { + // server returning unimplemented results in 'Not Implemented' code + // even when using custom error handler + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"unimplemented"}, + }, + }, + reqMethod: "GET", + reqPath: "/unimplemented", + respStatus: http.StatusNotImplemented, + respContent: `GET /unimplemented`, + errHandler: unknownPathIs404, + }, } { var opts []runtime.ServeMuxOption if spec.disablePathLengthFallback { opts = append(opts, runtime.WithDisablePathLengthFallback()) } + if spec.errHandler != nil { + opts = append(opts, runtime.WithProtoErrorHandler(spec.errHandler)) + } mux := runtime.NewServeMux(opts...) for _, p := range spec.patterns { func(p stubPattern) { @@ -252,6 +291,13 @@ func TestMuxServeHTTP(t *testing.T) { t.Fatalf("runtime.NewPattern(1, %#v, %#v, %q) failed with %v; want success", p.ops, p.pool, p.verb, err) } mux.Handle(p.method, pat, func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) { + if r.URL.Path == "/unimplemented" { + // simulate method returning "unimplemented" error + _, m := runtime.MarshalerForRequest(mux, r) + runtime.HTTPError(r.Context(), mux, m, w, r, status.Error(codes.Unimplemented, http.StatusText(http.StatusNotImplemented))) + w.WriteHeader(http.StatusNotImplemented) + return + } fmt.Fprintf(w, "%s %s", p.method, pat.String()) }) }(p) @@ -279,6 +325,17 @@ func TestMuxServeHTTP(t *testing.T) { } } +func unknownPathIs404(ctx context.Context, mux *runtime.ServeMux, m runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error) { + if err == runtime.ErrUnknownURI { + w.WriteHeader(http.StatusNotFound) + } else { + c := status.Convert(err).Code() + w.WriteHeader(runtime.HTTPStatusFromCode(c)) + } + + fmt.Fprintf(w, "%s %s", r.Method, r.URL.Path) +} + var defaultHeaderMatcherTests = []struct { name string in string From e30e263273548ac00850329531c78182f5afa39c Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 14 May 2019 09:42:49 +0100 Subject: [PATCH 405/552] Generate changelog for 1.9.0 --- CHANGELOG.md | 29 ++++++++++++++++++++++------- Makefile | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 606ce495162..c60c86475e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Change Log +## [v1.9.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.0) (2019-05-14) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.6...v1.9.0) + +**Closed issues:** + +- Errors in response streams do not go through the registered error handler [\#584](https://github.com/grpc-ecosystem/grpc-gateway/issues/584) + +**Merged pull requests:** + +- use error value for bad URI so custom error handler could treat it special [\#932](https://github.com/grpc-ecosystem/grpc-gateway/pull/932) ([jhump](https://github.com/jhump)) +- newline between JSON messages [\#931](https://github.com/grpc-ecosystem/grpc-gateway/pull/931) ([jhump](https://github.com/jhump)) +- ability to customize stream errors [\#930](https://github.com/grpc-ecosystem/grpc-gateway/pull/930) ([jhump](https://github.com/jhump)) + ## [v1.8.6](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.6) (2019-05-07) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.5...v1.8.6) @@ -17,10 +30,12 @@ **Merged pull requests:** +- Generate correct changelog version [\#929](https://github.com/grpc-ecosystem/grpc-gateway/pull/929) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Generate changelog for 1.8.6 [\#928](https://github.com/grpc-ecosystem/grpc-gateway/pull/928) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Use proto gen swagger with protos from external repository [\#924](https://github.com/grpc-ecosystem/grpc-gateway/pull/924) ([elenadeneva92](https://github.com/elenadeneva92)) - Delete redundant load statement [\#922](https://github.com/grpc-ecosystem/grpc-gateway/pull/922) ([pcj](https://github.com/pcj)) - Make gazelle diffs fail the build [\#916](https://github.com/grpc-ecosystem/grpc-gateway/pull/916) ([achew22](https://github.com/achew22)) - Fixed empty path bug [\#913](https://github.com/grpc-ecosystem/grpc-gateway/pull/913) ([brycematheson1234](https://github.com/brycematheson1234)) -- Use proto gen swagger with protos from external repository [\#924](https://github.com/grpc-ecosystem/grpc-gateway/pull/924) ([elenadeneva92](https://github.com/elenadeneva92)) ## [v1.8.5](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.8.5) (2019-03-15) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.4...v1.8.5) @@ -474,7 +489,7 @@ - properly respect file flag for protoc-gen-swagger [\#293](https://github.com/grpc-ecosystem/grpc-gateway/pull/293) ([tmc](https://github.com/tmc)) ## [v1.3.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.1) (2017-12-23) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.1) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3.1) **Implemented enhancements:** @@ -531,11 +546,11 @@ - grpc-gateway/generator: respect full package [\#462](https://github.com/grpc-ecosystem/grpc-gateway/pull/462) ([glerchundi](https://github.com/glerchundi)) - Add proto marshaller for proto-over-http [\#459](https://github.com/grpc-ecosystem/grpc-gateway/pull/459) ([MatthewDolan](https://github.com/MatthewDolan)) -## [v1.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3) - ## [v1.3.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3.0) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.0) + +## [v1.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3) **Closed issues:** @@ -949,4 +964,4 @@ -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/Makefile b/Makefile index 3a77f72f959..7875c2d738f 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.8.6 + --future-release=v1.9.0 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From ed155fef8c59d8827edfb16337c3c4e575c32cb6 Mon Sep 17 00:00:00 2001 From: Emil Aasa Date: Tue, 14 May 2019 19:38:07 +0200 Subject: [PATCH 406/552] Fix make test on MacOS make test errors out on MacOS because it uses bsd find instead of gnu find which is standard in most Linux distributions. The fix just provides an explicit folder . which bsd find requires but gnu find has as default. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7875c2d738f..ad9b85daec5 100644 --- a/Makefile +++ b/Makefile @@ -177,7 +177,7 @@ $(RESPONSE_BODY_EXAMPLE_SRCS): $(RESPONSE_BODY_EXAMPLE_SPEC) $(EXAMPLE_CLIENT_DIR)/responsebody/git_push.sh examples: $(EXAMPLE_DEPSRCS) $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) - find -type f -name *.go -exec sed -s -i 's;github.com/go-resty/resty;gopkg.in/resty.v1;g' {} + + find . -type f -name *.go -exec sed -s -i 's;github.com/go-resty/resty;gopkg.in/resty.v1;g' {} + test: examples go test -race ... go test -race examples/integration -args -network=unix -endpoint=test.sock From 6c6328990197d064e7bd588bc200ec3c7904aaa7 Mon Sep 17 00:00:00 2001 From: mingqing Date: Sun, 26 May 2019 15:08:02 +0800 Subject: [PATCH 407/552] fix query params not populate if method is post (#939) * fix query params not populate if method is post * regenerate example files. * fix go.mod * use req.From instead of req.PostForm to avoid missing url params in post method * regenerate example files * add test case and regenerate example files * adjust to use subtests and remove confused variable * use an explicit test name instead of the auto index * rename local var url to apiURL avoid conflict with net/url --- .../abe/a_bit_of_everything_service_api.go | 221 ++++++++ examples/integration/integration_test.go | 268 ++++++---- .../proto/examplepb/a_bit_of_everything.pb.go | 502 ++++++++++-------- .../examplepb/a_bit_of_everything.pb.gw.go | 157 +++++- .../proto/examplepb/a_bit_of_everything.proto | 11 + .../a_bit_of_everything.swagger.json | 355 +++++++++++++ .../proto/examplepb/echo_service.pb.gw.go | 30 +- .../proto/examplepb/flow_combination.pb.gw.go | 80 ++- .../unannotated_echo_service.pb.gw.go | 15 +- examples/server/a_bit_of_everything.go | 8 + .../gengateway/template.go | 5 +- 11 files changed, 1310 insertions(+), 342 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 415243210cd..f4fe7b6f87e 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -38,6 +38,227 @@ func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythin } } +/** + * + * + * @param singleNestedName name is nested field. + * @param floatValue Float value field + * @param singleNestedAmount + * @param singleNestedOk DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param uuid + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param bytesValue + * @param uint32Value + * @param enumValue - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param pathEnumValue + * @param nestedPathEnumValue + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param repeatedStringValue + * @param oneofString + * @param nonConventionalNameValue + * @param timestampValue + * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param repeatedEnumAnnotation Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param enumValueAnnotation Numeric enum title. Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param repeatedStringAnnotation Repeated string title. Repeated string description. + * @param nestedAnnotationAmount + * @param nestedAnnotationOk DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @return *ExamplepbABitOfEverything + */ +func (a ABitOfEverythingServiceApi) CheckGetQueryParams(singleNestedName string, floatValue float32, singleNestedAmount int64, singleNestedOk string, uuid string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationAmount int64, nestedAnnotationOk string) (*ExamplepbABitOfEverything, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/params/get/{single_nested.name}" + localVarPath = strings.Replace(localVarPath, "{"+"single_nested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + localVarQueryParams.Add("single_nested.amount", a.Configuration.APIClient.ParameterToString(singleNestedAmount, "")) + localVarQueryParams.Add("single_nested.ok", a.Configuration.APIClient.ParameterToString(singleNestedOk, "")) + localVarQueryParams.Add("uuid", a.Configuration.APIClient.ParameterToString(uuid, "")) + localVarQueryParams.Add("float_value", a.Configuration.APIClient.ParameterToString(floatValue, "")) + localVarQueryParams.Add("double_value", a.Configuration.APIClient.ParameterToString(doubleValue, "")) + localVarQueryParams.Add("int64_value", a.Configuration.APIClient.ParameterToString(int64Value, "")) + localVarQueryParams.Add("uint64_value", a.Configuration.APIClient.ParameterToString(uint64Value, "")) + localVarQueryParams.Add("int32_value", a.Configuration.APIClient.ParameterToString(int32Value, "")) + localVarQueryParams.Add("fixed64_value", a.Configuration.APIClient.ParameterToString(fixed64Value, "")) + localVarQueryParams.Add("fixed32_value", a.Configuration.APIClient.ParameterToString(fixed32Value, "")) + localVarQueryParams.Add("bool_value", a.Configuration.APIClient.ParameterToString(boolValue, "")) + localVarQueryParams.Add("string_value", a.Configuration.APIClient.ParameterToString(stringValue, "")) + localVarQueryParams.Add("bytes_value", a.Configuration.APIClient.ParameterToString(bytesValue, "")) + localVarQueryParams.Add("uint32_value", a.Configuration.APIClient.ParameterToString(uint32Value, "")) + localVarQueryParams.Add("enum_value", a.Configuration.APIClient.ParameterToString(enumValue, "")) + localVarQueryParams.Add("path_enum_value", a.Configuration.APIClient.ParameterToString(pathEnumValue, "")) + localVarQueryParams.Add("nested_path_enum_value", a.Configuration.APIClient.ParameterToString(nestedPathEnumValue, "")) + localVarQueryParams.Add("sfixed32_value", a.Configuration.APIClient.ParameterToString(sfixed32Value, "")) + localVarQueryParams.Add("sfixed64_value", a.Configuration.APIClient.ParameterToString(sfixed64Value, "")) + localVarQueryParams.Add("sint32_value", a.Configuration.APIClient.ParameterToString(sint32Value, "")) + localVarQueryParams.Add("sint64_value", a.Configuration.APIClient.ParameterToString(sint64Value, "")) + var repeatedStringValueCollectionFormat = "multi" + localVarQueryParams.Add("repeated_string_value", a.Configuration.APIClient.ParameterToString(repeatedStringValue, repeatedStringValueCollectionFormat)) + + localVarQueryParams.Add("oneof_string", a.Configuration.APIClient.ParameterToString(oneofString, "")) + localVarQueryParams.Add("nonConventionalNameValue", a.Configuration.APIClient.ParameterToString(nonConventionalNameValue, "")) + localVarQueryParams.Add("timestamp_value", a.Configuration.APIClient.ParameterToString(timestampValue, "")) + var repeatedEnumValueCollectionFormat = "multi" + localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) + + var repeatedEnumAnnotationCollectionFormat = "multi" + localVarQueryParams.Add("repeated_enum_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumAnnotation, repeatedEnumAnnotationCollectionFormat)) + + localVarQueryParams.Add("enum_value_annotation", a.Configuration.APIClient.ParameterToString(enumValueAnnotation, "")) + var repeatedStringAnnotationCollectionFormat = "multi" + localVarQueryParams.Add("repeated_string_annotation", a.Configuration.APIClient.ParameterToString(repeatedStringAnnotation, repeatedStringAnnotationCollectionFormat)) + + localVarQueryParams.Add("nested_annotation.amount", a.Configuration.APIClient.ParameterToString(nestedAnnotationAmount, "")) + localVarQueryParams.Add("nested_annotation.ok", a.Configuration.APIClient.ParameterToString(nestedAnnotationOk, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ExamplepbABitOfEverything) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "CheckGetQueryParams", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param stringValue + * @param body + * @return *ExamplepbABitOfEverything + */ +func (a ABitOfEverythingServiceApi) CheckPostQueryParams(stringValue string, body ABitOfEverythingNested) (*ExamplepbABitOfEverything, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/params/post/{string_value}" + localVarPath = strings.Replace(localVarPath, "{"+"string_value"+"}", fmt.Sprintf("%v", stringValue), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ExamplepbABitOfEverything) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "CheckPostQueryParams", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + /** * Create a new ABitOfEverything * This API creates a new ABitOfEverything diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index fd1a3655a9a..62db1063785 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -9,6 +9,7 @@ import ( "io" "io/ioutil" "net/http" + "net/url" "reflect" "strconv" "strings" @@ -72,10 +73,10 @@ func TestForwardResponseOption(t *testing.T) { } func testEcho(t *testing.T, port int, contentType string) { - url := fmt.Sprintf("http://localhost:%d/v1/example/echo/myid", port) - resp, err := http.Post(url, "application/json", strings.NewReader("{}")) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/echo/myid", port) + resp, err := http.Post(apiURL, "application/json", strings.NewReader("{}")) if err != nil { - t.Errorf("http.Post(%q) failed with %v; want success", url, err) + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -105,10 +106,10 @@ func testEcho(t *testing.T, port int, contentType string) { } func testEchoOneof(t *testing.T, port int, contentType string) { - url := fmt.Sprintf("http://localhost:%d/v1/example/echo/myid/10/golang", port) - resp, err := http.Get(url) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/echo/myid/10/golang", port) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -138,10 +139,10 @@ func testEchoOneof(t *testing.T, port int, contentType string) { } func testEchoOneof1(t *testing.T, port int, contentType string) { - url := fmt.Sprintf("http://localhost:%d/v1/example/echo1/myid/10/golang", port) - resp, err := http.Get(url) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/echo1/myid/10/golang", port) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -171,10 +172,10 @@ func testEchoOneof1(t *testing.T, port int, contentType string) { } func testEchoOneof2(t *testing.T, port int, contentType string) { - url := fmt.Sprintf("http://localhost:%d/v1/example/echo2/golang", port) - resp, err := http.Get(url) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/echo2/golang", port) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -211,10 +212,10 @@ func testEchoBody(t *testing.T, port int) { t.Fatalf("m.MarshalToString(%#v) failed with %v; want success", payload, err) } - url := fmt.Sprintf("http://localhost:%d/v1/example/echo_body", port) - resp, err := http.Post(url, "", strings.NewReader(payload)) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/echo_body", port) + resp, err := http.Post(apiURL, "", strings.NewReader(payload)) if err != nil { - t.Errorf("http.Post(%q) failed with %v; want success", url, err) + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -293,11 +294,11 @@ func testABECreate(t *testing.T, port int) { NestedPathEnumValue: pathenum.MessagePathEnum_JKL, EnumValueAnnotation: gw.NumericEnum_ONE, } - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/%f/%f/%d/separator/%d/%d/%d/%d/%v/%s/%d/%d/%d/%d/%d/%s/%s/%s/%s/%s", port, want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue, want.EnumValue, want.PathEnumValue, want.NestedPathEnumValue, want.EnumValueAnnotation) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/%f/%f/%d/separator/%d/%d/%d/%d/%v/%s/%d/%d/%d/%d/%d/%s/%s/%s/%s/%s", port, want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue, want.EnumValue, want.PathEnumValue, want.NestedPathEnumValue, want.EnumValueAnnotation) - resp, err := http.Post(url, "application/json", strings.NewReader("{}")) + resp, err := http.Post(apiURL, "application/json", strings.NewReader("{}")) if err != nil { - t.Errorf("http.Post(%q) failed with %v; want success", url, err) + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -373,11 +374,11 @@ func testABECreateBody(t *testing.T, port int) { "a": {Name: "x", Amount: 1}, "b": {Name: "y", Amount: 2}, }, - RepeatedEnumAnnotation: []gw.NumericEnum{ + RepeatedEnumAnnotation: []gw.NumericEnum{ gw.NumericEnum_ONE, gw.NumericEnum_ZERO, }, - EnumValueAnnotation: gw.NumericEnum_ONE, + EnumValueAnnotation: gw.NumericEnum_ONE, RepeatedStringAnnotation: []string{ "a", "b", @@ -397,16 +398,16 @@ func testABECreateBody(t *testing.T, port int) { Amount: 10, }, } - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) var m jsonpb.Marshaler payload, err := m.MarshalToString(&want) if err != nil { t.Fatalf("m.MarshalToString(%#v) failed with %v; want success", want, err) } - resp, err := http.Post(url, "application/json", strings.NewReader(payload)) + resp, err := http.Post(apiURL, "application/json", strings.NewReader(payload)) if err != nil { - t.Errorf("http.Post(%q) failed with %v; want success", url, err) + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -477,11 +478,11 @@ func testABEBulkCreate(t *testing.T, port int) { Amount: 20, }, }, - RepeatedEnumAnnotation: []gw.NumericEnum{ + RepeatedEnumAnnotation: []gw.NumericEnum{ gw.NumericEnum_ONE, gw.NumericEnum_ZERO, }, - EnumValueAnnotation: gw.NumericEnum_ONE, + EnumValueAnnotation: gw.NumericEnum_ONE, RepeatedStringAnnotation: []string{ "a", "b", @@ -512,10 +513,10 @@ func testABEBulkCreate(t *testing.T, port int) { count++ } }(w) - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/bulk", port) - resp, err := http.Post(url, "application/json", r) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/bulk", port) + resp, err := http.Post(apiURL, "application/json", r) if err != nil { - t.Errorf("http.Post(%q) failed with %v; want success", url, err) + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -549,12 +550,12 @@ func testABEBulkCreate(t *testing.T, port int) { } func testABELookup(t *testing.T, port int) { - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) - cresp, err := http.Post(url, "application/json", strings.NewReader(` + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) + cresp, err := http.Post(apiURL, "application/json", strings.NewReader(` {"bool_value": true, "string_value": "strprefix/example"} `)) if err != nil { - t.Errorf("http.Post(%q) failed with %v; want success", url, err) + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer cresp.Body.Close() @@ -575,10 +576,10 @@ func testABELookup(t *testing.T, port int) { return } - url = fmt.Sprintf("%s/%s", url, want.Uuid) - resp, err := http.Get(url) + apiURL = fmt.Sprintf("%s/%s", apiURL, want.Uuid) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -744,10 +745,10 @@ func mustMarshal(t *testing.T, i interface{}) string { // postABE conveniently creates a new ABE record for ease in testing func postABE(t *testing.T, port int, abe gw.ABitOfEverything) (uuid string) { - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) - postResp, err := http.Post(url, "application/json", strings.NewReader(mustMarshal(t, abe))) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) + postResp, err := http.Post(apiURL, "application/json", strings.NewReader(mustMarshal(t, abe))) if err != nil { - t.Fatalf("http.Post(%q) failed with %v; want success", url, err) + t.Fatalf("http.Post(%q) failed with %v; want success", apiURL, err) return } body, err := ioutil.ReadAll(postResp.Body) @@ -791,12 +792,12 @@ func getABE(t *testing.T, port int, uuid string) gw.ABitOfEverything { } func testABELookupNotFound(t *testing.T, port int) { - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) uuid := "not_exist" - url = fmt.Sprintf("%s/%s", url, uuid) - resp, err := http.Get(url) + apiURL = fmt.Sprintf("%s/%s", apiURL, uuid) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -841,10 +842,10 @@ func testABELookupNotFound(t *testing.T, port int) { } func testABEList(t *testing.T, port int) { - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) - resp, err := http.Get(url) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -915,17 +916,17 @@ func testABEBulkEcho(t *testing.T, port int) { } }() - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo", port) - req, err := http.NewRequest("POST", url, reqr) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo", port) + req, err := http.NewRequest("POST", apiURL, reqr) if err != nil { - t.Errorf("http.NewRequest(%q, %q, reqr) failed with %v; want success", "POST", url, err) + t.Errorf("http.NewRequest(%q, %q, reqr) failed with %v; want success", "POST", apiURL, err) return } req.Header.Set("Content-Type", "application/json") req.Header.Set("Transfer-Encoding", "chunked") resp, err := http.DefaultClient.Do(req) if err != nil { - t.Errorf("http.Post(%q, %q, req) failed with %v; want success", url, "application/json", err) + t.Errorf("http.Post(%q, %q, req) failed with %v; want success", apiURL, "application/json", err) return } defer resp.Body.Close() @@ -970,17 +971,17 @@ func testABEBulkEcho(t *testing.T, port int) { } func testABEBulkEchoZeroLength(t *testing.T, port int) { - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo", port) - req, err := http.NewRequest("POST", url, bytes.NewReader(nil)) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo", port) + req, err := http.NewRequest("POST", apiURL, bytes.NewReader(nil)) if err != nil { - t.Errorf("http.NewRequest(%q, %q, bytes.NewReader(nil)) failed with %v; want success", "POST", url, err) + t.Errorf("http.NewRequest(%q, %q, bytes.NewReader(nil)) failed with %v; want success", "POST", apiURL, err) return } req.Header.Set("Content-Type", "application/json") req.Header.Set("Transfer-Encoding", "chunked") resp, err := http.DefaultClient.Do(req) if err != nil { - t.Errorf("http.Post(%q, %q, req) failed with %v; want success", url, "application/json", err) + t.Errorf("http.Post(%q, %q, req) failed with %v; want success", apiURL, "application/json", err) return } defer resp.Body.Close() @@ -1004,19 +1005,19 @@ func testABEBulkEchoZeroLength(t *testing.T, port int) { func testAdditionalBindings(t *testing.T, port int) { for i, f := range []func() *http.Response{ func() *http.Response { - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo/hello", port) - resp, err := http.Get(url) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/echo/hello", port) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return nil } return resp }, func() *http.Response { - url := fmt.Sprintf("http://localhost:%d/v2/example/echo", port) - resp, err := http.Post(url, "application/json", strings.NewReader(`"hello"`)) + apiURL := fmt.Sprintf("http://localhost:%d/v2/example/echo", port) + resp, err := http.Post(apiURL, "application/json", strings.NewReader(`"hello"`)) if err != nil { - t.Errorf("http.Post(%q, %q, %q) failed with %v; want success", url, "application/json", `"hello"`, err) + t.Errorf("http.Post(%q, %q, %q) failed with %v; want success", apiURL, "application/json", `"hello"`, err) return nil } return resp @@ -1027,19 +1028,19 @@ func testAdditionalBindings(t *testing.T, port int) { defer w.Close() w.Write([]byte(`"hello"`)) }() - url := fmt.Sprintf("http://localhost:%d/v2/example/echo", port) - resp, err := http.Post(url, "application/json", r) + apiURL := fmt.Sprintf("http://localhost:%d/v2/example/echo", port) + resp, err := http.Post(apiURL, "application/json", r) if err != nil { - t.Errorf("http.Post(%q, %q, %q) failed with %v; want success", url, "application/json", `"hello"`, err) + t.Errorf("http.Post(%q, %q, %q) failed with %v; want success", apiURL, "application/json", `"hello"`, err) return nil } return resp }, func() *http.Response { - url := fmt.Sprintf("http://localhost:%d/v2/example/echo?value=hello", port) - resp, err := http.Get(url) + apiURL := fmt.Sprintf("http://localhost:%d/v2/example/echo?value=hello", port) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return nil } return resp @@ -1162,11 +1163,11 @@ func testABERepeated(t *testing.T, port int) { -4611686018427387904, }, } - url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything_repeated/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s", port, f(reflect.ValueOf(want.PathRepeatedFloatValue)), f(reflect.ValueOf(want.PathRepeatedDoubleValue)), f(reflect.ValueOf(want.PathRepeatedInt64Value)), f(reflect.ValueOf(want.PathRepeatedUint64Value)), f(reflect.ValueOf(want.PathRepeatedInt32Value)), f(reflect.ValueOf(want.PathRepeatedFixed64Value)), f(reflect.ValueOf(want.PathRepeatedFixed32Value)), f(reflect.ValueOf(want.PathRepeatedBoolValue)), f(reflect.ValueOf(want.PathRepeatedStringValue)), f(reflect.ValueOf(want.PathRepeatedBytesValue)), f(reflect.ValueOf(want.PathRepeatedUint32Value)), f(reflect.ValueOf(want.PathRepeatedEnumValue)), f(reflect.ValueOf(want.PathRepeatedSfixed32Value)), f(reflect.ValueOf(want.PathRepeatedSfixed64Value)), f(reflect.ValueOf(want.PathRepeatedSint32Value)), f(reflect.ValueOf(want.PathRepeatedSint64Value))) + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything_repeated/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s/%s", port, f(reflect.ValueOf(want.PathRepeatedFloatValue)), f(reflect.ValueOf(want.PathRepeatedDoubleValue)), f(reflect.ValueOf(want.PathRepeatedInt64Value)), f(reflect.ValueOf(want.PathRepeatedUint64Value)), f(reflect.ValueOf(want.PathRepeatedInt32Value)), f(reflect.ValueOf(want.PathRepeatedFixed64Value)), f(reflect.ValueOf(want.PathRepeatedFixed32Value)), f(reflect.ValueOf(want.PathRepeatedBoolValue)), f(reflect.ValueOf(want.PathRepeatedStringValue)), f(reflect.ValueOf(want.PathRepeatedBytesValue)), f(reflect.ValueOf(want.PathRepeatedUint32Value)), f(reflect.ValueOf(want.PathRepeatedEnumValue)), f(reflect.ValueOf(want.PathRepeatedSfixed32Value)), f(reflect.ValueOf(want.PathRepeatedSfixed64Value)), f(reflect.ValueOf(want.PathRepeatedSint32Value)), f(reflect.ValueOf(want.PathRepeatedSint64Value))) - resp, err := http.Get(url) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Post(%q) failed with %v; want success", url, err) + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -1192,10 +1193,10 @@ func testABERepeated(t *testing.T, port int) { } func TestTimeout(t *testing.T) { - url := "http://localhost:8080/v2/example/timeout" - req, err := http.NewRequest("GET", url, nil) + apiURL := "http://localhost:8080/v2/example/timeout" + req, err := http.NewRequest("GET", apiURL, nil) if err != nil { - t.Errorf(`http.NewRequest("GET", %q, nil) failed with %v; want success`, url, err) + t.Errorf(`http.NewRequest("GET", %q, nil) failed with %v; want success`, apiURL, err) return } req.Header.Set("Grpc-Timeout", "10m") @@ -1212,10 +1213,10 @@ func TestTimeout(t *testing.T) { } func TestErrorWithDetails(t *testing.T) { - url := "http://localhost:8080/v2/example/errorwithdetails" - resp, err := http.Get(url) + apiURL := "http://localhost:8080/v2/example/errorwithdetails" + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -1272,26 +1273,26 @@ func TestErrorWithDetails(t *testing.T) { } func TestPostWithEmptyBody(t *testing.T) { - url := "http://localhost:8080/v2/example/postwithemptybody/name" - rep, err := http.Post(url, "application/json", nil) + apiURL := "http://localhost:8080/v2/example/postwithemptybody/name" + rep, err := http.Post(apiURL, "application/json", nil) if err != nil { - t.Errorf("http.Post(%q) failed with %v; want success", url, err) + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } if rep.StatusCode != http.StatusOK { - t.Errorf("http.Post(%q) response code is %d; want %d", url, + t.Errorf("http.Post(%q) response code is %d; want %d", apiURL, rep.StatusCode, http.StatusOK) return } } func TestUnknownPath(t *testing.T) { - url := "http://localhost:8080" - resp, err := http.Post(url, "application/json", strings.NewReader("{}")) + apiURL := "http://localhost:8080" + resp, err := http.Post(apiURL, "application/json", strings.NewReader("{}")) if err != nil { - t.Errorf("http.Post(%q) failed with %v; want success", url, err) + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -1308,10 +1309,10 @@ func TestUnknownPath(t *testing.T) { } func TestMethodNotAllowed(t *testing.T) { - url := "http://localhost:8080/v1/example/echo/myid" - resp, err := http.Get(url) + apiURL := "http://localhost:8080/v1/example/echo/myid" + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Post(%q) failed with %v; want success", url, err) + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -1328,10 +1329,10 @@ func TestMethodNotAllowed(t *testing.T) { } func TestInvalidArgument(t *testing.T) { - url := "http://localhost:8080/v1/example/echo/myid/not_int64" - resp, err := http.Get(url) + apiURL := "http://localhost:8080/v1/example/echo/myid/not_int64" + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -1359,10 +1360,10 @@ func TestResponseBody(t *testing.T) { } func testResponseBody(t *testing.T, port int) { - url := fmt.Sprintf("http://localhost:%d/responsebody/foo", port) - resp, err := http.Get(url) + apiURL := fmt.Sprintf("http://localhost:%d/responsebody/foo", port) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -1383,10 +1384,10 @@ func testResponseBody(t *testing.T, port int) { } func testResponseBodies(t *testing.T, port int) { - url := fmt.Sprintf("http://localhost:%d/responsebodies/foo", port) - resp, err := http.Get(url) + apiURL := fmt.Sprintf("http://localhost:%d/responsebodies/foo", port) + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -1441,10 +1442,10 @@ func testResponseStrings(t *testing.T, port int) { }, } { t.Run(strconv.Itoa(i), func(t *testing.T) { - url := spec.endpoint - resp, err := http.Get(url) + apiURL := spec.endpoint + resp, err := http.Get(apiURL) if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", url, err) + t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) return } defer resp.Body.Close() @@ -1466,3 +1467,80 @@ func testResponseStrings(t *testing.T, port int) { } } + +func TestRequestQueryParams(t *testing.T) { + port := 8080 + + formValues := url.Values{} + formValues.Set("string_value", "hello-world") + formValues.Add("repeated_string_value", "demo1") + formValues.Add("repeated_string_value", "demo2") + + testCases := []struct { + name string + httpMethod string + contentType string + apiURL string + wantContent string + requestContent io.Reader + }{ + { + name: "get url query values", + httpMethod: "GET", + contentType: "application/json", + apiURL: fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/params/get/foo?double_value=%v&bool_value=%v", port, 1234.56, true), + wantContent: `{"single_nested":{"name":"foo"},"double_value":1234.56,"bool_value":true}`, + }, + { + name: "post url query values", + httpMethod: "POST", + contentType: "application/json", + apiURL: fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/params/post/hello-world?double_value=%v&bool_value=%v", port, 1234.56, true), + wantContent: `{"single_nested":{"name":"foo","amount":100},"double_value":1234.56,"bool_value":true,"string_value":"hello-world"}`, + requestContent: strings.NewReader(`{"name":"foo","amount":100}`), + }, + { + name: "post form and url query values", + httpMethod: "POST", + contentType: "application/x-www-form-urlencoded", + apiURL: fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/params/get/foo?double_value=%v&bool_value=%v", port, 1234.56, true), + wantContent: `{"single_nested":{"name":"foo"},"double_value":1234.56,"bool_value":true,"string_value":"hello-world","repeated_string_value":["demo1","demo2"]}`, + requestContent: strings.NewReader(formValues.Encode()), + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + req, err := http.NewRequest(tc.httpMethod, tc.apiURL, tc.requestContent) + if err != nil { + t.Errorf("http.method (%q) http.url (%q) failed with %v; want success", tc.httpMethod, tc.apiURL, err) + return + } + + req.Header.Add("Content-Type", tc.contentType) + + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Errorf("http.method (%q) http.url (%q) failed with %v; want success", tc.httpMethod, tc.apiURL, err) + return + } + defer resp.Body.Close() + + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if gotCode, wantCode := resp.StatusCode, http.StatusOK; gotCode != wantCode { + t.Errorf("resp.StatusCode = %d; want %d", gotCode, wantCode) + t.Logf("%s", buf) + } + + gotContent := string(buf) + if gotContent != tc.wantContent { + t.Errorf("http.method (%q) http.url (%q) response = %q; want %q", tc.httpMethod, tc.apiURL, gotContent, tc.wantContent) + } + }) + } +} diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 7b8ee6672ef..ee105d94ed4 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{0} + return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -139,7 +139,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{0} + return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -513,7 +513,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{0, 0} + return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -582,7 +582,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{1} + return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -725,7 +725,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{2} + return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -764,7 +764,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{3} + return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -811,7 +811,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_75cdf8204f309306, []int{4} + return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -897,6 +897,8 @@ type ABitOfEverythingServiceClient interface { ErrorWithDetails(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*empty.Empty, error) PostWithEmptyBody(ctx context.Context, in *Body, opts ...grpc.CallOption) (*empty.Empty, error) + CheckGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) + CheckPostQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) } type aBitOfEverythingServiceClient struct { @@ -1051,6 +1053,24 @@ func (c *aBitOfEverythingServiceClient) PostWithEmptyBody(ctx context.Context, i return out, nil } +func (c *aBitOfEverythingServiceClient) CheckGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { + out := new(ABitOfEverything) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckGetQueryParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) CheckPostQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { + out := new(ABitOfEverything) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckPostQueryParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ABitOfEverythingServiceServer is the server API for ABitOfEverythingService service. type ABitOfEverythingServiceServer interface { // Create a new ABitOfEverything @@ -1079,6 +1099,8 @@ type ABitOfEverythingServiceServer interface { ErrorWithDetails(context.Context, *empty.Empty) (*empty.Empty, error) GetMessageWithBody(context.Context, *MessageWithBody) (*empty.Empty, error) PostWithEmptyBody(context.Context, *Body) (*empty.Empty, error) + CheckGetQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) + CheckPostQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) } func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingServiceServer) { @@ -1373,6 +1395,42 @@ func _ABitOfEverythingService_PostWithEmptyBody_Handler(srv interface{}, ctx con return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_CheckGetQueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverything) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).CheckGetQueryParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckGetQueryParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).CheckGetQueryParams(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_CheckPostQueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverything) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).CheckPostQueryParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckPostQueryParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).CheckPostQueryParams(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) +} + var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.examplepb.ABitOfEverythingService", HandlerType: (*ABitOfEverythingServiceServer)(nil), @@ -1441,6 +1499,14 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "PostWithEmptyBody", Handler: _ABitOfEverythingService_PostWithEmptyBody_Handler, }, + { + MethodName: "CheckGetQueryParams", + Handler: _ABitOfEverythingService_CheckGetQueryParams_Handler, + }, + { + MethodName: "CheckPostQueryParams", + Handler: _ABitOfEverythingService_CheckPostQueryParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/proto/examplepb/a_bit_of_everything.proto", @@ -1575,212 +1641,216 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_75cdf8204f309306) -} - -var fileDescriptor_a_bit_of_everything_75cdf8204f309306 = []byte{ - // 3241 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x39, 0xcb, 0x6f, 0x1b, 0xc7, - 0xf9, 0x5a, 0xae, 0x9e, 0xa3, 0x17, 0x35, 0xb2, 0x65, 0x8a, 0x56, 0xa2, 0x31, 0xed, 0x24, 0x6b, - 0xc6, 0xe4, 0x4a, 0x2b, 0xd9, 0x91, 0x19, 0x24, 0xfe, 0x91, 0x7a, 0xd8, 0x8a, 0x6d, 0x59, 0x59, - 0x3b, 0xfe, 0x05, 0x8e, 0x1d, 0x61, 0x49, 0x0e, 0xc5, 0xb5, 0xb8, 0x3b, 0x9b, 0xdd, 0x59, 0xd9, - 0xac, 0xca, 0x36, 0x7d, 0xa0, 0x45, 0x9b, 0x43, 0x01, 0xa6, 0x45, 0xd1, 0x07, 0xfa, 0x17, 0xe4, - 0xda, 0x53, 0x80, 0xb6, 0x97, 0x9e, 0x7a, 0x73, 0x8b, 0xde, 0x7a, 0x6a, 0x0f, 0x3d, 0x15, 0x28, - 0x0a, 0x04, 0xe8, 0xa1, 0x45, 0xb1, 0xb3, 0xbb, 0xe4, 0xee, 0x92, 0xb4, 0x4c, 0x3b, 0xc8, 0x45, - 0xda, 0x99, 0xf9, 0xde, 0xdf, 0x37, 0xdf, 0x63, 0x08, 0x24, 0xfc, 0x58, 0xd1, 0x8c, 0x1a, 0xb6, - 0x44, 0xc3, 0x24, 0x94, 0x88, 0xde, 0xd2, 0x28, 0x8a, 0xca, 0x5e, 0x51, 0xa5, 0x7b, 0xa4, 0xb2, - 0x87, 0x0f, 0xb1, 0x59, 0xa7, 0x55, 0x55, 0xdf, 0xcf, 0x32, 0x18, 0xb8, 0xb8, 0x6f, 0x1a, 0xa5, - 0xec, 0xbe, 0x42, 0xf1, 0x23, 0x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 0x4e, 0x18, 0xf1, 0x80, 0x7c, 0x4a, 0x2f, 0x01, 0x50, 0x24, 0xa4, 0xe6, 0x41, 0x00, 0xc4, - 0x09, 0xa3, 0xf2, 0x98, 0xb3, 0xd3, 0x12, 0xd6, 0xa2, 0xa6, 0xaa, 0xef, 0x7b, 0x00, 0xe3, 0x4e, - 0x00, 0xc8, 0xe3, 0xee, 0x5e, 0x4b, 0xd8, 0x62, 0x9d, 0x62, 0xcb, 0x83, 0x78, 0x09, 0x71, 0xc2, - 0x84, 0x0c, 0xd8, 0x56, 0x48, 0xe1, 0x96, 0x18, 0x93, 0x88, 0x13, 0x26, 0x5d, 0x85, 0x7d, 0x29, - 0xae, 0x03, 0xe0, 0xdc, 0x3a, 0x0f, 0x60, 0x0a, 0x71, 0xc2, 0x94, 0x74, 0xe1, 0x58, 0xcf, 0xef, - 0xd8, 0x1a, 0x36, 0xd5, 0xd2, 0xa6, 0x6e, 0x6b, 0xf2, 0x98, 0x83, 0xef, 0x12, 0xdb, 0x05, 0xd3, - 0xad, 0x7b, 0xec, 0x51, 0x7c, 0x99, 0x51, 0x14, 0x7a, 0x50, 0xf4, 0xaf, 0x7f, 0x76, 0x57, 0xa1, - 0x55, 0x46, 0x6d, 0xd2, 0xf0, 0xbe, 0x5c, 0x8a, 0x16, 0x98, 0x73, 0x83, 0x69, 0x2f, 0x4a, 0x78, - 0x91, 0x11, 0x7e, 0xfb, 0x38, 0xc2, 0x37, 0xdd, 0x84, 0xe0, 0xd3, 0xf7, 0x42, 0xb4, 0xc5, 0x6e, - 0x56, 0x0f, 0xad, 0x5d, 0xa6, 0xaf, 0x80, 0x29, 0x2b, 0xec, 0xbf, 0x69, 0xc4, 0x09, 0xd3, 0xf2, - 0xa4, 0x15, 0x72, 0x60, 0x0b, 0xac, 0x15, 0x0b, 0x71, 0xc4, 0x09, 0x71, 0x1f, 0x2c, 0x10, 0x75, - 0x56, 0xd0, 0x09, 0x33, 0x88, 0x13, 0x66, 0xe4, 0x71, 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 0x86, 0x4f, 0x25, 0x9a, - 0xb9, 0xbb, 0x50, 0xd9, 0x09, 0x52, 0x79, 0x91, 0xde, 0xb9, 0xcd, 0x3f, 0xf7, 0xb3, 0x58, 0x33, - 0xff, 0x93, 0x18, 0xf8, 0x2e, 0x97, 0x9e, 0xcd, 0xa3, 0xa2, 0x4a, 0x11, 0xa9, 0xa0, 0xf6, 0xb8, - 0x27, 0x6d, 0x6f, 0xeb, 0xd4, 0xaf, 0x02, 0x75, 0x54, 0x22, 0x9a, 0x51, 0x53, 0x4b, 0xec, 0x72, - 0x78, 0x43, 0x10, 0xa2, 0x75, 0x03, 0x23, 0x4a, 0x50, 0x89, 0x1c, 0x62, 0x13, 0x69, 0x8a, 0x5e, - 0x47, 0x15, 0xac, 0x50, 0xdb, 0xc4, 0x96, 0x43, 0x6b, 0xd7, 0x2f, 0x07, 0x4f, 0x38, 0x36, 0x01, - 0x3c, 0xe1, 0x82, 0xfd, 0xf3, 0x13, 0x2e, 0xd4, 0x70, 0xa7, 0xef, 0x82, 0x73, 0x5b, 0xaa, 0x5e, - 0x46, 0xc4, 0xa6, 0x48, 0x23, 0x26, 0x46, 0x4a, 0xd1, 0xf9, 0xec, 0x98, 0x87, 0xb2, 0x55, 0x4a, - 0x0d, 0x2b, 0x27, 0x8a, 0xfb, 0x2a, 0xad, 0xda, 0xc5, 0x6c, 0x89, 0x68, 0xa2, 0x63, 0x8c, 0x0c, - 0x2e, 0x11, 0xab, 0x6e, 0x51, 0xec, 0x2d, 0x3d, 0xdb, 0x48, 0xab, 0x50, 0x3a, 0x42, 0x29, 0x87, - 0xbf, 0x13, 0x2c, 0x4b, 0xa5, 0xca, 0xca, 0xa5, 0x65, 0xbc, 0x9c, 0x59, 0x2d, 0xae, 0xae, 0x66, - 0x56, 0xd7, 0x56, 0xca, 0x19, 0x65, 0xf9, 0xe2, 0xe5, 0xcc, 0xc5, 0xd5, 0xb2, 0x52, 0x2c, 0x57, - 0xde, 0xc0, 0x6b, 0xcb,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 0xce, 0x59, 0xce, 0x7d, 0xb2, 0xb9, 0x07, - 0x61, 0xc7, 0x11, 0xfc, 0x35, 0x07, 0x26, 0x36, 0x30, 0x36, 0xd8, 0xef, 0x4b, 0xce, 0xc6, 0x57, - 0xd3, 0xd9, 0x5c, 0x61, 0xba, 0x5d, 0x4e, 0xad, 0x1e, 0x9b, 0xe2, 0x43, 0x3f, 0x5d, 0x67, 0x9d, - 0x71, 0x85, 0x55, 0xa1, 0x3c, 0x00, 0x3b, 0xa4, 0xa0, 0xea, 0x65, 0x55, 0xdf, 0xb7, 0xe0, 0x7c, - 0x47, 0x06, 0xdf, 0xf0, 0x7e, 0xd5, 0xef, 0x99, 0xdc, 0x07, 0xe0, 0x5d, 0x30, 0x72, 0x47, 0xd5, - 0x30, 0xb1, 0x29, 0xec, 0x01, 0xd4, 0x13, 0xf9, 0x34, 0x13, 0xff, 0x24, 0x9c, 0x0d, 0xda, 0x93, - 0x7a, 0xc4, 0xaa, 0x20, 0xbe, 0x69, 0x9a, 0xc4, 0x74, 0xca, 0xf7, 0x06, 0xa6, 0x8a, 0x5a, 0xb3, - 0xfa, 0x66, 0x70, 0x8e, 0x31, 0x78, 0x19, 0x2e, 0x84, 0x1c, 0xe6, 0x50, 0x7d, 0xa4, 0xd2, 0x6a, - 0xd9, 0xa3, 0xfa, 0x7d, 0x0e, 0xc0, 0xab, 0x98, 0x46, 0x67, 0xb7, 0xe3, 0x7b, 0x84, 0x08, 0x46, - 0x4f, 0x31, 0x5e, 0x63, 0x62, 0x9c, 0x49, 0xcd, 0x07, 0xc5, 0x70, 0x24, 0x28, 0x92, 0x72, 0x5d, - 0x3c, 0x72, 0x3a, 0x02, 0x36, 0xe3, 0xc1, 0xef, 0x70, 0x60, 0x66, 0x97, 0x58, 0xd4, 0xa1, 0xc8, - 0x50, 0x99, 0x20, 0xcf, 0x36, 0x26, 0xf6, 0xe4, 0x2e, 0x32, 0xee, 0xe7, 0x53, 0xe7, 0x82, 0xdc, - 0x0d, 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, - 0x77, 0xb7, 0x33, 0xd7, 0x71, 0x1d, 0xc5, 0xc0, 0x9f, 0xb9, 0xd6, 0x84, 0xf0, 0x07, 0x6e, 0x94, - 0x17, 0x06, 0xa5, 0xb3, 0xbe, 0x0f, 0x03, 0x0e, 0x17, 0x89, 0x62, 0xd3, 0xaa, 0xe8, 0xfc, 0x21, - 0xa6, 0xfa, 0x35, 0x9c, 0x5b, 0xec, 0x0d, 0x44, 0xc9, 0x01, 0xd6, 0x0b, 0xdf, 0x04, 0x49, 0x77, - 0xe0, 0x80, 0xf0, 0xaa, 0xa9, 0xe8, 0xd4, 0x42, 0xce, 0xc2, 0xb3, 0x1e, 0x58, 0xf0, 0xc6, 0x10, - 0x38, 0xeb, 0x1d, 0xb2, 0x95, 0x7f, 0xba, 0x0e, 0x86, 0x94, 0xb2, 0xa6, 0xea, 0x30, 0x17, 0x42, - 0xd5, 0xcb, 0x21, 0x30, 0xe6, 0x0c, 0x07, 0x4c, 0xb5, 0xa8, 0x53, 0x89, 0x0e, 0x31, 0x52, 0xf5, - 0x0a, 0x31, 0x35, 0xe6, 0xef, 0xe2, 0x22, 0x98, 0x0c, 0x9a, 0x62, 0x20, 0x3a, 0x1a, 0x15, 0xcf, - 0xf7, 0x1c, 0x8e, 0xa2, 0xa0, 0xe6, 0x36, 0x38, 0x75, 0xb3, 0x9d, 0x7d, 0x82, 0x77, 0xaa, 0xdf, - 0xbb, 0x74, 0x6f, 0xac, 0xe5, 0xb9, 0xe2, 0x30, 0xbb, 0xcf, 0x2b, 0xff, 0x0b, 0x00, 0x00, 0xff, - 0xff, 0xce, 0xfe, 0xb9, 0x59, 0xe2, 0x27, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_db561398d393056a) +} + +var fileDescriptor_a_bit_of_everything_db561398d393056a = []byte{ + // 3311 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x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a9, 0xa2, + 0x6b, 0x96, 0x8b, 0x9e, 0x44, 0xde, 0x29, 0x5b, 0x15, 0xed, 0x8a, 0x58, 0x51, 0x48, 0xad, 0xbc, + 0xa7, 0x62, 0xeb, 0xc0, 0x83, 0x38, 0x1d, 0x85, 0x20, 0xaa, 0x41, 0xeb, 0xde, 0xe1, 0xeb, 0xd1, + 0xc3, 0xb2, 0x6d, 0x32, 0xfa, 0xde, 0xf9, 0x5b, 0x11, 0x8d, 0x0c, 0x4c, 0xab, 0x44, 0xb3, 0x55, + 0xf6, 0xb1, 0xe7, 0x7c, 0xf9, 0x72, 0x44, 0x00, 0x2d, 0xbb, 0x28, 0xaa, 0xc4, 0xb2, 0xf0, 0x3e, + 0xf1, 0x20, 0xce, 0x74, 0x42, 0x48, 0x11, 0x90, 0xc5, 0xa8, 0x34, 0x54, 0x51, 0x89, 0x45, 0xb1, + 0x6a, 0x78, 0x00, 0x17, 0xd8, 0x3f, 0xa5, 0xcc, 0x3e, 0xd1, 0x32, 0xd6, 0x63, 0xbc, 0xbf, 0x4f, + 0x4c, 0x51, 0x37, 0x98, 0x3d, 0x3a, 0x6d, 0x93, 0xfa, 0xde, 0x69, 0x10, 0xcf, 0x17, 0x14, 0x7a, + 0xab, 0xb2, 0xd9, 0xb2, 0x3a, 0x7c, 0x08, 0x26, 0x2d, 0x45, 0xdb, 0xaf, 0x91, 0x3d, 0x8d, 0x58, + 0x94, 0x94, 0x13, 0xf3, 0x88, 0x13, 0xc6, 0xa5, 0xb5, 0xec, 0x31, 0x7e, 0xc8, 0x46, 0x29, 0x65, + 0x77, 0x18, 0xbe, 0x3c, 0xe1, 0x92, 0x73, 0x57, 0xb0, 0x0a, 0x06, 0x6d, 0x5b, 0x29, 0x27, 0x38, + 0xc4, 0x09, 0x63, 0x85, 0xbb, 0xcd, 0xfc, 0xed, 0xcf, 0x38, 0xee, 0x73, 0xee, 0xfa, 0xc7, 0x38, + 0x53, 0xc9, 0x67, 0xb6, 0x96, 0x32, 0x97, 0x1f, 0x1e, 0xad, 0x35, 0x32, 0xc1, 0xe5, 0x6a, 0x3f, + 0xcb, 0x65, 0xa9, 0x21, 0x33, 0x0e, 0x70, 0x17, 0x0c, 0x7b, 0x1a, 0xc4, 0x10, 0xff, 0x52, 0x1a, + 0x78, 0x74, 0xe0, 0x07, 0x60, 0xbc, 0x52, 0xd3, 0x31, 0xdd, 0x3b, 0xc4, 0x35, 0x9b, 0x24, 0x78, + 0xc4, 0x09, 0xb1, 0xc2, 0xf9, 0x66, 0xfe, 0x4d, 0x69, 0x66, 0xcb, 0xd9, 0x47, 0x6c, 0x1f, 0xb1, + 0x08, 0xcb, 0xf1, 0x4b, 0x59, 0xe9, 0x29, 0x17, 0x44, 0x90, 0x01, 0x5b, 0xdc, 0x73, 0xbe, 0xe1, + 0x19, 0x30, 0x51, 0xd6, 0xed, 0x62, 0x8d, 0x78, 0xc4, 0x06, 0x11, 0x27, 0x70, 0xf2, 0xb8, 0xbb, + 0xe7, 0x82, 0x2c, 0x82, 0x71, 0x45, 0xa3, 0x97, 0x56, 0x3d, 0x88, 0x21, 0xc4, 0x09, 0xbc, 0x0c, + 0xd8, 0x56, 0x8b, 0x86, 0x1d, 0x84, 0x18, 0x46, 0x9c, 0x30, 0x28, 0x8f, 0xdb, 0x01, 0x10, 0x97, + 0xc6, 0x8a, 0xe4, 0x41, 0x8c, 0x20, 0x4e, 0x18, 0x62, 0x34, 0x56, 0x24, 0x17, 0xe0, 0x2c, 0x98, + 0xac, 0x28, 0x4f, 0x48, 0xb9, 0x45, 0x64, 0x14, 0x71, 0xc2, 0xb0, 0x3c, 0xe1, 0x6d, 0x86, 0x81, + 0x5a, 0x74, 0xc6, 0x10, 0x27, 0x8c, 0x78, 0x40, 0x3e, 0xa5, 0xd7, 0x00, 0x28, 0xea, 0x7a, 0xcd, + 0x83, 0x00, 0x88, 0x13, 0x46, 0xe5, 0x31, 0x67, 0xa7, 0x25, 0xac, 0x45, 0x4d, 0x45, 0xdb, 0xf7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, + 0x31, 0x7d, 0x95, 0x89, 0x9b, 0x87, 0x57, 0x8e, 0x8b, 0x69, 0x83, 0x49, 0x25, 0xee, 0x13, 0xda, + 0x35, 0xbc, 0xe1, 0xaf, 0x39, 0x70, 0x82, 0xa9, 0xe1, 0x58, 0xf4, 0xd5, 0xeb, 0x71, 0x9b, 0xe9, + 0x71, 0x3d, 0x95, 0x7b, 0x4e, 0x3d, 0x1c, 0x8f, 0x84, 0x87, 0xbe, 0x46, 0x2e, 0xfc, 0x3f, 0x4e, + 0x92, 0x3f, 0xe3, 0x9a, 0xf9, 0xaf, 0x39, 0x58, 0xe9, 0x31, 0x4e, 0x07, 0x1f, 0xf1, 0x51, 0x26, + 0x83, 0x1e, 0x57, 0x95, 0x52, 0x15, 0x59, 0x55, 0xdd, 0xae, 0x95, 0x59, 0x5e, 0x2c, 0x12, 0x64, + 0x5b, 0xa4, 0x8c, 0x14, 0x0d, 0x19, 0x35, 0x5c, 0x22, 0x48, 0xaf, 0xb0, 0x0c, 0x5a, 0xd6, 0x4b, + 0xb6, 0x4a, 0x34, 0x77, 0x48, 0x43, 0x25, 0x5d, 0x75, 0x16, 0x67, 0x92, 0xb7, 0xc1, 0x62, 0xb7, + 0x96, 0xcd, 0xc9, 0x6f, 0xfe, 0x00, 0xdf, 0xef, 0x23, 0xf0, 0x23, 0x70, 0xa2, 0x84, 0x55, 0x52, + 0x5b, 0xc7, 0x16, 0xf1, 0x68, 0x38, 0xd3, 0x26, 0x94, 0xc1, 0x90, 0xfb, 0x7b, 0x74, 0xbf, 0x37, + 0x7c, 0x9e, 0x59, 0x79, 0x16, 0xce, 0x84, 0x6e, 0xb8, 0x73, 0x24, 0x7d, 0x02, 0x16, 0xf2, 0x9a, + 0x4e, 0xab, 0xc4, 0xf4, 0x38, 0x39, 0xb7, 0x2a, 0x90, 0xed, 0xde, 0x0f, 0xe5, 0xbe, 0x7e, 0x19, + 0x0f, 0x14, 0xbe, 0x1e, 0x69, 0xe6, 0xbf, 0x1a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01, 0x00, 0x00, 0xff, 0xff, 0xed, 0x21, 0x52, 0xb7, 0x7b, 0x29, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index 23ae923228d..cc2b326c833 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -265,7 +265,10 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run protoReq.EnumValueAnnotation = NumericEnum(e) - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Create_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Create_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -387,7 +390,10 @@ func request_ABitOfEverythingService_UpdateV2_0(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_UpdateV2_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateV2_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -439,7 +445,10 @@ func request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_UpdateV2_1); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateV2_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -539,7 +548,10 @@ func request_ABitOfEverythingService_GetQuery_0(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_GetQuery_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_GetQuery_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -799,7 +811,10 @@ func request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runti var protoReq sub.StringMessage var metadata runtime.ServerMetadata - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Echo_2); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Echo_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -931,6 +946,90 @@ func request_ABitOfEverythingService_PostWithEmptyBody_0(ctx context.Context, ma } +var ( + filter_ABitOfEverythingService_CheckGetQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "name": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} +) + +func request_ABitOfEverythingService_CheckGetQueryParams_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 + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["single_nested.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckGetQueryParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CheckGetQueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_ABitOfEverythingService_CheckPostQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "string_value": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_ABitOfEverythingService_CheckPostQueryParams_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 + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.SingleNested); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["string_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") + } + + protoReq.StringValue, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckPostQueryParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CheckPostQueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + func request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler runtime.Marshaler, client CamelCaseServiceNameClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq empty.Empty var metadata runtime.ServerMetadata @@ -1338,6 +1437,46 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) + mux.Handle("GET", pattern_ABitOfEverythingService_CheckGetQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_CheckGetQueryParams_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_CheckGetQueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_CheckPostQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_CheckPostQueryParams_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_CheckPostQueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1377,6 +1516,10 @@ var ( pattern_ABitOfEverythingService_GetMessageWithBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "withbody", "id"}, "")) pattern_ABitOfEverythingService_PostWithEmptyBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "postwithemptybody", "name"}, "")) + + pattern_ABitOfEverythingService_CheckGetQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "get", "single_nested.name"}, "")) + + pattern_ABitOfEverythingService_CheckPostQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "post", "string_value"}, "")) ) var ( @@ -1415,6 +1558,10 @@ var ( forward_ABitOfEverythingService_GetMessageWithBody_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_PostWithEmptyBody_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_CheckGetQueryParams_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_CheckPostQueryParams_0 = runtime.ForwardResponseMessage ) // RegisterCamelCaseServiceNameHandlerFromEndpoint is same as RegisterCamelCaseServiceNameHandler but diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 5a4e525ff8c..84d22126f11 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -438,6 +438,17 @@ service ABitOfEverythingService { body: "*" }; } + rpc CheckGetQueryParams(ABitOfEverything) returns (ABitOfEverything) { + option (google.api.http) = { + get: "/v1/example/a_bit_of_everything/params/get/{single_nested.name}" + }; + } + rpc CheckPostQueryParams(ABitOfEverything) returns (ABitOfEverything) { + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything/params/post/{string_value}" + body: "single_nested" + }; + } } // camelCase and lowercase service names are valid but not recommended (use TitleCase instead) diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 952baa18492..a83eeb952c3 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -121,6 +121,361 @@ } } }, + "/v1/example/a_bit_of_everything/params/get/{single_nested.name}": { + "get": { + "operationId": "CheckGetQueryParams", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + }, + "403": { + "description": "Returned when the user does not have permission to access the resource.", + "schema": {} + }, + "404": { + "description": "Returned when the resource does not exist.", + "schema": { + "format": "string" + } + }, + "418": { + "description": "I'm a teapot.", + "schema": { + "$ref": "#/definitions/examplepbNumericEnum" + } + } + }, + "parameters": [ + { + "name": "single_nested.name", + "description": "name is nested field.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "single_nested.amount", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "single_nested.ok", + "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "FALSE", + "TRUE" + ], + "default": "FALSE" + }, + { + "name": "uuid", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "float_value", + "description": "Float value field", + "in": "query", + "required": true, + "type": "number", + "format": "float", + "default": "0.2" + }, + { + "name": "double_value", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "int64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "uint64_value", + "in": "query", + "required": false, + "type": "string", + "format": "uint64" + }, + { + "name": "int32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "fixed64_value", + "in": "query", + "required": false, + "type": "string", + "format": "uint64" + }, + { + "name": "fixed32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "bool_value", + "in": "query", + "required": false, + "type": "boolean", + "format": "boolean" + }, + { + "name": "string_value", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "bytes_value", + "in": "query", + "required": false, + "type": "string", + "format": "byte" + }, + { + "name": "uint32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "enum_value", + "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "ZERO", + "ONE" + ], + "default": "ZERO" + }, + { + "name": "path_enum_value", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "ABC", + "DEF" + ], + "default": "ABC" + }, + { + "name": "nested_path_enum_value", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "GHI", + "JKL" + ], + "default": "GHI" + }, + { + "name": "sfixed32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "sfixed64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "sint32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "sint64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "repeated_string_value", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "oneof_string", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "nonConventionalNameValue", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "timestamp_value", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "repeated_enum_value", + "description": "repeated enum value. it is comma-separated in query.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + }, + "collectionFormat": "multi" + }, + { + "name": "repeated_enum_annotation", + "description": "Repeated numeric enum title. Repeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + }, + "collectionFormat": "multi" + }, + { + "name": "enum_value_annotation", + "description": "Numeric enum title. Numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "ZERO", + "ONE" + ], + "default": "ZERO" + }, + { + "name": "repeated_string_annotation", + "description": "Repeated string title. Repeated string description.", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "nested_annotation.amount", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "nested_annotation.ok", + "description": "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true.", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "FALSE", + "TRUE" + ], + "default": "FALSE" + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v1/example/a_bit_of_everything/params/post/{string_value}": { + "post": { + "operationId": "CheckPostQueryParams", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + }, + "403": { + "description": "Returned when the user does not have permission to access the resource.", + "schema": {} + }, + "404": { + "description": "Returned when the resource does not exist.", + "schema": { + "format": "string" + } + }, + "418": { + "description": "I'm a teapot.", + "schema": { + "$ref": "#/definitions/examplepbNumericEnum" + } + } + }, + "parameters": [ + { + "name": "string_value", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ABitOfEverythingNested" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, "/v1/example/a_bit_of_everything/query/{uuid}": { "get": { "operationId": "GetQuery", diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index 6995d2afc57..65aaccd3ccc 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -54,7 +54,10 @@ func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -100,7 +103,10 @@ func request_EchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_1); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -162,7 +168,10 @@ func request_EchoService_Echo_2(ctx context.Context, marshaler runtime.Marshaler return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lang", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_2); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -224,7 +233,10 @@ func request_EchoService_Echo_3(ctx context.Context, marshaler runtime.Marshaler return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status.note", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_3); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_3); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -259,7 +271,10 @@ func request_EchoService_Echo_4(ctx context.Context, marshaler runtime.Marshaler return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "no.note", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_4); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -293,7 +308,10 @@ func request_EchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Mar var protoReq SimpleMessage var metadata runtime.ServerMetadata - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_EchoDelete_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoDelete_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index b34314fe7d1..e633c129807 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -221,7 +221,10 @@ func request_FlowCombination_RpcBodyRpc_2(ctx context.Context, marshaler runtime var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_2); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -292,7 +295,10 @@ func request_FlowCombination_RpcBodyRpc_4(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_4); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -335,7 +341,10 @@ func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_5); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_5); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -370,7 +379,10 @@ func request_FlowCombination_RpcBodyRpc_6(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_6); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyRpc_6); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -405,7 +417,10 @@ func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -459,7 +474,10 @@ func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -494,7 +512,10 @@ func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_1); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -537,7 +558,10 @@ func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_2); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -636,7 +660,10 @@ func request_FlowCombination_RpcBodyStream_2(ctx context.Context, marshaler runt var protoReq NonEmptyProto var metadata runtime.ServerMetadata - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_2); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyStream_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -723,7 +750,10 @@ func request_FlowCombination_RpcBodyStream_4(ctx context.Context, marshaler runt return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_4); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyStream_4); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -774,7 +804,10 @@ func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runt return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_5); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyStream_5); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -817,7 +850,10 @@ func request_FlowCombination_RpcBodyStream_6(ctx context.Context, marshaler runt return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_6); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcBodyStream_6); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -860,7 +896,10 @@ func request_FlowCombination_RpcPathSingleNestedStream_0(ctx context.Context, ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathSingleNestedStream_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathSingleNestedStream_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -922,7 +961,10 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedStream_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -965,7 +1007,10 @@ func request_FlowCombination_RpcPathNestedStream_1(ctx context.Context, marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_1); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedStream_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -1016,7 +1061,10 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_2); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedStream_2); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index 19c6664ecb2..8d50142d728 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -54,7 +54,10 @@ func request_UnannotatedEchoService_Echo_0(ctx context.Context, marshaler runtim return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_UnannotatedEchoService_Echo_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -100,7 +103,10 @@ func request_UnannotatedEchoService_Echo_1(ctx context.Context, marshaler runtim return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_UnannotatedEchoService_Echo_1); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_Echo_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -134,7 +140,10 @@ func request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, marshaler var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_UnannotatedEchoService_EchoDelete_0); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UnannotatedEchoService_EchoDelete_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 384638cab31..fc3acca0c1e 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -312,3 +312,11 @@ func (s *_ABitOfEverythingServer) GetMessageWithBody(ctx context.Context, msg *e func (s *_ABitOfEverythingServer) PostWithEmptyBody(ctx context.Context, msg *examples.Body) (*empty.Empty, error) { return &empty.Empty{}, nil } + +func (s *_ABitOfEverythingServer) CheckGetQueryParams(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { + return msg, nil +} + +func (s *_ABitOfEverythingServer) CheckPostQueryParams(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { + return msg, nil +} diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index d376ccdb255..a14de379642 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -345,7 +345,10 @@ var ( {{end}} {{end}} {{if .HasQueryParam}} - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}); err != nil { + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } {{end}} From 6081c036fc208bab4518dffd513c4f3a7537cf4c Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Thu, 13 Jun 2019 09:06:42 +0100 Subject: [PATCH 408/552] Revert "protoc-gen-swagger: check typeIndex when typeName is Method" This reverts the changes introduced in #833. It caused a regression in the swagger generator allow_merge behaviour. Fixes #923 --- .../abe/camel_case_service_name_api.go | 3 +- .../a_bit_of_everything.swagger.json | 2 + protoc-gen-swagger/genswagger/template.go | 2 +- .../genswagger/template_test.go | 142 ------------------ 4 files changed, 5 insertions(+), 144 deletions(-) diff --git a/examples/clients/abe/camel_case_service_name_api.go b/examples/clients/abe/camel_case_service_name_api.go index d761b19786c..cb8cb48fd99 100644 --- a/examples/clients/abe/camel_case_service_name_api.go +++ b/examples/clients/abe/camel_case_service_name_api.go @@ -37,7 +37,8 @@ func NewCamelCaseServiceNameApiWithBasePath(basePath string) *CamelCaseServiceNa } /** - * + * Create a new ABitOfEverything + * This API creates a new ABitOfEverything * * @return *interface{} */ diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index a83eeb952c3..edfa08730b7 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -1589,6 +1589,8 @@ }, "/v2/example/empty": { "get": { + "summary": "Create a new ABitOfEverything", + "description": "This API creates a new ABitOfEverything", "operationId": "Empty", "responses": { "200": { diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index b802fef186d..b02ed6aa2c7 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1366,7 +1366,7 @@ func isProtoPathMatches(paths []int32, outerPaths []int32, typeName string, type } if typeName == "Method" { - if paths[0] != serviceProtoPath || paths[1] != typeIndex || paths[2] != methodProtoPath { + if paths[0] != serviceProtoPath || paths[2] != methodProtoPath { return false } paths = paths[2:] diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 6f14e5f268b..4853a4370d3 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -1372,148 +1372,6 @@ func TestRenderMessagesAsDefinition(t *testing.T) { } } -func fileFixtureServices(services []string) *descriptor.File { - var ( - svcdesc = []*protodescriptor.ServiceDescriptorProto{} - loc = []*protodescriptor.SourceCodeInfo_Location{} - msgdesc = []*protodescriptor.DescriptorProto{} - methdesc = []*protodescriptor.MethodDescriptorProto{} - msg = []*descriptor.Message{} - svc = []*descriptor.Service{} - ) - - for _, service := range services { - // loc - sc := &protodescriptor.SourceCodeInfo_Location{ - LeadingComments: proto.String(fmt.Sprintf("%s message", service)), - } - loc = append(loc, sc) - // methdesc - md := &protodescriptor.MethodDescriptorProto{ - Name: proto.String(service), - InputType: proto.String(fmt.Sprintf("%sMessage", service)), - OutputType: proto.String(fmt.Sprintf("%sMessage", service)), - } - methdesc = append(methdesc, md) - // svcdesc - sd := &protodescriptor.ServiceDescriptorProto{ - Name: proto.String(fmt.Sprintf("%sService", service)), - Method: []*protodescriptor.MethodDescriptorProto{md}, - } - svcdesc = append(svcdesc, sd) - // msgdesc - d := &protodescriptor.DescriptorProto{ - Name: proto.String(fmt.Sprintf("%sRequest", service)), - } - msgdesc = append(msgdesc, d) - // msg - m := &descriptor.Message{ - DescriptorProto: d, - } - msg = append(msg, m) - // methods - meth := &descriptor.Method{ - MethodDescriptorProto: md, - RequestType: m, - ResponseType: m, - Bindings: []*descriptor.Binding{ - { - HTTPMethod: "POST", - Body: &descriptor.Body{FieldPath: nil}, - PathTmpl: httprule.Template{ - Version: 1, - OpCodes: []int{0, 0}, - Template: fmt.Sprintf("/v1/%s", service), - }, - }, - }, - } - s := &descriptor.Service{ - ServiceDescriptorProto: sd, - Methods: []*descriptor.Method{meth}, - } - svc = append(svc, s) - } - - file := descriptor.File{ - FileDescriptorProto: &protodescriptor.FileDescriptorProto{ - SourceCodeInfo: &protodescriptor.SourceCodeInfo{ - Location: loc, - }, - Name: proto.String("example.proto"), - Package: proto.String("example"), - Dependency: []string{}, - MessageType: msgdesc, - Service: svcdesc, - }, - GoPkg: descriptor.GoPackage{ - Path: "example.com/path/to/example/example1.pb", - Name: "example_pb", - }, - Messages: msg, - Services: svc, - } - return &file -} - -func TestIsProtoPathMatches(t *testing.T) { - for _, test := range []struct { - path []int32 - outerPaths []int32 - typeName string - typeIndex int32 - fieldPaths []int32 - want bool - }{ - {[]int32{6, 0, 2, 0}, []int32{}, "Method", 1, []int32{2, 0}, false}, - {[]int32{6, 0, 2, 0, 1}, []int32{}, "Method", 1, []int32{2, 0}, false}, - {[]int32{6, 0, 2, 0}, []int32{}, "Method", 0, []int32{2, 0}, true}, - {[]int32{}, []int32{}, "Package", 2, []int32{}, false}, - {[]int32{2}, []int32{}, "Package", 3, []int32{}, false}, - {[]int32{2}, []int32{}, "Package", 2, []int32{}, true}, - {[]int32{4, 0}, []int32{}, "MessageType", 1, []int32{}, false}, - {[]int32{4, 0, 2, 0}, []int32{}, "MessageType", 0, []int32{4, 0}, false}, - } { - got := isProtoPathMatches(test.path, test.outerPaths, test.typeName, test.typeIndex, test.fieldPaths) - if got != test.want { - t.Errorf("isProtoPathMatches(%v) got (%t) want %t", test, got, test.want) - } - } -} - -func TestProtoComments(t *testing.T) { - for _, test := range []struct { - services []string - startPath []int32 - outers []string - typeName string - typeIndex int32 - fieldPaths []int32 - want string - }{ - {[]string{"Foo", "Bar"}, []int32{6, 0, 2, 0}, []string{}, "Method", 0, []int32{2, 0}, "Foo message"}, - {[]string{"Foo", "Bar"}, []int32{6, 0, 2, 0}, []string{}, "Method", 1, []int32{2, 0}, "Bar message"}, - {[]string{"Foo", "Bar"}, []int32{6, 0, 2, 0}, []string{}, "Method", 2, []int32{2, 0}, ""}, - {[]string{"Foo", "Bar"}, []int32{4, 0, 1}, []string{}, "Method", 0, []int32{2, 0}, ""}, - {[]string{"Foo", "Bar"}, []int32{6, 0, 1, 1}, []string{}, "Method", 0, []int32{2, 0}, ""}, - {[]string{"Foo", "Bar", "Baz"}, []int32{6, 0, 2, 0}, []string{}, "Method", 2, []int32{2, 0}, "Baz message"}, - } { - file := fileFixtureServices(test.services) - for i, loc := range file.SourceCodeInfo.Location { - test.startPath[1] = int32(i) - loc.Path = append(loc.Path, test.startPath...) - } - reg := descriptor.NewRegistry() - reg.Load(&plugin.CodeGeneratorRequest{ - ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}, - }) - got := protoComments(reg, file, test.outers, test.typeName, test.typeIndex, test.fieldPaths...) - if got != test.want { - t.Errorf("protoComments(%v) got (%s) want %s", test, got, test.want) - } - } -} - func TestUpdateSwaggerDataFromComments(t *testing.T) { tests := []struct { From cb0458be842765e7142783bc0d0086d01365fa25 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Thu, 13 Jun 2019 21:35:25 +0100 Subject: [PATCH 409/552] Generate changelog for 1.9.1 --- CHANGELOG.md | 22 ++++++++++++++++++---- Makefile | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c60c86475e5..b820c925e32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Change Log +## [v1.9.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.1) (2019-06-13) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.0...v1.9.1) + +**Closed issues:** + +- grpc: received message larger than max [\#943](https://github.com/grpc-ecosystem/grpc-gateway/issues/943) +- json 1.1 api support for grpc-ecosystem to use queryparams with filter [\#938](https://github.com/grpc-ecosystem/grpc-gateway/issues/938) +- i import a new gateway.Endpoint without recompile [\#937](https://github.com/grpc-ecosystem/grpc-gateway/issues/937) +- all SubConns are in TransientFailure [\#936](https://github.com/grpc-ecosystem/grpc-gateway/issues/936) +- Merging swagger specs fails to use rpc comments \(again\) [\#923](https://github.com/grpc-ecosystem/grpc-gateway/issues/923) + +**Merged pull requests:** + +- Revert "protoc-gen-swagger: check typeIndex when typeName is Method" [\#945](https://github.com/grpc-ecosystem/grpc-gateway/pull/945) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- fix query params not populate if method is post [\#939](https://github.com/grpc-ecosystem/grpc-gateway/pull/939) ([mingqing](https://github.com/mingqing)) +- Fix make test on MacOS [\#935](https://github.com/grpc-ecosystem/grpc-gateway/pull/935) ([emilaasa](https://github.com/emilaasa)) + ## [v1.9.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.0) (2019-05-14) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.8.6...v1.9.0) @@ -9,6 +26,7 @@ **Merged pull requests:** +- Generate changelog for 1.9.0 [\#933](https://github.com/grpc-ecosystem/grpc-gateway/pull/933) ([johanbrandhorst](https://github.com/johanbrandhorst)) - use error value for bad URI so custom error handler could treat it special [\#932](https://github.com/grpc-ecosystem/grpc-gateway/pull/932) ([jhump](https://github.com/jhump)) - newline between JSON messages [\#931](https://github.com/grpc-ecosystem/grpc-gateway/pull/931) ([jhump](https://github.com/jhump)) - ability to customize stream errors [\#930](https://github.com/grpc-ecosystem/grpc-gateway/pull/930) ([jhump](https://github.com/jhump)) @@ -202,10 +220,6 @@ ## [v1.6.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.6.3) (2018-12-21) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.6.2...v1.6.3) -**Fixed bugs:** - -- Comments of rpc method gets copied if multiple services are present in a proto file. [\#746](https://github.com/grpc-ecosystem/grpc-gateway/issues/746) - **Closed issues:** - Issue with google.protobuf.Empty representation in swagger file [\#831](https://github.com/grpc-ecosystem/grpc-gateway/issues/831) diff --git a/Makefile b/Makefile index ad9b85daec5..8d61d71bc66 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.9.0 + --future-release=v1.9.1 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 54535ae09d82fbf62b886e7741a854e5f3a378b0 Mon Sep 17 00:00:00 2001 From: James Hamlin Date: Sat, 15 Jun 2019 23:18:55 -0700 Subject: [PATCH 410/552] Support colon in final path segment, last match wins behavior (behind flags) (#949) * Support colon in final path segment, last match wins behavior (behind flags) Signed-off-by: James Hamlin * Update examples Signed-off-by: James Hamlin Fixes #224 --- .../examplepb/a_bit_of_everything.pb.gw.go | 42 +++++----- .../proto/examplepb/echo_service.pb.gw.go | 14 ++-- .../proto/examplepb/flow_combination.pb.gw.go | 52 ++++++------- .../examplepb/response_body_service.pb.gw.go | 6 +- examples/proto/examplepb/stream.pb.gw.go | 6 +- .../unannotated_echo_service.pb.gw.go | 8 +- examples/proto/examplepb/wrappers.pb.gw.go | 22 +++--- .../descriptor/registry.go | 14 ++++ .../gengateway/template.go | 8 +- .../gengateway/template_test.go | 4 +- protoc-gen-grpc-gateway/main.go | 2 + runtime/mux.go | 16 +++- runtime/mux_test.go | 78 ++++++++++++++++--- runtime/pattern.go | 51 ++++++++++-- 14 files changed, 227 insertions(+), 96 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index cc2b326c833..df3b7b394f4 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -1481,45 +1481,45 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt } var ( - pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19, 1, 0, 4, 1, 5, 20, 1, 0, 4, 1, 5, 21, 1, 0, 4, 1, 5, 22, 1, 0, 4, 1, 5, 23}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue", "enum_value", "path_enum_value", "nested_path_enum_value", "enum_value_annotation"}, "")) + pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19, 1, 0, 4, 1, 5, 20, 1, 0, 4, 1, 5, 21, 1, 0, 4, 1, 5, 22, 1, 0, 4, 1, 5, 23}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue", "enum_value", "path_enum_value", "nested_path_enum_value", "enum_value_annotation"}, "", runtime.AssumeColonVerbOpt(true))) - 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_CreateBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "", runtime.AssumeColonVerbOpt(true))) - 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_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"}, "", runtime.AssumeColonVerbOpt(true))) - 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_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"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_UpdateV2_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "a_bit_of_everything", "abe.uuid"}, "")) + pattern_ABitOfEverythingService_UpdateV2_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "a_bit_of_everything", "abe.uuid"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_UpdateV2_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "a_bit_of_everything", "abe.uuid"}, "")) + pattern_ABitOfEverythingService_UpdateV2_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "a_bit_of_everything", "abe.uuid"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_PatchWithFieldMaskInBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2a", "example", "a_bit_of_everything", "abe.uuid"}, "")) + pattern_ABitOfEverythingService_PatchWithFieldMaskInBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2a", "example", "a_bit_of_everything", "abe.uuid"}, "", runtime.AssumeColonVerbOpt(true))) - 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"}, "")) + 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"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_GetQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "query", "uuid"}, "")) + pattern_ABitOfEverythingService_GetQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "query", "uuid"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_GetRepeatedQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 1, 0, 4, 1, 5, 12, 1, 0, 4, 1, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18}, []string{"v1", "example", "a_bit_of_everything_repeated", "path_repeated_float_value", "path_repeated_double_value", "path_repeated_int64_value", "path_repeated_uint64_value", "path_repeated_int32_value", "path_repeated_fixed64_value", "path_repeated_fixed32_value", "path_repeated_bool_value", "path_repeated_string_value", "path_repeated_bytes_value", "path_repeated_uint32_value", "path_repeated_enum_value", "path_repeated_sfixed32_value", "path_repeated_sfixed64_value", "path_repeated_sint32_value", "path_repeated_sint64_value"}, "")) + pattern_ABitOfEverythingService_GetRepeatedQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 1, 0, 4, 1, 5, 12, 1, 0, 4, 1, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18}, []string{"v1", "example", "a_bit_of_everything_repeated", "path_repeated_float_value", "path_repeated_double_value", "path_repeated_int64_value", "path_repeated_uint64_value", "path_repeated_int32_value", "path_repeated_fixed64_value", "path_repeated_fixed32_value", "path_repeated_bool_value", "path_repeated_string_value", "path_repeated_bytes_value", "path_repeated_uint32_value", "path_repeated_enum_value", "path_repeated_sfixed32_value", "path_repeated_sfixed64_value", "path_repeated_sint32_value", "path_repeated_sint64_value"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "echo", "value"}, "")) + pattern_ABitOfEverythingService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "echo", "value"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, "")) + pattern_ABitOfEverythingService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, "")) + pattern_ABitOfEverythingService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, "", runtime.AssumeColonVerbOpt(true))) - 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_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"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_Timeout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "timeout"}, "")) + pattern_ABitOfEverythingService_Timeout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "timeout"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_ErrorWithDetails_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "errorwithdetails"}, "")) + pattern_ABitOfEverythingService_ErrorWithDetails_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "errorwithdetails"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_GetMessageWithBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "withbody", "id"}, "")) + pattern_ABitOfEverythingService_GetMessageWithBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "withbody", "id"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_PostWithEmptyBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "postwithemptybody", "name"}, "")) + pattern_ABitOfEverythingService_PostWithEmptyBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "postwithemptybody", "name"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_CheckGetQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "get", "single_nested.name"}, "")) + pattern_ABitOfEverythingService_CheckGetQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "get", "single_nested.name"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_CheckPostQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "post", "string_value"}, "")) + pattern_ABitOfEverythingService_CheckPostQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "post", "string_value"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -1626,7 +1626,7 @@ func RegisterCamelCaseServiceNameHandlerClient(ctx context.Context, mux *runtime } var ( - pattern_CamelCaseServiceName_Empty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "empty"}, "")) + pattern_CamelCaseServiceName_Empty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "empty"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index 65aaccd3ccc..1ceb1894a2e 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -502,19 +502,19 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } var ( - pattern_EchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, "")) + pattern_EchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_EchoService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "echo", "id", "num"}, "")) + pattern_EchoService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "echo", "id", "num"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_EchoService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "echo", "id", "num", "lang"}, "")) + pattern_EchoService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "echo", "id", "num", "lang"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_EchoService_Echo_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "echo1", "id", "line_num", "status.note"}, "")) + pattern_EchoService_Echo_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "echo1", "id", "line_num", "status.note"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_EchoService_Echo_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo2", "no.note"}, "")) + pattern_EchoService_Echo_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo2", "no.note"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_EchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, "")) + pattern_EchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_EchoService_EchoDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_delete"}, "")) + pattern_EchoService_EchoDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_delete"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index e633c129807..e5de847c464 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -1643,57 +1643,57 @@ func RegisterFlowCombinationHandlerClient(ctx context.Context, mux *runtime.Serv } var ( - pattern_FlowCombination_RpcEmptyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "empty"}, "")) + pattern_FlowCombination_RpcEmptyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "empty"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcEmptyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "empty", "stream"}, "")) + pattern_FlowCombination_RpcEmptyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "empty", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_StreamEmptyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stream", "empty", "rpc"}, "")) + pattern_FlowCombination_StreamEmptyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stream", "empty", "rpc"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_StreamEmptyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"stream", "empty"}, "")) + pattern_FlowCombination_StreamEmptyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"stream", "empty"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "body"}, "")) + pattern_FlowCombination_RpcBodyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "body"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyRpc_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 0}, []string{"rpc", "path", "a", "b", "c"}, "")) + pattern_FlowCombination_RpcBodyRpc_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 0}, []string{"rpc", "path", "a", "b", "c"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyRpc_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "query"}, "")) + pattern_FlowCombination_RpcBodyRpc_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "query"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyRpc_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 0}, []string{"rpc", "body", "path", "a", "b"}, "")) + pattern_FlowCombination_RpcBodyRpc_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 0}, []string{"rpc", "body", "path", "a", "b"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyRpc_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 0}, []string{"rpc", "body", "query"}, "")) + pattern_FlowCombination_RpcBodyRpc_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 0}, []string{"rpc", "body", "query"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyRpc_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 0}, []string{"rpc", "body", "path", "a", "query"}, "")) + pattern_FlowCombination_RpcBodyRpc_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 0}, []string{"rpc", "body", "path", "a", "query"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyRpc_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 0}, []string{"rpc", "path", "a", "query"}, "")) + pattern_FlowCombination_RpcBodyRpc_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 0}, []string{"rpc", "path", "a", "query"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcPathSingleNestedRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested", "a.str"}, "")) + pattern_FlowCombination_RpcPathSingleNestedRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested", "a.str"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcPathNestedRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 2, 0}, []string{"rpc", "path-nested", "a.str", "b"}, "")) + pattern_FlowCombination_RpcPathNestedRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 2, 0}, []string{"rpc", "path-nested", "a.str", "b"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcPathNestedRpc_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested", "a.str"}, "")) + pattern_FlowCombination_RpcPathNestedRpc_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested", "a.str"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcPathNestedRpc_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested", "a.str"}, "")) + pattern_FlowCombination_RpcPathNestedRpc_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested", "a.str"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "body", "stream"}, "")) + pattern_FlowCombination_RpcBodyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "body", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyStream_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"rpc", "path", "a", "b", "c", "stream"}, "")) + pattern_FlowCombination_RpcBodyStream_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"rpc", "path", "a", "b", "c", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyStream_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "query", "stream"}, "")) + pattern_FlowCombination_RpcBodyStream_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "query", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyStream_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"rpc", "body", "path", "a", "b", "stream"}, "")) + pattern_FlowCombination_RpcBodyStream_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"rpc", "body", "path", "a", "b", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyStream_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"rpc", "body", "query", "stream"}, "")) + pattern_FlowCombination_RpcBodyStream_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"rpc", "body", "query", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyStream_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 5}, []string{"rpc", "body", "path", "a", "query", "stream"}, "")) + pattern_FlowCombination_RpcBodyStream_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 5}, []string{"rpc", "body", "path", "a", "query", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcBodyStream_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 4}, []string{"rpc", "path", "a", "query", "stream"}, "")) + pattern_FlowCombination_RpcBodyStream_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 4}, []string{"rpc", "path", "a", "query", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcPathSingleNestedStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested", "a.str", "stream"}, "")) + pattern_FlowCombination_RpcPathSingleNestedStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested", "a.str", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcPathNestedStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"rpc", "path-nested", "a.str", "b", "stream"}, "")) + pattern_FlowCombination_RpcPathNestedStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"rpc", "path-nested", "a.str", "b", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcPathNestedStream_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested", "a.str", "stream"}, "")) + pattern_FlowCombination_RpcPathNestedStream_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested", "a.str", "stream"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_FlowCombination_RpcPathNestedStream_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested", "a.str", "stream"}, "")) + pattern_FlowCombination_RpcPathNestedStream_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested", "a.str", "stream"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index 35b4f766884..7de38ce36af 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -238,11 +238,11 @@ func (m response_ResponseBodyService_ListResponseStrings_0) XXX_ResponseBody() i } var ( - pattern_ResponseBodyService_GetResponseBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebody", "data"}, "")) + pattern_ResponseBodyService_GetResponseBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebody", "data"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ResponseBodyService_ListResponseBodies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebodies", "data"}, "")) + pattern_ResponseBodyService_ListResponseBodies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebodies", "data"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ResponseBodyService_ListResponseStrings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsestrings", "data"}, "")) + pattern_ResponseBodyService_ListResponseStrings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsestrings", "data"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index afda301f0ca..3b01d805071 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -242,11 +242,11 @@ func RegisterStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeM } 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_BulkCreate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "bulk"}, "", runtime.AssumeColonVerbOpt(true))) - 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_List_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "", runtime.AssumeColonVerbOpt(true))) - 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"}, "")) + 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"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index 8d50142d728..721b18ba6e2 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -274,13 +274,13 @@ func RegisterUnannotatedEchoServiceHandlerClient(ctx context.Context, mux *runti } var ( - pattern_UnannotatedEchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, "")) + pattern_UnannotatedEchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_UnannotatedEchoService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "echo", "id", "num"}, "")) + pattern_UnannotatedEchoService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "echo", "id", "num"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_UnannotatedEchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, "")) + pattern_UnannotatedEchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_UnannotatedEchoService_EchoDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_delete"}, "")) + pattern_UnannotatedEchoService_EchoDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_delete"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index 3b1478554aa..1c0765519f8 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -479,27 +479,27 @@ func RegisterWrappersServiceHandlerClient(ctx context.Context, mux *runtime.Serv } var ( - pattern_WrappersService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "wrappers"}, "")) + pattern_WrappersService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "wrappers"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_WrappersService_CreateStringValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testString"}, "")) + pattern_WrappersService_CreateStringValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testString"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_WrappersService_CreateInt32Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testInt32"}, "")) + pattern_WrappersService_CreateInt32Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testInt32"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_WrappersService_CreateInt64Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testInt64"}, "")) + pattern_WrappersService_CreateInt64Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testInt64"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_WrappersService_CreateFloatValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testFloat"}, "")) + pattern_WrappersService_CreateFloatValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testFloat"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_WrappersService_CreateDoubleValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testDouble"}, "")) + pattern_WrappersService_CreateDoubleValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testDouble"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_WrappersService_CreateBoolValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testBool"}, "")) + pattern_WrappersService_CreateBoolValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testBool"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_WrappersService_CreateUInt32Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testUint32"}, "")) + pattern_WrappersService_CreateUInt32Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testUint32"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_WrappersService_CreateUInt64Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testUint64"}, "")) + pattern_WrappersService_CreateUInt64Value_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testUint64"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_WrappersService_CreateBytesValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testBytes"}, "")) + pattern_WrappersService_CreateBytesValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testBytes"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_WrappersService_CreateEmpty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testEmpty"}, "")) + pattern_WrappersService_CreateEmpty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "testEmpty"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index 1131ca453f9..2f056364b8f 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -67,6 +67,10 @@ type Registry struct { // If false, the default behavior is to concat the last 2 elements of the FQN if they are unique, otherwise concat // all the elements of the FQN without any separator useFQNForSwaggerName bool + + // allowColonFinalSegments determines whether colons are permitted + // in the final segment of a path. + allowColonFinalSegments bool } type repeatedFieldSeparator struct { @@ -422,6 +426,16 @@ func (r *Registry) SetUseFQNForSwaggerName(use bool) { r.useFQNForSwaggerName = use } +// GetAllowColonFinalSegments returns allowColonFinalSegments +func (r *Registry) GetAllowColonFinalSegments() bool { + return r.allowColonFinalSegments +} + +// SetAllowColonFinalSegments sets allowColonFinalSegments +func (r *Registry) SetAllowColonFinalSegments(use bool) { + r.allowColonFinalSegments = use +} + // GetUseFQNForSwaggerName returns useFQNForSwaggerName func (r *Registry) GetUseFQNForSwaggerName() bool { return r.useFQNForSwaggerName diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index a14de379642..d5a4980d65c 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -136,6 +136,7 @@ type trailerParams struct { Services []*descriptor.Service UseRequestContext bool RegisterFuncSuffix string + AssumeColonVerb bool } func applyTemplate(p param, reg *descriptor.Registry) (string, error) { @@ -176,10 +177,15 @@ func applyTemplate(p param, reg *descriptor.Registry) (string, error) { return "", errNoTargetService } + assumeColonVerb := true + if reg != nil { + assumeColonVerb = !reg.GetAllowColonFinalSegments() + } tp := trailerParams{ Services: targetServices, UseRequestContext: p.UseRequestContext, RegisterFuncSuffix: p.RegisterFuncSuffix, + AssumeColonVerb: assumeColonVerb, } if err := trailerTemplate.Execute(w, tp); err != nil { return "", err @@ -517,7 +523,7 @@ func (m response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}) XXX_ResponseBody( var ( {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} - pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}} = runtime.MustPattern(runtime.NewPattern({{$b.PathTmpl.Version}}, {{$b.PathTmpl.OpCodes | printf "%#v"}}, {{$b.PathTmpl.Pool | printf "%#v"}}, {{$b.PathTmpl.Verb | printf "%q"}})) + pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}} = runtime.MustPattern(runtime.NewPattern({{$b.PathTmpl.Version}}, {{$b.PathTmpl.OpCodes | printf "%#v"}}, {{$b.PathTmpl.Pool | printf "%#v"}}, {{$b.PathTmpl.Verb | printf "%q"}}, runtime.AssumeColonVerbOpt({{$.AssumeColonVerb}}))) {{end}} {{end}} ) diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index 5e287a680d1..fbf54e6a69d 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -242,7 +242,7 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, want) { + if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), "", runtime.AssumeColonVerbOpt(true)))`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } @@ -394,7 +394,7 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } - if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, want) { + if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), "", runtime.AssumeColonVerbOpt(true)))`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 60d9de92e6b..291ba7deb2f 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -33,6 +33,7 @@ var ( allowRepeatedFieldsInBody = flag.Bool("allow_repeated_fields_in_body", false, "allows to use repeated field in `body` and `response_body` field of `google.api.http` annotation option") repeatedPathParamSeparator = flag.String("repeated_path_param_separator", "csv", "configures how repeated fields should be split. Allowed values are `csv`, `pipes`, `ssv` and `tsv`.") allowPatchFeature = flag.Bool("allow_patch_feature", true, "determines whether to use PATCH feature involving update masks (using google.protobuf.FieldMask).") + allowColonFinalSegments = flag.Bool("allow_colon_final_segments", false, "determines whether colons are permitted in the final segment of a path") versionFlag = flag.Bool("version", false, "print the current verison") ) @@ -93,6 +94,7 @@ func main() { reg.SetImportPath(*importPath) reg.SetAllowDeleteBody(*allowDeleteBody) reg.SetAllowRepeatedFieldsInBody(*allowRepeatedFieldsInBody) + reg.SetAllowColonFinalSegments(*allowColonFinalSegments) if err := reg.SetRepeatedPathParamSeparator(*repeatedPathParamSeparator); err != nil { emitError(err) return diff --git a/runtime/mux.go b/runtime/mux.go index 093373a204a..1da3a58854d 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -37,6 +37,7 @@ type ServeMux struct { streamErrorHandler StreamErrorHandlerFunc protoErrorHandler ProtoErrorHandlerFunc disablePathLengthFallback bool + lastMatchWins bool } // ServeMuxOption is an option that can be given to a ServeMux on construction. @@ -133,6 +134,15 @@ func WithStreamErrorHandler(fn StreamErrorHandlerFunc) ServeMuxOption { } } +// WithLastMatchWins returns a ServeMuxOption that will enable "last +// match wins" behavior, where if multiple path patterns match a +// request path, the last one defined in the .proto file will be used. +func WithLastMatchWins() ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.lastMatchWins = true + } +} + // NewServeMux returns a new ServeMux whose internal mapping is empty. func NewServeMux(opts ...ServeMuxOption) *ServeMux { serveMux := &ServeMux{ @@ -173,7 +183,11 @@ func NewServeMux(opts ...ServeMuxOption) *ServeMux { // Handle associates "h" to the pair of HTTP method and path pattern. func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) { - s.handlers[meth] = append(s.handlers[meth], handler{pat: pat, h: h}) + if s.lastMatchWins { + s.handlers[meth] = append([]handler{handler{pat: pat, h: h}}, s.handlers[meth]...) + } else { + s.handlers[meth] = append(s.handlers[meth], handler{pat: pat, h: h}) + } } // ServeHTTP dispatches the request to the first handler whose pattern matches to r.Method and r.Path. diff --git a/runtime/mux_test.go b/runtime/mux_test.go index e033091a885..23243d8f3a4 100644 --- a/runtime/mux_test.go +++ b/runtime/mux_test.go @@ -22,7 +22,8 @@ func TestMuxServeHTTP(t *testing.T) { verb string } for _, spec := range []struct { - patterns []stubPattern + patterns []stubPattern + patternOpts []runtime.PatternOpt reqMethod string reqPath string @@ -33,6 +34,7 @@ func TestMuxServeHTTP(t *testing.T) { disablePathLengthFallback bool errHandler runtime.ProtoErrorHandlerFunc + muxOpts []runtime.ServeMuxOption }{ { patterns: nil, @@ -253,11 +255,11 @@ func TestMuxServeHTTP(t *testing.T) { pool: []string{"unimplemented"}, }, }, - reqMethod: "GET", - reqPath: "/foobar", + reqMethod: "GET", + reqPath: "/foobar", respStatus: http.StatusNotFound, respContent: "GET /foobar", - errHandler: unknownPathIs404, + errHandler: unknownPathIs404, }, { // server returning unimplemented results in 'Not Implemented' code @@ -269,14 +271,72 @@ func TestMuxServeHTTP(t *testing.T) { pool: []string{"unimplemented"}, }, }, - reqMethod: "GET", - reqPath: "/unimplemented", + reqMethod: "GET", + reqPath: "/unimplemented", respStatus: http.StatusNotImplemented, respContent: `GET /unimplemented`, - errHandler: unknownPathIs404, + errHandler: unknownPathIs404, + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, + pool: []string{"foo", "id"}, + }, + }, + patternOpts: []runtime.PatternOpt{runtime.AssumeColonVerbOpt(false)}, + reqMethod: "GET", + reqPath: "/foo/bar", + headers: map[string]string{ + "Content-Type": "application/json", + }, + respStatus: http.StatusOK, + respContent: "GET /foo/{id=*}", + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, + pool: []string{"foo", "id"}, + }, + }, + patternOpts: []runtime.PatternOpt{runtime.AssumeColonVerbOpt(false)}, + reqMethod: "GET", + reqPath: "/foo/bar:123", + headers: map[string]string{ + "Content-Type": "application/json", + }, + respStatus: http.StatusOK, + respContent: "GET /foo/{id=*}", + }, + { + patterns: []stubPattern{ + { + method: "POST", + ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, + pool: []string{"foo", "id"}, + }, + { + method: "POST", + ops: []int{int(utilities.OpLitPush), 0, int(utilities.OpPush), 0, int(utilities.OpConcatN), 1, int(utilities.OpCapture), 1}, + pool: []string{"foo", "id"}, + verb: "verb", + }, + }, + patternOpts: []runtime.PatternOpt{runtime.AssumeColonVerbOpt(false)}, + reqMethod: "POST", + reqPath: "/foo/bar:verb", + headers: map[string]string{ + "Content-Type": "application/json", + }, + respStatus: http.StatusOK, + respContent: "POST /foo/{id=*}:verb", + muxOpts: []runtime.ServeMuxOption{runtime.WithLastMatchWins()}, }, } { - var opts []runtime.ServeMuxOption + opts := spec.muxOpts if spec.disablePathLengthFallback { opts = append(opts, runtime.WithDisablePathLengthFallback()) } @@ -286,7 +346,7 @@ func TestMuxServeHTTP(t *testing.T) { mux := runtime.NewServeMux(opts...) for _, p := range spec.patterns { func(p stubPattern) { - pat, err := runtime.NewPattern(1, p.ops, p.pool, p.verb) + pat, err := runtime.NewPattern(1, p.ops, p.pool, p.verb, spec.patternOpts...) if err != nil { t.Fatalf("runtime.NewPattern(1, %#v, %#v, %q) failed with %v; want success", p.ops, p.pool, p.verb, err) } diff --git a/runtime/pattern.go b/runtime/pattern.go index f16a84ad389..09053695da7 100644 --- a/runtime/pattern.go +++ b/runtime/pattern.go @@ -35,14 +35,31 @@ type Pattern struct { tailLen int // verb is the VERB part of the path pattern. It is empty if the pattern does not have VERB part. verb string + // assumeColonVerb indicates whether a path suffix after a final + // colon may only be interpreted as a verb. + assumeColonVerb bool } +type patternOptions struct { + assumeColonVerb bool +} + +// PatternOpt is an option for creating Patterns. +type PatternOpt func(*patternOptions) + // NewPattern returns a new Pattern from the given definition values. // "ops" is a sequence of op codes. "pool" is a constant pool. // "verb" is the verb part of the pattern. It is empty if the pattern does not have the part. // "version" must be 1 for now. // It returns an error if the given definition is invalid. -func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, error) { +func NewPattern(version int, ops []int, pool []string, verb string, opts ...PatternOpt) (Pattern, error) { + options := patternOptions{ + assumeColonVerb: true, + } + for _, o := range opts { + o(&options) + } + if version != 1 { grpclog.Infof("unsupported version: %d", version) return Pattern{}, ErrInvalidPattern @@ -122,12 +139,13 @@ func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, er typedOps = append(typedOps, op) } return Pattern{ - ops: typedOps, - pool: pool, - vars: vars, - stacksize: maxstack, - tailLen: tailLen, - verb: verb, + ops: typedOps, + pool: pool, + vars: vars, + stacksize: maxstack, + tailLen: tailLen, + verb: verb, + assumeColonVerb: options.assumeColonVerb, }, nil } @@ -144,7 +162,16 @@ func MustPattern(p Pattern, err error) Pattern { // If otherwise, the function returns an error. func (p Pattern) Match(components []string, verb string) (map[string]string, error) { if p.verb != verb { - return nil, ErrNotMatch + if p.assumeColonVerb || p.verb != "" { + return nil, ErrNotMatch + } + if len(components) == 0 { + components = []string{":" + verb} + } else { + components = append([]string{}, components...) + components[len(components)-1] += ":" + verb + } + verb = "" } var pos int @@ -225,3 +252,11 @@ func (p Pattern) String() string { } return "/" + segs } + +// AssumeColonVerbOpt indicates whether a path suffix after a final +// colon may only be interpreted as a verb. +func AssumeColonVerbOpt(val bool) PatternOpt { + return PatternOpt(func(o *patternOptions) { + o.assumeColonVerb = val + }) +} From 998d9a6fb1e4d68368e5f1880e54aed3145339f7 Mon Sep 17 00:00:00 2001 From: Charles Chan Date: Sat, 15 Jun 2019 22:13:50 -0700 Subject: [PATCH 411/552] Improve README file --- README.md | 70 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 4dc4733234b..811e97876be 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ The grpc-gateway is a plugin of the Google protocol buffers compiler [protoc](https://github.com/protocolbuffers/protobuf). It reads protobuf service definitions and generates a reverse-proxy server which -translates a RESTful JSON API into gRPC. This server is generated according to the +'translates a RESTful HTTP API into gRPC. This server is generated according to the [`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) annotations in your service definitions. -It helps you provide your APIs in both gRPC and RESTful style at the same time. +This helps you provide your APIs in both gRPC and RESTful style at the same time. ![architecture introduction diagram](https://docs.google.com/drawings/d/12hp4CPqrNPFhattL_cIoJptFvlAqm5wLQ0ggqI5mkCg/pub?w=749&h=370) @@ -21,7 +21,7 @@ languages, it is fast, easy-to-use, bandwidth-efficient and its design is combat-proven by Google. However, you might still want to provide a traditional RESTful JSON API as well. Reasons can range from maintaining backwards-compatibility, supporting languages or clients not well supported by -gRPC to simply maintaining the aesthetics and tooling involved with a RESTful +gRPC, to simply maintaining the aesthetics and tooling involved with a RESTful JSON architecture. This project aims to provide that HTTP+JSON interface to your gRPC service. @@ -37,7 +37,7 @@ manager or by downloading one of the releases from the official repository: https://github.com/protocolbuffers/protobuf/releases -Then, `go get -u` as usual the following packages: +Then use `go get -u` to download the following packages: ```sh go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway @@ -55,9 +55,9 @@ Make sure that your `$GOBIN` is in your `$PATH`. ## Usage -1. Define your service in gRPC +1. Define your [gRPC](https://grpc.io/docs/) service using protocol buffers - your_service.proto: + `your_service.proto`: ```protobuf syntax = "proto3"; package example; @@ -69,10 +69,11 @@ Make sure that your `$GOBIN` is in your `$PATH`. rpc Echo(StringMessage) returns (StringMessage) {} } ``` + 2. Add a [`google.api.http`](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L46) annotation to your .proto file - your_service.proto: + `your_service.proto`: ```diff syntax = "proto3"; package example; @@ -102,6 +103,7 @@ annotation to your .proto file 3. Generate gRPC stub + The following generates gRPC code for Golang based on `path/to/your_service.proto`: ```sh protoc -I/usr/local/include -I. \ -I$GOPATH/src \ @@ -111,28 +113,30 @@ annotation to your .proto file ``` It will generate a stub file `path/to/your_service.pb.go`. + 4. Implement your service in gRPC as usual - 1. (Optional) Generate gRPC stub in the language you want. - e.g. + 1. (Optional) Generate gRPC stub in the [other programming languages](https://grpc.io/docs/). + + For example, the following generates gRPC code for Ruby based on `path/to/your_service.proto`: ```sh protoc -I/usr/local/include -I. \ -I$GOPATH/src \ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --ruby_out=. \ - path/to/your/service_proto + path/to/your_service.proto protoc -I/usr/local/include -I. \ -I$GOPATH/src \ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --plugin=protoc-gen-grpc=grpc_ruby_plugin \ --grpc-ruby_out=. \ - path/to/your/service.proto + path/to/your_service.proto ``` 2. Add the googleapis-common-protos gem (or your language equivalent) as a dependency to your project. - 3. Implement your service + 3. Implement your gRPC service stubs -5. Generate reverse-proxy +5. Generate reverse-proxy using `protoc-gen-grpc-gateway` ```sh protoc -I/usr/local/include -I. \ @@ -144,54 +148,58 @@ annotation to your .proto file It will generate a reverse proxy `path/to/your_service.pb.gw.go`. -6. Write an entrypoint +6. Write an entrypoint for the HTTP reverse-proxy server - Now you need to write an entrypoint of the proxy server. ```go package main - + import ( + "context" // Use "golang.org/x/net/context" for Golang version <= 1.6 "flag" "net/http" - + "github.com/golang/glog" - "golang.org/x/net/context" "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc" - - gw "path/to/your_service_package" + + gw "path/to/your_service_package" // Update ) - + var ( - echoEndpoint = flag.String("echo_endpoint", "localhost:9090", "endpoint of YourService") + // command-line options: + // gRPC server endpoint + grpcServerEndpoint = flag.String("grpc-server-endpoint", "localhost:9090", "gRPC server endpoint") ) - + func run() error { ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() - + + // Register gRPC server endpoint + // Note: Make sure the gRPC server is running properly and accessible mux := runtime.NewServeMux() opts := []grpc.DialOption{grpc.WithInsecure()} - err := gw.RegisterYourServiceHandlerFromEndpoint(ctx, mux, *echoEndpoint, opts) + err := gw.RegisterYourServiceHandlerFromEndpoint(ctx, mux, *grpcServerEndpoint, opts) if err != nil { return err } - - return http.ListenAndServe(":8080", mux) + + // Start HTTP server (and proxy calls to gRPC server endpoint) + return http.ListenAndServe(":8081", mux) } - + func main() { flag.Parse() defer glog.Flush() - + if err := run(); err != nil { glog.Fatal(err) } } ``` -7. (Optional) Generate swagger definitions +7. (Optional) Generate swagger definitions using `protoc-gen-grpc-swagger` ```sh protoc -I/usr/local/include -I. \ @@ -226,7 +234,7 @@ More examples are available under `examples` directory. To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRPC-gateway, and a gRPC server, see -[this code example by CoreOS](https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go) +[this example by CoreOS](https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go) (and its accompanying [blog post](https://coreos.com/blog/gRPC-protobufs-swagger.html)). ## Features From 1c69f03c1198aed80d89de3e4214105ffd3767e0 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 17 Jun 2019 15:57:34 +0100 Subject: [PATCH 412/552] Generate changelog for 1.9.2 --- CHANGELOG.md | 23 ++++++++++++++++++----- Makefile | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b820c925e32..f321e33786a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## [v1.9.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.2) (2019-06-17) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.1...v1.9.2) + +**Fixed bugs:** + +- 404s using colons in the middle of the last path segment [\#224](https://github.com/grpc-ecosystem/grpc-gateway/issues/224) + +**Merged pull requests:** + +- Improve README file [\#950](https://github.com/grpc-ecosystem/grpc-gateway/pull/950) ([charleswhchan](https://github.com/charleswhchan)) +- Support colon in final path segment, last match wins behavior \(behind flags\) [\#949](https://github.com/grpc-ecosystem/grpc-gateway/pull/949) ([jfhamlin](https://github.com/jfhamlin)) + ## [v1.9.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.1) (2019-06-13) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.0...v1.9.1) @@ -13,6 +25,7 @@ **Merged pull requests:** +- Generate changelog for 1.9.1 [\#946](https://github.com/grpc-ecosystem/grpc-gateway/pull/946) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Revert "protoc-gen-swagger: check typeIndex when typeName is Method" [\#945](https://github.com/grpc-ecosystem/grpc-gateway/pull/945) ([johanbrandhorst](https://github.com/johanbrandhorst)) - fix query params not populate if method is post [\#939](https://github.com/grpc-ecosystem/grpc-gateway/pull/939) ([mingqing](https://github.com/mingqing)) - Fix make test on MacOS [\#935](https://github.com/grpc-ecosystem/grpc-gateway/pull/935) ([emilaasa](https://github.com/emilaasa)) @@ -503,7 +516,7 @@ - properly respect file flag for protoc-gen-swagger [\#293](https://github.com/grpc-ecosystem/grpc-gateway/pull/293) ([tmc](https://github.com/tmc)) ## [v1.3.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.1) (2017-12-23) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3.1) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.1) **Implemented enhancements:** @@ -560,11 +573,11 @@ - grpc-gateway/generator: respect full package [\#462](https://github.com/grpc-ecosystem/grpc-gateway/pull/462) ([glerchundi](https://github.com/glerchundi)) - Add proto marshaller for proto-over-http [\#459](https://github.com/grpc-ecosystem/grpc-gateway/pull/459) ([MatthewDolan](https://github.com/MatthewDolan)) -## [v1.3.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.0) - ## [v1.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3) + +## [v1.3.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3.0) **Closed issues:** diff --git a/Makefile b/Makefile index 8d61d71bc66..56b2b927160 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.9.1 + --future-release=v1.9.2 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 99599eeb193148f8df5899607084b49e827aa9ab Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Tue, 18 Jun 2019 16:08:21 +0200 Subject: [PATCH 413/552] docs/customizingyourgateway: add ?pretty example (#954) As discussed in slack. The code is rough, but should illustrate the point. Signed-off-by: Stephan Renatus --- docs/_docs/customizingyourgateway.md | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/docs/_docs/customizingyourgateway.md b/docs/_docs/customizingyourgateway.md index 31b7794bd55..1d927f0166d 100644 --- a/docs/_docs/customizingyourgateway.md +++ b/docs/_docs/customizingyourgateway.md @@ -28,6 +28,55 @@ The protocol buffer compiler generates camelCase JSON tags that can be used with mux := runtime.NewServeMux(runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName:false})) ``` +### Pretty-print JSON responses when queried with ?pretty + +You can have Elasticsearch-style `?pretty` support in your gateway's endpoints as follows: + +1. Wrap the ServeMux using a stdlib [`http.HandlerFunc`](https://golang.org/pkg/net/http/#HandlerFunc) + that translates the provided query parameter into a custom `Accept` header, and +2. Register a pretty-printing marshaler for that MIME code. + +For example: + +```go +mux := runtime.NewServeMux( + runtime.WithMarshalerOption("application/json+pretty", &runtime.JSONPb{Indent: " "}), +) +prettier := func(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // checking Values as map[string][]string also catches ?pretty and ?pretty= + // r.URL.Query().Get("pretty") would not. + if _, ok := r.URL.Query()["pretty"]; ok { + r.Header.Set("Accept", "application/json+pretty") + } + h.ServeHTTP(w, r) + }) +} +http.ListenAndServe(":8080", prettier(mux)) +``` + +Note that `runtime.JSONPb{Indent: " "}` will do the trick for pretty-printing: it wraps +`jsonpb.Marshaler`: +```go +type Marshaler struct { + // ... + + // A string to indent each level by. The presence of this field will + // also cause a space to appear between the field separator and + // value, and for newlines to be appear between fields and array + // elements. + Indent string + + // ... +} +``` + +Now, either when passing the header `Accept: application/json+pretty` or appending `?pretty` to +your HTTP endpoints, the response will be pretty-printed. + +Note that this will conflict with any methods having input messages with fields named `pretty`; +also, this example code does not remove the query parameter `pretty` from further processing. + ## Mapping from HTTP request headers to gRPC client metadata You might not like [the default mapping rule](http://godoc.org/github.com/grpc-ecosystem/grpc-gateway/runtime#DefaultHeaderMatcher) and might want to pass through all the HTTP headers, for example. From 39760daa35359d5efec0eb901f0defa01c48be58 Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Tue, 18 Jun 2019 16:57:23 +0200 Subject: [PATCH 414/552] Update to rules_go and buildtools (#956) * Update to rules_go v0.18.6 This fixes the build with Bazel 0.27. * Update bazelbuild/buildtools to v0.26. This is also required for Bazel 0.27, it seems. Fixes #955 --- BUILD | 1 + WORKSPACE | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/BUILD b/BUILD index 27944f25764..08af40b556e 100644 --- a/BUILD +++ b/BUILD @@ -12,6 +12,7 @@ buildifier( # gazelle:exclude third_party # gazelle:exclude vendor +# gazelle:exclude _output # gazelle:prefix github.com/grpc-ecosystem/grpc-gateway gazelle(name = "gazelle") diff --git a/WORKSPACE b/WORKSPACE index 4084128959d..b4b48563b75 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,8 +4,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - sha256 = "6776d68ebb897625dead17ae510eac3d5f6342367327875210df44dbe2aeeb19", - urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.1/rules_go-0.17.1.tar.gz"], + sha256 = "f04d2373bcaf8aa09bccb08a98a57e721306c8f6043a2a0ee610fd6853dcde3d", + urls = [ + "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz", + "https://github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz", + ], ) http_archive( @@ -61,8 +64,9 @@ go_repository( http_archive( name = "com_github_bazelbuild_buildtools", - strip_prefix = "buildtools-bf564b4925ab5876a3f64d8b90fab7f769013d42", - url = "https://github.com/bazelbuild/buildtools/archive/bf564b4925ab5876a3f64d8b90fab7f769013d42.zip", + sha256 = "86592d703ecbe0c5cbb5139333a63268cf58d7efd2c459c8be8e69e77d135e29", + strip_prefix = "buildtools-0.26.0", + urls = ["https://github.com/bazelbuild/buildtools/archive/0.26.0.tar.gz"], ) load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies") From f7c8b90d780319d5ebc0bf9c2873f438f42a4e02 Mon Sep 17 00:00:00 2001 From: Vladislav Saveliev Date: Fri, 21 Jun 2019 16:47:27 +0600 Subject: [PATCH 415/552] Add new option for the decoder - to disallow unknown fields (#959) Fixes #448 --- runtime/marshal_jsonpb.go | 16 ++++++++++++++-- runtime/marshal_jsonpb_test.go | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/runtime/marshal_jsonpb.go b/runtime/marshal_jsonpb.go index 2fbb2628727..f0de351b212 100644 --- a/runtime/marshal_jsonpb.go +++ b/runtime/marshal_jsonpb.go @@ -172,7 +172,7 @@ func decodeJSONPb(d *json.Decoder, v interface{}) error { if !ok { return decodeNonProtoField(d, v) } - unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: true} + unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: allowUnknownFields} return unmarshaler.UnmarshalNext(d, p) } @@ -186,7 +186,7 @@ func decodeNonProtoField(d *json.Decoder, v interface{}) error { rv.Set(reflect.New(rv.Type().Elem())) } if rv.Type().ConvertibleTo(typeProtoMessage) { - unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: true} + unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: allowUnknownFields} return unmarshaler.UnmarshalNext(d, rv.Interface().(proto.Message)) } rv = rv.Elem() @@ -248,3 +248,15 @@ var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem() func (j *JSONPb) Delimiter() []byte { return []byte("\n") } + +// allowUnknownFields helps not to return an error when the destination +// is a struct and the input contains object keys which do not match any +// non-ignored, exported fields in the destination. +var allowUnknownFields = true + +// DisallowUnknownFields enables option in decoder (unmarshaller) to +// return an error when it finds an unknown field. This function must be +// called before using the JSON marshaller. +func DisallowUnknownFields() { + allowUnknownFields = false +} diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index 00590e94401..7d60ef7ce35 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -468,6 +468,25 @@ func TestJSONPbDecoderFields(t *testing.T) { } } +func TestJSONPbDecoderUnknownField(t *testing.T) { + var ( + m runtime.JSONPb + got examplepb.ABitOfEverything + ) + data := `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "unknownField": "111" + }` + + runtime.DisallowUnknownFields() + + r := strings.NewReader(data) + dec := m.NewDecoder(r) + if err := dec.Decode(&got); err == nil { + t.Errorf("m.Unmarshal(&got) not failed; want `unknown field` error; data=%q", data) + } +} + var ( fieldFixtures = []struct { data interface{} From 803f56d4eba34b2c4cadd7a7883fb58de29cd33a Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Mon, 24 Jun 2019 11:19:17 -0400 Subject: [PATCH 416/552] protoc_gen_swagger: Add attr for single_output (#944) --- examples/proto/examplepb/BUILD.bazel | 8 +++- protoc-gen-swagger/defs.bzl | 68 +++++++++++++++++++++------- 2 files changed, 59 insertions(+), 17 deletions(-) diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index f5aa149eb8e..dd7a2d45c3c 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -70,6 +70,12 @@ go_library( ) protoc_gen_swagger( - name = "expamplepb_protoc_gen_swagger", + name = "examplepb_protoc_gen_swagger", proto = ":examplepb_proto", ) + +protoc_gen_swagger( + name = "examplepb_protoc_gen_swagger_merged", + proto = ":examplepb_proto", + single_output = True, # Outputs a single swagger.json file. +) diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index 936ca4791fe..4f90807f0f5 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -30,33 +30,38 @@ def _collect_includes(gen_dir, srcs): return includes -def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, actions, protoc, protoc_gen_swagger, grpc_api_configuration): +def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, actions, protoc, protoc_gen_swagger, grpc_api_configuration, single_output): swagger_files = [] - for proto in direct_proto_srcs: - swagger_file = actions.declare_file( - "%s.swagger.json" % proto.basename[:-len(".proto")], - sibling = proto, - ) - inputs = direct_proto_srcs + transitive_proto_srcs - tools = [protoc_gen_swagger] + inputs = direct_proto_srcs + transitive_proto_srcs + tools = [protoc_gen_swagger] - options = ["logtostderr=true", "allow_repeated_fields_in_body=true"] - if grpc_api_configuration: - options.append("grpc_api_configuration=%s" % grpc_api_configuration.path) - inputs.append(grpc_api_configuration) + options = ["logtostderr=true", "allow_repeated_fields_in_body=true"] + if grpc_api_configuration: + options.append("grpc_api_configuration=%s" % grpc_api_configuration.path) + inputs.append(grpc_api_configuration) + includes = _collect_includes(ctx.genfiles_dir.path, direct_proto_srcs + transitive_proto_srcs) + + if single_output: + swagger_file = actions.declare_file( + "%s.swagger.json" % ctx.attr.name, + sibling = direct_proto_srcs[0], + ) output_dir = ctx.bin_dir.path - if proto.owner.workspace_root: - output_dir = "/".join([output_dir, proto.owner.workspace_root]) + if direct_proto_srcs[0].owner.workspace_root: + output_dir = "/".join([output_dir, direct_proto_srcs[0].owner.workspace_root]) + + output_dir = "/".join([output_dir, direct_proto_srcs[0].dirname]) - includes = _collect_includes(ctx.genfiles_dir.path, direct_proto_srcs + transitive_proto_srcs) + options.append("allow_merge=true") + options.append("merge_file_name=%s" % ctx.attr.name) args = actions.args() args.add("--plugin=%s" % protoc_gen_swagger.path) args.add("--swagger_out=%s:%s" % (",".join(options), output_dir)) args.add_all(["-I%s" % include for include in includes]) - args.add(proto.path) + args.add_all([src.path for src in direct_proto_srcs]) actions.run( executable = protoc, @@ -67,6 +72,32 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action ) swagger_files.append(swagger_file) + else: + for proto in direct_proto_srcs: + swagger_file = actions.declare_file( + "%s.swagger.json" % proto.basename[:-len(".proto")], + sibling = proto, + ) + + output_dir = ctx.bin_dir.path + if proto.owner.workspace_root: + output_dir = "/".join([output_dir, proto.owner.workspace_root]) + + args = actions.args() + args.add("--plugin=%s" % protoc_gen_swagger.path) + args.add("--swagger_out=%s:%s" % (",".join(options), output_dir)) + args.add_all(["-I%s" % include for include in includes]) + args.add(proto.path) + + actions.run( + executable = protoc, + inputs = inputs, + tools = tools, + outputs = [swagger_file], + arguments = [args], + ) + + swagger_files.append(swagger_file) return swagger_files @@ -84,6 +115,7 @@ def _proto_gen_swagger_impl(ctx): protoc = ctx.executable._protoc, protoc_gen_swagger = ctx.executable._protoc_gen_swagger, grpc_api_configuration = grpc_api_configuration, + single_output = ctx.attr.single_output, ), ), )] @@ -99,6 +131,10 @@ protoc_gen_swagger = rule( allow_single_file = True, mandatory = False, ), + "single_output": attr.bool( + default = False, + mandatory = False, + ), "_protoc": attr.label( default = "@com_google_protobuf//:protoc", executable = True, From 00a010659be5a4230bbd194afc7cdc81d27917dc Mon Sep 17 00:00:00 2001 From: Gustavo Covas Date: Fri, 28 Jun 2019 12:55:27 -0300 Subject: [PATCH 417/552] Fix EOF handling in client side streaming (#962) * Add integration test for #961 Co-authored-by: Jonas Arilho * Add verification for io.EOF after stream.Send() on generated code template (#961) Co-authored-by: Jonas Arilho * Add more values on testABEBulkCreateWithError, run go mod tidy Fixes #961 --- examples/integration/integration_test.go | 61 +++++++++++++++++++ .../proto/examplepb/flow_combination.pb.gw.go | 3 + examples/proto/examplepb/stream.pb.gw.go | 3 + examples/server/a_bit_of_everything.go | 9 ++- .../gengateway/template.go | 3 + 5 files changed, 78 insertions(+), 1 deletion(-) diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index 62db1063785..03aed1a0886 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -15,6 +15,7 @@ import ( "strings" "sync" "testing" + "time" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" @@ -263,6 +264,7 @@ func TestABE(t *testing.T) { testABECreate(t, 8080) testABECreateBody(t, 8080) testABEBulkCreate(t, 8080) + testABEBulkCreateWithError(t, 8080) testABELookup(t, 8080) testABELookupNotFound(t, 8080) testABEList(t, 8080) @@ -549,6 +551,65 @@ func testABEBulkCreate(t *testing.T, port int) { } } +func testABEBulkCreateWithError(t *testing.T, port int) { + count := 0 + r, w := io.Pipe() + go func(w io.WriteCloser) { + defer func() { + if cerr := w.Close(); cerr != nil { + t.Errorf("w.Close() failed with %v; want success", cerr) + } + }() + for _, val := range []string{ + "foo", "bar", "baz", "qux", "quux", + } { + time.Sleep(1 * time.Millisecond) + + want := gw.ABitOfEverything{ + StringValue: fmt.Sprintf("strprefix/%s", val), + } + var m jsonpb.Marshaler + if err := m.Marshal(w, &want); err != nil { + t.Fatalf("m.Marshal(%#v, w) failed with %v; want success", want, err) + } + if _, err := io.WriteString(w, "\n"); err != nil { + t.Errorf("w.Write(%q) failed with %v; want success", "\n", err) + return + } + count++ + } + }(w) + + apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/bulk", port) + request, err := http.NewRequest("POST", apiURL, r) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "POST", apiURL, err) + } + request.Header.Add("Grpc-Metadata-error", "some error") + + resp, err := http.DefaultClient.Do(request) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusBadRequest; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + var msg errorBody + if err := json.Unmarshal(buf, &msg); err != nil { + t.Fatalf("json.Unmarshal(%s, &msg) failed with %v; want success", buf, err) + } +} + func testABELookup(t *testing.T, port int) { apiURL := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) cresp, err := http.Post(apiURL, "application/json", strings.NewReader(` diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index e5de847c464..b29a6f3bbf9 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -73,6 +73,9 @@ func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler run return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err = stream.Send(&protoReq); err != nil { + if err == io.EOF { + break + } grpclog.Infof("Failed to send request: %v", err) return nil, metadata, err } diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index 3b01d805071..ec7cb9217b6 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -49,6 +49,9 @@ func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.M return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err = stream.Send(&protoReq); err != nil { + if err == io.EOF { + break + } grpclog.Infof("Failed to send request: %v", err) return nil, metadata, err } diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index fc3acca0c1e..b2bcf41994d 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -65,8 +65,15 @@ func (s *_ABitOfEverythingServer) CreateBody(ctx context.Context, msg *examples. } func (s *_ABitOfEverythingServer) BulkCreate(stream examples.StreamService_BulkCreateServer) error { - count := 0 ctx := stream.Context() + + if header, ok := metadata.FromIncomingContext(ctx); ok { + if v, ok := header["error"]; ok { + return status.Errorf(codes.InvalidArgument, "error metadata: %v", v) + } + } + + count := 0 for { msg, err := stream.Recv() if err == io.EOF { diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index d5a4980d65c..97770d93bf0 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -254,6 +254,9 @@ func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx cont return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err = stream.Send(&protoReq); err != nil { + if err == io.EOF { + break + } grpclog.Infof("Failed to send request: %v", err) return nil, metadata, err } From c89bee82ec06218550b59135de6a51e9363b7898 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 28 Jun 2019 23:22:12 +0100 Subject: [PATCH 418/552] Generate changelog for 1.9.3 (#964) --- CHANGELOG.md | 22 ++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f321e33786a..41ddf8c2fe4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Change Log +## [v1.9.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.3) (2019-06-28) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.2...v1.9.3) + +**Fixed bugs:** + +- EOF when calling Send for client streams [\#961](https://github.com/grpc-ecosystem/grpc-gateway/issues/961) + +**Closed issues:** + +- application/x-www-form-urlencoded support. [\#960](https://github.com/grpc-ecosystem/grpc-gateway/issues/960) +- Bazel files are out of date [\#955](https://github.com/grpc-ecosystem/grpc-gateway/issues/955) +- Configurable AllowUnknownFields in jsonpb? [\#448](https://github.com/grpc-ecosystem/grpc-gateway/issues/448) + +**Merged pull requests:** + +- EOF on send [\#962](https://github.com/grpc-ecosystem/grpc-gateway/pull/962) ([gustavocovas](https://github.com/gustavocovas)) +- Add new option for the decoder - to disallow unknown fields [\#959](https://github.com/grpc-ecosystem/grpc-gateway/pull/959) ([vsaveliev](https://github.com/vsaveliev)) +- Update to rules\_go and buildtools [\#956](https://github.com/grpc-ecosystem/grpc-gateway/pull/956) ([drigz](https://github.com/drigz)) +- docs/customizingyourgateway: add ?pretty example [\#954](https://github.com/grpc-ecosystem/grpc-gateway/pull/954) ([srenatus](https://github.com/srenatus)) +- protoc\_gen\_swagger: Add attr for allow\_merge [\#944](https://github.com/grpc-ecosystem/grpc-gateway/pull/944) ([prestonvanloon](https://github.com/prestonvanloon)) + ## [v1.9.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.2) (2019-06-17) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.1...v1.9.2) @@ -9,6 +30,7 @@ **Merged pull requests:** +- Generate changelog for 1.9.2 [\#953](https://github.com/grpc-ecosystem/grpc-gateway/pull/953) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Improve README file [\#950](https://github.com/grpc-ecosystem/grpc-gateway/pull/950) ([charleswhchan](https://github.com/charleswhchan)) - Support colon in final path segment, last match wins behavior \(behind flags\) [\#949](https://github.com/grpc-ecosystem/grpc-gateway/pull/949) ([jfhamlin](https://github.com/jfhamlin)) diff --git a/Makefile b/Makefile index 56b2b927160..df63bfdb96a 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.9.2 + --future-release=v1.9.3 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From bb741a76f707d8e172ab727a335cfac2874e28b0 Mon Sep 17 00:00:00 2001 From: Scott Meeuwsen <3615587+nu11ptr@users.noreply.github.com> Date: Sat, 29 Jun 2019 09:22:16 -0700 Subject: [PATCH 419/552] Added comments to base_path to explain behavior (#919) * Add base_path docs to explain behavior * Add to 'base_path' description * Regenerated Go code from protobuf * Revert go.mod to previous version Closes #918 --- protoc-gen-swagger/options/openapiv2.pb.go | 56 ++++++++++++---------- protoc-gen-swagger/options/openapiv2.proto | 6 +++ 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index 8bf40b05e6a..f52414a5ef9 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -48,7 +48,7 @@ func (x Swagger_SwaggerScheme) String() string { return proto.EnumName(Swagger_SwaggerScheme_name, int32(x)) } func (Swagger_SwaggerScheme) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{0, 0} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{0, 0} } type JSONSchema_JSONSchemaSimpleTypes int32 @@ -89,7 +89,7 @@ func (x JSONSchema_JSONSchemaSimpleTypes) String() string { return proto.EnumName(JSONSchema_JSONSchemaSimpleTypes_name, int32(x)) } func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{8, 0} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{8, 0} } // Required. The type of the security scheme. Valid values are "basic", @@ -120,7 +120,7 @@ func (x SecurityScheme_Type) String() string { return proto.EnumName(SecurityScheme_Type_name, int32(x)) } func (SecurityScheme_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{11, 0} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{11, 0} } // Required. The location of the API key. Valid values are "query" or "header". @@ -147,7 +147,7 @@ func (x SecurityScheme_In) String() string { return proto.EnumName(SecurityScheme_In_name, int32(x)) } func (SecurityScheme_In) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{11, 1} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{11, 1} } // Required. The flow used by the OAuth2 security scheme. Valid values are @@ -181,7 +181,7 @@ func (x SecurityScheme_Flow) String() string { return proto.EnumName(SecurityScheme_Flow_name, int32(x)) } func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{11, 2} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{11, 2} } // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. @@ -190,9 +190,15 @@ func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { // // TODO(ivucica): document fields type Swagger struct { - Swagger string `protobuf:"bytes,1,opt,name=swagger,proto3" json:"swagger,omitempty"` - Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` - Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` + Swagger string `protobuf:"bytes,1,opt,name=swagger,proto3" json:"swagger,omitempty"` + Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` + // `base_path` is the common prefix path used on all API endpoints (ie. /api, /v1, etc.). By adding this, + // it allows you to remove this portion from the path endpoints in your Swagger file making them easier + // to read. Note that using `base_path` does not change the endpoint paths that are generated in the resulting + // Swagger file. If you wish to use `base_path` with relatively generated Swagger paths, the + // `base_path` prefix must be manually removed from your `google.api.http` paths and your code changed to + // serve the API from the `base_path`. BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,proto3,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` @@ -210,7 +216,7 @@ func (m *Swagger) Reset() { *m = Swagger{} } func (m *Swagger) String() string { return proto.CompactTextString(m) } func (*Swagger) ProtoMessage() {} func (*Swagger) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{0} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{0} } func (m *Swagger) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Swagger.Unmarshal(m, b) @@ -333,7 +339,7 @@ func (m *Operation) Reset() { *m = Operation{} } func (m *Operation) String() string { return proto.CompactTextString(m) } func (*Operation) ProtoMessage() {} func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{1} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{1} } func (m *Operation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Operation.Unmarshal(m, b) @@ -450,7 +456,7 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{2} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{2} } func (m *Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Response.Unmarshal(m, b) @@ -505,7 +511,7 @@ func (m *Info) Reset() { *m = Info{} } func (m *Info) String() string { return proto.CompactTextString(m) } func (*Info) ProtoMessage() {} func (*Info) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{3} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{3} } func (m *Info) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Info.Unmarshal(m, b) @@ -585,7 +591,7 @@ func (m *Contact) Reset() { *m = Contact{} } func (m *Contact) String() string { return proto.CompactTextString(m) } func (*Contact) ProtoMessage() {} func (*Contact) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{4} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{4} } func (m *Contact) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Contact.Unmarshal(m, b) @@ -644,7 +650,7 @@ func (m *License) Reset() { *m = License{} } func (m *License) String() string { return proto.CompactTextString(m) } func (*License) ProtoMessage() {} func (*License) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{5} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{5} } func (m *License) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_License.Unmarshal(m, b) @@ -696,7 +702,7 @@ func (m *ExternalDocumentation) Reset() { *m = ExternalDocumentation{} } func (m *ExternalDocumentation) String() string { return proto.CompactTextString(m) } func (*ExternalDocumentation) ProtoMessage() {} func (*ExternalDocumentation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{6} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{6} } func (m *ExternalDocumentation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExternalDocumentation.Unmarshal(m, b) @@ -750,7 +756,7 @@ func (m *Schema) Reset() { *m = Schema{} } func (m *Schema) String() string { return proto.CompactTextString(m) } func (*Schema) ProtoMessage() {} func (*Schema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{7} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{7} } func (m *Schema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Schema.Unmarshal(m, b) @@ -854,7 +860,7 @@ func (m *JSONSchema) Reset() { *m = JSONSchema{} } func (m *JSONSchema) String() string { return proto.CompactTextString(m) } func (*JSONSchema) ProtoMessage() {} func (*JSONSchema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{8} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{8} } func (m *JSONSchema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JSONSchema.Unmarshal(m, b) @@ -1040,7 +1046,7 @@ func (m *Tag) Reset() { *m = Tag{} } func (m *Tag) String() string { return proto.CompactTextString(m) } func (*Tag) ProtoMessage() {} func (*Tag) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{9} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{9} } func (m *Tag) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Tag.Unmarshal(m, b) @@ -1094,7 +1100,7 @@ func (m *SecurityDefinitions) Reset() { *m = SecurityDefinitions{} } func (m *SecurityDefinitions) String() string { return proto.CompactTextString(m) } func (*SecurityDefinitions) ProtoMessage() {} func (*SecurityDefinitions) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{10} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{10} } func (m *SecurityDefinitions) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityDefinitions.Unmarshal(m, b) @@ -1172,7 +1178,7 @@ func (m *SecurityScheme) Reset() { *m = SecurityScheme{} } func (m *SecurityScheme) String() string { return proto.CompactTextString(m) } func (*SecurityScheme) ProtoMessage() {} func (*SecurityScheme) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{11} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{11} } func (m *SecurityScheme) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityScheme.Unmarshal(m, b) @@ -1274,7 +1280,7 @@ func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} } func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) } func (*SecurityRequirement) ProtoMessage() {} func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{12} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{12} } func (m *SecurityRequirement) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement.Unmarshal(m, b) @@ -1319,7 +1325,7 @@ func (m *SecurityRequirement_SecurityRequirementValue) String() string { } func (*SecurityRequirement_SecurityRequirementValue) ProtoMessage() {} func (*SecurityRequirement_SecurityRequirementValue) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{12, 0} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{12, 0} } func (m *SecurityRequirement_SecurityRequirementValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Unmarshal(m, b) @@ -1364,7 +1370,7 @@ func (m *Scopes) Reset() { *m = Scopes{} } func (m *Scopes) String() string { return proto.CompactTextString(m) } func (*Scopes) ProtoMessage() {} func (*Scopes) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_29cfb415de848cf5, []int{13} + return fileDescriptor_openapiv2_78431ddfac00899a, []int{13} } func (m *Scopes) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Scopes.Unmarshal(m, b) @@ -1420,10 +1426,10 @@ func init() { } func init() { - proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_29cfb415de848cf5) + proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_78431ddfac00899a) } -var fileDescriptor_openapiv2_29cfb415de848cf5 = []byte{ +var fileDescriptor_openapiv2_78431ddfac00899a = []byte{ // 1777 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x73, 0xdb, 0xc6, 0x11, 0x0f, 0x48, 0x90, 0x04, 0x97, 0x22, 0x73, 0x3e, 0xcb, 0x2d, 0xa2, 0xc4, 0xae, 0xc2, 0xa6, diff --git a/protoc-gen-swagger/options/openapiv2.proto b/protoc-gen-swagger/options/openapiv2.proto index 105f8feb41d..1fb248ca144 100644 --- a/protoc-gen-swagger/options/openapiv2.proto +++ b/protoc-gen-swagger/options/openapiv2.proto @@ -15,6 +15,12 @@ message Swagger { string swagger = 1; Info info = 2; string host = 3; + // `base_path` is the common prefix path used on all API endpoints (ie. /api, /v1, etc.). By adding this, + // it allows you to remove this portion from the path endpoints in your Swagger file making them easier + // to read. Note that using `base_path` does not change the endpoint paths that are generated in the resulting + // Swagger file. If you wish to use `base_path` with relatively generated Swagger paths, the + // `base_path` prefix must be manually removed from your `google.api.http` paths and your code changed to + // serve the API from the `base_path`. string base_path = 4; enum SwaggerScheme { UNKNOWN = 0; From a47d5bac8ae75b30155b506bd7d88581f529bea3 Mon Sep 17 00:00:00 2001 From: Franxois Date: Tue, 2 Jul 2019 14:52:40 +0200 Subject: [PATCH 420/552] doc(readme): fix typo (#965) Fix `protoc-gen-swagger` binary name in readme.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 811e97876be..75dcd753620 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ go get -u github.com/golang/protobuf/protoc-gen-go This will place three binaries in your `$GOBIN`; * `protoc-gen-grpc-gateway` -* `protoc-gen-grpc-swagger` +* `protoc-gen-swagger` * `protoc-gen-go` Make sure that your `$GOBIN` is in your `$PATH`. @@ -199,7 +199,7 @@ annotation to your .proto file } ``` -7. (Optional) Generate swagger definitions using `protoc-gen-grpc-swagger` +7. (Optional) Generate swagger definitions using `protoc-gen-swagger` ```sh protoc -I/usr/local/include -I. \ From 918b74f50f954b31e2f9cdf91e17af1f11cae1bd Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Mon, 8 Jul 2019 14:01:51 -0700 Subject: [PATCH 421/552] Fix query.go to avoid invalid protobuf assumptions The golang/protobuf compatibility agreement reserves the right add/remove XXX fields and methods. Fix this code to avoid assuming: * that XXX_WellKnownType always exists (it won't in the future). Instead, it should determine whether a message is a well-known type based on its full name. * that Go struct field indexes are stable (they aren't). An internal field may be added to the front of the message, causing the current assumptions to be invalidated. Instead, access the struct field by name, which will not change. --- runtime/query.go | 177 +++++++++++++++++++++++------------------------ 1 file changed, 88 insertions(+), 89 deletions(-) diff --git a/runtime/query.go b/runtime/query.go index bb9359f17c0..5fbba5e8e8b 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -202,103 +202,102 @@ func populateField(f reflect.Value, value string, props *proto.Properties) error i := f.Addr().Interface() // Handle protobuf well known types - type wkt interface { - XXX_WellKnownType() string + var name string + switch m := i.(type) { + case interface{ XXX_WellKnownType() string }: + name = m.XXX_WellKnownType() + case proto.Message: + const wktPrefix = "google.protobuf." + if fullName := proto.MessageName(m); strings.HasPrefix(fullName, wktPrefix) { + name = fullName[len(wktPrefix):] + } } - if wkt, ok := i.(wkt); ok { - switch wkt.XXX_WellKnownType() { - case "Timestamp": - if value == "null" { - f.Field(0).SetInt(0) - f.Field(1).SetInt(0) - return nil - } - - t, err := time.Parse(time.RFC3339Nano, value) - if err != nil { - return fmt.Errorf("bad Timestamp: %v", err) - } - f.Field(0).SetInt(int64(t.Unix())) - f.Field(1).SetInt(int64(t.Nanosecond())) + switch name { + case "Timestamp": + if value == "null" { + f.FieldByName("Seconds").SetInt(0) + f.FieldByName("Nanos").SetInt(0) return nil - case "Duration": - if value == "null" { - f.Field(0).SetInt(0) - f.Field(1).SetInt(0) - return nil - } - d, err := time.ParseDuration(value) - if err != nil { - return fmt.Errorf("bad Duration: %v", err) - } + } - ns := d.Nanoseconds() - s := ns / 1e9 - ns %= 1e9 - f.Field(0).SetInt(s) - f.Field(1).SetInt(ns) - return nil - case "DoubleValue": - fallthrough - case "FloatValue": - float64Val, err := strconv.ParseFloat(value, 64) - if err != nil { - return fmt.Errorf("bad DoubleValue: %s", value) - } - f.Field(0).SetFloat(float64Val) - return nil - case "Int64Value": - fallthrough - case "Int32Value": - int64Val, err := strconv.ParseInt(value, 10, 64) - if err != nil { - return fmt.Errorf("bad DoubleValue: %s", value) - } - f.Field(0).SetInt(int64Val) - return nil - case "UInt64Value": - fallthrough - case "UInt32Value": - uint64Val, err := strconv.ParseUint(value, 10, 64) - if err != nil { - return fmt.Errorf("bad DoubleValue: %s", value) - } - f.Field(0).SetUint(uint64Val) - return nil - case "BoolValue": - if value == "true" { - f.Field(0).SetBool(true) - } else if value == "false" { - f.Field(0).SetBool(false) - } else { - return fmt.Errorf("bad BoolValue: %s", value) - } - return nil - case "StringValue": - f.Field(0).SetString(value) - return nil - case "BytesValue": - bytesVal, err := base64.StdEncoding.DecodeString(value) - if err != nil { - return fmt.Errorf("bad BytesValue: %s", value) - } - f.Field(0).SetBytes(bytesVal) + t, err := time.Parse(time.RFC3339Nano, value) + if err != nil { + return fmt.Errorf("bad Timestamp: %v", err) + } + f.FieldByName("Seconds").SetInt(int64(t.Unix())) + f.FieldByName("Nanos").SetInt(int64(t.Nanosecond())) + return nil + case "Duration": + if value == "null" { + f.FieldByName("Seconds").SetInt(0) + f.FieldByName("Nanos").SetInt(0) return nil } - } + d, err := time.ParseDuration(value) + if err != nil { + return fmt.Errorf("bad Duration: %v", err) + } - // Handle google well known types - if gwkt, ok := i.(proto.Message); ok { - switch proto.MessageName(gwkt) { - case "google.protobuf.FieldMask": - p := f.Field(0) - for _, v := range strings.Split(value, ",") { - if v != "" { - p.Set(reflect.Append(p, reflect.ValueOf(v))) - } + ns := d.Nanoseconds() + s := ns / 1e9 + ns %= 1e9 + f.FieldByName("Seconds").SetInt(s) + f.FieldByName("Nanos").SetInt(ns) + return nil + case "DoubleValue": + fallthrough + case "FloatValue": + float64Val, err := strconv.ParseFloat(value, 64) + if err != nil { + return fmt.Errorf("bad DoubleValue: %s", value) + } + f.FieldByName("Value").SetFloat(float64Val) + return nil + case "Int64Value": + fallthrough + case "Int32Value": + int64Val, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return fmt.Errorf("bad DoubleValue: %s", value) + } + f.FieldByName("Value").SetInt(int64Val) + return nil + case "UInt64Value": + fallthrough + case "UInt32Value": + uint64Val, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return fmt.Errorf("bad DoubleValue: %s", value) + } + f.FieldByName("Value").SetUint(uint64Val) + return nil + case "BoolValue": + if value == "true" { + f.FieldByName("Value").SetBool(true) + } else if value == "false" { + f.FieldByName("Value").SetBool(false) + } else { + return fmt.Errorf("bad BoolValue: %s", value) + } + return nil + case "StringValue": + f.FieldByName("Value").SetString(value) + return nil + case "BytesValue": + bytesVal, err := base64.StdEncoding.DecodeString(value) + if err != nil { + return fmt.Errorf("bad BytesValue: %s", value) + } + f.FieldByName("Value").SetBytes(bytesVal) + return nil + case "FieldMask": + p := f.FieldByName("Paths") + for _, v := range strings.Split(value, ",") { + if v != "" { + p.Set(reflect.Append(p, reflect.ValueOf(v))) } - return nil } + return nil } // Handle Time and Duration stdlib types From 899b61429a97532c16081f19dc1d1239a10236b2 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 9 Jul 2019 08:56:50 +0100 Subject: [PATCH 422/552] Generate changelog for 1.9.4 --- CHANGELOG.md | 26 +++++++++++++++++++++----- Makefile | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41ddf8c2fe4..74a1c58b5ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Change Log +## [v1.9.4](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.4) (2019-07-09) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.3...v1.9.4) + +**Closed issues:** + +- Read the Http Post Body [\#921](https://github.com/grpc-ecosystem/grpc-gateway/issues/921) +- Swagger document generation, required field is invalid [\#665](https://github.com/grpc-ecosystem/grpc-gateway/issues/665) + +**Merged pull requests:** + +- Fix query.go to avoid invalid protobuf assumptions [\#967](https://github.com/grpc-ecosystem/grpc-gateway/pull/967) ([dsnet](https://github.com/dsnet)) +- doc\(readme\): fix typo [\#965](https://github.com/grpc-ecosystem/grpc-gateway/pull/965) ([franxois](https://github.com/franxois)) +- Added comments to base\_path to explain behavior [\#919](https://github.com/grpc-ecosystem/grpc-gateway/pull/919) ([nu11ptr](https://github.com/nu11ptr)) + ## [v1.9.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.3) (2019-06-28) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.2...v1.9.3) @@ -9,12 +23,14 @@ **Closed issues:** +- Please make a new release! [\#963](https://github.com/grpc-ecosystem/grpc-gateway/issues/963) - application/x-www-form-urlencoded support. [\#960](https://github.com/grpc-ecosystem/grpc-gateway/issues/960) - Bazel files are out of date [\#955](https://github.com/grpc-ecosystem/grpc-gateway/issues/955) - Configurable AllowUnknownFields in jsonpb? [\#448](https://github.com/grpc-ecosystem/grpc-gateway/issues/448) **Merged pull requests:** +- Generate changelog for 1.9.3 [\#964](https://github.com/grpc-ecosystem/grpc-gateway/pull/964) ([johanbrandhorst](https://github.com/johanbrandhorst)) - EOF on send [\#962](https://github.com/grpc-ecosystem/grpc-gateway/pull/962) ([gustavocovas](https://github.com/gustavocovas)) - Add new option for the decoder - to disallow unknown fields [\#959](https://github.com/grpc-ecosystem/grpc-gateway/pull/959) ([vsaveliev](https://github.com/vsaveliev)) - Update to rules\_go and buildtools [\#956](https://github.com/grpc-ecosystem/grpc-gateway/pull/956) ([drigz](https://github.com/drigz)) @@ -538,7 +554,7 @@ - properly respect file flag for protoc-gen-swagger [\#293](https://github.com/grpc-ecosystem/grpc-gateway/pull/293) ([tmc](https://github.com/tmc)) ## [v1.3.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.1) (2017-12-23) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.1) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3.1) **Implemented enhancements:** @@ -595,11 +611,11 @@ - grpc-gateway/generator: respect full package [\#462](https://github.com/grpc-ecosystem/grpc-gateway/pull/462) ([glerchundi](https://github.com/glerchundi)) - Add proto marshaller for proto-over-http [\#459](https://github.com/grpc-ecosystem/grpc-gateway/pull/459) ([MatthewDolan](https://github.com/MatthewDolan)) -## [v1.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3.0...v1.3) - ## [v1.3.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3.0) (2017-11-03) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3.0) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.3...v1.3.0) + +## [v1.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.3) (2017-11-03) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.2.2...v1.3) **Closed issues:** diff --git a/Makefile b/Makefile index df63bfdb96a..d4f087f892a 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.9.3 + --future-release=v1.9.4 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From c234fc32299978bec08f9fb9bdfa409b77ccc949 Mon Sep 17 00:00:00 2001 From: Masoud Ghiasi Date: Mon, 22 Jul 2019 12:26:55 +0430 Subject: [PATCH 423/552] fix: Support preflight of auth libraries in js --- examples/gateway/handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gateway/handlers.go b/examples/gateway/handlers.go index 3db3fc3bf2b..ead3bb5bf3b 100644 --- a/examples/gateway/handlers.go +++ b/examples/gateway/handlers.go @@ -46,7 +46,7 @@ func allowCORS(h http.Handler) http.Handler { // CORS from any origin using the methods "GET", "HEAD", "POST", "PUT", "DELETE" // We insist, don't do this without consideration in production systems. func preflightHandler(w http.ResponseWriter, r *http.Request) { - headers := []string{"Content-Type", "Accept"} + headers := []string{"Content-Type", "Accept", "Authorization"} w.Header().Set("Access-Control-Allow-Headers", strings.Join(headers, ",")) methods := []string{"GET", "HEAD", "POST", "PUT", "DELETE"} w.Header().Set("Access-Control-Allow-Methods", strings.Join(methods, ",")) From eaf17ae5531b6db68c526b289ab9ce0e0667c8c6 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 22 Jul 2019 11:32:35 +0100 Subject: [PATCH 424/552] Fix HTTP Status Code returned for a `Failed Precondition` error Fixes #972 (and reverses #657). This now returns the semantically correct `400` response, rather than a `412`. This matches the gRPC documentation. --- runtime/errors.go | 3 ++- runtime/errors_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/errors.go b/runtime/errors.go index 41d54ef916a..ad945788dc6 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -37,7 +37,8 @@ func HTTPStatusFromCode(code codes.Code) int { case codes.ResourceExhausted: return http.StatusTooManyRequests case codes.FailedPrecondition: - return http.StatusPreconditionFailed + // Note, this deliberately doesn't translate to the similarly named '412 Precondition Failed' HTTP response status. + return http.StatusBadRequest case codes.Aborted: return http.StatusConflict case codes.OutOfRange: diff --git a/runtime/errors_test.go b/runtime/errors_test.go index f595375718e..6d684d4ed89 100644 --- a/runtime/errors_test.go +++ b/runtime/errors_test.go @@ -40,7 +40,7 @@ func TestDefaultHTTPError(t *testing.T) { }, { err: statusWithDetails.Err(), - status: http.StatusPreconditionFailed, + status: http.StatusBadRequest, msg: "failed precondition", details: "type.googleapis.com/google.rpc.PreconditionFailure", }, From 3e7dbaec58c028f39c625810f8cf3e3a7b9e8251 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 22 Jul 2019 18:15:56 +0100 Subject: [PATCH 425/552] Generate changelog for 1.9.5 --- CHANGELOG.md | 17 +++++++++++++++++ Makefile | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74a1c58b5ae..27e479b6f99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Change Log +## [v1.9.5](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.5) (2019-07-22) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.4...v1.9.5) + +**Fixed bugs:** + +- Non-standard use of 412 HTTP Status Code [\#972](https://github.com/grpc-ecosystem/grpc-gateway/issues/972) + +**Closed issues:** + +- why response use enum's name [\#970](https://github.com/grpc-ecosystem/grpc-gateway/issues/970) + +**Merged pull requests:** + +- Fix HTTP Status Code returned for a `Failed Precondition` error [\#974](https://github.com/grpc-ecosystem/grpc-gateway/pull/974) ([cjcormack](https://github.com/cjcormack)) +- Examples fix: Support preflight of auth libraries in js [\#973](https://github.com/grpc-ecosystem/grpc-gateway/pull/973) ([GhiaC](https://github.com/GhiaC)) + ## [v1.9.4](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.4) (2019-07-09) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.3...v1.9.4) @@ -10,6 +26,7 @@ **Merged pull requests:** +- Generate changelog for 1.9.4 [\#969](https://github.com/grpc-ecosystem/grpc-gateway/pull/969) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Fix query.go to avoid invalid protobuf assumptions [\#967](https://github.com/grpc-ecosystem/grpc-gateway/pull/967) ([dsnet](https://github.com/dsnet)) - doc\(readme\): fix typo [\#965](https://github.com/grpc-ecosystem/grpc-gateway/pull/965) ([franxois](https://github.com/franxois)) - Added comments to base\_path to explain behavior [\#919](https://github.com/grpc-ecosystem/grpc-gateway/pull/919) ([nu11ptr](https://github.com/nu11ptr)) diff --git a/Makefile b/Makefile index d4f087f892a..5915f17d506 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.9.4 + --future-release=v1.9.5 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 4e17b8017c837327781f4573369f39f1ce4c9f7d Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Mon, 29 Jul 2019 23:26:13 -0600 Subject: [PATCH 426/552] Upgrade to the latest rules_go (#979) Also, finally does the thing where we can now run a single command after updating `go.mod` and Bazel will be fixed. This was released in the latest gazelle. ```sh bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories ``` --- WORKSPACE | 66 +++++++++----------- repositories.bzl | 153 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+), 39 deletions(-) create mode 100644 repositories.bzl diff --git a/WORKSPACE b/WORKSPACE index b4b48563b75..79e4cd83235 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,64 +4,52 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - sha256 = "f04d2373bcaf8aa09bccb08a98a57e721306c8f6043a2a0ee610fd6853dcde3d", + sha256 = "8df59f11fb697743cbb3f26cfb8750395f30471e9eabde0d174c3aebc7a1cd39", urls = [ - "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz", - "https://github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz", + "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.19.1/rules_go-0.19.1.tar.gz", + "https://github.com/bazelbuild/rules_go/releases/download/0.19.1/rules_go-0.19.1.tar.gz", ], ) -http_archive( - name = "bazel_gazelle", - sha256 = "3c681998538231a2d24d0c07ed5a7658cb72bfb5fd4bf9911157c0e9ac6a2687", - urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.17.0/bazel-gazelle-0.17.0.tar.gz"], -) - load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") go_rules_dependencies() go_register_toolchains() -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") +http_archive( + name = "bazel_gazelle", + sha256 = "be9296bfd64882e3c08e3283c58fcb461fa6dd3c171764fcc4cf322f60615a9b", + urls = [ + "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/0.18.1/bazel-gazelle-0.18.1.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.18.1/bazel-gazelle-0.18.1.tar.gz", + ], +) + +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") gazelle_dependencies() -# Also define in Gopkg.toml -go_repository( - name = "org_golang_google_genproto", - commit = "383e8b2c3b9e36c4076b235b32537292176bae20", - importpath = "google.golang.org/genproto", -) +# Use gazelle to declare Go dependencies in Bazel. +# gazelle:repository_macro repositories.bzl%go_repositories -# Also define in Gopkg.toml -go_repository( - name = "com_github_rogpeppe_fastuuid", - commit = "6724a57986aff9bff1a1770e9347036def7c89f6", - importpath = "github.com/rogpeppe/fastuuid", -) +load("//:repositories.bzl", "go_repositories") -# Also define in Gopkg.toml -go_repository( - name = "in_gopkg_resty_v1", - commit = "fa5875c0caa5c260ab78acec5a244215a730247f", - importpath = "gopkg.in/resty.v1", -) +go_repositories() -# Also define in Gopkg.toml -go_repository( - name = "com_github_ghodss_yaml", - commit = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7", - importpath = "github.com/ghodss/yaml", -) +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") -# Also define in Gopkg.toml -go_repository( - name = "in_gopkg_yaml_v2", - commit = "eb3733d160e74a9c7e442f435eb3bea458e1d19f", - importpath = "gopkg.in/yaml.v2", +git_repository( + name = "com_google_protobuf", + commit = "09745575a923640154bcf307fba8aedff47f240a", + remote = "https://github.com/protocolbuffers/protobuf", + shallow_since = "1558721209 -0700", ) +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() + http_archive( name = "com_github_bazelbuild_buildtools", sha256 = "86592d703ecbe0c5cbb5139333a63268cf58d7efd2c459c8be8e69e77d135e29", diff --git a/repositories.bzl b/repositories.bzl new file mode 100644 index 00000000000..9477332b07a --- /dev/null +++ b/repositories.bzl @@ -0,0 +1,153 @@ +load("@bazel_gazelle//:deps.bzl", "go_repository") + +def go_repositories(): + go_repository( + name = "co_honnef_go_tools", + importpath = "honnef.co/go/tools", + sum = "h1:XJP7lxbSxWLOMNdBE4B/STaqVy6L73o0knwj2vIlxnw=", + version = "v0.0.0-20190102054323-c2f93a96b099", + ) + go_repository( + name = "com_github_burntsushi_toml", + importpath = "github.com/BurntSushi/toml", + sum = "h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=", + version = "v0.3.1", + ) + go_repository( + name = "com_github_client9_misspell", + importpath = "github.com/client9/misspell", + sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=", + version = "v0.3.4", + ) + go_repository( + name = "com_github_ghodss_yaml", + importpath = "github.com/ghodss/yaml", + sum = "h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_golang_glog", + importpath = "github.com/golang/glog", + sum = "h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=", + version = "v0.0.0-20160126235308-23def4e6c14b", + ) + go_repository( + name = "com_github_golang_mock", + importpath = "github.com/golang/mock", + sum = "h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=", + version = "v1.1.1", + ) + go_repository( + name = "com_github_golang_protobuf", + importpath = "github.com/golang/protobuf", + sum = "h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=", + version = "v1.2.0", + ) + go_repository( + name = "com_github_kr_pretty", + importpath = "github.com/kr/pretty", + sum = "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=", + version = "v0.1.0", + ) + go_repository( + name = "com_github_kr_pty", + importpath = "github.com/kr/pty", + sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=", + version = "v1.1.1", + ) + go_repository( + name = "com_github_kr_text", + importpath = "github.com/kr/text", + sum = "h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=", + version = "v0.1.0", + ) + go_repository( + name = "com_github_rogpeppe_fastuuid", + importpath = "github.com/rogpeppe/fastuuid", + sum = "h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng=", + version = "v0.0.0-20150106093220-6724a57986af", + ) + go_repository( + name = "com_google_cloud_go", + importpath = "cloud.google.com/go", + sum = "h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ=", + version = "v0.26.0", + ) + go_repository( + name = "in_gopkg_check_v1", + importpath = "gopkg.in/check.v1", + sum = "h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=", + version = "v1.0.0-20180628173108-788fd7840127", + ) + go_repository( + name = "in_gopkg_resty_v1", + importpath = "gopkg.in/resty.v1", + sum = "h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI=", + version = "v1.12.0", + ) + go_repository( + name = "in_gopkg_yaml_v2", + importpath = "gopkg.in/yaml.v2", + sum = "h1:+t9dhfO+GNOIGJof6kPOAenx7YgrZMTdRPV+EsnPabk=", + version = "v2.0.0-20170812160011-eb3733d160e7", + ) + go_repository( + name = "org_golang_google_appengine", + importpath = "google.golang.org/appengine", + sum = "h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs=", + version = "v1.1.0", + ) + go_repository( + name = "org_golang_google_genproto", + importpath = "google.golang.org/genproto", + sum = "h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=", + version = "v0.0.0-20180817151627-c66870c02cf8", + ) + go_repository( + name = "org_golang_google_grpc", + importpath = "google.golang.org/grpc", + sum = "h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8=", + version = "v1.19.0", + ) + go_repository( + name = "org_golang_x_lint", + importpath = "golang.org/x/lint", + sum = "h1:x/bBzNauLQAlE3fLku/xy92Y8QwKX5HZymrMz2IiKFc=", + version = "v0.0.0-20181026193005-c67002cb31c3", + ) + go_repository( + name = "org_golang_x_net", + importpath = "golang.org/x/net", + sum = "h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis=", + version = "v0.0.0-20181220203305-927f97764cc3", + ) + go_repository( + name = "org_golang_x_oauth2", + importpath = "golang.org/x/oauth2", + sum = "h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=", + version = "v0.0.0-20180821212333-d2e6202438be", + ) + go_repository( + name = "org_golang_x_sync", + importpath = "golang.org/x/sync", + sum = "h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=", + version = "v0.0.0-20180314180146-1d60e4601c6f", + ) + go_repository( + name = "org_golang_x_sys", + importpath = "golang.org/x/sys", + sum = "h1:YoY1wS6JYVRpIfFngRf2HHo9R9dAne3xbkGOQ5rJXjU=", + version = "v0.0.0-20181107165924-66b7b1311ac8", + ) + go_repository( + name = "org_golang_x_text", + importpath = "golang.org/x/text", + sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=", + version = "v0.3.0", + ) + go_repository( + name = "org_golang_x_tools", + importpath = "golang.org/x/tools", + sum = "h1:qMK98NmNCRVDIYFycQ5yVRkvgDUFfdP8Ip4KqmDEB7g=", + version = "v0.0.0-20190114222345-bf090417da8b", + ) From f807a38f74f1553120828bf284550ed622a11f1b Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Mon, 5 Aug 2019 15:25:06 -0600 Subject: [PATCH 427/552] Create presubmit.yaml which configures CI (#983) Bazel runs a community CI server that has a bunch of free resources for testing projects that opt into Bazel. This configures that resource. --- .bazelci/presubmit.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .bazelci/presubmit.yml diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml new file mode 100644 index 00000000000..1e998201599 --- /dev/null +++ b/.bazelci/presubmit.yml @@ -0,0 +1,42 @@ +--- +platforms: + ubuntu1804: + build_flags: + - "--build_tag_filters=-nolinux" + build_targets: + - "..." + test_flags: + - "--features=race" + - "--test_tag_filters=-nolinux" + test_targets: + - "..." + ubuntu1604: + build_flags: + - "--build_tag_filters=-nolinux" + build_targets: + - "..." + test_flags: + - "--features=race" + - "--test_tag_filters=-nolinux" + test_targets: + - "..." + macos: + build_flags: + - "--build_tag_filters=-nomacos" + build_targets: + - "..." + test_flags: + - "--features=race" + - "--test_tag_filters=-nomacos" + test_targets: + - "..." + windows: + build_flags: + - "--build_tag_filters=-nowindows" + build_targets: + - "..." + test_flags: + - "--test_tag_filters=-nowindows" + - "--experimental_enable_runfiles" + test_targets: + - "..." From 5151b2479122c8e8bdc9d358fdd68db76cba9bd4 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 5 Aug 2019 16:08:44 +0100 Subject: [PATCH 428/552] Fix release script Specify an "id" for each build, as this was otherwise inferred and duplicate for our two builds. Also remove the use of the deprecated "archive" instruction in favour of "archives". Fixes #981 --- .goreleaser.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 28131d84ff0..bcc63e544d3 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,6 @@ builds: - main: ./protoc-gen-grpc-gateway/main.go + id: protoc-gen-grpc-gateway binary: protoc-gen-grpc-gateway env: - CGO_ENABLED=0 @@ -10,6 +11,7 @@ builds: goarch: - amd64 - main: ./protoc-gen-swagger/main.go + id: protoc-gen-swagger binary: protoc-gen-swagger env: - CGO_ENABLED=0 @@ -19,9 +21,9 @@ builds: - windows goarch: - amd64 -archive: - name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}" - format: binary - replacements: - amd64: x86_64 +archives: + - name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}" + format: binary + replacements: + amd64: x86_64 dist: _output From da1a113668f95313ba96b4c87ee80c423feb2c3d Mon Sep 17 00:00:00 2001 From: xin-au Date: Fri, 9 Aug 2019 00:12:05 -0700 Subject: [PATCH 429/552] Use json camel case when GetUseJSONNamesForFields is enabled (#985) * Use json name when GetUseJSONNamesForFields is enabled * Optimzed an if statement * Merge two if statements * Convert parameters to lower camel case in url * Revert services.go file * Fix an unit test * Update bazel file * Add an unit test for testing json camel case * Add an unit test for testing code without enabling json camel case * Add more corner cases Fixes #986 --- protoc-gen-swagger/genswagger/BUILD.bazel | 1 + protoc-gen-swagger/genswagger/template.go | 34 +++++++++-- .../genswagger/template_test.go | 61 +++++++++++++++++-- 3 files changed, 87 insertions(+), 9 deletions(-) diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/genswagger/BUILD.bazel index 18f72b9e37c..7798e9b99c5 100644 --- a/protoc-gen-swagger/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/genswagger/BUILD.bazel @@ -19,6 +19,7 @@ go_library( "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", "@io_bazel_rules_go//proto/wkt:any_go_proto", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index b02ed6aa2c7..3b1e8348c20 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -13,6 +13,7 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + gogen "github.com/golang/protobuf/protoc-gen-go/generator" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) @@ -597,7 +598,7 @@ func resolveFullyQualifiedNameToSwaggerNames(messages []string, useFQNForSwagger } // Swagger expects paths of the form /path/{string_value} but grpc-gateway paths are expected to be of the form /path/{string_value=strprefix/*}. This should reformat it correctly. -func templateToSwaggerPath(path string) string { +func templateToSwaggerPath(path string, reg *descriptor.Registry) string { // It seems like the right thing to do here is to just use // strings.Split(path, "/") but that breaks badly when you hit a url like // /{my_field=prefix/*}/ and end up with 2 sections representing my_field. @@ -606,12 +607,15 @@ func templateToSwaggerPath(path string) string { var parts []string depth := 0 buffer := "" + jsonBuffer := "" for _, char := range path { switch char { case '{': // Push on the stack depth++ buffer += string(char) + jsonBuffer = "" + jsonBuffer += string(char) break case '}': if depth == 0 { @@ -620,6 +624,14 @@ func templateToSwaggerPath(path string) string { // Pop from the stack depth-- buffer += string(char) + if reg.GetUseJSONNamesForFields() && + len(jsonBuffer) > 1 { + jsonSnakeCaseName := string(jsonBuffer[1 : len(buffer)-1]) + jsonCamelCaseName := string(lowerCamelCase(jsonSnakeCaseName)) + prev := string(buffer[:len(buffer)-len(jsonSnakeCaseName)-2]) + buffer = strings.Join([]string{prev, "{", jsonCamelCaseName, "}"}, "") + jsonBuffer = "" + } case '/': if depth == 0 { parts = append(parts, buffer) @@ -631,6 +643,7 @@ func templateToSwaggerPath(path string) string { buffer += string(char) default: buffer += string(char) + jsonBuffer += string(char) break } } @@ -731,9 +744,12 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re if desc == "" { desc = fieldProtoComments(reg, parameter.Target.Message, parameter.Target) } - + parameterString := parameter.String() + if reg.GetUseJSONNamesForFields() { + parameterString = lowerCamelCase(parameterString) + } parameters = append(parameters, swaggerParameterObject{ - Name: parameter.String(), + Name: parameterString, Description: desc, In: "path", Required: true, @@ -797,7 +813,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re parameters = append(parameters, queryParams...) } - pathItemObject, ok := paths[templateToSwaggerPath(b.PathTmpl.Template)] + pathItemObject, ok := paths[templateToSwaggerPath(b.PathTmpl.Template, reg)] if !ok { pathItemObject = swaggerPathItemObject{} } @@ -947,7 +963,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re pathItemObject.Patch = operationObject break } - paths[templateToSwaggerPath(b.PathTmpl.Template)] = pathItemObject + paths[templateToSwaggerPath(b.PathTmpl.Template, reg)] = pathItemObject } } } @@ -1661,3 +1677,11 @@ func addCustomRefs(d swaggerDefinitionsObject, reg *descriptor.Registry, refs re // Run again in case any new refs were added addCustomRefs(d, reg, refs) } + +func lowerCamelCase(parameter string) string { + parameterString := gogen.CamelCase(parameter) + builder := &strings.Builder{} + builder.WriteString(strings.ToLower(string(parameterString[0]))) + builder.WriteString(parameterString[1:]) + return builder.String() +} diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 4853a4370d3..200f563d544 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -838,6 +838,59 @@ func TestApplyTemplateRequestWithUnusedReferences(t *testing.T) { } } +func TestTemplateWithJsonCamelCase(t *testing.T) { + var tests = []struct { + input string + expected string + }{ + {"/test/{test_id}", "/test/{testId}"}, + {"/test1/{test1_id}/test2/{test2_id}", "/test1/{test1Id}/test2/{test2Id}"}, + {"/test1/{test1_id}/{test2_id}", "/test1/{test1Id}/{test2Id}"}, + {"/test1/test2/{test1_id}/{test2_id}", "/test1/test2/{test1Id}/{test2Id}"}, + {"/test1/{test1_id1_id2}", "/test1/{test1Id1Id2}"}, + {"/test1/{test1_id1_id2}/test2/{test2_id3_id4}", "/test1/{test1Id1Id2}/test2/{test2Id3Id4}"}, + {"/test1/test2/{test1_id1_id2}/{test2_id3_id4}", "/test1/test2/{test1Id1Id2}/{test2Id3Id4}"}, + {"test/{a}", "test/{a}"}, + {"test/{ab}", "test/{ab}"}, + {"test/{a_a}", "test/{aA}"}, + {"test/{ab_c}", "test/{abC}"}, + } + reg := descriptor.NewRegistry() + reg.SetUseJSONNamesForFields(true) + for _, data := range tests { + actual := templateToSwaggerPath(data.input, reg) + if data.expected != actual { + t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) + } + } +} + +func TestTemplateWithoutJsonCamelCase(t *testing.T) { + var tests = []struct { + input string + expected string + }{ + {"/test/{test_id}", "/test/{test_id}"}, + {"/test1/{test1_id}/test2/{test2_id}", "/test1/{test1_id}/test2/{test2_id}"}, + {"/test1/{test1_id}/{test2_id}", "/test1/{test1_id}/{test2_id}"}, + {"/test1/test2/{test1_id}/{test2_id}", "/test1/test2/{test1_id}/{test2_id}"}, + {"/test1/{test1_id1_id2}", "/test1/{test1_id1_id2}"}, + {"/test1/{test1_id1_id2}/test2/{test2_id3_id4}", "/test1/{test1_id1_id2}/test2/{test2_id3_id4}"}, + {"/test1/test2/{test1_id1_id2}/{test2_id3_id4}", "/test1/test2/{test1_id1_id2}/{test2_id3_id4}"}, + {"test/{a}", "test/{a}"}, + {"test/{ab}", "test/{ab}"}, + {"test/{a_a}", "test/{a_a}"}, + } + reg := descriptor.NewRegistry() + reg.SetUseJSONNamesForFields(false) + for _, data := range tests { + actual := templateToSwaggerPath(data.input, reg) + if data.expected != actual { + t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) + } + } +} + func TestTemplateToSwaggerPath(t *testing.T) { var tests = []struct { input string @@ -860,9 +913,9 @@ func TestTemplateToSwaggerPath(t *testing.T) { {"/{user.name=prefix1/*/prefix2/*}:customMethod", "/{user.name=prefix1/*/prefix2/*}:customMethod"}, {"/{parent=prefix/*}/children:customMethod", "/{parent=prefix/*}/children:customMethod"}, } - + reg := descriptor.NewRegistry() for _, data := range tests { - actual := templateToSwaggerPath(data.input) + actual := templateToSwaggerPath(data.input, reg) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } @@ -937,9 +990,9 @@ func TestFQMNtoSwaggerName(t *testing.T) { {"/{test1}/{test2}", "/{test1}/{test2}"}, {"/{test1}/{test2}/", "/{test1}/{test2}/"}, } - + reg := descriptor.NewRegistry() for _, data := range tests { - actual := templateToSwaggerPath(data.input) + actual := templateToSwaggerPath(data.input, reg) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } From af0b9bbd2c4a85258000574220bcb29b649a3ea4 Mon Sep 17 00:00:00 2001 From: vthiery Date: Fri, 9 Aug 2019 10:29:42 +0200 Subject: [PATCH 430/552] Add doc for opentracing support Mention the fact that the client must be initialized with an opentracing interceptor to allow the propagation of spans through the gateway. --- docs/_docs/customizingyourgateway.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/_docs/customizingyourgateway.md b/docs/_docs/customizingyourgateway.md index 1d927f0166d..73286d9f8c9 100644 --- a/docs/_docs/customizingyourgateway.md +++ b/docs/_docs/customizingyourgateway.md @@ -154,6 +154,28 @@ if err := http.ListenAndServe(":8080", tracingWrapper(mux)); err != nil { } ``` +Finally, don't forget to add a tracing interceptor when registering +the services. E.g. + +```go +import ( + ... + "google.golang.org/grpc" + "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing" +) + +opts := []grpc.DialOption{ + grpc.WithUnaryInterceptor( + grpc_opentracing.UnaryClientInterceptor( + grpc_opentracing.WithTracer(opentracing.GlobalTracer()), + ), + ), +} +if err := pb.RegisterMyServiceHandlerFromEndpoint(ctx, mux, serviceEndpoint, opts); err != nil { + log.Fatalf("could not register HTTP service: %v", err) +} +``` + ## Error handler http://mycodesmells.com/post/grpc-gateway-error-handler From c2967617a5db97cebe7c9549ae970226a0060c9d Mon Sep 17 00:00:00 2001 From: xin-au Date: Sat, 10 Aug 2019 08:54:38 -0700 Subject: [PATCH 431/552] Camel case backward compatible in Swagger doc (#988) * Avoid potential out of range and support the convention that could be inside * Add some test cases for testing backward compatible --- protoc-gen-swagger/genswagger/template.go | 3 ++- protoc-gen-swagger/genswagger/template_test.go | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 3b1e8348c20..0a32b49e68d 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -626,7 +626,7 @@ func templateToSwaggerPath(path string, reg *descriptor.Registry) string { buffer += string(char) if reg.GetUseJSONNamesForFields() && len(jsonBuffer) > 1 { - jsonSnakeCaseName := string(jsonBuffer[1 : len(buffer)-1]) + jsonSnakeCaseName := string(jsonBuffer[1:]) jsonCamelCaseName := string(lowerCamelCase(jsonSnakeCaseName)) prev := string(buffer[:len(buffer)-len(jsonSnakeCaseName)-2]) buffer = strings.Join([]string{prev, "{", jsonCamelCaseName, "}"}, "") @@ -641,6 +641,7 @@ func templateToSwaggerPath(path string, reg *descriptor.Registry) string { continue } buffer += string(char) + jsonBuffer += string(char) default: buffer += string(char) jsonBuffer += string(char) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 200f563d544..385785ffc8f 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -914,6 +914,14 @@ func TestTemplateToSwaggerPath(t *testing.T) { {"/{parent=prefix/*}/children:customMethod", "/{parent=prefix/*}/children:customMethod"}, } reg := descriptor.NewRegistry() + reg.SetUseJSONNamesForFields(false) + for _, data := range tests { + actual := templateToSwaggerPath(data.input, reg) + if data.expected != actual { + t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) + } + } + reg.SetUseJSONNamesForFields(true) for _, data := range tests { actual := templateToSwaggerPath(data.input, reg) if data.expected != actual { @@ -991,6 +999,14 @@ func TestFQMNtoSwaggerName(t *testing.T) { {"/{test1}/{test2}/", "/{test1}/{test2}/"}, } reg := descriptor.NewRegistry() + reg.SetUseJSONNamesForFields(false) + for _, data := range tests { + actual := templateToSwaggerPath(data.input, reg) + if data.expected != actual { + t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) + } + } + reg.SetUseJSONNamesForFields(true) for _, data := range tests { actual := templateToSwaggerPath(data.input, reg) if data.expected != actual { From babc2834ce913522996e28c0ce791d6f791b845d Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Sun, 11 Aug 2019 22:20:18 +0100 Subject: [PATCH 432/552] protoc-gen-swagger: correctly type struct.proto types --- protoc-gen-swagger/genswagger/template.go | 15 +++++ .../genswagger/template_test.go | 55 +++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 0a32b49e68d..ca83b3693f2 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -62,6 +62,21 @@ var wktSchemas = map[string]schemaCore{ Format: "boolean", }, ".google.protobuf.Empty": schemaCore{}, + ".google.protobuf.Struct": schemaCore{ + Type: "object", + }, + ".google.protobuf.Value": schemaCore{ + Type: "object", + }, + ".google.protobuf.ListValue": schemaCore{ + Type: "array", + Items: (*swaggerItemsObject)(&schemaCore{ + Type: "object", + }), + }, + ".google.protobuf.NullValue": schemaCore{ + Type: "string", + }, } func listEnumNames(enum *descriptor.Enum) (names []string) { diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 385785ffc8f..06021fe10ce 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -1193,6 +1193,61 @@ func TestSchemaOfField(t *testing.T) { Format: "boolean", }, }, + { + field: &descriptor.Field{ + FieldDescriptorProto: &protodescriptor.FieldDescriptorProto{ + Name: proto.String("wrapped_field"), + TypeName: proto.String(".google.protobuf.Struct"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + }, + }, + refs: make(refMap), + expected: schemaCore{ + Type: "object", + }, + }, + { + field: &descriptor.Field{ + FieldDescriptorProto: &protodescriptor.FieldDescriptorProto{ + Name: proto.String("wrapped_field"), + TypeName: proto.String(".google.protobuf.Value"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + }, + }, + refs: make(refMap), + expected: schemaCore{ + Type: "object", + }, + }, + { + field: &descriptor.Field{ + FieldDescriptorProto: &protodescriptor.FieldDescriptorProto{ + Name: proto.String("wrapped_field"), + TypeName: proto.String(".google.protobuf.ListValue"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + }, + }, + refs: make(refMap), + expected: schemaCore{ + Type: "array", + Items: (*swaggerItemsObject)(&schemaCore{ + Type: "object", + }), + }, + }, + { + field: &descriptor.Field{ + FieldDescriptorProto: &protodescriptor.FieldDescriptorProto{ + Name: proto.String("wrapped_field"), + TypeName: proto.String(".google.protobuf.NullValue"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + }, + }, + refs: make(refMap), + expected: schemaCore{ + Type: "string", + }, + }, { field: &descriptor.Field{ FieldDescriptorProto: &protodescriptor.FieldDescriptorProto{ From ff58b8e528ab4a9121e78cec748b7853b7bce10b Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Thu, 15 Aug 2019 15:23:39 +0100 Subject: [PATCH 433/552] Correct HTTPBody doc The previous suggestion would result in a compilation error. --- docs/_docs/httpbody.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/_docs/httpbody.md b/docs/_docs/httpbody.md index f95148ab336..5a0f9219ada 100644 --- a/docs/_docs/httpbody.md +++ b/docs/_docs/httpbody.md @@ -6,10 +6,11 @@ category: documentation The [HTTP Body](https://github.com/googleapis/googleapis/blob/master/google/api/httpbody.proto) messages allows a response message to be specified with custom data content and a custom content type header. The values included in the HTTPBody response will be used verbatim in the returned message from the gateway. Make sure you format your response carefully! ## Example Usage -1. Create a mux with the HTTP Body Marshaler as option. +1. Create a mux and configure it to use the `HTTPBodyMarshaler`. ```golang - mux := runtime.NewServeMux(runtime.SetHTTPBodyMarshaler) + mux := runtime.NewServeMux() + runtime.SetHTTPBodyMarshaler(mux) ``` 2. Define your service in gRPC with an httpbody response message From 6f185a88719759a9247863766534a5fa8989adc3 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Thu, 15 Aug 2019 13:00:22 -0600 Subject: [PATCH 434/552] Disable Windows CI Bazel We don't have a maintainer for Bazel windows. If you want to volunteer, send a PR rolling this back and let's fix it. --- .bazelci/presubmit.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 1e998201599..a0da2fcc0bc 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -30,13 +30,3 @@ platforms: - "--test_tag_filters=-nomacos" test_targets: - "..." - windows: - build_flags: - - "--build_tag_filters=-nowindows" - build_targets: - - "..." - test_flags: - - "--test_tag_filters=-nowindows" - - "--experimental_enable_runfiles" - test_targets: - - "..." From 115b809b4bcf3bca9b8915f9bb439241d1120b15 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 12 Aug 2019 11:19:22 +0100 Subject: [PATCH 435/552] Generate changelog for 1.9.6 --- CHANGELOG.md | 28 +++++++++++++++++++++++++++- Makefile | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27e479b6f99..735a96a3d4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Change Log +## [v1.9.6](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.6) (2019-08-16) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.5...v1.9.6) + +**Closed issues:** + +- Returning a primitive type as a response instead of proto messages [\#994](https://github.com/grpc-ecosystem/grpc-gateway/issues/994) +- protoc-gen-swagger: fix description of google/protobuf/struct.proto types [\#989](https://github.com/grpc-ecosystem/grpc-gateway/issues/989) +- Swagger generator does not convert parameters in URLs to camel case when `json\_names\_for\_fields` is enable. [\#986](https://github.com/grpc-ecosystem/grpc-gateway/issues/986) +- The release upload job is broken [\#981](https://github.com/grpc-ecosystem/grpc-gateway/issues/981) +- Schema and field name questions from a front end developer [\#980](https://github.com/grpc-ecosystem/grpc-gateway/issues/980) +- undefined: runtime.AssumeColonVerbOpt [\#978](https://github.com/grpc-ecosystem/grpc-gateway/issues/978) +- I want to know how to transfer http+proto to grpc. [\#977](https://github.com/grpc-ecosystem/grpc-gateway/issues/977) +- Is it possible to use protoc-gen-swagger options in my own protos? [\#976](https://github.com/grpc-ecosystem/grpc-gateway/issues/976) + +**Merged pull requests:** + +- Disable Windows CI Bazel [\#996](https://github.com/grpc-ecosystem/grpc-gateway/pull/996) ([achew22](https://github.com/achew22)) +- Correct HTTPBody doc [\#995](https://github.com/grpc-ecosystem/grpc-gateway/pull/995) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- protoc-gen-swagger: correctly type struct.proto types [\#990](https://github.com/grpc-ecosystem/grpc-gateway/pull/990) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Camel case backward compatible in Swagger doc [\#988](https://github.com/grpc-ecosystem/grpc-gateway/pull/988) ([xin-au](https://github.com/xin-au)) +- Add doc for opentracing support [\#987](https://github.com/grpc-ecosystem/grpc-gateway/pull/987) ([vthiery](https://github.com/vthiery)) +- Use json camel case when GetUseJSONNamesForFields is enabled [\#985](https://github.com/grpc-ecosystem/grpc-gateway/pull/985) ([xin-au](https://github.com/xin-au)) +- Create presubmit.yaml which configures CI [\#983](https://github.com/grpc-ecosystem/grpc-gateway/pull/983) ([achew22](https://github.com/achew22)) +- Fix release script [\#982](https://github.com/grpc-ecosystem/grpc-gateway/pull/982) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Upgrade to the latest rules\_go [\#979](https://github.com/grpc-ecosystem/grpc-gateway/pull/979) ([achew22](https://github.com/achew22)) + ## [v1.9.5](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.5) (2019-07-22) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.4...v1.9.5) @@ -13,6 +39,7 @@ **Merged pull requests:** +- Generate changelog for 1.9.5 [\#975](https://github.com/grpc-ecosystem/grpc-gateway/pull/975) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Fix HTTP Status Code returned for a `Failed Precondition` error [\#974](https://github.com/grpc-ecosystem/grpc-gateway/pull/974) ([cjcormack](https://github.com/cjcormack)) - Examples fix: Support preflight of auth libraries in js [\#973](https://github.com/grpc-ecosystem/grpc-gateway/pull/973) ([GhiaC](https://github.com/GhiaC)) @@ -719,7 +746,6 @@ **Closed issues:** - Empty value omitted [\#355](https://github.com/grpc-ecosystem/grpc-gateway/issues/355) -- Must generate reverse proxy in same package? [\#353](https://github.com/grpc-ecosystem/grpc-gateway/issues/353) - Release 1.2.0 [\#340](https://github.com/grpc-ecosystem/grpc-gateway/issues/340) - Cut another release [\#278](https://github.com/grpc-ecosystem/grpc-gateway/issues/278) diff --git a/Makefile b/Makefile index 5915f17d506..f48004971f5 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.9.5 + --future-release=v1.9.6 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 8a4c7400535182c2a184e0272ea14ab28ca99fff Mon Sep 17 00:00:00 2001 From: Zach Date: Sat, 24 Aug 2019 10:06:41 -0400 Subject: [PATCH 436/552] Allow overriding the primitive type of fields (#1003) * Allow overriding the primitive type of fields * Updated generated files and added a separate example for type override * Fixed formatting * Made logic for type override a little bit more forgiving * Added additional files it needs to pass tests --- .../abe/a_bit_of_everything_service_api.go | 8 +- .../abe/examplepb_a_bit_of_everything.go | 2 + .../proto/examplepb/a_bit_of_everything.pb.go | 451 +++++++++--------- .../proto/examplepb/a_bit_of_everything.proto | 2 + .../a_bit_of_everything.swagger.json | 42 +- examples/proto/examplepb/stream.swagger.json | 4 + protoc-gen-swagger/genswagger/template.go | 3 + 7 files changed, 287 insertions(+), 225 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index f4fe7b6f87e..31a5b3c9c1c 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -73,9 +73,10 @@ func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythin * @param repeatedStringAnnotation Repeated string title. Repeated string description. * @param nestedAnnotationAmount * @param nestedAnnotationOk DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param int64OverrideType * @return *ExamplepbABitOfEverything */ -func (a ABitOfEverythingServiceApi) CheckGetQueryParams(singleNestedName string, floatValue float32, singleNestedAmount int64, singleNestedOk string, uuid string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationAmount int64, nestedAnnotationOk string) (*ExamplepbABitOfEverything, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) CheckGetQueryParams(singleNestedName string, floatValue float32, singleNestedAmount int64, singleNestedOk string, uuid string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationAmount int64, nestedAnnotationOk string, int64OverrideType int64) (*ExamplepbABitOfEverything, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables @@ -144,6 +145,7 @@ func (a ABitOfEverythingServiceApi) CheckGetQueryParams(singleNestedName string, localVarQueryParams.Add("nested_annotation.amount", a.Configuration.APIClient.ParameterToString(nestedAnnotationAmount, "")) localVarQueryParams.Add("nested_annotation.ok", a.Configuration.APIClient.ParameterToString(nestedAnnotationOk, "")) + localVarQueryParams.Add("int64_override_type", a.Configuration.APIClient.ParameterToString(int64OverrideType, "")) // to determine the Content-Type header localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } @@ -776,9 +778,10 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param nestedAnnotationName name is nested field. * @param nestedAnnotationAmount * @param nestedAnnotationOk DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param int64OverrideType * @return *interface{} */ -func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, singleNestedName string, singleNestedAmount int64, singleNestedOk string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationName string, nestedAnnotationAmount int64, nestedAnnotationOk string) (*interface{}, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, singleNestedName string, singleNestedAmount int64, singleNestedOk string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationName string, nestedAnnotationAmount int64, nestedAnnotationOk string, int64OverrideType int64) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables @@ -835,6 +838,7 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, si localVarQueryParams.Add("nested_annotation.name", a.Configuration.APIClient.ParameterToString(nestedAnnotationName, "")) localVarQueryParams.Add("nested_annotation.amount", a.Configuration.APIClient.ParameterToString(nestedAnnotationAmount, "")) localVarQueryParams.Add("nested_annotation.ok", a.Configuration.APIClient.ParameterToString(nestedAnnotationOk, "")) + localVarQueryParams.Add("int64_override_type", a.Configuration.APIClient.ParameterToString(int64OverrideType, "")) // to determine the Content-Type header localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go index 2190507a464..f14edb018dd 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -92,4 +92,6 @@ type ExamplepbABitOfEverything struct { // Nested object description. NestedAnnotation ABitOfEverythingNested `json:"nested_annotation,omitempty"` + + Int64OverrideType int64 `json:"int64_override_type,omitempty"` } diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index ee105d94ed4..677cdab761e 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{0} + return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{0, 0, 0} } // Intentionaly complicated message type to cover many features of Protobuf. @@ -130,6 +130,7 @@ type ABitOfEverything struct { RepeatedNestedAnnotation []*ABitOfEverything_Nested `protobuf:"bytes,35,rep,name=repeated_nested_annotation,json=repeatedNestedAnnotation,proto3" json:"repeated_nested_annotation,omitempty"` // nested object comments (This comment is overridden by the field annotation) NestedAnnotation *ABitOfEverything_Nested `protobuf:"bytes,36,opt,name=nested_annotation,json=nestedAnnotation,proto3" json:"nested_annotation,omitempty"` + Int64OverrideType int64 `protobuf:"varint,37,opt,name=int64_override_type,json=int64OverrideType,proto3" json:"int64_override_type,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -139,7 +140,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{0} + return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -427,6 +428,13 @@ func (m *ABitOfEverything) GetNestedAnnotation() *ABitOfEverything_Nested { return nil } +func (m *ABitOfEverything) GetInt64OverrideType() int64 { + if m != nil { + return m.Int64OverrideType + } + return 0 +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*ABitOfEverything) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _ABitOfEverything_OneofMarshaler, _ABitOfEverything_OneofUnmarshaler, _ABitOfEverything_OneofSizer, []interface{}{ @@ -513,7 +521,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{0, 0} + return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -582,7 +590,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{1} + return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -725,7 +733,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{2} + return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -764,7 +772,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{3} + return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -811,7 +819,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_db561398d393056a, []int{4} + return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1641,216 +1649,219 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_db561398d393056a) -} - -var fileDescriptor_a_bit_of_everything_db561398d393056a = []byte{ - // 3311 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x3a, 0x4b, 0x73, 0x1b, 0xc7, - 0x99, 0x1c, 0x0c, 0x9f, 0xcd, 0x17, 0xd8, 0x94, 0x28, 0x10, 0xa2, 0xcd, 0x16, 0x24, 0xdb, 0x23, - 0x58, 0xc0, 0x90, 0x43, 0x4a, 0xa6, 0xe0, 0xb2, 0xb5, 0x00, 0x1f, 0x12, 0x2d, 0x89, 0xa2, 0x46, - 0xb2, 0xd6, 0x25, 0x4b, 0x66, 0x35, 0x80, 0x06, 0x31, 0x22, 0xe6, 0xe1, 0x99, 0x1e, 0x4a, 0x58, - 0x2e, 0x76, 0xbd, 0x8f, 0xda, 0xad, 0xb5, 0x0f, 0x5b, 0x05, 0x27, 0x95, 0xca, 0xa3, 0xf2, 0x0b, - 0x7c, 0xcd, 0xc9, 0x55, 0x49, 0x0e, 0xc9, 0x29, 0x87, 0x54, 0x29, 0xa9, 0xdc, 0x72, 0x4a, 0x0e, - 0x39, 0xe5, 0x92, 0x2a, 0x57, 0xe5, 0x90, 0x54, 0x6a, 0x7a, 0x66, 0x80, 0x99, 0x01, 0x20, 0x0a, - 0x92, 0x4b, 0x17, 0x6a, 0xba, 0xfb, 0x7b, 0x7f, 0x5f, 0x7f, 0x8f, 0x86, 0x80, 0x44, 0x9e, 0x60, - 0xd5, 0xa8, 0x11, 0x4b, 0x34, 0x4c, 0x9d, 0xea, 0xa2, 0xb7, 0x34, 0x8a, 0x22, 0xde, 0x2b, 0x2a, - 0x74, 0x4f, 0xaf, 0xec, 0x91, 0x43, 0x62, 0xd6, 0x69, 0x55, 0xd1, 0xf6, 0xb3,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c, 0xe1, 0x92, 0x73, 0x57, 0xb0, 0x0a, 0x06, 0x6d, 0x5b, 0x29, 0x27, 0x38, - 0xc4, 0x09, 0x63, 0x85, 0xbb, 0xcd, 0xfc, 0xed, 0xcf, 0x38, 0xee, 0x73, 0xee, 0xfa, 0xc7, 0x38, - 0x53, 0xc9, 0x67, 0xb6, 0x96, 0x32, 0x97, 0x1f, 0x1e, 0xad, 0x35, 0x32, 0xc1, 0xe5, 0x6a, 0x3f, - 0xcb, 0x65, 0xa9, 0x21, 0x33, 0x0e, 0x70, 0x17, 0x0c, 0x7b, 0x1a, 0xc4, 0x10, 0xff, 0x52, 0x1a, - 0x78, 0x74, 0xe0, 0x07, 0x60, 0xbc, 0x52, 0xd3, 0x31, 0xdd, 0x3b, 0xc4, 0x35, 0x9b, 0x24, 0x78, - 0xc4, 0x09, 0xb1, 0xc2, 0xf9, 0x66, 0xfe, 0x4d, 0x69, 0x66, 0xcb, 0xd9, 0x47, 0x6c, 0x1f, 0xb1, - 0x08, 0xcb, 0xf1, 0x4b, 0x59, 0xe9, 0x29, 0x17, 0x44, 0x90, 0x01, 0x5b, 0xdc, 0x73, 0xbe, 0xe1, - 0x19, 0x30, 0x51, 0xd6, 0xed, 0x62, 0x8d, 0x78, 0xc4, 0x06, 0x11, 0x27, 0x70, 0xf2, 0xb8, 0xbb, - 0xe7, 0x82, 0x2c, 0x82, 0x71, 0x45, 0xa3, 0x97, 0x56, 0x3d, 0x88, 0x21, 0xc4, 0x09, 0xbc, 0x0c, - 0xd8, 0x56, 0x8b, 0x86, 0x1d, 0x84, 0x18, 0x46, 0x9c, 0x30, 0x28, 0x8f, 0xdb, 0x01, 0x10, 0x97, - 0xc6, 0x8a, 0xe4, 0x41, 0x8c, 0x20, 0x4e, 0x18, 0x62, 0x34, 0x56, 0x24, 0x17, 0xe0, 0x2c, 0x98, - 0xac, 0x28, 0x4f, 0x48, 0xb9, 0x45, 0x64, 0x14, 0x71, 0xc2, 0xb0, 0x3c, 0xe1,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 0xd0, 0x09, 0x33, 0x88, 0x13, 0x66, 0xe4, 0x71, 0x2b, 0xe0, 0x04, 0x0f, - 0xa4, 0x45, 0x07, 0x22, 0x4e, 0x80, 0x2e, 0x88, 0x4f, 0x45, 0x02, 0x27, 0x4d, 0x62, 0x10, 0xec, - 0x98, 0x22, 0x14, 0x17, 0xb3, 0x88, 0x17, 0xc6, 0xe4, 0x59, 0xff, 0xf0, 0x4e, 0x20, 0x3e, 0x2e, - 0x83, 0x71, 0x5d, 0x23, 0x4e, 0x91, 0x70, 0x32, 0x74, 0xe2, 0x04, 0x4b, 0x4c, 0x73, 0x59, 0x37, - 0x29, 0x66, 0xfd, 0xa4, 0x98, 0xdd, 0x74, 0x4e, 0xaf, 0x0d, 0xc8, 0x80, 0x01, 0xb3, 0x15, 0x3c, - 0x0b, 0x26, 0x5c, 0x54, 0x97, 0x57, 0xe2, 0xa4, 0x13, 0x7d, 0xd7, 0x06, 0x64, 0x97, 0xa0, 0xcb, - 0x04, 0x3e, 0x00, 0x63, 0x2a, 0x36, 0x3c, 0x39, 0xe6, 0x58, 0xd2, 0xb8, 0xd2, 0x7f, 0xd2, 0xb8, - 0x89, 0x0d, 0x26, 0xee, 0xa6, 0x46, 0xcd, 0xba, 0x3c, 0xaa, 0x7a, 0x4b, 0xf8, 0x04, 0xcc, 0xaa, - 0xd8, 0x30, 0xa2, 0xfa, 0x9e, 0x62, 0x7c, 0xae, 0xbd, 0x10, 0x1f, 0x23, 0x64, 0x1f, 0x97, 0xe1, - 0x8c, 0x1a, 0xdd, 0x0f, 0x70, 0xf6, 0x62, 0xcf, 0xe5, 0x9c, 0x78, 0x39, 0xce, 0x6e, 0xe4, 0x75, - 0x72, 0x0e, 0xec, 0xc3, 0x1c, 0x48, 0x68, 0xba, 0xb6, 0xae, 0x6b, 0x87, 0x44, 0x73, 0x2a, 0x0f, - 0xae, 0xed, 0x60, 0xd5, 0x4d, 0x6f, 0x89, 0x24, 0x4b, 0x00, 0x3d, 0xcf, 0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 0x8c, 0x8b, 0xe5, 0xca, 0x3b, 0x64, 0x6d, 0x79, 0x35, 0x85, 0x1a, 0x85, 0x49, 0xbf, 0xb5, 0x61, - 0xc2, 0xa5, 0xfe, 0x3e, 0x0a, 0x12, 0x51, 0x49, 0xfc, 0x5c, 0x01, 0x2f, 0x83, 0x79, 0xd6, 0x3c, - 0xb6, 0x72, 0x57, 0x70, 0x28, 0xe1, 0x10, 0x2f, 0xc4, 0xe4, 0x39, 0x07, 0xc0, 0x47, 0xd8, 0x6a, - 0x4f, 0x1d, 0xef, 0x82, 0x64, 0x18, 0x35, 0x34, 0x83, 0x38, 0x73, 0x12, 0x27, 0x9f, 0x0a, 0xe2, - 0x6e, 0x04, 0xe6, 0x91, 0x0e, 0xbe, 0xc1, 0x16, 0x8f, 0x47, 0xbc, 0xc0, 0x87, 0xf9, 0x6e, 0xb7, - 0xbb, 0xbd, 0x0e, 0xbe, 0xa1, 0xb9, 0x65, 0x10, 0xf1, 0xc2, 0x60, 0x98, 0xef, 0x87, 0x81, 0x56, - 0xb1, 0x1b, 0xdf, 0x56, 0xf7, 0x39, 0x84, 0x78, 0x61, 0xa8, 0x83, 0xaf, 0xdf, 0x88, 0xbe, 0x07, - 0x4e, 0x47, 0x4c, 0x15, 0xea, 0x6f, 0x87, 0x11, 0x2f, 0x0c, 0xcb, 0x89, 0x90, 0xb1, 0x82, 0xad, - 0x6e, 0x77, 0xf4, 0xc0, 0x34, 0xc5, 0x0b, 0x23, 0x5d, 0xd0, 0x7d, 0xee, 0xef, 0x80, 0x44, 0x18, - 0x3d, 0x30, 0x1f, 0x8d, 0x22, 0x5e, 0x18, 0x95, 0x4f, 0x06, 0x71, 0x0b, 0xad, 0x59, 0xa9, 0xc3, - 0x5c, 0xa1, 0x8e, 0x71, 0x8c, 0x75, 0xc8, 0x21, 0x73, 0x85, 0xbb, 0xe4, 0x88, 0xb9, 0x82, 0x33, - 0x15, 0x40, 0xbc, 0x30, 0x11, 0x36, 0x57, 0xa1, 0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c, 0xcf, 0xa7, - 0xce, 0x05, 0xb9, 0x1b, 0xba, 0x45, 0x1d, 0x09, 0xd8, 0x2f, 0x86, 0xae, 0x18, 0xad, 0xa0, 0xf8, - 0x05, 0x07, 0x66, 0xd7, 0xab, 0xa4, 0x74, 0xe0, 0x17, 0xe7, 0x5d, 0x6c, 0x62, 0xd5, 0x7a, 0x45, - 0x31, 0x7d, 0x95, 0x89, 0x9b, 0x87, 0x57, 0x8e, 0x8b, 0x69, 0x83, 0x49, 0x25, 0xee, 0x13, 0xda, - 0x35, 0xbc, 0xe1, 0xaf, 0x39, 0x70, 0x82, 0xa9, 0xe1, 0x58, 0xf4, 0xd5, 0xeb, 0x71, 0x9b, 0xe9, - 0x71, 0x3d, 0x95, 0x7b, 0x4e, 0x3d, 0x1c, 0x8f, 0x84, 0x87, 0xbe, 0x46, 0x2e, 0xfc, 0x3f, 0x4e, - 0x92, 0x3f, 0xe3, 0x9a, 0xf9, 0xaf, 0x39, 0x58, 0xe9, 0x31, 0x4e, 0x07, 0x1f, 0xf1, 0x51, 0x26, - 0x83, 0x1e, 0x57, 0x95, 0x52, 0x15, 0x59, 0x55, 0xdd, 0xae, 0x95, 0x59, 0x5e, 0x2c, 0x12, 0x64, - 0x5b, 0xa4, 0x8c, 0x14, 0x0d, 0x19, 0x35, 0x5c, 0x22, 0x48, 0xaf, 0xb0, 0x0c, 0x5a, 0xd6, 0x4b, - 0xb6, 0x4a, 0x34, 0x77, 0x48, 0x43, 0x25, 0x5d, 0x75, 0x16, 0x67, 0x92, 0xb7, 0xc1, 0x62, 0xb7, - 0x96, 0xcd, 0xc9, 0x6f, 0xfe, 0x00, 0xdf, 0xef, 0x23, 0xf0, 0x23, 0x70, 0xa2, 0x84, 0x55, 0x52, - 0x5b, 0xc7, 0x16, 0xf1, 0x68, 0x38, 0xd3, 0x26, 0x94, 0xc1, 0x90, 0xfb, 0x7b, 0x74, 0xbf, 0x37, - 0x7c, 0x9e, 0x59, 0x79, 0x16, 0xce, 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44, 0x67, 0xd6, 0xe2, 0xf9, 0x9e, 0x53, 0x6b, 0x14, 0xd4, 0xdc, 0x06, 0xa7, 0x6e, 0xb6, - 0xb3, 0x4f, 0xf0, 0x4e, 0xf5, 0x7b, 0x97, 0xee, 0x8f, 0xb5, 0x3c, 0x57, 0x1c, 0x66, 0xf7, 0x79, - 0xe5, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xed, 0x21, 0x52, 0xb7, 0x7b, 0x29, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71) +} + +var fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71 = []byte{ + // 3345 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x3a, 0x4b, 0x73, 0x1b, 0x47, + 0x7a, 0x1c, 0x0c, 0x9f, 0xcd, 0x17, 0xd8, 0x94, 0x28, 0x10, 0xa2, 0xcd, 0x16, 0x24, 0xaf, 0xc7, + 0xb0, 0x80, 0x21, 0x87, 0xb4, 0x4d, 0xc1, 0xb5, 0xab, 0x0c, 0xf8, 0x90, 0x69, 0xd9, 0x14, 0x3d, + 0x92, 0x1d, 0x97, 0xd6, 0x5a, 0x56, 0x03, 0x68, 0x10, 0x23, 0x62, 0x1e, 0x3b, 0xd3, 0x43, 0x09, + 0x61, 0x90, 0x6c, 0x1e, 0x95, 0x54, 0x76, 0x0f, 0xa9, 0xc2, 0x26, 0x87, 0x3c, 0x2a, 0xbf, 0x60, + 0xaf, 0x39, 0x6d, 0x55, 0x92, 0x43, 0x72, 0xca, 0x21, 0x29, 0x27, 0x95, 0x5b, 0x4e, 0xc9, 0x21, + 0xa7, 0x5c, 0x52, 0xb5, 0x55, 0x39, 0x24, 0xb5, 0xd5, 0x3d, 0x33, 0xc0, 0xcc, 0x00, 0x10, 0x05, + 0x69, 0x4b, 0x17, 0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 0xbb, + 0x40, 0xfc, 0x60, 0x63, 0x0b, 0xee, 0x80, 0x0f, 0x35, 0x42, 0x3d, 0xc7, 0x24, 0x35, 0xf4, 0xac, + 0x41, 0x4c, 0x44, 0x1b, 0x04, 0x39, 0xc4, 0xb5, 0x3c, 0xa7, 0x4a, 0x90, 0xee, 0x22, 0x4a, 0x0c, + 0xdb, 0x72, 0xb0, 0xa3, 0x37, 0x5b, 0xc8, 0x33, 0xf1, 0x39, 0xd6, 0x9b, 0xb8, 0xd2, 0x24, 0xc5, + 0x4f, 0x3f, 0x06, 0xe2, 0xf6, 0xc6, 0x36, 0xdc, 0x06, 0xf9, 0x17, 0x10, 0xa8, 0x59, 0xc4, 0x45, + 0xa6, 0x45, 0x11, 0x79, 0xae, 0xbb, 0xb4, 0x08, 0x27, 0x01, 0x7f, 0x83, 0xe3, 0x97, 0xec, 0xc9, + 0xe5, 0x69, 0x82, 0x19, 0x46, 0xbe, 0xf0, 0x1d, 0xf3, 0x78, 0x35, 0x97, 0x8e, 0x16, 0x1c, 0x76, + 0x56, 0xf2, 0x9f, 0x6c, 0x1e, 0x43, 0xd8, 0x77, 0x04, 0xff, 0x5a, 0x00, 0x73, 0x7b, 0x84, 0xd8, + 0xfc, 0x87, 0x29, 0xb6, 0xf1, 0x66, 0x3a, 0x9b, 0xbb, 0x5c, 0xb7, 0x3b, 0xb9, 0xed, 0x4b, 0x53, + 0x7c, 0xec, 0x37, 0xef, 0x22, 0x1b, 0x57, 0x78, 0x15, 0x52, 0x01, 0x38, 0xb2, 0xca, 0xba, 0x59, + 0xd3, 0xcd, 0x53, 0x17, 0xae, 0xf6, 0x65, 0xf0, 0xbd, 0xe0, 0xcf, 0x01, 0x86, 0x26, 0xf7, 0x31, + 0xf8, 0x15, 0x98, 0x7a, 0xa4, 0x1b, 0xc4, 0xf2, 0x28, 0x1c, 0x02, 0x34, 0x14, 0xf9, 0x3a, 0x17, + 0xff, 0x2a, 0x5c, 0x8e, 0xda, 0x93, 0x06, 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x16, 0xa5, 0x71, 0xe5, 0x66, 0xe8, 0xc3, 0x88, 0xc3, + 0x65, 0x0b, 0x7b, 0xb4, 0x21, 0xb3, 0x7f, 0x2c, 0x47, 0xff, 0x0d, 0x52, 0x5a, 0x1f, 0x0e, 0x44, + 0xad, 0x33, 0x62, 0x96, 0x7f, 0x1b, 0x64, 0xfd, 0x49, 0x10, 0xc2, 0x7b, 0x0e, 0x36, 0xa9, 0x8b, + 0xd8, 0x22, 0xb0, 0x1e, 0x58, 0x0b, 0xe6, 0x43, 0xb8, 0x1c, 0x1c, 0xf2, 0x55, 0x78, 0xba, 0x0b, + 0x26, 0x70, 0xcd, 0xd0, 0x4d, 0x58, 0x8a, 0xa1, 0x9a, 0xb5, 0x18, 0x18, 0x77, 0x06, 0x03, 0xd3, + 0x5d, 0xca, 0x5a, 0x84, 0x73, 0x82, 0x74, 0xb3, 0x6e, 0x39, 0x06, 0xf7, 0x77, 0x65, 0x1d, 0xcc, + 0x47, 0x4d, 0x31, 0x96, 0x9c, 0x59, 0x2b, 0xef, 0x0d, 0x9d, 0x5a, 0x93, 0xa0, 0xce, 0x21, 0xb8, + 0xf6, 0x79, 0x2f, 0xfb, 0x44, 0xef, 0xd4, 0xa8, 0x77, 0xe9, 0xf1, 0x4c, 0xd7, 0x73, 0x95, 0x49, + 0x7e, 0x9f, 0xb7, 0x7e, 0x19, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x34, 0x38, 0x21, 0xb4, 0x29, 0x00, + 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 84d22126f11..85235fa9520 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -219,6 +219,8 @@ message ABitOfEverything { // nested object comments (This comment is overridden by the field annotation) Nested nested_annotation = 36 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {title: "Nested object title", description: "Nested object description."}]; + + int64 int64_override_type = 37 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {type: INTEGER}]; } // ABitOfEverythingRepeated is used to validate repeated path parameter functionality diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index edfa08730b7..278c4aaaa2f 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -44,6 +44,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -88,7 +89,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { - "type": "int32", + "type": "integer", "format": "integer" } }, @@ -138,6 +139,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -421,6 +423,13 @@ "TRUE" ], "default": "FALSE" + }, + { + "name": "int64_override_type", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" } ], "tags": [ @@ -445,6 +454,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -493,6 +503,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -783,6 +794,13 @@ "TRUE" ], "default": "FALSE" + }, + { + "name": "int64_override_type", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" } ], "tags": [ @@ -815,6 +833,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -995,6 +1014,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1044,6 +1064,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1082,6 +1103,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1129,6 +1151,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1177,6 +1200,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1406,6 +1430,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1452,6 +1477,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1502,7 +1528,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { - "type": "int32", + "type": "integer", "format": "integer" } }, @@ -1552,7 +1578,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { - "type": "int32", + "type": "integer", "format": "integer" } }, @@ -1606,6 +1632,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1638,6 +1665,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1670,6 +1698,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1718,6 +1747,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1750,6 +1780,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -1798,6 +1829,7 @@ "404": { "description": "Returned when the resource does not exist.", "schema": { + "type": "string", "format": "string" } }, @@ -2039,6 +2071,10 @@ "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" + }, + "int64_override_type": { + "type": "integer", + "format": "int64" } }, "description": "Intentionaly complicated message type to cover many features of Protobuf.", diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index d67b6d24496..e9fcd5ed5ee 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -295,6 +295,10 @@ "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" + }, + "int64_override_type": { + "type": "integer", + "format": "int64" } }, "description": "Intentionaly complicated message type to cover many features of Protobuf.", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index ca83b3693f2..dfb8a490854 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1599,6 +1599,9 @@ func updateSwaggerObjectFromJSONSchema(s *swaggerSchemaObject, j *swagger_option s.MaxProperties = j.GetMaxProperties() s.MinProperties = j.GetMinProperties() s.Required = j.GetRequired() + if overrideType := j.GetType(); len(overrideType) > 0 { + s.Type = strings.ToLower(overrideType[0].String()) + } } func swaggerSchemaFromProtoSchema(s *swagger_options.Schema, reg *descriptor.Registry, refs refMap) swaggerSchemaObject { From f32a764c95bd176d24e5121edcb176c083916650 Mon Sep 17 00:00:00 2001 From: Dominik Honnef Date: Tue, 20 Aug 2019 08:30:13 +0200 Subject: [PATCH 437/552] Add Fuzzit integration Add a basic fuzz test for the httprule package, run regression tests locally on every PR and continuous fuzzing on fuzzit.dev. --- .circleci/config.yml | 9 ++++++++ README.md | 2 +- fuzzit.sh | 27 ++++++++++++++++++++++++ protoc-gen-grpc-gateway/httprule/fuzz.go | 11 ++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 fuzzit.sh create mode 100644 protoc-gen-grpc-gateway/httprule/fuzz.go diff --git a/.circleci/config.yml b/.circleci/config.yml index 373948713d4..3ce4687d4dd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -48,6 +48,14 @@ jobs: - checkout - run: go get golang.org/x/lint/golint - run: make lint + fuzzit: + docker: + - image: fuzzitdev/fuzzit:golang1.12-stretch-llvm9 + working_directory: /go/src/github.com/grpc-gateway/grpc-gateway + steps: + - checkout + - setup_remote_docker + - run: ./fuzzit.sh bazel: docker: - image: l.gcr.io/google/bazel:latest @@ -88,6 +96,7 @@ workflows: jobs: - build - test + - fuzzit - node_test - generate - lint diff --git a/README.md b/README.md index 75dcd753620..bb1af895665 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # grpc-gateway -[![release](https://img.shields.io/github/release/grpc-ecosystem/grpc-gateway.svg?style=flat-square)](https://github.com/grpc-ecosystem/grpc-gateway/releases) [![CircleCI](https://img.shields.io/circleci/project/github/grpc-ecosystem/grpc-gateway/master.svg?style=flat-square)](https://circleci.com/gh/grpc-ecosystem/grpc-gateway) [![coverage](https://img.shields.io/codecov/c/github/grpc-ecosystem/grpc-gateway/master.svg?style=flat-square)](https://codecov.io/gh/grpc-ecosystem/grpc-gateway) [![license](https://img.shields.io/github/license/grpc-ecosystem/grpc-gateway.svg?style=flat-square)](LICENSE.txt) +[![release](https://img.shields.io/github/release/grpc-ecosystem/grpc-gateway.svg?style=flat-square)](https://github.com/grpc-ecosystem/grpc-gateway/releases) [![CircleCI](https://img.shields.io/circleci/project/github/grpc-ecosystem/grpc-gateway/master.svg?style=flat-square)](https://circleci.com/gh/grpc-ecosystem/grpc-gateway) [![fuzzit](https://app.fuzzit.dev/badge?org_id=grpc-gateway)](https://app.fuzzit.dev/orgs/grpc-gateway/dashboard) [![coverage](https://img.shields.io/codecov/c/github/grpc-ecosystem/grpc-gateway/master.svg?style=flat-square)](https://codecov.io/gh/grpc-ecosystem/grpc-gateway) [![license](https://img.shields.io/github/license/grpc-ecosystem/grpc-gateway.svg?style=flat-square)](LICENSE.txt) The grpc-gateway is a plugin of the Google protocol buffers compiler [protoc](https://github.com/protocolbuffers/protobuf). diff --git a/fuzzit.sh b/fuzzit.sh new file mode 100755 index 00000000000..63d35a57675 --- /dev/null +++ b/fuzzit.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -xe + +# Go-fuzz doesn't support modules yet, so ensure we do everything in the old style GOPATH way +export GO111MODULE="off" + +# Install go-fuzz +go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build + +# Compiling fuzz targets in fuzz.go with go-fuzz (https://github.com/dvyukov/go-fuzz) and libFuzzer support +# This is a workaround until go-fuzz has gomodules support https://github.com/dvyukov/go-fuzz/issues/195 +BRANCH=$(git rev-parse --abbrev-ref HEAD) +git branch --set-upstream-to=origin/master $BRANCH + +go get -v -u ./protoc-gen-grpc-gateway/httprule +go-fuzz-build -libfuzzer -o parse-http-rule.a ./protoc-gen-grpc-gateway/httprule +clang-9 -fsanitize=fuzzer parse-http-rule.a -o parse-http-rule + +wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.29/fuzzit_Linux_x86_64 +chmod a+x fuzzit + +if [ -z "CIRCLE_PULL_REQUEST" ]; then + TYPE="fuzzing" +else + TYPE="local-regression" +fi +./fuzzit create job --type ${TYPE} grpc-gateway/parse-http-rule parse-http-rule diff --git a/protoc-gen-grpc-gateway/httprule/fuzz.go b/protoc-gen-grpc-gateway/httprule/fuzz.go new file mode 100644 index 00000000000..138f7c12f0e --- /dev/null +++ b/protoc-gen-grpc-gateway/httprule/fuzz.go @@ -0,0 +1,11 @@ +// +build gofuzz + +package httprule + +func Fuzz(data []byte) int { + _, err := Parse(string(data)) + if err != nil { + return 0 + } + return 0 +} From 789131a95f0ddd93767a2645798458afb31da26a Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Thu, 24 Jan 2019 10:14:59 +0800 Subject: [PATCH 438/552] =?UTF-8?q?=E5=A2=9E=E5=8A=A0local=20server?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 6fc552f9c3cd8ee378e9ac179604f0d1005e4af1) --- .../gengateway/template_local.go | 148 ++++++++++++++++++ protoc-gen-grpc-gateway/main.go | 2 +- 2 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 protoc-gen-grpc-gateway/gengateway/template_local.go diff --git a/protoc-gen-grpc-gateway/gengateway/template_local.go b/protoc-gen-grpc-gateway/gengateway/template_local.go new file mode 100644 index 00000000000..ed6385242fe --- /dev/null +++ b/protoc-gen-grpc-gateway/gengateway/template_local.go @@ -0,0 +1,148 @@ +package gengateway + +import ( + "strings" + "text/template" +) + +var ( + localHandlerTemplate = template.Must(template.New("local-handler").Parse(` +{{if and .Method.GetClientStreaming .Method.GetServerStreaming}} +// TODO bidi-streaming-request +{{else if .Method.GetClientStreaming}} +// TODO client-streaming-request +{{else if .Method.GetServerStreaming}} +// TODO server-streaming-request +{{else}} +{{template "local-rpc-request-func" .}} +{{end}} +`)) + + _ = template.Must(localHandlerTemplate.New("local-request-func-signature").Parse(strings.Replace(` +{{if .Method.GetServerStreaming}} +// TODO +{{else}} +func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, marshaler runtime.Marshaler, server {{.Method.Service.GetName}}Server, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) +{{end}}`, "\n", "", -1))) + + _ = template.Must(localHandlerTemplate.New("local-rpc-request-func").Parse(` +{{$AllowPatchFeature := .AllowPatchFeature}} +{{template "local-request-func-signature" .}} { + var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} + var metadata runtime.ServerMetadata +{{if .Body}} + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&{{.Body.AssignableExpr "protoReq"}}); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + {{- if and $AllowPatchFeature (and (eq (.HTTPMethod) "PATCH") (.FieldMaskField))}} + if protoReq.{{.FieldMaskField}} != nil && len(protoReq.{{.FieldMaskField}}.GetPaths()) > 0 { + runtime.CamelCaseFieldMask(protoReq.{{.FieldMaskField}}) + } {{if not (eq "*" .GetBodyFieldPath)}} else { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.{{.FieldMaskField}} = fieldMask + } + } {{end}} + {{end}} +{{end}} +{{if .PathParams}} + var ( + val string +{{- if .HasEnumPathParam}} + e int32 +{{- end}} +{{- if .HasRepeatedEnumPathParam}} + es []int32 +{{- end}} + ok bool + err error + _ = err + ) + {{$binding := .}} + {{range $param := .PathParams}} + {{$enum := $binding.LookupEnum $param}} + val, ok = pathParams[{{$param | printf "%q"}}] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", {{$param | printf "%q"}}) + } +{{if $param.IsNestedProto3}} + err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) +{{else if $enum}} + e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}_value) +{{else}} + {{$param.AssignableExpr "protoReq"}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}) +{{end}} + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) + } +{{if and $enum $param.IsRepeated}} + s := make([]{{$enum.GoType $param.Target.Message.File.GoPkg.Path}}, len(es)) + for i, v := range es { + s[i] = {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}(v) + } + {{$param.AssignableExpr "protoReq"}} = s +{{else if $enum}} + {{$param.AssignableExpr "protoReq"}} = {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}(e) +{{end}} + {{end}} +{{end}} +{{if .HasQueryParam}} + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } +{{end}} +{{if .Method.GetServerStreaming}} + // TODO +{{else}} + msg, err := server.{{.Method.GetName}}(ctx, &protoReq) + return msg, metadata, err +{{end}} +}`)) + + localTrailerTemplate = template.Must(template.New("local-trailer").Parse(` +{{$UseRequestContext := .UseRequestContext}} +{{range $svc := .Services}} +// {{$svc.GetName}} local server register +func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server) error { + {{range $m := $svc.Methods}} + {{range $b := $m.Bindings}} + mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + {{- if $UseRequestContext }} + ctx, cancel := context.WithCancel(req.Context()) + {{- else -}} + ctx, cancel := context.WithCancel(ctx) + {{- end }} + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + {{if $m.GetServerStreaming}} + // TODO + {{else}} + {{ if $b.ResponseBody }} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{resp}, mux.GetForwardResponseOptions()...) + {{ else }} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + {{end}} + {{end}} + }) + {{end}} + {{end}} + return nil +} +{{end}}`)) +) diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 291ba7deb2f..9717164ec00 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -19,7 +19,7 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/grpc-ecosystem/grpc-gateway/codegenerator" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway" + "github.com/hb-go/grpc-gateway/protoc-gen-grpc-gateway/gengateway" ) var ( From 9a7729dcfe510580ad7539b5c609dcbda3d523e9 Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Sat, 1 Jun 2019 08:00:53 +0800 Subject: [PATCH 439/552] put back the import path (cherry picked from commit 726a5605013cd835e46c0a5cbad012b41b20a124) --- protoc-gen-grpc-gateway/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 9717164ec00..291ba7deb2f 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -19,7 +19,7 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/grpc-ecosystem/grpc-gateway/codegenerator" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/hb-go/grpc-gateway/protoc-gen-grpc-gateway/gengateway" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway" ) var ( From 90eba2ae11a982dbd037adad81ab5c6c22d3e6e8 Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Mon, 17 Jun 2019 11:17:17 +0800 Subject: [PATCH 440/552] merge template to the same file (cherry picked from commit 3470c1c99549dbcb7630b2b7a8e156db8c38cc54) --- .../gengateway/template_local.go | 148 ------------------ 1 file changed, 148 deletions(-) delete mode 100644 protoc-gen-grpc-gateway/gengateway/template_local.go diff --git a/protoc-gen-grpc-gateway/gengateway/template_local.go b/protoc-gen-grpc-gateway/gengateway/template_local.go deleted file mode 100644 index ed6385242fe..00000000000 --- a/protoc-gen-grpc-gateway/gengateway/template_local.go +++ /dev/null @@ -1,148 +0,0 @@ -package gengateway - -import ( - "strings" - "text/template" -) - -var ( - localHandlerTemplate = template.Must(template.New("local-handler").Parse(` -{{if and .Method.GetClientStreaming .Method.GetServerStreaming}} -// TODO bidi-streaming-request -{{else if .Method.GetClientStreaming}} -// TODO client-streaming-request -{{else if .Method.GetServerStreaming}} -// TODO server-streaming-request -{{else}} -{{template "local-rpc-request-func" .}} -{{end}} -`)) - - _ = template.Must(localHandlerTemplate.New("local-request-func-signature").Parse(strings.Replace(` -{{if .Method.GetServerStreaming}} -// TODO -{{else}} -func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, marshaler runtime.Marshaler, server {{.Method.Service.GetName}}Server, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) -{{end}}`, "\n", "", -1))) - - _ = template.Must(localHandlerTemplate.New("local-rpc-request-func").Parse(` -{{$AllowPatchFeature := .AllowPatchFeature}} -{{template "local-request-func-signature" .}} { - var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} - var metadata runtime.ServerMetadata -{{if .Body}} - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&{{.Body.AssignableExpr "protoReq"}}); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - {{- if and $AllowPatchFeature (and (eq (.HTTPMethod) "PATCH") (.FieldMaskField))}} - if protoReq.{{.FieldMaskField}} != nil && len(protoReq.{{.FieldMaskField}}.GetPaths()) > 0 { - runtime.CamelCaseFieldMask(protoReq.{{.FieldMaskField}}) - } {{if not (eq "*" .GetBodyFieldPath)}} else { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } else { - protoReq.{{.FieldMaskField}} = fieldMask - } - } {{end}} - {{end}} -{{end}} -{{if .PathParams}} - var ( - val string -{{- if .HasEnumPathParam}} - e int32 -{{- end}} -{{- if .HasRepeatedEnumPathParam}} - es []int32 -{{- end}} - ok bool - err error - _ = err - ) - {{$binding := .}} - {{range $param := .PathParams}} - {{$enum := $binding.LookupEnum $param}} - val, ok = pathParams[{{$param | printf "%q"}}] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", {{$param | printf "%q"}}) - } -{{if $param.IsNestedProto3}} - err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) -{{else if $enum}} - e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}_value) -{{else}} - {{$param.AssignableExpr "protoReq"}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}) -{{end}} - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) - } -{{if and $enum $param.IsRepeated}} - s := make([]{{$enum.GoType $param.Target.Message.File.GoPkg.Path}}, len(es)) - for i, v := range es { - s[i] = {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}(v) - } - {{$param.AssignableExpr "protoReq"}} = s -{{else if $enum}} - {{$param.AssignableExpr "protoReq"}} = {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}(e) -{{end}} - {{end}} -{{end}} -{{if .HasQueryParam}} - if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } -{{end}} -{{if .Method.GetServerStreaming}} - // TODO -{{else}} - msg, err := server.{{.Method.GetName}}(ctx, &protoReq) - return msg, metadata, err -{{end}} -}`)) - - localTrailerTemplate = template.Must(template.New("local-trailer").Parse(` -{{$UseRequestContext := .UseRequestContext}} -{{range $svc := .Services}} -// {{$svc.GetName}} local server register -func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server) error { - {{range $m := $svc.Methods}} - {{range $b := $m.Bindings}} - mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - {{- if $UseRequestContext }} - ctx, cancel := context.WithCancel(req.Context()) - {{- else -}} - ctx, cancel := context.WithCancel(ctx) - {{- end }} - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - {{if $m.GetServerStreaming}} - // TODO - {{else}} - {{ if $b.ResponseBody }} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{resp}, mux.GetForwardResponseOptions()...) - {{ else }} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - {{end}} - {{end}} - }) - {{end}} - {{end}} - return nil -} -{{end}}`)) -) From 3b04e7c1eb00212ea6b637cfd9ff253e69d599ad Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Mon, 17 Jun 2019 11:17:55 +0800 Subject: [PATCH 441/552] regenerate `*.pb.gw.go` files (cherry picked from commit 6d795959b51aae2bc4b3c5cfa1319868df5dfcdb) --- .../examplepb/a_bit_of_everything.pb.gw.go | 2242 +++++++++++++---- .../proto/examplepb/echo_service.pb.gw.go | 396 +++ .../proto/examplepb/flow_combination.pb.gw.go | 1048 +++++++- .../examplepb/response_body_service.pb.gw.go | 147 ++ examples/proto/examplepb/stream.pb.gw.go | 72 + .../unannotated_echo_service.pb.gw.go | 189 ++ examples/proto/examplepb/wrappers.pb.gw.go | 413 +++ 7 files changed, 4022 insertions(+), 485 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index df3b7b394f4..b1c9fcd2923 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -277,490 +277,307 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run } -func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.CreateBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - 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 - var ( val string + e int32 ok bool err error _ = err ) - val, ok = pathParams["uuid"] + val, ok = pathParams["float_value"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "float_value") } - protoReq.Uuid, err = runtime.String(val) + protoReq.FloatValue, err = runtime.Float32(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "float_value", err) } - msg, err := client.Lookup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} + val, ok = pathParams["double_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "double_value") + } -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 + protoReq.DoubleValue, err = runtime.Float64(val) - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "double_value", err) } - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["uuid"] + val, ok = pathParams["int64_value"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int64_value") } - protoReq.Uuid, err = runtime.String(val) + protoReq.Int64Value, err = runtime.Int64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int64_value", err) } - msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -var ( - filter_ABitOfEverythingService_UpdateV2_0 = &utilities.DoubleArray{Encoding: map[string]int{"abe": 0, "uuid": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} -) + val, ok = pathParams["uint64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64_value") + } -func request_ABitOfEverythingService_UpdateV2_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateV2Request - var metadata runtime.ServerMetadata + protoReq.Uint64Value, err = runtime.Uint64(val) - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint64_value", err) } - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["abe.uuid"] + val, ok = pathParams["int32_value"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int32_value") } - err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) + protoReq.Int32Value, err = runtime.Int32(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int32_value", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateV2_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + val, ok = pathParams["fixed64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed64_value") } - msg, err := client.UpdateV2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err + protoReq.Fixed64Value, err = runtime.Uint64(val) -} + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fixed64_value", err) + } -var ( - filter_ABitOfEverythingService_UpdateV2_1 = &utilities.DoubleArray{Encoding: map[string]int{"abe": 0, "uuid": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} -) + val, ok = pathParams["fixed32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed32_value") + } -func request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateV2Request - var metadata runtime.ServerMetadata + protoReq.Fixed32Value, err = runtime.Uint32(val) - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { - runtime.CamelCaseFieldMask(protoReq.UpdateMask) - } else { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } else { - protoReq.UpdateMask = fieldMask - } + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fixed32_value", err) } - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["abe.uuid"] + val, ok = pathParams["bool_value"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bool_value") } - err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) + protoReq.BoolValue, err = runtime.Bool(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bool_value", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateV2_1); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + val, ok = pathParams["string_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") } - msg, err := client.UpdateV2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} + protoReq.StringValue, err = runtime.String(val) -func request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateV2Request - var metadata runtime.ServerMetadata + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) + } - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + val, ok = pathParams["uint32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32_value") } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + protoReq.Uint32Value, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint32_value", err) } - if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { - runtime.CamelCaseFieldMask(protoReq.UpdateMask) + + val, ok = pathParams["sfixed32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed32_value") } - var ( - val string - ok bool - err error - _ = err - ) + protoReq.Sfixed32Value, err = runtime.Int32(val) - val, ok = pathParams["abe.uuid"] + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sfixed32_value", err) + } + + val, ok = pathParams["sfixed64_value"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed64_value") } - err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) + protoReq.Sfixed64Value, err = runtime.Int64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sfixed64_value", err) } - msg, err := client.PatchWithFieldMaskInBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} + val, ok = pathParams["sint32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sint32_value") + } -func request_ABitOfEverythingService_Delete_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 + protoReq.Sint32Value, err = runtime.Int32(val) - var ( - val string - ok bool - err error - _ = err - ) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sint32_value", err) + } - val, ok = pathParams["uuid"] + val, ok = pathParams["sint64_value"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sint64_value") } - protoReq.Uuid, err = runtime.String(val) + protoReq.Sint64Value, err = runtime.Int64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sint64_value", err) } - msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err + val, ok = pathParams["nonConventionalNameValue"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonConventionalNameValue") + } -} - -var ( - filter_ABitOfEverythingService_GetQuery_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) - -func request_ABitOfEverythingService_GetQuery_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 - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["uuid"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") - } - - protoReq.Uuid, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_GetQuery_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GetQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func request_ABitOfEverythingService_GetRepeatedQuery_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ABitOfEverythingRepeated - var metadata runtime.ServerMetadata - - var ( - val string - es []int32 - ok bool - err error - _ = err - ) - - val, ok = pathParams["path_repeated_float_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_float_value") - } - - protoReq.PathRepeatedFloatValue, err = runtime.Float32Slice(val, ",") - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_float_value", err) - } - - val, ok = pathParams["path_repeated_double_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_double_value") - } - - protoReq.PathRepeatedDoubleValue, err = runtime.Float64Slice(val, ",") + protoReq.NonConventionalNameValue, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_double_value", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonConventionalNameValue", err) } - val, ok = pathParams["path_repeated_int64_value"] + val, ok = pathParams["enum_value"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_int64_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "enum_value") } - protoReq.PathRepeatedInt64Value, err = runtime.Int64Slice(val, ",") + e, err = runtime.Enum(val, NumericEnum_value) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_int64_value", err) - } - - val, ok = pathParams["path_repeated_uint64_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_uint64_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "enum_value", err) } - protoReq.PathRepeatedUint64Value, err = runtime.Uint64Slice(val, ",") - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_uint64_value", err) - } + protoReq.EnumValue = NumericEnum(e) - val, ok = pathParams["path_repeated_int32_value"] + val, ok = pathParams["path_enum_value"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_int32_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_enum_value") } - protoReq.PathRepeatedInt32Value, err = runtime.Int32Slice(val, ",") + e, err = runtime.Enum(val, pathenum.PathEnum_value) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_int32_value", err) - } - - val, ok = pathParams["path_repeated_fixed64_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_fixed64_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_enum_value", err) } - protoReq.PathRepeatedFixed64Value, err = runtime.Uint64Slice(val, ",") - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_fixed64_value", err) - } + protoReq.PathEnumValue = pathenum.PathEnum(e) - val, ok = pathParams["path_repeated_fixed32_value"] + val, ok = pathParams["nested_path_enum_value"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_fixed32_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nested_path_enum_value") } - protoReq.PathRepeatedFixed32Value, err = runtime.Uint32Slice(val, ",") + e, err = runtime.Enum(val, pathenum.MessagePathEnum_NestedPathEnum_value) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_fixed32_value", err) - } - - val, ok = pathParams["path_repeated_bool_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_bool_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nested_path_enum_value", err) } - protoReq.PathRepeatedBoolValue, err = runtime.BoolSlice(val, ",") - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_bool_value", err) - } + protoReq.NestedPathEnumValue = pathenum.MessagePathEnum_NestedPathEnum(e) - val, ok = pathParams["path_repeated_string_value"] + val, ok = pathParams["enum_value_annotation"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_string_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "enum_value_annotation") } - protoReq.PathRepeatedStringValue, err = runtime.StringSlice(val, ",") + e, err = runtime.Enum(val, NumericEnum_value) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_string_value", err) - } - - val, ok = pathParams["path_repeated_bytes_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_bytes_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "enum_value_annotation", err) } - protoReq.PathRepeatedBytesValue, err = runtime.BytesSlice(val, ",") + protoReq.EnumValueAnnotation = NumericEnum(e) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_bytes_value", err) + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Create_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - val, ok = pathParams["path_repeated_uint32_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_uint32_value") - } + msg, err := server.Create(ctx, &protoReq) + return msg, metadata, err - protoReq.PathRepeatedUint32Value, err = runtime.Uint32Slice(val, ",") +} - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_uint32_value", err) - } +func request_ABitOfEverythingService_CreateBody_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 - val, ok = pathParams["path_repeated_enum_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_enum_value") + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - - es, err = runtime.EnumSlice(val, ",", NumericEnum_value) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_enum_value", err) + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - s := make([]NumericEnum, len(es)) - for i, v := range es { - s[i] = NumericEnum(v) - } - protoReq.PathRepeatedEnumValue = s + msg, err := client.CreateBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err - val, ok = pathParams["path_repeated_sfixed32_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sfixed32_value") - } +} - protoReq.PathRepeatedSfixed32Value, err = runtime.Int32Slice(val, ",") +func local_request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sfixed32_value", err) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - - val, ok = pathParams["path_repeated_sfixed64_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sfixed64_value") + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - protoReq.PathRepeatedSfixed64Value, err = runtime.Int64Slice(val, ",") - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sfixed64_value", err) - } + msg, err := server.CreateBody(ctx, &protoReq) + return msg, metadata, err - val, ok = pathParams["path_repeated_sint32_value"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sint32_value") - } +} - protoReq.PathRepeatedSint32Value, err = runtime.Int32Slice(val, ",") +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 - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sint32_value", err) - } + var ( + val string + ok bool + err error + _ = err + ) - val, ok = pathParams["path_repeated_sint64_value"] + val, ok = pathParams["uuid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sint64_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } - protoReq.PathRepeatedSint64Value, err = runtime.Int64Slice(val, ",") + protoReq.Uuid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sint64_value", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } - msg, err := client.GetRepeatedQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.Lookup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq sub.StringMessage +func local_request_ABitOfEverythingService_Lookup_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub2.IdMessage var metadata runtime.ServerMetadata var ( @@ -770,60 +587,58 @@ func request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["value"] + val, ok = pathParams["uuid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } - protoReq.Value, err = runtime.StringP(val) + protoReq.Uuid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } - msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := server.Lookup(ctx, &protoReq) return msg, metadata, err } -func request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq sub.StringMessage +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 newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Value); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} + var ( + val string + ok bool + err error + _ = err + ) -var ( - filter_ABitOfEverythingService_Echo_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) + val, ok = pathParams["uuid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + } -func request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq sub.StringMessage - var metadata runtime.ServerMetadata + protoReq.Uuid, err = runtime.String(val) - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Echo_2); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } - msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -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) { +func local_request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata @@ -842,49 +657,77 @@ func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshal _ = err ) - val, ok = pathParams["single_nested.name"] + val, ok = pathParams["uuid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") } - err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) + protoReq.Uuid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) } - msg, err := client.DeepPathEcho(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := server.Update(ctx, &protoReq) return msg, metadata, err } -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 empty.Empty +var ( + filter_ABitOfEverythingService_UpdateV2_0 = &utilities.DoubleArray{Encoding: map[string]int{"abe": 0, "uuid": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} +) + +func request_ABitOfEverythingService_UpdateV2_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateV2Request var metadata runtime.ServerMetadata - msg, err := client.Timeout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } -} + var ( + val string + ok bool + err error + _ = err + ) -func request_ABitOfEverythingService_ErrorWithDetails_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty - var metadata runtime.ServerMetadata + val, ok = pathParams["abe.uuid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") + } - msg, err := client.ErrorWithDetails(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateV2_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateV2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MessageWithBody +func local_request_ABitOfEverythingService_UpdateV2_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateV2Request var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Data); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -895,33 +738,50 @@ func request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, m _ = err ) - val, ok = pathParams["id"] + val, ok = pathParams["abe.uuid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") } - protoReq.Id, err = runtime.String(val) + err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } - msg, err := client.GetMessageWithBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_UpdateV2_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateV2(ctx, &protoReq) return msg, metadata, err } -func request_ABitOfEverythingService_PostWithEmptyBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq Body +var ( + filter_ABitOfEverythingService_UpdateV2_1 = &utilities.DoubleArray{Encoding: map[string]int{"abe": 0, "uuid": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} +) + +func request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateV2Request var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } + if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { + runtime.CamelCaseFieldMask(protoReq.UpdateMask) + } else { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } var ( val string @@ -930,30 +790,50 @@ func request_ABitOfEverythingService_PostWithEmptyBody_0(ctx context.Context, ma _ = err ) - val, ok = pathParams["name"] + val, ok = pathParams["abe.uuid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") } - protoReq.Name, err = runtime.String(val) + err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } - msg, err := client.PostWithEmptyBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_UpdateV2_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateV2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -var ( - filter_ABitOfEverythingService_CheckGetQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "name": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} -) - -func request_ABitOfEverythingService_CheckGetQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ABitOfEverything +func local_request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateV2Request var metadata runtime.ServerMetadata + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { + runtime.CamelCaseFieldMask(protoReq.UpdateMask) + } else { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + var ( val string ok bool @@ -961,44 +841,40 @@ func request_ABitOfEverythingService_CheckGetQueryParams_0(ctx context.Context, _ = err ) - val, ok = pathParams["single_nested.name"] + val, ok = pathParams["abe.uuid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") } - err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) + err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckGetQueryParams_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_UpdateV2_1); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.CheckGetQueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := server.UpdateV2(ctx, &protoReq) return msg, metadata, err } -var ( - filter_ABitOfEverythingService_CheckPostQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "string_value": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} -) - -func request_ABitOfEverythingService_CheckPostQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ABitOfEverything +func request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateV2Request var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.SingleNested); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } + if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { + runtime.CamelCaseFieldMask(protoReq.UpdateMask) + } var ( val string @@ -1007,38 +883,1552 @@ func request_ABitOfEverythingService_CheckPostQueryParams_0(ctx context.Context, _ = err ) - val, ok = pathParams["string_value"] + val, ok = pathParams["abe.uuid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") } - protoReq.StringValue, err = runtime.String(val) + err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + msg, err := client.PatchWithFieldMaskInBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateV2Request + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckPostQueryParams_0); err != nil { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } + if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { + runtime.CamelCaseFieldMask(protoReq.UpdateMask) + } - msg, err := client.CheckPostQueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["abe.uuid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "abe.uuid") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "abe.uuid", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) + } + + msg, err := server.PatchWithFieldMaskInBody(ctx, &protoReq) return msg, metadata, err } -func request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler runtime.Marshaler, client CamelCaseServiceNameClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty +func request_ABitOfEverythingService_Delete_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 - msg, err := client.Empty(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uuid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + } + + protoReq.Uuid, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) + } + + msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } +func local_request_ABitOfEverythingService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub2.IdMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uuid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + } + + protoReq.Uuid, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) + } + + msg, err := server.Delete(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_ABitOfEverythingService_GetQuery_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_ABitOfEverythingService_GetQuery_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 + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uuid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + } + + protoReq.Uuid, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_GetQuery_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_GetQuery_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uuid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + } + + protoReq.Uuid, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uuid", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_GetQuery_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetQuery(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_GetRepeatedQuery_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverythingRepeated + var metadata runtime.ServerMetadata + + var ( + val string + es []int32 + ok bool + err error + _ = err + ) + + val, ok = pathParams["path_repeated_float_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_float_value") + } + + protoReq.PathRepeatedFloatValue, err = runtime.Float32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_float_value", err) + } + + val, ok = pathParams["path_repeated_double_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_double_value") + } + + protoReq.PathRepeatedDoubleValue, err = runtime.Float64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_double_value", err) + } + + val, ok = pathParams["path_repeated_int64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_int64_value") + } + + protoReq.PathRepeatedInt64Value, err = runtime.Int64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_int64_value", err) + } + + val, ok = pathParams["path_repeated_uint64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_uint64_value") + } + + protoReq.PathRepeatedUint64Value, err = runtime.Uint64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_uint64_value", err) + } + + val, ok = pathParams["path_repeated_int32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_int32_value") + } + + protoReq.PathRepeatedInt32Value, err = runtime.Int32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_int32_value", err) + } + + val, ok = pathParams["path_repeated_fixed64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_fixed64_value") + } + + protoReq.PathRepeatedFixed64Value, err = runtime.Uint64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_fixed64_value", err) + } + + val, ok = pathParams["path_repeated_fixed32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_fixed32_value") + } + + protoReq.PathRepeatedFixed32Value, err = runtime.Uint32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_fixed32_value", err) + } + + val, ok = pathParams["path_repeated_bool_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_bool_value") + } + + protoReq.PathRepeatedBoolValue, err = runtime.BoolSlice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_bool_value", err) + } + + val, ok = pathParams["path_repeated_string_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_string_value") + } + + protoReq.PathRepeatedStringValue, err = runtime.StringSlice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_string_value", err) + } + + val, ok = pathParams["path_repeated_bytes_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_bytes_value") + } + + protoReq.PathRepeatedBytesValue, err = runtime.BytesSlice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_bytes_value", err) + } + + val, ok = pathParams["path_repeated_uint32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_uint32_value") + } + + protoReq.PathRepeatedUint32Value, err = runtime.Uint32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_uint32_value", err) + } + + val, ok = pathParams["path_repeated_enum_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_enum_value") + } + + es, err = runtime.EnumSlice(val, ",", NumericEnum_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_enum_value", err) + } + + s := make([]NumericEnum, len(es)) + for i, v := range es { + s[i] = NumericEnum(v) + } + protoReq.PathRepeatedEnumValue = s + + val, ok = pathParams["path_repeated_sfixed32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sfixed32_value") + } + + protoReq.PathRepeatedSfixed32Value, err = runtime.Int32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sfixed32_value", err) + } + + val, ok = pathParams["path_repeated_sfixed64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sfixed64_value") + } + + protoReq.PathRepeatedSfixed64Value, err = runtime.Int64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sfixed64_value", err) + } + + val, ok = pathParams["path_repeated_sint32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sint32_value") + } + + protoReq.PathRepeatedSint32Value, err = runtime.Int32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sint32_value", err) + } + + val, ok = pathParams["path_repeated_sint64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sint64_value") + } + + protoReq.PathRepeatedSint64Value, err = runtime.Int64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sint64_value", err) + } + + msg, err := client.GetRepeatedQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_GetRepeatedQuery_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverythingRepeated + var metadata runtime.ServerMetadata + + var ( + val string + es []int32 + ok bool + err error + _ = err + ) + + val, ok = pathParams["path_repeated_float_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_float_value") + } + + protoReq.PathRepeatedFloatValue, err = runtime.Float32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_float_value", err) + } + + val, ok = pathParams["path_repeated_double_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_double_value") + } + + protoReq.PathRepeatedDoubleValue, err = runtime.Float64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_double_value", err) + } + + val, ok = pathParams["path_repeated_int64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_int64_value") + } + + protoReq.PathRepeatedInt64Value, err = runtime.Int64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_int64_value", err) + } + + val, ok = pathParams["path_repeated_uint64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_uint64_value") + } + + protoReq.PathRepeatedUint64Value, err = runtime.Uint64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_uint64_value", err) + } + + val, ok = pathParams["path_repeated_int32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_int32_value") + } + + protoReq.PathRepeatedInt32Value, err = runtime.Int32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_int32_value", err) + } + + val, ok = pathParams["path_repeated_fixed64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_fixed64_value") + } + + protoReq.PathRepeatedFixed64Value, err = runtime.Uint64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_fixed64_value", err) + } + + val, ok = pathParams["path_repeated_fixed32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_fixed32_value") + } + + protoReq.PathRepeatedFixed32Value, err = runtime.Uint32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_fixed32_value", err) + } + + val, ok = pathParams["path_repeated_bool_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_bool_value") + } + + protoReq.PathRepeatedBoolValue, err = runtime.BoolSlice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_bool_value", err) + } + + val, ok = pathParams["path_repeated_string_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_string_value") + } + + protoReq.PathRepeatedStringValue, err = runtime.StringSlice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_string_value", err) + } + + val, ok = pathParams["path_repeated_bytes_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_bytes_value") + } + + protoReq.PathRepeatedBytesValue, err = runtime.BytesSlice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_bytes_value", err) + } + + val, ok = pathParams["path_repeated_uint32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_uint32_value") + } + + protoReq.PathRepeatedUint32Value, err = runtime.Uint32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_uint32_value", err) + } + + val, ok = pathParams["path_repeated_enum_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_enum_value") + } + + es, err = runtime.EnumSlice(val, ",", NumericEnum_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_enum_value", err) + } + + s := make([]NumericEnum, len(es)) + for i, v := range es { + s[i] = NumericEnum(v) + } + protoReq.PathRepeatedEnumValue = s + + val, ok = pathParams["path_repeated_sfixed32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sfixed32_value") + } + + protoReq.PathRepeatedSfixed32Value, err = runtime.Int32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sfixed32_value", err) + } + + val, ok = pathParams["path_repeated_sfixed64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sfixed64_value") + } + + protoReq.PathRepeatedSfixed64Value, err = runtime.Int64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sfixed64_value", err) + } + + val, ok = pathParams["path_repeated_sint32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sint32_value") + } + + protoReq.PathRepeatedSint32Value, err = runtime.Int32Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sint32_value", err) + } + + val, ok = pathParams["path_repeated_sint64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_repeated_sint64_value") + } + + protoReq.PathRepeatedSint64Value, err = runtime.Int64Slice(val, ",") + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path_repeated_sint64_value", err) + } + + msg, err := server.GetRepeatedQuery(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub.StringMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value") + } + + protoReq.Value, err = runtime.StringP(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err) + } + + msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub.StringMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value") + } + + protoReq.Value, err = runtime.StringP(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err) + } + + msg, err := server.Echo(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub.StringMessage + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Value); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub.StringMessage + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Value); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Echo(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_ABitOfEverythingService_Echo_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub.StringMessage + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_Echo_2); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub.StringMessage + var metadata runtime.ServerMetadata + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Echo_2); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Echo(ctx, &protoReq) + return msg, metadata, err + +} + +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 + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["single_nested.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) + } + + msg, err := client.DeepPathEcho(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["single_nested.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) + } + + msg, err := server.DeepPathEcho(ctx, &protoReq) + return msg, metadata, err + +} + +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 empty.Empty + var metadata runtime.ServerMetadata + + msg, err := client.Timeout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_Timeout_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + msg, err := server.Timeout(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_ErrorWithDetails_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + msg, err := client.ErrorWithDetails(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_ErrorWithDetails_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + msg, err := server.ErrorWithDetails(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MessageWithBody + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Data); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.GetMessageWithBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_GetMessageWithBody_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MessageWithBody + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Data); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.GetMessageWithBody(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_PostWithEmptyBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Body + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.PostWithEmptyBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_PostWithEmptyBody_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Body + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.PostWithEmptyBody(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_ABitOfEverythingService_CheckGetQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "name": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} +) + +func request_ABitOfEverythingService_CheckGetQueryParams_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 + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["single_nested.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckGetQueryParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CheckGetQueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_CheckGetQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["single_nested.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.name", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_CheckGetQueryParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CheckGetQueryParams(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_ABitOfEverythingService_CheckPostQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "string_value": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_ABitOfEverythingService_CheckPostQueryParams_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 + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.SingleNested); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["string_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") + } + + protoReq.StringValue, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckPostQueryParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CheckPostQueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_CheckPostQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.SingleNested); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["string_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") + } + + protoReq.StringValue, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_CheckPostQueryParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CheckPostQueryParams(ctx, &protoReq) + return msg, metadata, err + +} + +func request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler runtime.Marshaler, client CamelCaseServiceNameClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + msg, err := client.Empty(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler runtime.Marshaler, server CamelCaseServiceNameServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + msg, err := server.Empty(ctx, &protoReq) + return msg, metadata, err + +} + +// ABitOfEverythingService local server register +func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ABitOfEverythingServiceServer) error { + + mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_Create_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Create_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_CreateBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_CreateBody_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_CreateBody_0(ctx, mux, 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(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_Lookup_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Lookup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_ABitOfEverythingService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_Update_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Update_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_ABitOfEverythingService_UpdateV2_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_UpdateV2_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_UpdateV2_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_ABitOfEverythingService_UpdateV2_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_UpdateV2_1(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_UpdateV2_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_ABitOfEverythingService_PatchWithFieldMaskInBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_ABitOfEverythingService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_Delete_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Delete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_GetQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_GetQuery_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_GetQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_GetRepeatedQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_GetRepeatedQuery_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_GetRepeatedQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_Echo_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Echo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_Echo_1(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Echo_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_Echo_2(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Echo_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_DeepPathEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_DeepPathEcho_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_DeepPathEcho_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_Timeout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_Timeout_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Timeout_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_ErrorWithDetails_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_ErrorWithDetails_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_ErrorWithDetails_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_GetMessageWithBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_GetMessageWithBody_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_GetMessageWithBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_PostWithEmptyBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_PostWithEmptyBody_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_PostWithEmptyBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_CheckGetQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_CheckGetQueryParams_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_CheckGetQueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_CheckPostQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_CheckPostQueryParams_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_CheckPostQueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// CamelCaseServiceName local server register +func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CamelCaseServiceNameServer) error { + + mux.Handle("GET", pattern_CamelCaseServiceName_Empty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_CamelCaseServiceName_Empty_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CamelCaseServiceName_Empty_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + // RegisterABitOfEverythingServiceHandlerFromEndpoint is same as RegisterABitOfEverythingServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index 1ceb1894a2e..a9ef0451e5f 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -66,6 +66,37 @@ func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler } +func local_request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SimpleMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Echo(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_EchoService_Echo_1 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "num": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) @@ -115,6 +146,48 @@ func request_EchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler } +func local_request_EchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SimpleMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + val, ok = pathParams["num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") + } + + protoReq.Num, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Echo(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_EchoService_Echo_2 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "num": 1, "lang": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}} ) @@ -180,6 +253,64 @@ func request_EchoService_Echo_2(ctx context.Context, marshaler runtime.Marshaler } +func local_request_EchoService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SimpleMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + val, ok = pathParams["num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") + } + + protoReq.Num, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) + } + + val, ok = pathParams["lang"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lang") + } + + if protoReq.Code == nil { + protoReq.Code = &SimpleMessage_Lang{} + } else if _, ok := protoReq.Code.(*SimpleMessage_Lang); !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_Lang, but: %t\n", protoReq.Code) + } + protoReq.Code.(*SimpleMessage_Lang).Lang, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lang", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_2); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Echo(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_EchoService_Echo_3 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "line_num": 1, "status": 2, "note": 3}, Base: []int{1, 1, 2, 1, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 4, 2, 3, 5}} ) @@ -245,6 +376,64 @@ func request_EchoService_Echo_3(ctx context.Context, marshaler runtime.Marshaler } +func local_request_EchoService_Echo_3(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SimpleMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + val, ok = pathParams["line_num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "line_num") + } + + if protoReq.Code == nil { + protoReq.Code = &SimpleMessage_LineNum{} + } else if _, ok := protoReq.Code.(*SimpleMessage_LineNum); !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_LineNum, but: %t\n", protoReq.Code) + } + protoReq.Code.(*SimpleMessage_LineNum).LineNum, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "line_num", err) + } + + val, ok = pathParams["status.note"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status.note") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "status.note", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status.note", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_3); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Echo(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_EchoService_Echo_4 = &utilities.DoubleArray{Encoding: map[string]int{"no": 0, "note": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) @@ -283,6 +472,37 @@ func request_EchoService_Echo_4(ctx context.Context, marshaler runtime.Marshaler } +func local_request_EchoService_Echo_4(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SimpleMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["no.note"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "no.note") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "no.note", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "no.note", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_Echo_4); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Echo(ctx, &protoReq) + return msg, metadata, err + +} + func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata @@ -300,6 +520,23 @@ func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marsh } +func local_request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SimpleMessage + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EchoBody(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_EchoService_EchoDelete_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -320,6 +557,165 @@ func request_EchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Mar } +func local_request_EchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SimpleMessage + var metadata runtime.ServerMetadata + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_EchoService_EchoDelete_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EchoDelete(ctx, &protoReq) + return msg, metadata, err + +} + +// EchoService local server register +func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error { + + mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_EchoService_Echo_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_EchoService_Echo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_EchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_EchoService_Echo_1(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_EchoService_Echo_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_EchoService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_EchoService_Echo_2(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_EchoService_Echo_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_EchoService_Echo_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_EchoService_Echo_3(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_EchoService_Echo_3(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_EchoService_Echo_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_EchoService_Echo_4(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_EchoService_Echo_4(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_EchoService_EchoBody_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_EchoService_EchoBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_EchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_EchoService_EchoDelete_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_EchoService_EchoDelete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + // RegisterEchoServiceHandlerFromEndpoint is same as RegisterEchoServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index b29a6f3bbf9..dfce88514f2 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -37,6 +37,15 @@ func request_FlowCombination_RpcEmptyRpc_0(ctx context.Context, marshaler runtim } +func local_request_FlowCombination_RpcEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EmptyProto + var metadata runtime.ServerMetadata + + msg, err := server.RpcEmptyRpc(ctx, &protoReq) + return msg, metadata, err + +} + func request_FlowCombination_RpcEmptyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcEmptyStreamClient, runtime.ServerMetadata, error) { var protoReq EmptyProto var metadata runtime.ServerMetadata @@ -54,6 +63,8 @@ func request_FlowCombination_RpcEmptyStream_0(ctx context.Context, marshaler run } +// TODO server-streaming-request + func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var metadata runtime.ServerMetadata stream, err := client.StreamEmptyRpc(ctx) @@ -98,6 +109,8 @@ func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler run } +// TODO client-streaming-request + func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_StreamEmptyStreamClient, runtime.ServerMetadata, error) { var metadata runtime.ServerMetadata stream, err := client.StreamEmptyStream(ctx) @@ -150,6 +163,8 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler return stream, metadata, nil } +// TODO bidi-streaming-request + func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -167,6 +182,23 @@ func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime } +func local_request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RpcBodyRpc(ctx, &protoReq) + return msg, metadata, err + +} + func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -216,6 +248,55 @@ func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime } +func local_request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) + } + + val, ok = pathParams["b"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + } + + protoReq.B, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) + } + + val, ok = pathParams["c"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "c") + } + + protoReq.C, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "c", err) + } + + msg, err := server.RpcBodyRpc(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_FlowCombination_RpcBodyRpc_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -236,6 +317,19 @@ func request_FlowCombination_RpcBodyRpc_2(ctx context.Context, marshaler runtime } +func local_request_FlowCombination_RpcBodyRpc_2(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_2); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RpcBodyRpc(ctx, &protoReq) + return msg, metadata, err + +} + func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -282,6 +376,52 @@ func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime } +func local_request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) + } + + val, ok = pathParams["b"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + } + + protoReq.B, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) + } + + msg, err := server.RpcBodyRpc(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_FlowCombination_RpcBodyRpc_4 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -310,6 +450,27 @@ func request_FlowCombination_RpcBodyRpc_4(ctx context.Context, marshaler runtime } +func local_request_FlowCombination_RpcBodyRpc_4(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_4); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RpcBodyRpc(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_FlowCombination_RpcBodyRpc_5 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) @@ -356,6 +517,45 @@ func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime } +func local_request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_5); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RpcBodyRpc(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_FlowCombination_RpcBodyRpc_6 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -394,12 +594,8 @@ func request_FlowCombination_RpcBodyRpc_6(ctx context.Context, marshaler runtime } -var ( - filter_FlowCombination_RpcPathSingleNestedRpc_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} -) - -func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq SingleNestedProto +func local_request_FlowCombination_RpcBodyRpc_6(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto var metadata runtime.ServerMetadata var ( @@ -409,45 +605,34 @@ func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marsh _ = err ) - val, ok = pathParams["a.str"] + val, ok = pathParams["a"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") } - err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + protoReq.A, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_6); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.RpcPathSingleNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := server.RpcBodyRpc(ctx, &protoReq) return msg, metadata, err } var ( - filter_FlowCombination_RpcPathNestedRpc_0 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2, "b": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 3, 1, 2, 4, 5}} + filter_FlowCombination_RpcPathSingleNestedRpc_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) -func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq NestedProto +func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SingleNestedProto var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - var ( val string ok bool @@ -466,35 +651,20 @@ func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } - val, ok = pathParams["b"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") - } - - protoReq.B, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) - } - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.RpcPathSingleNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -var ( - filter_FlowCombination_RpcPathNestedRpc_1 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} -) - -func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq NestedProto +func local_request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SingleNestedProto var metadata runtime.ServerMetadata var ( @@ -515,23 +685,20 @@ func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_1); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := server.RpcPathSingleNestedRpc(ctx, &protoReq) return msg, metadata, err } var ( - filter_FlowCombination_RpcPathNestedRpc_2 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 3, 2, 4}} + filter_FlowCombination_RpcPathNestedRpc_0 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2, "b": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 3, 1, 2, 4, 5}} ) -func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NestedProto var metadata runtime.ServerMetadata @@ -561,15 +728,230 @@ func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_2); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + val, ok = pathParams["b"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") } - msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err + protoReq.B, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) + } + + val, ok = pathParams["b"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + } + + protoReq.B, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "b", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RpcPathNestedRpc(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_FlowCombination_RpcPathNestedRpc_1 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} +) + +func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RpcPathNestedRpc(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_FlowCombination_RpcPathNestedRpc_2 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 3, 2, 4}} +) + +func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_FlowCombination_RpcPathNestedRpc_2); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler runtime.Marshaler, server FlowCombinationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.C); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a.str", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_2); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RpcPathNestedRpc(ctx, &protoReq) + return msg, metadata, err } @@ -598,6 +980,8 @@ func request_FlowCombination_RpcBodyStream_0(ctx context.Context, marshaler runt } +// TODO server-streaming-request + func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -655,6 +1039,8 @@ func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runt } +// TODO server-streaming-request + var ( filter_FlowCombination_RpcBodyStream_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -683,6 +1069,8 @@ func request_FlowCombination_RpcBodyStream_2(ctx context.Context, marshaler runt } +// TODO server-streaming-request + func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -737,6 +1125,8 @@ func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runt } +// TODO server-streaming-request + var ( filter_FlowCombination_RpcBodyStream_4 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -773,6 +1163,8 @@ func request_FlowCombination_RpcBodyStream_4(ctx context.Context, marshaler runt } +// TODO server-streaming-request + var ( filter_FlowCombination_RpcBodyStream_5 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) @@ -827,6 +1219,8 @@ func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runt } +// TODO server-streaming-request + var ( filter_FlowCombination_RpcBodyStream_6 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -873,6 +1267,8 @@ func request_FlowCombination_RpcBodyStream_6(ctx context.Context, marshaler runt } +// TODO server-streaming-request + var ( filter_FlowCombination_RpcPathSingleNestedStream_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) @@ -919,6 +1315,8 @@ func request_FlowCombination_RpcPathSingleNestedStream_0(ctx context.Context, ma } +// TODO server-streaming-request + var ( filter_FlowCombination_RpcPathNestedStream_0 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2, "b": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 3, 1, 2, 4, 5}} ) @@ -984,6 +1382,8 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale } +// TODO server-streaming-request + var ( filter_FlowCombination_RpcPathNestedStream_1 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) @@ -1030,6 +1430,8 @@ func request_FlowCombination_RpcPathNestedStream_1(ctx context.Context, marshale } +// TODO server-streaming-request + var ( filter_FlowCombination_RpcPathNestedStream_2 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 3, 2, 4}} ) @@ -1084,6 +1486,534 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale } +// TODO server-streaming-request + +// FlowCombination local server register +func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer) error { + + mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcEmptyRpc_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcEmptyRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcEmptyStream_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_StreamEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_StreamEmptyRpc_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_StreamEmptyRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_StreamEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_StreamEmptyStream_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyRpc_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyRpc_1(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyRpc_2(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyRpc_3(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_3(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyRpc_4(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_4(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyRpc_5(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_5(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyRpc_6(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_6(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcPathSingleNestedRpc_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathSingleNestedRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcPathNestedRpc_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathNestedRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcPathNestedRpc_1(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathNestedRpc_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcPathNestedRpc_2(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathNestedRpc_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyStream_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyStream_1(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyStream_2(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyStream_3(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyStream_4(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyStream_5(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcBodyStream_6(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcPathSingleNestedStream_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcPathNestedStream_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcPathNestedStream_1(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_FlowCombination_RpcPathNestedStream_2(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + return nil +} + // RegisterFlowCombinationHandlerFromEndpoint is same as RegisterFlowCombinationHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterFlowCombinationHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index 7de38ce36af..360d9b204c3 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -55,6 +55,33 @@ func request_ResponseBodyService_GetResponseBody_0(ctx context.Context, marshale } +func local_request_ResponseBodyService_GetResponseBody_0(ctx context.Context, marshaler runtime.Marshaler, server ResponseBodyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ResponseBodyIn + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["data"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") + } + + protoReq.Data, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) + } + + msg, err := server.GetResponseBody(ctx, &protoReq) + return msg, metadata, err + +} + func request_ResponseBodyService_ListResponseBodies_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ResponseBodyIn var metadata runtime.ServerMetadata @@ -82,6 +109,33 @@ func request_ResponseBodyService_ListResponseBodies_0(ctx context.Context, marsh } +func local_request_ResponseBodyService_ListResponseBodies_0(ctx context.Context, marshaler runtime.Marshaler, server ResponseBodyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ResponseBodyIn + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["data"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") + } + + protoReq.Data, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) + } + + msg, err := server.ListResponseBodies(ctx, &protoReq) + return msg, metadata, err + +} + func request_ResponseBodyService_ListResponseStrings_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ResponseBodyIn var metadata runtime.ServerMetadata @@ -109,6 +163,99 @@ func request_ResponseBodyService_ListResponseStrings_0(ctx context.Context, mars } +func local_request_ResponseBodyService_ListResponseStrings_0(ctx context.Context, marshaler runtime.Marshaler, server ResponseBodyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ResponseBodyIn + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["data"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") + } + + protoReq.Data, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) + } + + msg, err := server.ListResponseStrings(ctx, &protoReq) + return msg, metadata, err + +} + +// ResponseBodyService local server register +func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResponseBodyServiceServer) error { + + mux.Handle("GET", pattern_ResponseBodyService_GetResponseBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ResponseBodyService_GetResponseBody_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ResponseBodyService_GetResponseBody_0(ctx, mux, outboundMarshaler, w, req, response_ResponseBodyService_GetResponseBody_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ResponseBodyService_ListResponseBodies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ResponseBodyService_ListResponseBodies_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ResponseBodyService_ListResponseBodies_0(ctx, mux, outboundMarshaler, w, req, response_ResponseBodyService_ListResponseBodies_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ResponseBodyService_ListResponseStrings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ResponseBodyService_ListResponseStrings_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ResponseBodyService_ListResponseStrings_0(ctx, mux, outboundMarshaler, w, req, response_ResponseBodyService_ListResponseStrings_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + // RegisterResponseBodyServiceHandlerFromEndpoint is same as RegisterResponseBodyServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterResponseBodyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index ec7cb9217b6..4157d741a18 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -74,6 +74,8 @@ func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.M } +// TODO client-streaming-request + 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 empty.Empty var metadata runtime.ServerMetadata @@ -91,6 +93,8 @@ func request_StreamService_List_0(ctx context.Context, marshaler runtime.Marshal } +// TODO server-streaming-request + 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) @@ -143,6 +147,74 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar return stream, metadata, nil } +// TODO bidi-streaming-request + +// StreamService local server register +func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer) error { + + mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_StreamService_BulkCreate_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_StreamService_BulkCreate_0(ctx, mux, 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(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_StreamService_List_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_StreamService_BulkEcho_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + // TODO + + }) + + return 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) { diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index 721b18ba6e2..09f91ca367e 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -66,6 +66,37 @@ func request_UnannotatedEchoService_Echo_0(ctx context.Context, marshaler runtim } +func local_request_UnannotatedEchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UnannotatedSimpleMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_UnannotatedEchoService_Echo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Echo(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_UnannotatedEchoService_Echo_1 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "num": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) @@ -115,6 +146,48 @@ func request_UnannotatedEchoService_Echo_1(ctx context.Context, marshaler runtim } +func local_request_UnannotatedEchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, server UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UnannotatedSimpleMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + val, ok = pathParams["num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num") + } + + protoReq.Num, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_UnannotatedEchoService_Echo_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Echo(ctx, &protoReq) + return msg, metadata, err + +} + func request_UnannotatedEchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client UnannotatedEchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UnannotatedSimpleMessage var metadata runtime.ServerMetadata @@ -132,6 +205,23 @@ func request_UnannotatedEchoService_EchoBody_0(ctx context.Context, marshaler ru } +func local_request_UnannotatedEchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, server UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UnannotatedSimpleMessage + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EchoBody(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_UnannotatedEchoService_EchoDelete_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -152,6 +242,105 @@ func request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, marshaler } +func local_request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, server UnannotatedEchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UnannotatedSimpleMessage + var metadata runtime.ServerMetadata + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_UnannotatedEchoService_EchoDelete_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EchoDelete(ctx, &protoReq) + return msg, metadata, err + +} + +// UnannotatedEchoService local server register +func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UnannotatedEchoServiceServer) error { + + mux.Handle("POST", pattern_UnannotatedEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UnannotatedEchoService_Echo_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_UnannotatedEchoService_Echo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_UnannotatedEchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UnannotatedEchoService_Echo_1(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_UnannotatedEchoService_Echo_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_UnannotatedEchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UnannotatedEchoService_EchoBody_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_UnannotatedEchoService_EchoBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_UnannotatedEchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UnannotatedEchoService_EchoDelete_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_UnannotatedEchoService_EchoDelete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + // RegisterUnannotatedEchoServiceHandlerFromEndpoint is same as RegisterUnannotatedEchoServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterUnannotatedEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index 1c0765519f8..824c098fa94 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -47,6 +47,23 @@ func request_WrappersService_Create_0(ctx context.Context, marshaler runtime.Mar } +func local_request_WrappersService_Create_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Wrappers + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Create(ctx, &protoReq) + return msg, metadata, err + +} + func request_WrappersService_CreateStringValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrappers.StringValue var metadata runtime.ServerMetadata @@ -64,6 +81,23 @@ func request_WrappersService_CreateStringValue_0(ctx context.Context, marshaler } +func local_request_WrappersService_CreateStringValue_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.StringValue + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateStringValue(ctx, &protoReq) + return msg, metadata, err + +} + func request_WrappersService_CreateInt32Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrappers.Int32Value var metadata runtime.ServerMetadata @@ -81,6 +115,23 @@ func request_WrappersService_CreateInt32Value_0(ctx context.Context, marshaler r } +func local_request_WrappersService_CreateInt32Value_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.Int32Value + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateInt32Value(ctx, &protoReq) + return msg, metadata, err + +} + func request_WrappersService_CreateInt64Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrappers.Int64Value var metadata runtime.ServerMetadata @@ -98,6 +149,23 @@ func request_WrappersService_CreateInt64Value_0(ctx context.Context, marshaler r } +func local_request_WrappersService_CreateInt64Value_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.Int64Value + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateInt64Value(ctx, &protoReq) + return msg, metadata, err + +} + func request_WrappersService_CreateFloatValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrappers.FloatValue var metadata runtime.ServerMetadata @@ -115,6 +183,23 @@ func request_WrappersService_CreateFloatValue_0(ctx context.Context, marshaler r } +func local_request_WrappersService_CreateFloatValue_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.FloatValue + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateFloatValue(ctx, &protoReq) + return msg, metadata, err + +} + func request_WrappersService_CreateDoubleValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrappers.DoubleValue var metadata runtime.ServerMetadata @@ -132,6 +217,23 @@ func request_WrappersService_CreateDoubleValue_0(ctx context.Context, marshaler } +func local_request_WrappersService_CreateDoubleValue_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.DoubleValue + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateDoubleValue(ctx, &protoReq) + return msg, metadata, err + +} + func request_WrappersService_CreateBoolValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrappers.BoolValue var metadata runtime.ServerMetadata @@ -149,6 +251,23 @@ func request_WrappersService_CreateBoolValue_0(ctx context.Context, marshaler ru } +func local_request_WrappersService_CreateBoolValue_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.BoolValue + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateBoolValue(ctx, &protoReq) + return msg, metadata, err + +} + func request_WrappersService_CreateUInt32Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrappers.UInt32Value var metadata runtime.ServerMetadata @@ -166,6 +285,23 @@ func request_WrappersService_CreateUInt32Value_0(ctx context.Context, marshaler } +func local_request_WrappersService_CreateUInt32Value_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.UInt32Value + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateUInt32Value(ctx, &protoReq) + return msg, metadata, err + +} + func request_WrappersService_CreateUInt64Value_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrappers.UInt64Value var metadata runtime.ServerMetadata @@ -183,6 +319,23 @@ func request_WrappersService_CreateUInt64Value_0(ctx context.Context, marshaler } +func local_request_WrappersService_CreateUInt64Value_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.UInt64Value + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateUInt64Value(ctx, &protoReq) + return msg, metadata, err + +} + func request_WrappersService_CreateBytesValue_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq wrappers.BytesValue var metadata runtime.ServerMetadata @@ -200,6 +353,23 @@ func request_WrappersService_CreateBytesValue_0(ctx context.Context, marshaler r } +func local_request_WrappersService_CreateBytesValue_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq wrappers.BytesValue + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateBytesValue(ctx, &protoReq) + return msg, metadata, err + +} + func request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq empty.Empty var metadata runtime.ServerMetadata @@ -217,6 +387,249 @@ func request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler runtim } +func local_request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler runtime.Marshaler, server WrappersServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateEmpty(ctx, &protoReq) + return msg, metadata, err + +} + +// WrappersService local server register +func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WrappersServiceServer) error { + + mux.Handle("POST", pattern_WrappersService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_Create_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_Create_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateStringValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_CreateStringValue_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateStringValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateInt32Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_CreateInt32Value_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateInt32Value_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateInt64Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_CreateInt64Value_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateInt64Value_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateFloatValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_CreateFloatValue_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateFloatValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateDoubleValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_CreateDoubleValue_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateDoubleValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateBoolValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_CreateBoolValue_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateBoolValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateUInt32Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_CreateUInt32Value_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateUInt32Value_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateUInt64Value_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_CreateUInt64Value_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateUInt64Value_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateBytesValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_CreateBytesValue_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateBytesValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_WrappersService_CreateEmpty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_WrappersService_CreateEmpty_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_WrappersService_CreateEmpty_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + // RegisterWrappersServiceHandlerFromEndpoint is same as RegisterWrappersServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterWrappersServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { From d9425e1a10be3c788f2e81305fa6d17ae4fffdf4 Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Tue, 18 Jun 2019 14:21:59 +0800 Subject: [PATCH 442/552] Support stream through DialOption grpc.WithContextDialer(), not directly. (cherry picked from commit fa54ccf81d6254afc2aa1fdb215dbc25fc9043b6) --- .../examplepb/a_bit_of_everything.pb.gw.go | 58 ++++- .../proto/examplepb/echo_service.pb.gw.go | 29 ++- .../proto/examplepb/flow_combination.pb.gw.go | 130 +++++----- .../examplepb/response_body_service.pb.gw.go | 29 ++- examples/proto/examplepb/stream.pb.gw.go | 64 ++++- .../unannotated_echo_service.pb.gw.go | 29 ++- examples/proto/examplepb/wrappers.pb.gw.go | 29 ++- .../gengateway/template.go | 233 ++++++++++++++++++ 8 files changed, 521 insertions(+), 80 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index b1c9fcd2923..43fb890813e 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -1997,8 +1997,33 @@ func local_request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler r } -// ABitOfEverythingService local server register -func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ABitOfEverythingServiceServer) error { +// RegisterABitOfEverythingServiceHandlerServer registers the http handlers for service ABitOfEverythingService to "mux". +// UnaryRPC :call ABitOfEverythingServiceServer directly. +// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. +// +// bcLis := bufconn.Listen(1024 * 1024) +// go s.Serve(bcLis) +// +// ctx := context.Background() +// ctx, cancel := context.WithCancel(ctx) +// defer cancel() +// +// mux := runtime.NewServeMux() +// err := pb.RegisterABitOfEverythingServiceHandlerServer( +// ctx, +// mux, +// &srv, +// []grpc.DialOption{ +// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { +// return bcLis.Dial() +// }), +// }, +// ) +// +// RegisterABitOfEverythingServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: +// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. +func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ABitOfEverythingServiceServer, opts []grpc.DialOption) error { mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -2403,8 +2428,33 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt return nil } -// CamelCaseServiceName local server register -func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CamelCaseServiceNameServer) error { +// RegisterCamelCaseServiceNameHandlerServer registers the http handlers for service CamelCaseServiceName to "mux". +// UnaryRPC :call CamelCaseServiceNameServer directly. +// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. +// +// bcLis := bufconn.Listen(1024 * 1024) +// go s.Serve(bcLis) +// +// ctx := context.Background() +// ctx, cancel := context.WithCancel(ctx) +// defer cancel() +// +// mux := runtime.NewServeMux() +// err := pb.RegisterCamelCaseServiceNameHandlerServer( +// ctx, +// mux, +// &srv, +// []grpc.DialOption{ +// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { +// return bcLis.Dial() +// }), +// }, +// ) +// +// RegisterCamelCaseServiceNameHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: +// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. +func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CamelCaseServiceNameServer, opts []grpc.DialOption) error { mux.Handle("GET", pattern_CamelCaseServiceName_Empty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index a9ef0451e5f..fae175b770f 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -570,8 +570,33 @@ func local_request_EchoService_EchoDelete_0(ctx context.Context, marshaler runti } -// EchoService local server register -func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error { +// RegisterEchoServiceHandlerServer registers the http handlers for service EchoService to "mux". +// UnaryRPC :call EchoServiceServer directly. +// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. +// +// bcLis := bufconn.Listen(1024 * 1024) +// go s.Serve(bcLis) +// +// ctx := context.Background() +// ctx, cancel := context.WithCancel(ctx) +// defer cancel() +// +// mux := runtime.NewServeMux() +// err := pb.RegisterEchoServiceHandlerServer( +// ctx, +// mux, +// &srv, +// []grpc.DialOption{ +// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { +// return bcLis.Dial() +// }), +// }, +// ) +// +// RegisterEchoServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: +// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. +func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer, opts []grpc.DialOption) error { mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index dfce88514f2..b11c2782b16 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -63,8 +63,6 @@ func request_FlowCombination_RpcEmptyStream_0(ctx context.Context, marshaler run } -// TODO server-streaming-request - func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var metadata runtime.ServerMetadata stream, err := client.StreamEmptyRpc(ctx) @@ -109,8 +107,6 @@ func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler run } -// TODO client-streaming-request - func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_StreamEmptyStreamClient, runtime.ServerMetadata, error) { var metadata runtime.ServerMetadata stream, err := client.StreamEmptyStream(ctx) @@ -163,8 +159,6 @@ func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler return stream, metadata, nil } -// TODO bidi-streaming-request - func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -980,8 +974,6 @@ func request_FlowCombination_RpcBodyStream_0(ctx context.Context, marshaler runt } -// TODO server-streaming-request - func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -1039,8 +1031,6 @@ func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runt } -// TODO server-streaming-request - var ( filter_FlowCombination_RpcBodyStream_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -1069,8 +1059,6 @@ func request_FlowCombination_RpcBodyStream_2(ctx context.Context, marshaler runt } -// TODO server-streaming-request - func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { var protoReq NonEmptyProto var metadata runtime.ServerMetadata @@ -1125,8 +1113,6 @@ func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runt } -// TODO server-streaming-request - var ( filter_FlowCombination_RpcBodyStream_4 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -1163,8 +1149,6 @@ func request_FlowCombination_RpcBodyStream_4(ctx context.Context, marshaler runt } -// TODO server-streaming-request - var ( filter_FlowCombination_RpcBodyStream_5 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) @@ -1219,8 +1203,6 @@ func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runt } -// TODO server-streaming-request - var ( filter_FlowCombination_RpcBodyStream_6 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -1267,8 +1249,6 @@ func request_FlowCombination_RpcBodyStream_6(ctx context.Context, marshaler runt } -// TODO server-streaming-request - var ( filter_FlowCombination_RpcPathSingleNestedStream_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) @@ -1315,8 +1295,6 @@ func request_FlowCombination_RpcPathSingleNestedStream_0(ctx context.Context, ma } -// TODO server-streaming-request - var ( filter_FlowCombination_RpcPathNestedStream_0 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2, "b": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 3, 1, 2, 4, 5}} ) @@ -1382,8 +1360,6 @@ func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshale } -// TODO server-streaming-request - var ( filter_FlowCombination_RpcPathNestedStream_1 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} ) @@ -1430,8 +1406,6 @@ func request_FlowCombination_RpcPathNestedStream_1(ctx context.Context, marshale } -// TODO server-streaming-request - var ( filter_FlowCombination_RpcPathNestedStream_2 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 3, 2, 4}} ) @@ -1486,10 +1460,54 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale } -// TODO server-streaming-request +// RegisterFlowCombinationHandlerServer registers the http handlers for service FlowCombination to "mux". +// UnaryRPC :call FlowCombinationServer directly. +// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. +// +// bcLis := bufconn.Listen(1024 * 1024) +// go s.Serve(bcLis) +// +// ctx := context.Background() +// ctx, cancel := context.WithCancel(ctx) +// defer cancel() +// +// mux := runtime.NewServeMux() +// err := pb.RegisterFlowCombinationHandlerServer( +// ctx, +// mux, +// &srv, +// []grpc.DialOption{ +// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { +// return bcLis.Dial() +// }), +// }, +// ) +// +// RegisterFlowCombinationHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: +// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. +func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer, opts []grpc.DialOption) error { + + conn, err := grpc.Dial("", opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn: %v", cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn: %v", cerr) + } + }() + }() -// FlowCombination local server register -func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer) error { + client := NewFlowCombinationClient(conn) mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -1520,14 +1538,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcEmptyStream_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcEmptyStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcEmptyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1540,7 +1558,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_StreamEmptyRpc_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_StreamEmptyRpc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1560,14 +1578,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_StreamEmptyStream_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_StreamEmptyStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_StreamEmptyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1800,14 +1818,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcBodyStream_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcBodyStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcBodyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1820,14 +1838,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcBodyStream_1(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcBodyStream_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcBodyStream_1(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1840,14 +1858,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcBodyStream_2(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcBodyStream_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcBodyStream_2(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1860,14 +1878,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcBodyStream_3(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcBodyStream_3(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcBodyStream_3(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1880,14 +1898,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcBodyStream_4(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcBodyStream_4(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcBodyStream_4(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1900,14 +1918,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcBodyStream_5(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcBodyStream_5(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcBodyStream_5(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1920,14 +1938,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcBodyStream_6(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcBodyStream_6(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcBodyStream_6(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1940,14 +1958,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcPathSingleNestedStream_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcPathSingleNestedStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcPathSingleNestedStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1960,14 +1978,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcPathNestedStream_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcPathNestedStream_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcPathNestedStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -1980,14 +1998,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcPathNestedStream_1(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcPathNestedStream_1(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcPathNestedStream_1(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -2000,14 +2018,14 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_FlowCombination_RpcPathNestedStream_2(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_FlowCombination_RpcPathNestedStream_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_FlowCombination_RpcPathNestedStream_2(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index 360d9b204c3..3d316a97efe 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -190,8 +190,33 @@ func local_request_ResponseBodyService_ListResponseStrings_0(ctx context.Context } -// ResponseBodyService local server register -func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResponseBodyServiceServer) error { +// RegisterResponseBodyServiceHandlerServer registers the http handlers for service ResponseBodyService to "mux". +// UnaryRPC :call ResponseBodyServiceServer directly. +// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. +// +// bcLis := bufconn.Listen(1024 * 1024) +// go s.Serve(bcLis) +// +// ctx := context.Background() +// ctx, cancel := context.WithCancel(ctx) +// defer cancel() +// +// mux := runtime.NewServeMux() +// err := pb.RegisterResponseBodyServiceHandlerServer( +// ctx, +// mux, +// &srv, +// []grpc.DialOption{ +// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { +// return bcLis.Dial() +// }), +// }, +// ) +// +// RegisterResponseBodyServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: +// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. +func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResponseBodyServiceServer, opts []grpc.DialOption) error { mux.Handle("GET", pattern_ResponseBodyService_GetResponseBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index 4157d741a18..b6d6cfc4881 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -74,8 +74,6 @@ func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.M } -// TODO client-streaming-request - 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 empty.Empty var metadata runtime.ServerMetadata @@ -93,8 +91,6 @@ func request_StreamService_List_0(ctx context.Context, marshaler runtime.Marshal } -// TODO server-streaming-request - 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) @@ -147,10 +143,54 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar return stream, metadata, nil } -// TODO bidi-streaming-request +// RegisterStreamServiceHandlerServer registers the http handlers for service StreamService to "mux". +// UnaryRPC :call StreamServiceServer directly. +// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. +// +// bcLis := bufconn.Listen(1024 * 1024) +// go s.Serve(bcLis) +// +// ctx := context.Background() +// ctx, cancel := context.WithCancel(ctx) +// defer cancel() +// +// mux := runtime.NewServeMux() +// err := pb.RegisterStreamServiceHandlerServer( +// ctx, +// mux, +// &srv, +// []grpc.DialOption{ +// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { +// return bcLis.Dial() +// }), +// }, +// ) +// +// RegisterStreamServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: +// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. +func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer, opts []grpc.DialOption) error { + + conn, err := grpc.Dial("", opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn: %v", cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn: %v", cerr) + } + }() + }() -// StreamService local server register -func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer) 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(req.Context()) @@ -161,7 +201,7 @@ func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeM runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_StreamService_BulkCreate_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_StreamService_BulkCreate_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -181,14 +221,14 @@ func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeM runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_StreamService_List_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_StreamService_List_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_StreamService_List_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) @@ -201,14 +241,14 @@ func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeM runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_StreamService_BulkEcho_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := request_StreamService_BulkEcho_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - // TODO + forward_StreamService_BulkEcho_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) }) diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index 09f91ca367e..263f9228361 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -255,8 +255,33 @@ func local_request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, mars } -// UnannotatedEchoService local server register -func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UnannotatedEchoServiceServer) error { +// RegisterUnannotatedEchoServiceHandlerServer registers the http handlers for service UnannotatedEchoService to "mux". +// UnaryRPC :call UnannotatedEchoServiceServer directly. +// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. +// +// bcLis := bufconn.Listen(1024 * 1024) +// go s.Serve(bcLis) +// +// ctx := context.Background() +// ctx, cancel := context.WithCancel(ctx) +// defer cancel() +// +// mux := runtime.NewServeMux() +// err := pb.RegisterUnannotatedEchoServiceHandlerServer( +// ctx, +// mux, +// &srv, +// []grpc.DialOption{ +// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { +// return bcLis.Dial() +// }), +// }, +// ) +// +// RegisterUnannotatedEchoServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: +// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. +func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UnannotatedEchoServiceServer, opts []grpc.DialOption) error { mux.Handle("POST", pattern_UnannotatedEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index 824c098fa94..825bc012a7b 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -404,8 +404,33 @@ func local_request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler } -// WrappersService local server register -func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WrappersServiceServer) error { +// RegisterWrappersServiceHandlerServer registers the http handlers for service WrappersService to "mux". +// UnaryRPC :call WrappersServiceServer directly. +// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. +// +// bcLis := bufconn.Listen(1024 * 1024) +// go s.Serve(bcLis) +// +// ctx := context.Background() +// ctx, cancel := context.WithCancel(ctx) +// defer cancel() +// +// mux := runtime.NewServeMux() +// err := pb.RegisterWrappersServiceHandlerServer( +// ctx, +// mux, +// &srv, +// []grpc.DialOption{ +// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { +// return bcLis.Dial() +// }), +// }, +// ) +// +// RegisterWrappersServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: +// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. +func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WrappersServiceServer, opts []grpc.DialOption) error { mux.Handle("POST", pattern_WrappersService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 97770d93bf0..9b5f62abda1 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -167,6 +167,15 @@ func applyTemplate(p param, reg *descriptor.Registry) (string, error) { }); err != nil { return "", err } + + // Local + if err := localHandlerTemplate.Execute(w, binding{ + Binding: b, + Registry: reg, + AllowPatchFeature: p.AllowPatchFeature, + }); err != nil { + return "", err + } } } if methodWithBindingsSeen { @@ -187,6 +196,11 @@ func applyTemplate(p param, reg *descriptor.Registry) (string, error) { RegisterFuncSuffix: p.RegisterFuncSuffix, AssumeColonVerb: assumeColonVerb, } + // Local + if err := localTrailerTemplate.Execute(w, tp); err != nil { + return "", err + } + if err := trailerTemplate.Execute(w, tp); err != nil { return "", err } @@ -432,6 +446,225 @@ var ( } `)) + localHandlerTemplate = template.Must(template.New("local-handler").Parse(` +{{if and .Method.GetClientStreaming .Method.GetServerStreaming}} +{{else if .Method.GetClientStreaming}} +{{else if .Method.GetServerStreaming}} +{{else}} +{{template "local-client-rpc-request-func" .}} +{{end}} +`)) + + _ = template.Must(localHandlerTemplate.New("local-request-func-signature").Parse(strings.Replace(` +{{if .Method.GetServerStreaming}} +{{else}} +func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, marshaler runtime.Marshaler, server {{.Method.Service.GetName}}Server, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) +{{end}}`, "\n", "", -1))) + + _ = template.Must(localHandlerTemplate.New("local-client-rpc-request-func").Parse(` +{{$AllowPatchFeature := .AllowPatchFeature}} +{{template "local-request-func-signature" .}} { + var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} + var metadata runtime.ServerMetadata +{{if .Body}} + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&{{.Body.AssignableExpr "protoReq"}}); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + {{- if and $AllowPatchFeature (and (eq (.HTTPMethod) "PATCH") (.FieldMaskField))}} + if protoReq.{{.FieldMaskField}} != nil && len(protoReq.{{.FieldMaskField}}.GetPaths()) > 0 { + runtime.CamelCaseFieldMask(protoReq.{{.FieldMaskField}}) + } {{if not (eq "*" .GetBodyFieldPath)}} else { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.{{.FieldMaskField}} = fieldMask + } + } {{end}} + {{end}} +{{end}} +{{if .PathParams}} + var ( + val string +{{- if .HasEnumPathParam}} + e int32 +{{- end}} +{{- if .HasRepeatedEnumPathParam}} + es []int32 +{{- end}} + ok bool + err error + _ = err + ) + {{$binding := .}} + {{range $param := .PathParams}} + {{$enum := $binding.LookupEnum $param}} + val, ok = pathParams[{{$param | printf "%q"}}] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", {{$param | printf "%q"}}) + } +{{if $param.IsNestedProto3}} + err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) +{{else if $enum}} + e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}_value) +{{else}} + {{$param.AssignableExpr "protoReq"}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}) +{{end}} + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", {{$param | printf "%q"}}, err) + } +{{if and $enum $param.IsRepeated}} + s := make([]{{$enum.GoType $param.Target.Message.File.GoPkg.Path}}, len(es)) + for i, v := range es { + s[i] = {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}(v) + } + {{$param.AssignableExpr "protoReq"}} = s +{{else if $enum}} + {{$param.AssignableExpr "protoReq"}} = {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}(e) +{{end}} + {{end}} +{{end}} +{{if .HasQueryParam}} + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } +{{end}} +{{if .Method.GetServerStreaming}} + // TODO +{{else}} + msg, err := server.{{.Method.GetName}}(ctx, &protoReq) + return msg, metadata, err +{{end}} +}`)) + + localTrailerTemplate = template.Must(template.New("local-trailer").Parse(` +{{$UseRequestContext := .UseRequestContext}} +{{range $svc := .Services}} +// Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server registers the http handlers for service {{$svc.GetName}} to "mux". +// UnaryRPC :call {{$svc.GetName}}Server directly. +// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. +// +// bcLis := bufconn.Listen(1024 * 1024) +// go s.Serve(bcLis) +// +// ctx := context.Background() +// ctx, cancel := context.WithCancel(ctx) +// defer cancel() +// +// mux := runtime.NewServeMux() +// err := pb.Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server( +// ctx, +// mux, +// &srv, +// []grpc.DialOption{ +// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { +// return bcLis.Dial() +// }), +// }, +// ) +// +// Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server does not support stream rpc call directly, and grpc-go have an issue "Feature Request: +// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. +func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server, opts []grpc.DialOption) error { + {{$streaming := 0}} + {{range $m := $svc.Methods}} + {{if or $m.GetClientStreaming $m.GetServerStreaming}} + {{$streaming = 1}} + {{end}} + {{end}} + {{if eq $streaming 1}} + conn, err := grpc.Dial("", opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn: %v", cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn: %v", cerr) + } + }() + }() + + client := New{{$svc.GetName}}Client(conn) + {{end}} + + {{range $m := $svc.Methods}} + {{range $b := $m.Bindings}} + {{if or $m.GetClientStreaming $m.GetServerStreaming}} + mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + {{- if $UseRequestContext }} + ctx, cancel := context.WithCancel(req.Context()) + {{- else -}} + ctx, cancel := context.WithCancel(ctx) + {{- end }} + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + {{if $m.GetServerStreaming}} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + {{else}} + {{ if $b.ResponseBody }} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{resp}, mux.GetForwardResponseOptions()...) + {{ else }} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + {{end}} + {{end}} + }) + {{else}} + mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + {{- if $UseRequestContext }} + ctx, cancel := context.WithCancel(req.Context()) + {{- else -}} + ctx, cancel := context.WithCancel(ctx) + {{- end }} + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + {{ if $b.ResponseBody }} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{resp}, mux.GetForwardResponseOptions()...) + {{ else }} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + {{end}} + }) + {{end}} + {{end}} + {{end}} + return nil +} +{{end}}`)) + trailerTemplate = template.Must(template.New("trailer").Parse(` {{$UseRequestContext := .UseRequestContext}} {{range $svc := .Services}} From b741d8b63160d042ca6abda3b61e20a73ca6b305 Mon Sep 17 00:00:00 2001 From: Hobo Chen Date: Wed, 31 Jul 2019 08:57:48 +0800 Subject: [PATCH 443/552] Update protoc-gen-grpc-gateway/gengateway/template.go Co-Authored-By: Johan Brandhorst --- protoc-gen-grpc-gateway/gengateway/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 9b5f62abda1..bdd0960eb4b 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -545,7 +545,7 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct {{range $svc := .Services}} // Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server registers the http handlers for service {{$svc.GetName}} to "mux". // UnaryRPC :call {{$svc.GetName}}Server directly. -// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. // // bcLis := bufconn.Listen(1024 * 1024) From 7e20376ab8624b00339a990e6cff0a96f80cd93c Mon Sep 17 00:00:00 2001 From: Hobo Chen Date: Wed, 31 Jul 2019 09:02:51 +0800 Subject: [PATCH 444/552] Update protoc-gen-grpc-gateway/gengateway/template.go Co-Authored-By: Johan Brandhorst --- protoc-gen-grpc-gateway/gengateway/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index bdd0960eb4b..59e768953d8 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -569,7 +569,7 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct // // Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server does not support stream rpc call directly, and grpc-go have an issue "Feature Request: // Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server, opts []grpc.DialOption) error { +func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server, opts []grpc.DialOption) (err error) { {{$streaming := 0}} {{range $m := $svc.Methods}} {{if or $m.GetClientStreaming $m.GetServerStreaming}} From c45e73e114ed400cdfea78f32d53b8415873a138 Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Wed, 31 Jul 2019 09:26:56 +0800 Subject: [PATCH 445/552] regenerate `*.pb.gw.go` files --- examples/proto/examplepb/a_bit_of_everything.pb.gw.go | 8 ++++---- examples/proto/examplepb/echo_service.pb.gw.go | 4 ++-- examples/proto/examplepb/flow_combination.pb.gw.go | 4 ++-- examples/proto/examplepb/response_body_service.pb.gw.go | 4 ++-- examples/proto/examplepb/stream.pb.gw.go | 4 ++-- .../proto/examplepb/unannotated_echo_service.pb.gw.go | 4 ++-- examples/proto/examplepb/wrappers.pb.gw.go | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index 43fb890813e..cc3fdc51d18 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -1999,7 +1999,7 @@ func local_request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler r // RegisterABitOfEverythingServiceHandlerServer registers the http handlers for service ABitOfEverythingService to "mux". // UnaryRPC :call ABitOfEverythingServiceServer directly. -// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. // // bcLis := bufconn.Listen(1024 * 1024) @@ -2023,7 +2023,7 @@ func local_request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler r // // RegisterABitOfEverythingServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: // Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ABitOfEverythingServiceServer, opts []grpc.DialOption) error { +func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ABitOfEverythingServiceServer, opts []grpc.DialOption) (err error) { mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -2430,7 +2430,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt // RegisterCamelCaseServiceNameHandlerServer registers the http handlers for service CamelCaseServiceName to "mux". // UnaryRPC :call CamelCaseServiceNameServer directly. -// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. // // bcLis := bufconn.Listen(1024 * 1024) @@ -2454,7 +2454,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt // // RegisterCamelCaseServiceNameHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: // Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CamelCaseServiceNameServer, opts []grpc.DialOption) error { +func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CamelCaseServiceNameServer, opts []grpc.DialOption) (err error) { mux.Handle("GET", pattern_CamelCaseServiceName_Empty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index fae175b770f..bfbbbc14005 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -572,7 +572,7 @@ func local_request_EchoService_EchoDelete_0(ctx context.Context, marshaler runti // RegisterEchoServiceHandlerServer registers the http handlers for service EchoService to "mux". // UnaryRPC :call EchoServiceServer directly. -// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. // // bcLis := bufconn.Listen(1024 * 1024) @@ -596,7 +596,7 @@ func local_request_EchoService_EchoDelete_0(ctx context.Context, marshaler runti // // RegisterEchoServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: // Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer, opts []grpc.DialOption) error { +func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer, opts []grpc.DialOption) (err error) { mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index b11c2782b16..3cc01b9d43a 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -1462,7 +1462,7 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale // RegisterFlowCombinationHandlerServer registers the http handlers for service FlowCombination to "mux". // UnaryRPC :call FlowCombinationServer directly. -// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. // // bcLis := bufconn.Listen(1024 * 1024) @@ -1486,7 +1486,7 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale // // RegisterFlowCombinationHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: // Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer, opts []grpc.DialOption) error { +func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer, opts []grpc.DialOption) (err error) { conn, err := grpc.Dial("", opts...) if err != nil { diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index 3d316a97efe..45332fad13a 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -192,7 +192,7 @@ func local_request_ResponseBodyService_ListResponseStrings_0(ctx context.Context // RegisterResponseBodyServiceHandlerServer registers the http handlers for service ResponseBodyService to "mux". // UnaryRPC :call ResponseBodyServiceServer directly. -// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. // // bcLis := bufconn.Listen(1024 * 1024) @@ -216,7 +216,7 @@ func local_request_ResponseBodyService_ListResponseStrings_0(ctx context.Context // // RegisterResponseBodyServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: // Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResponseBodyServiceServer, opts []grpc.DialOption) error { +func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResponseBodyServiceServer, opts []grpc.DialOption) (err error) { mux.Handle("GET", pattern_ResponseBodyService_GetResponseBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index b6d6cfc4881..b5da899be70 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -145,7 +145,7 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar // RegisterStreamServiceHandlerServer registers the http handlers for service StreamService to "mux". // UnaryRPC :call StreamServiceServer directly. -// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. // // bcLis := bufconn.Listen(1024 * 1024) @@ -169,7 +169,7 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar // // RegisterStreamServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: // Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer, opts []grpc.DialOption) error { +func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer, opts []grpc.DialOption) (err error) { conn, err := grpc.Dial("", opts...) if err != nil { diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index 263f9228361..40fc15038e9 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -257,7 +257,7 @@ func local_request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, mars // RegisterUnannotatedEchoServiceHandlerServer registers the http handlers for service UnannotatedEchoService to "mux". // UnaryRPC :call UnannotatedEchoServiceServer directly. -// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. // // bcLis := bufconn.Listen(1024 * 1024) @@ -281,7 +281,7 @@ func local_request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, mars // // RegisterUnannotatedEchoServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: // Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UnannotatedEchoServiceServer, opts []grpc.DialOption) error { +func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UnannotatedEchoServiceServer, opts []grpc.DialOption) (err error) { mux.Handle("POST", pattern_UnannotatedEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index 825bc012a7b..c9691cdea7b 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -406,7 +406,7 @@ func local_request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler // RegisterWrappersServiceHandlerServer registers the http handlers for service WrappersService to "mux". // UnaryRPC :call WrappersServiceServer directly. -// StreamingRPC :need dial the same port for grpc.Server, we can use bufconn package(grpc-go/test/bufconn). +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. // // bcLis := bufconn.Listen(1024 * 1024) @@ -430,7 +430,7 @@ func local_request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler // // RegisterWrappersServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: // Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WrappersServiceServer, opts []grpc.DialOption) error { +func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WrappersServiceServer, opts []grpc.DialOption) (err error) { mux.Handle("POST", pattern_WrappersService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) From 8fb033230e46b3f4ce7b404c276cdc2e44e53bc5 Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Sat, 3 Aug 2019 07:31:49 +0800 Subject: [PATCH 446/552] streaming return Unimplemented error --- .../examplepb/a_bit_of_everything.pb.gw.go | 50 +-- .../proto/examplepb/echo_service.pb.gw.go | 25 +- .../proto/examplepb/flow_combination.pb.gw.go | 298 +----------------- .../examplepb/response_body_service.pb.gw.go | 25 +- examples/proto/examplepb/stream.pb.gw.go | 100 +----- .../unannotated_echo_service.pb.gw.go | 25 +- examples/proto/examplepb/wrappers.pb.gw.go | 25 +- .../gengateway/template.go | 75 +---- 8 files changed, 27 insertions(+), 596 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index cc3fdc51d18..32080de1dac 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -2000,30 +2000,7 @@ func local_request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler r // RegisterABitOfEverythingServiceHandlerServer registers the http handlers for service ABitOfEverythingService to "mux". // UnaryRPC :call ABitOfEverythingServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. -// -// bcLis := bufconn.Listen(1024 * 1024) -// go s.Serve(bcLis) -// -// ctx := context.Background() -// ctx, cancel := context.WithCancel(ctx) -// defer cancel() -// -// mux := runtime.NewServeMux() -// err := pb.RegisterABitOfEverythingServiceHandlerServer( -// ctx, -// mux, -// &srv, -// []grpc.DialOption{ -// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { -// return bcLis.Dial() -// }), -// }, -// ) -// -// RegisterABitOfEverythingServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: -// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ABitOfEverythingServiceServer, opts []grpc.DialOption) (err error) { +func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ABitOfEverythingServiceServer, opts []grpc.DialOption) error { mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -2431,30 +2408,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt // RegisterCamelCaseServiceNameHandlerServer registers the http handlers for service CamelCaseServiceName to "mux". // UnaryRPC :call CamelCaseServiceNameServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. -// -// bcLis := bufconn.Listen(1024 * 1024) -// go s.Serve(bcLis) -// -// ctx := context.Background() -// ctx, cancel := context.WithCancel(ctx) -// defer cancel() -// -// mux := runtime.NewServeMux() -// err := pb.RegisterCamelCaseServiceNameHandlerServer( -// ctx, -// mux, -// &srv, -// []grpc.DialOption{ -// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { -// return bcLis.Dial() -// }), -// }, -// ) -// -// RegisterCamelCaseServiceNameHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: -// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CamelCaseServiceNameServer, opts []grpc.DialOption) (err error) { +func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CamelCaseServiceNameServer, opts []grpc.DialOption) error { mux.Handle("GET", pattern_CamelCaseServiceName_Empty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index bfbbbc14005..f86a9be9d25 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -573,30 +573,7 @@ func local_request_EchoService_EchoDelete_0(ctx context.Context, marshaler runti // RegisterEchoServiceHandlerServer registers the http handlers for service EchoService to "mux". // UnaryRPC :call EchoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. -// -// bcLis := bufconn.Listen(1024 * 1024) -// go s.Serve(bcLis) -// -// ctx := context.Background() -// ctx, cancel := context.WithCancel(ctx) -// defer cancel() -// -// mux := runtime.NewServeMux() -// err := pb.RegisterEchoServiceHandlerServer( -// ctx, -// mux, -// &srv, -// []grpc.DialOption{ -// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { -// return bcLis.Dial() -// }), -// }, -// ) -// -// RegisterEchoServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: -// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer, opts []grpc.DialOption) (err error) { +func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer, opts []grpc.DialOption) error { mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index 3cc01b9d43a..ed9700e5b70 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -1463,51 +1463,7 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale // RegisterFlowCombinationHandlerServer registers the http handlers for service FlowCombination to "mux". // UnaryRPC :call FlowCombinationServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. -// -// bcLis := bufconn.Listen(1024 * 1024) -// go s.Serve(bcLis) -// -// ctx := context.Background() -// ctx, cancel := context.WithCancel(ctx) -// defer cancel() -// -// mux := runtime.NewServeMux() -// err := pb.RegisterFlowCombinationHandlerServer( -// ctx, -// mux, -// &srv, -// []grpc.DialOption{ -// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { -// return bcLis.Dial() -// }), -// }, -// ) -// -// RegisterFlowCombinationHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: -// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer, opts []grpc.DialOption) (err error) { - - conn, err := grpc.Dial("", opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn: %v", cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn: %v", cerr) - } - }() - }() - - client := NewFlowCombinationClient(conn) +func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer, opts []grpc.DialOption) error { mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -1530,63 +1486,15 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcEmptyStream_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcEmptyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_StreamEmptyRpc_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_StreamEmptyRpc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_StreamEmptyStream_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_StreamEmptyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1810,223 +1718,47 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcBodyStream_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcBodyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcBodyStream_1(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcBodyStream_1(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcBodyStream_2(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcBodyStream_2(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcBodyStream_3(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcBodyStream_3(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcBodyStream_4(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcBodyStream_4(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcBodyStream_5(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcBodyStream_5(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcBodyStream_6(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcBodyStream_6(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcPathSingleNestedStream_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcPathSingleNestedStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcPathNestedStream_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcPathNestedStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcPathNestedStream_1(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcPathNestedStream_1(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_FlowCombination_RpcPathNestedStream_2(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_FlowCombination_RpcPathNestedStream_2(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) return nil diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index 45332fad13a..8b82a1b816e 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -193,30 +193,7 @@ func local_request_ResponseBodyService_ListResponseStrings_0(ctx context.Context // RegisterResponseBodyServiceHandlerServer registers the http handlers for service ResponseBodyService to "mux". // UnaryRPC :call ResponseBodyServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. -// -// bcLis := bufconn.Listen(1024 * 1024) -// go s.Serve(bcLis) -// -// ctx := context.Background() -// ctx, cancel := context.WithCancel(ctx) -// defer cancel() -// -// mux := runtime.NewServeMux() -// err := pb.RegisterResponseBodyServiceHandlerServer( -// ctx, -// mux, -// &srv, -// []grpc.DialOption{ -// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { -// return bcLis.Dial() -// }), -// }, -// ) -// -// RegisterResponseBodyServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: -// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResponseBodyServiceServer, opts []grpc.DialOption) (err error) { +func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResponseBodyServiceServer, opts []grpc.DialOption) error { mux.Handle("GET", pattern_ResponseBodyService_GetResponseBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index b5da899be70..04e76615e3f 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -146,110 +146,18 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar // RegisterStreamServiceHandlerServer registers the http handlers for service StreamService to "mux". // UnaryRPC :call StreamServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. -// -// bcLis := bufconn.Listen(1024 * 1024) -// go s.Serve(bcLis) -// -// ctx := context.Background() -// ctx, cancel := context.WithCancel(ctx) -// defer cancel() -// -// mux := runtime.NewServeMux() -// err := pb.RegisterStreamServiceHandlerServer( -// ctx, -// mux, -// &srv, -// []grpc.DialOption{ -// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { -// return bcLis.Dial() -// }), -// }, -// ) -// -// RegisterStreamServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: -// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer, opts []grpc.DialOption) (err error) { - - conn, err := grpc.Dial("", opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn: %v", cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn: %v", cerr) - } - }() - }() - - client := NewStreamServiceClient(conn) +func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer, opts []grpc.DialOption) error { mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_StreamService_BulkCreate_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_StreamService_BulkCreate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("GET", pattern_StreamService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_StreamService_List_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_StreamService_List_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_StreamService_BulkEcho_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_StreamService_BulkEcho_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) return nil diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index 40fc15038e9..fdb9f186e19 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -258,30 +258,7 @@ func local_request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, mars // RegisterUnannotatedEchoServiceHandlerServer registers the http handlers for service UnannotatedEchoService to "mux". // UnaryRPC :call UnannotatedEchoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. -// -// bcLis := bufconn.Listen(1024 * 1024) -// go s.Serve(bcLis) -// -// ctx := context.Background() -// ctx, cancel := context.WithCancel(ctx) -// defer cancel() -// -// mux := runtime.NewServeMux() -// err := pb.RegisterUnannotatedEchoServiceHandlerServer( -// ctx, -// mux, -// &srv, -// []grpc.DialOption{ -// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { -// return bcLis.Dial() -// }), -// }, -// ) -// -// RegisterUnannotatedEchoServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: -// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UnannotatedEchoServiceServer, opts []grpc.DialOption) (err error) { +func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UnannotatedEchoServiceServer, opts []grpc.DialOption) error { mux.Handle("POST", pattern_UnannotatedEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index c9691cdea7b..beaf2bf5fc4 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -407,30 +407,7 @@ func local_request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler // RegisterWrappersServiceHandlerServer registers the http handlers for service WrappersService to "mux". // UnaryRPC :call WrappersServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. -// -// bcLis := bufconn.Listen(1024 * 1024) -// go s.Serve(bcLis) -// -// ctx := context.Background() -// ctx, cancel := context.WithCancel(ctx) -// defer cancel() -// -// mux := runtime.NewServeMux() -// err := pb.RegisterWrappersServiceHandlerServer( -// ctx, -// mux, -// &srv, -// []grpc.DialOption{ -// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { -// return bcLis.Dial() -// }), -// }, -// ) -// -// RegisterWrappersServiceHandlerServer does not support stream rpc call directly, and grpc-go have an issue "Feature Request: -// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WrappersServiceServer, opts []grpc.DialOption) (err error) { +func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WrappersServiceServer, opts []grpc.DialOption) error { mux.Handle("POST", pattern_WrappersService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 59e768953d8..e1d5393e94c 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -546,90 +546,19 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct // Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server registers the http handlers for service {{$svc.GetName}} to "mux". // UnaryRPC :call {{$svc.GetName}}Server directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// If the gateway proto have stream must add DialOption grpc.WithContextDialer. e.g. -// -// bcLis := bufconn.Listen(1024 * 1024) -// go s.Serve(bcLis) -// -// ctx := context.Background() -// ctx, cancel := context.WithCancel(ctx) -// defer cancel() -// -// mux := runtime.NewServeMux() -// err := pb.Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server( -// ctx, -// mux, -// &srv, -// []grpc.DialOption{ -// grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { -// return bcLis.Dial() -// }), -// }, -// ) -// -// Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server does not support stream rpc call directly, and grpc-go have an issue "Feature Request: -// Add support for In-Process transport #906". So it is currently EXPERIMENTAL and subject to change. -func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server, opts []grpc.DialOption) (err error) { +func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server, opts []grpc.DialOption) error { {{$streaming := 0}} {{range $m := $svc.Methods}} {{if or $m.GetClientStreaming $m.GetServerStreaming}} {{$streaming = 1}} {{end}} {{end}} - {{if eq $streaming 1}} - conn, err := grpc.Dial("", opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn: %v", cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn: %v", cerr) - } - }() - }() - - client := New{{$svc.GetName}}Client(conn) - {{end}} {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} {{if or $m.GetClientStreaming $m.GetServerStreaming}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - {{- if $UseRequestContext }} - ctx, cancel := context.WithCancel(req.Context()) - {{- else -}} - ctx, cancel := context.WithCancel(ctx) - {{- end }} - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - {{if $m.GetServerStreaming}} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - {{else}} - {{ if $b.ResponseBody }} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{resp}, mux.GetForwardResponseOptions()...) - {{ else }} - forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - {{end}} - {{end}} + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) {{else}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { From 95dc4e703b41858b23ccb0d5c2876c3d35377557 Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Sat, 3 Aug 2019 07:43:58 +0800 Subject: [PATCH 447/552] remove un used code --- protoc-gen-grpc-gateway/gengateway/template.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index e1d5393e94c..00dcd2709b1 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -547,13 +547,6 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct // UnaryRPC :call {{$svc.GetName}}Server directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server, opts []grpc.DialOption) error { - {{$streaming := 0}} - {{range $m := $svc.Methods}} - {{if or $m.GetClientStreaming $m.GetServerStreaming}} - {{$streaming = 1}} - {{end}} - {{end}} - {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} {{if or $m.GetClientStreaming $m.GetServerStreaming}} From 298ee999f6ca52ad41964aca4565ac2ca4d3068a Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Sat, 3 Aug 2019 13:27:19 +0800 Subject: [PATCH 448/552] return Unimplemented error when registering service have stream method --- .../proto/examplepb/flow_combination.pb.gw.go | 16 ++-------------- examples/proto/examplepb/stream.pb.gw.go | 5 ++--- protoc-gen-grpc-gateway/gengateway/template.go | 11 ++++++++++- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index ed9700e5b70..b64993cd5db 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -1465,6 +1465,8 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer, opts []grpc.DialOption) error { + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1486,15 +1488,12 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1718,47 +1717,36 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) return nil diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index 04e76615e3f..42e42dc53af 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -148,16 +148,15 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer, opts []grpc.DialOption) error { + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("GET", pattern_StreamService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) return nil diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 00dcd2709b1..3f746439753 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -547,11 +547,20 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct // UnaryRPC :call {{$svc.GetName}}Server directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server, opts []grpc.DialOption) error { + {{$streaming := 0}} + {{range $m := $svc.Methods}} + {{if or $m.GetClientStreaming $m.GetServerStreaming}} + {{$streaming = 1}} + {{end}} + {{end}} + {{if eq $streaming 1}} + return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + {{end}} + {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} {{if or $m.GetClientStreaming $m.GetServerStreaming}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") }) {{else}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { From eace7340d0097ead66e87e9a2ff7647efb1be29a Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Sat, 3 Aug 2019 14:49:31 +0800 Subject: [PATCH 449/552] return error when streaming method call --- .../proto/examplepb/flow_combination.pb.gw.go | 58 ++++++++++++++++++- examples/proto/examplepb/stream.pb.gw.go | 14 ++++- .../gengateway/template.go | 14 ++--- 3 files changed, 72 insertions(+), 14 deletions(-) diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index b64993cd5db..8d5a83e6e37 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -1465,8 +1465,6 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer, opts []grpc.DialOption) error { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") - mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1488,12 +1486,24 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_StreamEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1717,36 +1727,80 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) return nil diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index 42e42dc53af..117e0903bf5 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -148,15 +148,25 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer, opts []grpc.DialOption) error { - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") - mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("GET", pattern_StreamService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) return nil diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 3f746439753..a524fa25fc9 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -547,20 +547,14 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct // UnaryRPC :call {{$svc.GetName}}Server directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server, opts []grpc.DialOption) error { - {{$streaming := 0}} - {{range $m := $svc.Methods}} - {{if or $m.GetClientStreaming $m.GetServerStreaming}} - {{$streaming = 1}} - {{end}} - {{end}} - {{if eq $streaming 1}} - return status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") - {{end}} - {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} {{if or $m.GetClientStreaming $m.GetServerStreaming}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return }) {{else}} mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { From 5efb516a3123066359b80fe274cf2469dea1c539 Mon Sep 17 00:00:00 2001 From: Hobo86 Date: Tue, 20 Aug 2019 21:54:24 +0800 Subject: [PATCH 450/552] add template in process test --- .../gengateway/template_test.go | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index fbf54e6a69d..b18162e4266 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -400,6 +400,182 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { } } +func TestApplyTemplateInProcess(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("nested"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String("NestedMessage"), + Number: proto.Int32(1), + }, + }, + } + nesteddesc := &protodescriptor.DescriptorProto{ + Name: proto.String("NestedMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("int32"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_INT32.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("bool"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_BOOL.Enum(), + Number: proto.Int32(2), + }, + }, + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Echo"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + ClientStreaming: proto.Bool(true), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + for _, spec := range []struct { + clientStreaming bool + serverStreaming bool + sigWant []string + }{ + { + clientStreaming: false, + serverStreaming: false, + sigWant: []string{ + `func local_request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server ExampleServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {`, + `resp, md, err := local_request_ExampleService_Echo_0(rctx, inboundMarshaler, server, req, pathParams)`, + }, + }, + { + clientStreaming: true, + serverStreaming: true, + sigWant: []string{ + `err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")`, + }, + }, + { + clientStreaming: true, + serverStreaming: false, + sigWant: []string{ + `err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")`, + }, + }, + { + clientStreaming: false, + serverStreaming: true, + sigWant: []string{ + `err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")`, + }, + }, + } { + meth.ClientStreaming = proto.Bool(spec.clientStreaming) + meth.ServerStreaming = proto.Bool(spec.serverStreaming) + + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + nested := &descriptor.Message{ + DescriptorProto: nesteddesc, + } + + nestedField := &descriptor.Field{ + Message: msg, + FieldDescriptorProto: msg.GetField()[0], + } + intField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nested.GetField()[0], + } + boolField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nested.GetField()[1], + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + Name: proto.String("example.proto"), + Package: proto.String("example"), + MessageType: []*protodescriptor.DescriptorProto{msgdesc, nesteddesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg, nested}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "POST", + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + }, + PathParams: []descriptor.Parameter{ + { + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "int32", + Target: intField, + }, + }), + Target: intField, + }, + }, + Body: &descriptor.Body{ + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "bool", + Target: boolField, + }, + }), + }, + }, + }, + }, + }, + }, + }, + } + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: true}, descriptor.NewRegistry()) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + + for _, want := range spec.sigWant { + if !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + } + + if want := `func RegisterExampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServiceServer, opts []grpc.DialOption) error {`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + } +} + func TestAllowPatchFeature(t *testing.T) { updateMaskDesc := &protodescriptor.FieldDescriptorProto{ Name: proto.String("UpdateMask"), From 73ad3b4bdc48aee1b9a88e563f680a27f485fd00 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 28 Aug 2019 11:37:40 +0100 Subject: [PATCH 451/552] Generate changelog for 1.10.0 --- CHANGELOG.md | 25 +++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 735a96a3d4d..f42367a063c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Change Log +## [v1.10.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.10.0) (2019-08-28) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.6...v1.10.0) + +**Implemented enhancements:** + +- allow protobuf well known types in params [\#400](https://github.com/grpc-ecosystem/grpc-gateway/issues/400) +- Add a register, so that the gRPC service can be invoked in-process to provide a HTTP server. [\#947](https://github.com/grpc-ecosystem/grpc-gateway/pull/947) ([hb-chen](https://github.com/hb-chen)) + +**Fixed bugs:** + +- grpc-gateway don't work well when using github.com/golang/protobuf/ptypes/struct with streaming [\#999](https://github.com/grpc-ecosystem/grpc-gateway/issues/999) + +**Closed issues:** + +- Allow final url path parameter to be optional [\#1005](https://github.com/grpc-ecosystem/grpc-gateway/issues/1005) +- Update integration test dependencies [\#1004](https://github.com/grpc-ecosystem/grpc-gateway/issues/1004) +- Suggestion: Continuous Fuzzing [\#998](https://github.com/grpc-ecosystem/grpc-gateway/issues/998) +- Why grpc gateway does not call grpc callback directly? [\#952](https://github.com/grpc-ecosystem/grpc-gateway/issues/952) + +**Merged pull requests:** + +- Allow overriding the primitive type of fields [\#1003](https://github.com/grpc-ecosystem/grpc-gateway/pull/1003) ([snowzach](https://github.com/snowzach)) +- Add Continuous Fuzzing Integration via fuzzit.dev [\#1001](https://github.com/grpc-ecosystem/grpc-gateway/pull/1001) ([yevgenypats](https://github.com/yevgenypats)) + ## [v1.9.6](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.9.6) (2019-08-16) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.5...v1.9.6) @@ -18,6 +42,7 @@ - Disable Windows CI Bazel [\#996](https://github.com/grpc-ecosystem/grpc-gateway/pull/996) ([achew22](https://github.com/achew22)) - Correct HTTPBody doc [\#995](https://github.com/grpc-ecosystem/grpc-gateway/pull/995) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Generate changelog for 1.9.6 [\#993](https://github.com/grpc-ecosystem/grpc-gateway/pull/993) ([johanbrandhorst](https://github.com/johanbrandhorst)) - protoc-gen-swagger: correctly type struct.proto types [\#990](https://github.com/grpc-ecosystem/grpc-gateway/pull/990) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Camel case backward compatible in Swagger doc [\#988](https://github.com/grpc-ecosystem/grpc-gateway/pull/988) ([xin-au](https://github.com/xin-au)) - Add doc for opentracing support [\#987](https://github.com/grpc-ecosystem/grpc-gateway/pull/987) ([vthiery](https://github.com/vthiery)) diff --git a/Makefile b/Makefile index f48004971f5..a5751064323 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.9.6 + --future-release=v1.10.0 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From e5cd270cca52bab3204e89f6bb0ff5ba628df519 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 29 Aug 2019 18:08:17 -0700 Subject: [PATCH 452/552] Fix hand-crafted protobuf message (#1016) errorBody is an improperly hand-crafted protobuf Message. In particular, field number 1 is used twice, causing this to message to crash in the v2 re-implementation of Go protobufs. This PR modifies the field numbers to be unique. Since Error is a special field not in status.proto, we choose a large field number to avoid conflicting with any new field that may be added to the real Status message. We also fix the field numbers to truly match up with Status. --- runtime/errors.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/errors.go b/runtime/errors.go index ad945788dc6..a36080713ce 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -66,12 +66,12 @@ var ( ) type errorBody struct { - Error string `protobuf:"bytes,1,name=error" json:"error"` + Error string `protobuf:"bytes,100,name=error" json:"error"` // This is to make the error more compatible with users that expect errors to be Status objects: // https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto // It should be the exact same message as the Error field. - Message string `protobuf:"bytes,1,name=message" json:"message"` - Code int32 `protobuf:"varint,2,name=code" json:"code"` + Code int32 `protobuf:"varint,1,name=code" json:"code"` + Message string `protobuf:"bytes,2,name=message" json:"message"` Details []*any.Any `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"` } From 070cb194c87ac17b7fb82a77656423d3c7eb1e77 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2019 00:01:29 -0600 Subject: [PATCH 453/552] Bump nokogiri from 1.8.2 to 1.10.4 in /docs (#1007) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.8.2 to 1.10.4. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.8.2...v1.10.4) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 6bc4cb1f8f7..0ec5af07799 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -201,7 +201,7 @@ GEM rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) mercenary (0.3.6) - mini_portile2 (2.3.0) + mini_portile2 (2.4.0) minima (2.4.1) jekyll (~> 3.5) jekyll-feed (~> 0.9) @@ -209,8 +209,8 @@ GEM minitest (5.11.3) multipart-post (2.0.0) net-dns (0.8.0) - nokogiri (1.8.2) - mini_portile2 (~> 2.3.0) + nokogiri (1.10.4) + mini_portile2 (~> 2.4.0) octokit (4.8.0) sawyer (~> 0.8.0, >= 0.5.3) pathutil (0.16.1) From 7e90b273f534ec7b630f7b240981a837768c23a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2019 00:01:38 -0600 Subject: [PATCH 454/552] Bump rubyzip from 1.2.1 to 1.2.3 in /docs (#1008) Bumps [rubyzip](https://github.com/rubyzip/rubyzip) from 1.2.1 to 1.2.3. - [Release notes](https://github.com/rubyzip/rubyzip/releases) - [Changelog](https://github.com/rubyzip/rubyzip/blob/master/Changelog.md) - [Commits](https://github.com/rubyzip/rubyzip/compare/v1.2.1...v1.2.3) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 0ec5af07799..16d37d39e96 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -223,7 +223,7 @@ GEM ruby-enum (0.7.2) i18n ruby_dep (1.5.0) - rubyzip (1.2.1) + rubyzip (1.2.3) safe_yaml (1.0.4) sass (3.5.6) sass-listen (~> 4.0.0) From 69d407b628644cce8789e66a5fdf9307cb163604 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2019 00:01:55 -0600 Subject: [PATCH 455/552] Bump ffi from 1.9.23 to 1.11.1 in /docs (#1009) Bumps [ffi](https://github.com/ffi/ffi) from 1.9.23 to 1.11.1. - [Release notes](https://github.com/ffi/ffi/releases) - [Changelog](https://github.com/ffi/ffi/blob/master/CHANGELOG.md) - [Commits](https://github.com/ffi/ffi/compare/1.9.23...1.11.1) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 16d37d39e96..9bf6baf5847 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -25,7 +25,7 @@ GEM execjs (2.7.0) faraday (0.14.0) multipart-post (>= 1.2, < 3) - ffi (1.9.23) + ffi (1.11.1) forwardable-extended (2.6.0) gemoji (3.0.0) github-pages (182) From 6afc170e31f5fbb7e10aad3d52ca1fc90256b9a8 Mon Sep 17 00:00:00 2001 From: Hobo Chen Date: Sat, 31 Aug 2019 04:56:31 +0800 Subject: [PATCH 456/552] Remove template func RegisterXXXServer() unused param opts []grpc.DialOption (#1018) --- examples/proto/examplepb/a_bit_of_everything.pb.gw.go | 4 ++-- examples/proto/examplepb/echo_service.pb.gw.go | 2 +- examples/proto/examplepb/flow_combination.pb.gw.go | 2 +- examples/proto/examplepb/response_body_service.pb.gw.go | 2 +- examples/proto/examplepb/stream.pb.gw.go | 2 +- examples/proto/examplepb/unannotated_echo_service.pb.gw.go | 2 +- examples/proto/examplepb/wrappers.pb.gw.go | 2 +- protoc-gen-grpc-gateway/gengateway/template.go | 2 +- protoc-gen-grpc-gateway/gengateway/template_test.go | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index 32080de1dac..b86b40cccb1 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -2000,7 +2000,7 @@ func local_request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler r // RegisterABitOfEverythingServiceHandlerServer registers the http handlers for service ABitOfEverythingService to "mux". // UnaryRPC :call ABitOfEverythingServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ABitOfEverythingServiceServer, opts []grpc.DialOption) error { +func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ABitOfEverythingServiceServer) error { mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -2408,7 +2408,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt // RegisterCamelCaseServiceNameHandlerServer registers the http handlers for service CamelCaseServiceName to "mux". // UnaryRPC :call CamelCaseServiceNameServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CamelCaseServiceNameServer, opts []grpc.DialOption) error { +func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CamelCaseServiceNameServer) error { mux.Handle("GET", pattern_CamelCaseServiceName_Empty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index f86a9be9d25..26c82ddaf77 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -573,7 +573,7 @@ func local_request_EchoService_EchoDelete_0(ctx context.Context, marshaler runti // RegisterEchoServiceHandlerServer registers the http handlers for service EchoService to "mux". // UnaryRPC :call EchoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer, opts []grpc.DialOption) error { +func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error { mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index 8d5a83e6e37..13dacf6400c 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -1463,7 +1463,7 @@ func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshale // RegisterFlowCombinationHandlerServer registers the http handlers for service FlowCombination to "mux". // UnaryRPC :call FlowCombinationServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer, opts []grpc.DialOption) error { +func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FlowCombinationServer) error { mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index 8b82a1b816e..8937e2cad3d 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -193,7 +193,7 @@ func local_request_ResponseBodyService_ListResponseStrings_0(ctx context.Context // RegisterResponseBodyServiceHandlerServer registers the http handlers for service ResponseBodyService to "mux". // UnaryRPC :call ResponseBodyServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResponseBodyServiceServer, opts []grpc.DialOption) error { +func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResponseBodyServiceServer) error { mux.Handle("GET", pattern_ResponseBodyService_GetResponseBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index 117e0903bf5..b2629f9a564 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -146,7 +146,7 @@ func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Mar // RegisterStreamServiceHandlerServer registers the http handlers for service StreamService to "mux". // UnaryRPC :call StreamServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer, opts []grpc.DialOption) error { +func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StreamServiceServer) error { mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index fdb9f186e19..04ab538bcf6 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -258,7 +258,7 @@ func local_request_UnannotatedEchoService_EchoDelete_0(ctx context.Context, mars // RegisterUnannotatedEchoServiceHandlerServer registers the http handlers for service UnannotatedEchoService to "mux". // UnaryRPC :call UnannotatedEchoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UnannotatedEchoServiceServer, opts []grpc.DialOption) error { +func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UnannotatedEchoServiceServer) error { mux.Handle("POST", pattern_UnannotatedEchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index beaf2bf5fc4..8896b32124f 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -407,7 +407,7 @@ func local_request_WrappersService_CreateEmpty_0(ctx context.Context, marshaler // RegisterWrappersServiceHandlerServer registers the http handlers for service WrappersService to "mux". // UnaryRPC :call WrappersServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WrappersServiceServer, opts []grpc.DialOption) error { +func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WrappersServiceServer) error { mux.Handle("POST", pattern_WrappersService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index a524fa25fc9..0751cd3cea7 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -546,7 +546,7 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct // Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server registers the http handlers for service {{$svc.GetName}} to "mux". // UnaryRPC :call {{$svc.GetName}}Server directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server, opts []grpc.DialOption) error { +func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, mux *runtime.ServeMux, server {{$svc.GetName}}Server) error { {{range $m := $svc.Methods}} {{range $b := $m.Bindings}} {{if or $m.GetClientStreaming $m.GetServerStreaming}} diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index b18162e4266..eca95556c9a 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -570,7 +570,7 @@ func TestApplyTemplateInProcess(t *testing.T) { } } - if want := `func RegisterExampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServiceServer, opts []grpc.DialOption) error {`; !strings.Contains(got, want) { + if want := `func RegisterExampleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleServiceServer) error {`; !strings.Contains(got, want) { t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) } } From 4242732b669188c3ff76925ef4f6bd14096fcb1f Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 30 Aug 2019 22:14:36 +0100 Subject: [PATCH 457/552] Generate changelog for 1.11.0 --- CHANGELOG.md | 20 ++++++++++++++++++++ Makefile | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f42367a063c..cb476a4f02a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Change Log +## [v1.11.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.11.0) (2019-08-30) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.10.0...v1.11.0) + +**Fixed bugs:** + +- protoc-gen-grpc-gateway fails silently after release 1.10 [\#1013](https://github.com/grpc-ecosystem/grpc-gateway/issues/1013) + +**Closed issues:** + +- protoc-gen-swagger does not generate parameters other than body and path parameters. [\#1012](https://github.com/grpc-ecosystem/grpc-gateway/issues/1012) + +**Merged pull requests:** + +- remove template func RegisterXXXServer\(\) unused param opts \[\]grpc.DialOption [\#1018](https://github.com/grpc-ecosystem/grpc-gateway/pull/1018) ([hb-chen](https://github.com/hb-chen)) +- Fix hand-crafted protobuf message [\#1016](https://github.com/grpc-ecosystem/grpc-gateway/pull/1016) ([dsnet](https://github.com/dsnet)) +- Bump ffi from 1.9.23 to 1.11.1 in /docs [\#1009](https://github.com/grpc-ecosystem/grpc-gateway/pull/1009) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump rubyzip from 1.2.1 to 1.2.3 in /docs [\#1008](https://github.com/grpc-ecosystem/grpc-gateway/pull/1008) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump nokogiri from 1.8.2 to 1.10.4 in /docs [\#1007](https://github.com/grpc-ecosystem/grpc-gateway/pull/1007) ([dependabot[bot]](https://github.com/apps/dependabot)) + ## [v1.10.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.10.0) (2019-08-28) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.9.6...v1.10.0) @@ -21,6 +40,7 @@ **Merged pull requests:** +- Generate changelog for 1.10.0 [\#1011](https://github.com/grpc-ecosystem/grpc-gateway/pull/1011) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Allow overriding the primitive type of fields [\#1003](https://github.com/grpc-ecosystem/grpc-gateway/pull/1003) ([snowzach](https://github.com/snowzach)) - Add Continuous Fuzzing Integration via fuzzit.dev [\#1001](https://github.com/grpc-ecosystem/grpc-gateway/pull/1001) ([yevgenypats](https://github.com/yevgenypats)) diff --git a/Makefile b/Makefile index a5751064323..77adf474592 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.10.0 + --future-release=v1.11.0 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From e72ba9ab0dd9f2303aee01dcc21ae524636da12c Mon Sep 17 00:00:00 2001 From: Yevgeny Pats Date: Sat, 31 Aug 2019 10:30:30 +0300 Subject: [PATCH 458/552] Fuzzit: use go-fuzz with go-modules support --- .circleci/config.yml | 2 +- fuzzit.sh | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3ce4687d4dd..f4332817307 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,7 +51,7 @@ jobs: fuzzit: docker: - image: fuzzitdev/fuzzit:golang1.12-stretch-llvm9 - working_directory: /go/src/github.com/grpc-gateway/grpc-gateway + working_directory: /src/grpc-gateway steps: - checkout - setup_remote_docker diff --git a/fuzzit.sh b/fuzzit.sh index 63d35a57675..e5df5f3f843 100755 --- a/fuzzit.sh +++ b/fuzzit.sh @@ -1,18 +1,16 @@ #!/bin/bash set -xe -# Go-fuzz doesn't support modules yet, so ensure we do everything in the old style GOPATH way -export GO111MODULE="off" +# We use fuzzit fork until go-fuzz will support go-modules +mkdir -p /go/src/github.com/dvyukov +cd /go/src/github.com/dvyukov +git clone https://github.com/fuzzitdev/go-fuzz +cd go-fuzz +go get ./... +go build ./... -# Install go-fuzz -go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build - -# Compiling fuzz targets in fuzz.go with go-fuzz (https://github.com/dvyukov/go-fuzz) and libFuzzer support -# This is a workaround until go-fuzz has gomodules support https://github.com/dvyukov/go-fuzz/issues/195 -BRANCH=$(git rev-parse --abbrev-ref HEAD) -git branch --set-upstream-to=origin/master $BRANCH - -go get -v -u ./protoc-gen-grpc-gateway/httprule +#go get -v -u ./protoc-gen-grpc-gateway/httprule +cd /src/grpc-gateway go-fuzz-build -libfuzzer -o parse-http-rule.a ./protoc-gen-grpc-gateway/httprule clang-9 -fsanitize=fuzzer parse-http-rule.a -o parse-http-rule From 72e75f3ee638a7156ad90cc4d878ead765e89836 Mon Sep 17 00:00:00 2001 From: Hobo Chen Date: Sat, 31 Aug 2019 17:37:33 +0800 Subject: [PATCH 459/552] Use incoming context for direct server calls (#1021) * invoke in process server need attach md to incoming context * else if code style --- .../examplepb/a_bit_of_everything.pb.gw.go | 42 ++-- .../proto/examplepb/echo_service.pb.gw.go | 14 +- .../proto/examplepb/flow_combination.pb.gw.go | 24 +-- .../examplepb/response_body_service.pb.gw.go | 6 +- .../unannotated_echo_service.pb.gw.go | 8 +- examples/proto/examplepb/wrappers.pb.gw.go | 22 +- .../gengateway/template.go | 2 +- runtime/context.go | 34 ++- runtime/context_test.go | 203 ++++++++++++++++++ 9 files changed, 292 insertions(+), 63 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index b86b40cccb1..11bb93e3bca 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -2006,7 +2006,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2026,7 +2026,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2046,7 +2046,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2066,7 +2066,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2086,7 +2086,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2106,7 +2106,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2126,7 +2126,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2146,7 +2146,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2166,7 +2166,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2186,7 +2186,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2206,7 +2206,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2226,7 +2226,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2246,7 +2246,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2266,7 +2266,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2286,7 +2286,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2306,7 +2306,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2326,7 +2326,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2346,7 +2346,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2366,7 +2366,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2386,7 +2386,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2414,7 +2414,7 @@ func RegisterCamelCaseServiceNameHandlerServer(ctx context.Context, mux *runtime ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index 26c82ddaf77..a0445e04929 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -579,7 +579,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -599,7 +599,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -619,7 +619,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -639,7 +639,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -659,7 +659,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -679,7 +679,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -699,7 +699,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index 13dacf6400c..c69b4f1daae 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -1469,7 +1469,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1510,7 +1510,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1530,7 +1530,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1550,7 +1550,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1570,7 +1570,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1590,7 +1590,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1610,7 +1610,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1630,7 +1630,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1650,7 +1650,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1670,7 +1670,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1690,7 +1690,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1710,7 +1710,7 @@ func RegisterFlowCombinationHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index 8937e2cad3d..e90bba3f44c 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -199,7 +199,7 @@ func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime. ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -219,7 +219,7 @@ func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime. ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -239,7 +239,7 @@ func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime. ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index 04ab538bcf6..e92b4af943c 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -264,7 +264,7 @@ func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runti ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -284,7 +284,7 @@ func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runti ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -304,7 +304,7 @@ func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runti ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -324,7 +324,7 @@ func RegisterUnannotatedEchoServiceHandlerServer(ctx context.Context, mux *runti ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index 8896b32124f..57ff5f69962 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -413,7 +413,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -433,7 +433,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -453,7 +453,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -473,7 +473,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -493,7 +493,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -513,7 +513,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -533,7 +533,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -553,7 +553,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -573,7 +573,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -593,7 +593,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -613,7 +613,7 @@ func RegisterWrappersServiceHandlerServer(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 0751cd3cea7..4dcc9637d5d 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -565,7 +565,7 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server(ctx context.Context, {{- end }} defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return diff --git a/runtime/context.go b/runtime/context.go index 896057e1e1e..f8083821f3d 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -57,13 +57,39 @@ except that the forwarded destination is not another HTTP service but rather a gRPC service. */ func AnnotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (context.Context, error) { + ctx, md, err := annotateContext(ctx, mux, req) + if err != nil { + return nil, err + } + if md == nil { + return ctx, nil + } + + return metadata.NewOutgoingContext(ctx, md), nil +} + +// AnnotateIncomingContext adds context information such as metadata from the request. +// Attach metadata as incoming context. +func AnnotateIncomingContext(ctx context.Context, mux *ServeMux, req *http.Request) (context.Context, error) { + ctx, md, err := annotateContext(ctx, mux, req) + if err != nil { + return nil, err + } + if md == nil { + return ctx, nil + } + + return metadata.NewIncomingContext(ctx, md), nil +} + +func annotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (context.Context, metadata.MD, error) { var pairs []string timeout := DefaultContextTimeout if tm := req.Header.Get(metadataGrpcTimeout); tm != "" { var err error timeout, err = timeoutDecode(tm) if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "invalid grpc-timeout: %s", tm) + return nil, nil, status.Errorf(codes.InvalidArgument, "invalid grpc-timeout: %s", tm) } } @@ -80,7 +106,7 @@ func AnnotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (con if strings.HasSuffix(key, metadataHeaderBinarySuffix) { b, err := decodeBinHeader(val) if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "invalid binary header %s: %s", key, err) + return nil, nil, status.Errorf(codes.InvalidArgument, "invalid binary header %s: %s", key, err) } val = string(b) @@ -111,13 +137,13 @@ func AnnotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (con ctx, _ = context.WithTimeout(ctx, timeout) } if len(pairs) == 0 { - return ctx, nil + return ctx, nil, nil } md := metadata.Pairs(pairs...) for _, mda := range mux.metadataAnnotators { md = metadata.Join(md, mda(ctx, req)) } - return metadata.NewOutgoingContext(ctx, md), nil + return ctx, md, nil } // ServerMetadata consists of metadata sent from gRPC server. diff --git a/runtime/context_test.go b/runtime/context_test.go index 5f752408a03..93e28eca103 100644 --- a/runtime/context_test.go +++ b/runtime/context_test.go @@ -215,3 +215,206 @@ func TestAnnotateContext_SupportsCustomAnnotators(t *testing.T) { } } } + +func TestAnnotateIncomingContext_WorksWithEmpty(t *testing.T) { + ctx := context.Background() + + request, err := http.NewRequest("GET", "http://www.example.com", nil) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) + } + request.Header.Add("Some-Irrelevant-Header", "some value") + annotated, err := runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request) + if err != nil { + t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) + return + } + md, ok := metadata.FromIncomingContext(annotated) + if !ok || len(md) != emptyForwardMetaCount { + t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount, md) + } +} + +func TestAnnotateIncomingContext_ForwardsGrpcMetadata(t *testing.T) { + ctx := context.Background() + request, err := http.NewRequest("GET", "http://www.example.com", nil) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) + } + request.Header.Add("Some-Irrelevant-Header", "some value") + request.Header.Add("Grpc-Metadata-FooBar", "Value1") + request.Header.Add("Grpc-Metadata-Foo-BAZ", "Value2") + request.Header.Add("Grpc-Metadata-foo-bAz", "Value3") + request.Header.Add("Authorization", "Token 1234567890") + annotated, err := runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request) + if err != nil { + t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) + return + } + md, ok := metadata.FromIncomingContext(annotated) + if got, want := len(md), emptyForwardMetaCount+4; !ok || got != want { + t.Errorf("metadata items in context = %d want %d: %v", got, want, md) + } + if got, want := md["foobar"], []string{"Value1"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["grpcgateway-foobar"] = %q; want %q`, got, want) + } + if got, want := md["foo-baz"], []string{"Value2", "Value3"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["grpcgateway-foo-baz"] = %q want %q`, got, want) + } + if got, want := md["grpcgateway-authorization"], []string{"Token 1234567890"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["grpcgateway-authorization"] = %q want %q`, got, want) + } + if got, want := md["authorization"], []string{"Token 1234567890"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["authorization"] = %q want %q`, got, want) + } +} + +func TestAnnotateIncomingContext_ForwardGrpcBinaryMetadata(t *testing.T) { + ctx := context.Background() + request, err := http.NewRequest("GET", "http://www.example.com", nil) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) + } + + binData := []byte("\x00test-binary-data") + request.Header.Add("Grpc-Metadata-Test-Bin", base64.StdEncoding.EncodeToString(binData)) + + annotated, err := runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request) + if err != nil { + t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) + return + } + md, ok := metadata.FromIncomingContext(annotated) + if !ok || len(md) != emptyForwardMetaCount+1 { + t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) + } + if got, want := md["test-bin"], []string{string(binData)}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["test-bin"] = %q want %q`, got, want) + } +} + +func TestAnnotateIncomingContext_XForwardedFor(t *testing.T) { + ctx := context.Background() + request, err := http.NewRequest("GET", "http://bar.foo.example.com", nil) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://bar.foo.example.com", err) + } + request.Header.Add("X-Forwarded-For", "192.0.2.100") // client + request.RemoteAddr = "192.0.2.200:12345" // proxy + + annotated, err := runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request) + if err != nil { + t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) + return + } + md, ok := metadata.FromIncomingContext(annotated) + if !ok || len(md) != emptyForwardMetaCount+1 { + t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) + } + if got, want := md["x-forwarded-host"], []string{"bar.foo.example.com"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["host"] = %v; want %v`, got, want) + } + // Note: it must be in order client, proxy1, proxy2 + if got, want := md["x-forwarded-for"], []string{"192.0.2.100, 192.0.2.200"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["x-forwarded-for"] = %v want %v`, got, want) + } +} + +func TestAnnotateIncomingContext_SupportsTimeouts(t *testing.T) { + // While run all test, TestAnnotateContext_SupportsTimeouts() will change the DefaultContextTimeout, so reset it to zero. + runtime.DefaultContextTimeout = 0 * time.Second + + ctx := context.Background() + request, err := http.NewRequest("GET", "http://example.com", nil) + if err != nil { + t.Fatalf(`http.NewRequest("GET", "http://example.com", nil failed with %v; want success`, err) + } + annotated, err := runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request) + if err != nil { + t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) + return + } + if _, ok := annotated.Deadline(); ok { + // no deadline by default + t.Errorf("annotated.Deadline() = _, true; want _, false") + } + + const acceptableError = 50 * time.Millisecond + runtime.DefaultContextTimeout = 10 * time.Second + annotated, err = runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request) + if err != nil { + t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) + return + } + deadline, ok := annotated.Deadline() + if !ok { + t.Errorf("annotated.Deadline() = _, false; want _, true") + } + if got, want := deadline.Sub(time.Now()), runtime.DefaultContextTimeout; got-want > acceptableError || got-want < -acceptableError { + t.Errorf("deadline.Sub(time.Now()) = %v; want %v; with error %v", got, want, acceptableError) + } + + for _, spec := range []struct { + timeout string + want time.Duration + }{ + { + timeout: "17H", + want: 17 * time.Hour, + }, + { + timeout: "19M", + want: 19 * time.Minute, + }, + { + timeout: "23S", + want: 23 * time.Second, + }, + { + timeout: "1009m", + want: 1009 * time.Millisecond, + }, + { + timeout: "1000003u", + want: 1000003 * time.Microsecond, + }, + { + timeout: "100000007n", + want: 100000007 * time.Nanosecond, + }, + } { + request.Header.Set("Grpc-Timeout", spec.timeout) + annotated, err = runtime.AnnotateIncomingContext(ctx, runtime.NewServeMux(), request) + if err != nil { + t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) + return + } + deadline, ok := annotated.Deadline() + if !ok { + t.Errorf("annotated.Deadline() = _, false; want _, true; timeout = %q", spec.timeout) + } + if got, want := deadline.Sub(time.Now()), spec.want; got-want > acceptableError || got-want < -acceptableError { + t.Errorf("deadline.Sub(time.Now()) = %v; want %v; with error %v; timeout= %q", got, want, acceptableError, spec.timeout) + } + } +} +func TestAnnotateIncomingContext_SupportsCustomAnnotators(t *testing.T) { + md1 := func(context.Context, *http.Request) metadata.MD { return metadata.New(map[string]string{"foo": "bar"}) } + md2 := func(context.Context, *http.Request) metadata.MD { return metadata.New(map[string]string{"baz": "qux"}) } + expected := metadata.New(map[string]string{"foo": "bar", "baz": "qux"}) + request, err := http.NewRequest("GET", "http://example.com", nil) + if err != nil { + t.Fatalf(`http.NewRequest("GET", "http://example.com", nil failed with %v; want success`, err) + } + annotated, err := runtime.AnnotateIncomingContext(context.Background(), runtime.NewServeMux(runtime.WithMetadata(md1), runtime.WithMetadata(md2)), request) + if err != nil { + t.Errorf("runtime.AnnotateIncomingContext(ctx, %#v) failed with %v; want success", request, err) + return + } + actual, _ := metadata.FromIncomingContext(annotated) + for key, e := range expected { + if a, ok := actual[key]; !ok || !reflect.DeepEqual(e, a) { + t.Errorf("metadata.MD[%s] = %v; want %v", key, a, e) + } + } +} From 30d69ebd00798e1683b3663fe1e72fb5eca8d68c Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 2 Sep 2019 18:20:31 +0100 Subject: [PATCH 460/552] Generate changelog for 1.11.1 --- CHANGELOG.md | 19 +++++++++++++++++++ Makefile | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb476a4f02a..0c39858b0b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Change Log +## [v1.11.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.11.1) (2019-09-02) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.11.0...v1.11.1) + +**Fixed bugs:** + +- protoc\_gen\_swagger openapiv2\_field definition ignores the type option [\#1002](https://github.com/grpc-ecosystem/grpc-gateway/issues/1002) + +**Closed issues:** + +- AnnotateIncomingContext not declared by package runtime [\#1023](https://github.com/grpc-ecosystem/grpc-gateway/issues/1023) +- Fuzzit CI job is failing unexpectedly [\#1019](https://github.com/grpc-ecosystem/grpc-gateway/issues/1019) +- Bazel Rule? [\#1010](https://github.com/grpc-ecosystem/grpc-gateway/issues/1010) + +**Merged pull requests:** + +- Fuzzit: use go-fuzz with go-modules support [\#1022](https://github.com/grpc-ecosystem/grpc-gateway/pull/1022) ([yevgenypats](https://github.com/yevgenypats)) +- invoke in process server need attach md to incoming context [\#1021](https://github.com/grpc-ecosystem/grpc-gateway/pull/1021) ([hb-chen](https://github.com/hb-chen)) + ## [v1.11.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.11.0) (2019-08-30) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.10.0...v1.11.0) @@ -13,6 +31,7 @@ **Merged pull requests:** +- Generate changelog for 1.11.0 [\#1020](https://github.com/grpc-ecosystem/grpc-gateway/pull/1020) ([johanbrandhorst](https://github.com/johanbrandhorst)) - remove template func RegisterXXXServer\(\) unused param opts \[\]grpc.DialOption [\#1018](https://github.com/grpc-ecosystem/grpc-gateway/pull/1018) ([hb-chen](https://github.com/hb-chen)) - Fix hand-crafted protobuf message [\#1016](https://github.com/grpc-ecosystem/grpc-gateway/pull/1016) ([dsnet](https://github.com/dsnet)) - Bump ffi from 1.9.23 to 1.11.1 in /docs [\#1009](https://github.com/grpc-ecosystem/grpc-gateway/pull/1009) ([dependabot[bot]](https://github.com/apps/dependabot)) diff --git a/Makefile b/Makefile index 77adf474592..f1af53985ce 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.11.0 + --future-release=v1.11.1 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From fff5b4cae4628d6c2e47d859d920f060bca118dd Mon Sep 17 00:00:00 2001 From: Zach Gershman Date: Tue, 3 Sep 2019 08:32:39 -0700 Subject: [PATCH 461/552] docs need type assertion on proto.Message (#1026) * docs need type assertion on proto.Message * Update docs/_docs/customizingyourgateway.md Co-Authored-By: Johan Brandhorst --- docs/_docs/customizingyourgateway.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/_docs/customizingyourgateway.md b/docs/_docs/customizingyourgateway.md index 73286d9f8c9..a22ce80594c 100644 --- a/docs/_docs/customizingyourgateway.md +++ b/docs/_docs/customizingyourgateway.md @@ -104,8 +104,13 @@ Or you might want to mutate the response messages to be returned. 1. Write a filter function. ```go func myFilter(ctx context.Context, w http.ResponseWriter, resp proto.Message) error { - w.Header().Set("X-My-Tracking-Token", resp.Token) - resp.Token = "" + t, ok := resp.(*externalpb.Tokenizer) + + if ok { + w.Header().Set("X-My-Tracking-Token", t.Token) + t.Token = "" + } + return nil } ``` From 1e8459c69469d910ae2f94c83b382171fb5f18a6 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 4 Sep 2019 05:14:49 +0200 Subject: [PATCH 462/552] runtime: stop using nil ponters with Unmarshal (#1028) * runtime: stop using nil ponters with Unmarshal Fixes #1025 --- runtime/BUILD.bazel | 1 + runtime/convert.go | 18 +++-- runtime/convert_test.go | 143 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 6 deletions(-) create mode 100644 runtime/convert_test.go diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index 20862228ef8..d03ca5c97a2 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -48,6 +48,7 @@ go_test( size = "small", srcs = [ "context_test.go", + "convert_test.go", "errors_test.go", "fieldmask_test.go", "handler_test.go", diff --git a/runtime/convert.go b/runtime/convert.go index a5b3bd6a792..2c279344dc4 100644 --- a/runtime/convert.go +++ b/runtime/convert.go @@ -206,16 +206,22 @@ func BytesSlice(val, sep string) ([][]byte, error) { // Timestamp converts the given RFC3339 formatted string into a timestamp.Timestamp. func Timestamp(val string) (*timestamp.Timestamp, error) { - var r *timestamp.Timestamp - err := jsonpb.UnmarshalString(val, r) - return r, err + var r timestamp.Timestamp + err := jsonpb.UnmarshalString(val, &r) + if err != nil { + return nil, err + } + return &r, nil } // Duration converts the given string into a timestamp.Duration. func Duration(val string) (*duration.Duration, error) { - var r *duration.Duration - err := jsonpb.UnmarshalString(val, r) - return r, err + var r duration.Duration + err := jsonpb.UnmarshalString(val, &r) + if err != nil { + return nil, err + } + return &r, nil } // Enum converts the given string into an int32 that should be type casted into the diff --git a/runtime/convert_test.go b/runtime/convert_test.go new file mode 100644 index 00000000000..ffbc0a56553 --- /dev/null +++ b/runtime/convert_test.go @@ -0,0 +1,143 @@ +package runtime_test + +import ( + "encoding/json" + "fmt" + "reflect" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/duration" + "github.com/golang/protobuf/ptypes/timestamp" + "github.com/grpc-ecosystem/grpc-gateway/runtime" +) + +func TestConvertTimestamp(t *testing.T) { + specs := []struct { + name string + input string + output *timestamp.Timestamp + wanterr error + }{ + { + name: "a valid RFC3339 timestamp", + input: `"2016-05-10T10:19:13.123Z"`, + output: ×tamp.Timestamp{ + Seconds: 1462875553, + Nanos: 123000000, + }, + wanterr: nil, + }, + { + name: "invalid timestamp", + input: `"05-10-2016T10:19:13.123Z"`, + output: nil, + wanterr: fmt.Errorf(`bad Timestamp: parsing time "05-10-2016T10:19:13.123Z" as "2006-01-02T15:04:05.999999999Z07:00": cannot parse "0-2016T10:19:13.123Z" as "2006"`), + }, + { + name: "JSON number", + input: "123", + output: nil, + wanterr: &json.UnmarshalTypeError{ + Value: "number", + Type: reflect.TypeOf("123"), + Offset: 3, + }, + }, + { + name: "JSON bool", + input: "true", + output: nil, + wanterr: &json.UnmarshalTypeError{ + Value: "bool", + Type: reflect.TypeOf("123"), + Offset: 4, + }, + }, + } + + for _, spec := range specs { + t.Run(spec.name, func(t *testing.T) { + ts, err := runtime.Timestamp(spec.input) + if spec.wanterr != nil { + if !reflect.DeepEqual(err, spec.wanterr) { + t.Errorf("got unexpected error\n%#v\nexpected\n%#v", err, spec.wanterr) + } + return + } + if !proto.Equal(ts, spec.output) { + t.Errorf( + "when testing %s; got\n%#v\nexpected\n%#v", + spec.name, + ts, + spec.output, + ) + } + }) + } +} + +func TestConvertDuration(t *testing.T) { + specs := []struct { + name string + input string + output *duration.Duration + wanterr error + }{ + { + name: "a valid duration", + input: `"123.456s"`, + output: &duration.Duration{ + Seconds: 123, + Nanos: 456000000, + }, + wanterr: nil, + }, + { + name: "invalid duration", + input: `"123years"`, + output: nil, + wanterr: fmt.Errorf(`bad Duration: time: unknown unit years in duration 123years`), + }, + { + name: "JSON number", + input: "123", + output: nil, + wanterr: &json.UnmarshalTypeError{ + Value: "number", + Type: reflect.TypeOf("123"), + Offset: 3, + }, + }, + { + name: "JSON bool", + input: "true", + output: nil, + wanterr: &json.UnmarshalTypeError{ + Value: "bool", + Type: reflect.TypeOf("123"), + Offset: 4, + }, + }, + } + + for _, spec := range specs { + t.Run(spec.name, func(t *testing.T) { + ts, err := runtime.Duration(spec.input) + if spec.wanterr != nil { + if !reflect.DeepEqual(err, spec.wanterr) { + t.Errorf("got unexpected error\n%#v\nexpected\n%#v", err, spec.wanterr) + } + return + } + if !proto.Equal(ts, spec.output) { + t.Errorf( + "when testing %s; got\n%#v\nexpected\n%#v", + spec.name, + ts, + spec.output, + ) + } + }) + } +} From 7f62597797c9fd9a83d1605c4355345af051451e Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 4 Sep 2019 10:33:31 +0200 Subject: [PATCH 463/552] nitpick a_bit_of_everything.proto (#1030) * examples/ABE: fix typo, replace spaces Signed-off-by: Stephan Renatus * examples/ABE: fix typo, replace spaces [regenerate] Signed-off-by: Stephan Renatus --- .../proto/examplepb/a_bit_of_everything.pb.go | 23 +++++++++---------- .../proto/examplepb/a_bit_of_everything.proto | 17 +++++++------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 677cdab761e..0799993d5bf 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{0} + return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{0} } // DeepEnum is one or zero. @@ -81,11 +81,10 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{0, 0, 0} } -// Intentionaly complicated message type to cover many features of Protobuf. -// NEXT ID: 30 +// Intentionally complicated message type to cover many features of Protobuf. type ABitOfEverything struct { SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested,proto3" json:"single_nested,omitempty"` Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` @@ -140,7 +139,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{0} + return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -521,7 +520,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{0, 0} + return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -590,7 +589,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{1} + return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -733,7 +732,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{2} + return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -772,7 +771,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{3} + return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -819,7 +818,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71, []int{4} + return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1649,10 +1648,10 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71) + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_8015f566ede6db7f) } -var fileDescriptor_a_bit_of_everything_f9a4fe1a63432c71 = []byte{ +var fileDescriptor_a_bit_of_everything_8015f566ede6db7f = []byte{ // 3345 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x3a, 0x4b, 0x73, 0x1b, 0x47, 0x7a, 0x1c, 0x0c, 0x9f, 0xcd, 0x17, 0xd8, 0x94, 0x28, 0x10, 0xa2, 0xcd, 0x16, 0x24, 0xaf, 0xc7, diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 85235fa9520..ce0b654823d 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -131,8 +131,7 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { }; -// Intentionaly complicated message type to cover many features of Protobuf. -// NEXT ID: 30 +// Intentionally complicated message type to cover many features of Protobuf. message ABitOfEverything { option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = { json_schema: { @@ -205,7 +204,7 @@ message ABitOfEverything { // repeated enum value. it is comma-separated in query repeated NumericEnum repeated_enum_value = 28; - // repeated numeric enum comment (This comment is overridden by the field annotation) + // repeated numeric enum comment (This comment is overridden by the field annotation) repeated NumericEnum repeated_enum_annotation = 32 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {title: "Repeated numeric enum title", description: "Repeated numeric enum description."}]; // numeric enum comment (This comment is overridden by the field annotation) @@ -440,17 +439,17 @@ service ABitOfEverythingService { body: "*" }; } - rpc CheckGetQueryParams(ABitOfEverything) returns (ABitOfEverything) { - option (google.api.http) = { + rpc CheckGetQueryParams(ABitOfEverything) returns (ABitOfEverything) { + option (google.api.http) = { get: "/v1/example/a_bit_of_everything/params/get/{single_nested.name}" }; - } - rpc CheckPostQueryParams(ABitOfEverything) returns (ABitOfEverything) { - option (google.api.http) = { + } + rpc CheckPostQueryParams(ABitOfEverything) returns (ABitOfEverything) { + option (google.api.http) = { post: "/v1/example/a_bit_of_everything/params/post/{string_value}" body: "single_nested" }; - } + } } // camelCase and lowercase service names are valid but not recommended (use TitleCase instead) From 68af84a94bfbb990dbf587e50b348b1c6b3e2e56 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 4 Sep 2019 15:04:10 +0200 Subject: [PATCH 464/552] nitpick spacing in other proto files (#1032) * examples/*.proto: make spaces consistent (with tabs) Signed-off-by: Stephan Renatus * examples/*.proto: make spaces consistent (with tabs) [regenerate] Signed-off-by: Stephan Renatus --- .../examplepb/response_body_service.pb.go | 18 +-- .../examplepb/response_body_service.proto | 78 ++++++------ .../examplepb/unannotated_echo_service.proto | 4 +- examples/proto/examplepb/wrappers.pb.go | 6 +- examples/proto/examplepb/wrappers.proto | 120 +++++++++--------- 5 files changed, 115 insertions(+), 111 deletions(-) diff --git a/examples/proto/examplepb/response_body_service.pb.go b/examples/proto/examplepb/response_body_service.pb.go index ed7ead481db..ae80ec69077 100644 --- a/examples/proto/examplepb/response_body_service.pb.go +++ b/examples/proto/examplepb/response_body_service.pb.go @@ -50,7 +50,7 @@ func (x RepeatedResponseBodyOut_Response_ResponseType) String() string { return proto.EnumName(RepeatedResponseBodyOut_Response_ResponseType_name, int32(x)) } func (RepeatedResponseBodyOut_Response_ResponseType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_d3778d99bb1173be, []int{2, 0, 0} + return fileDescriptor_response_body_service_dd1070a6693ff118, []int{2, 0, 0} } type ResponseBodyIn struct { @@ -64,7 +64,7 @@ func (m *ResponseBodyIn) Reset() { *m = ResponseBodyIn{} } func (m *ResponseBodyIn) String() string { return proto.CompactTextString(m) } func (*ResponseBodyIn) ProtoMessage() {} func (*ResponseBodyIn) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_d3778d99bb1173be, []int{0} + return fileDescriptor_response_body_service_dd1070a6693ff118, []int{0} } func (m *ResponseBodyIn) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyIn.Unmarshal(m, b) @@ -102,7 +102,7 @@ func (m *ResponseBodyOut) Reset() { *m = ResponseBodyOut{} } func (m *ResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut) ProtoMessage() {} func (*ResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_d3778d99bb1173be, []int{1} + return fileDescriptor_response_body_service_dd1070a6693ff118, []int{1} } func (m *ResponseBodyOut) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyOut.Unmarshal(m, b) @@ -140,7 +140,7 @@ func (m *ResponseBodyOut_Response) Reset() { *m = ResponseBodyOut_Respon func (m *ResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut_Response) ProtoMessage() {} func (*ResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_d3778d99bb1173be, []int{1, 0} + return fileDescriptor_response_body_service_dd1070a6693ff118, []int{1, 0} } func (m *ResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyOut_Response.Unmarshal(m, b) @@ -178,7 +178,7 @@ func (m *RepeatedResponseBodyOut) Reset() { *m = RepeatedResponseBodyOut func (m *RepeatedResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseBodyOut) ProtoMessage() {} func (*RepeatedResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_d3778d99bb1173be, []int{2} + return fileDescriptor_response_body_service_dd1070a6693ff118, []int{2} } func (m *RepeatedResponseBodyOut) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseBodyOut.Unmarshal(m, b) @@ -217,7 +217,7 @@ func (m *RepeatedResponseBodyOut_Response) Reset() { *m = RepeatedRespon func (m *RepeatedResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseBodyOut_Response) ProtoMessage() {} func (*RepeatedResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_d3778d99bb1173be, []int{2, 0} + return fileDescriptor_response_body_service_dd1070a6693ff118, []int{2, 0} } func (m *RepeatedResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseBodyOut_Response.Unmarshal(m, b) @@ -262,7 +262,7 @@ func (m *RepeatedResponseStrings) Reset() { *m = RepeatedResponseStrings func (m *RepeatedResponseStrings) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseStrings) ProtoMessage() {} func (*RepeatedResponseStrings) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_d3778d99bb1173be, []int{3} + return fileDescriptor_response_body_service_dd1070a6693ff118, []int{3} } func (m *RepeatedResponseStrings) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseStrings.Unmarshal(m, b) @@ -438,10 +438,10 @@ var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_response_body_service_d3778d99bb1173be) + proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_response_body_service_dd1070a6693ff118) } -var fileDescriptor_response_body_service_d3778d99bb1173be = []byte{ +var fileDescriptor_response_body_service_dd1070a6693ff118 = []byte{ // 441 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0xcf, 0xaa, 0xd3, 0x40, 0x14, 0xc6, 0x9d, 0xb4, 0x5e, 0x6f, 0x27, 0x72, 0x6f, 0x99, 0x2b, 0xf7, 0x86, 0x22, 0x1a, 0x07, diff --git a/examples/proto/examplepb/response_body_service.proto b/examples/proto/examplepb/response_body_service.proto index 48b50f80545..215591daf95 100644 --- a/examples/proto/examplepb/response_body_service.proto +++ b/examples/proto/examplepb/response_body_service.proto @@ -5,50 +5,54 @@ package grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; -message ResponseBodyIn { string data = 1; } +message ResponseBodyIn { + string data = 1; +} message ResponseBodyOut { - message Response { string data = 1; } - Response response = 2; + message Response { + string data = 1; + } + Response response = 2; } message RepeatedResponseBodyOut { - message Response { - string data = 1; - enum ResponseType { - // UNKNOWN - UNKNOWN = 0; - // A is 1 - A = 1; - // B is 2 - B = 2; - } - ResponseType type = 3; - } - repeated Response response = 2; + message Response { + string data = 1; + enum ResponseType { + // UNKNOWN + UNKNOWN = 0; + // A is 1 + A = 1; + // B is 2 + B = 2; + } + ResponseType type = 3; + } + repeated Response response = 2; } -message RepeatedResponseStrings { repeated string values = 1; } +message RepeatedResponseStrings { + repeated string values = 1; +} service ResponseBodyService { - rpc GetResponseBody(ResponseBodyIn) returns (ResponseBodyOut) { - option (google.api.http) = { - get : "/responsebody/{data}" - response_body : "response" - }; - } - - rpc ListResponseBodies(ResponseBodyIn) returns (RepeatedResponseBodyOut) { - option (google.api.http) = { - get : "/responsebodies/{data}" - response_body : "response" - }; - } - - rpc ListResponseStrings(ResponseBodyIn) returns (RepeatedResponseStrings) { - option (google.api.http) = { - get : "/responsestrings/{data}" - response_body : "values" - }; - } + rpc GetResponseBody(ResponseBodyIn) returns (ResponseBodyOut) { + option (google.api.http) = { + get : "/responsebody/{data}" + response_body : "response" + }; + } + rpc ListResponseBodies(ResponseBodyIn) returns (RepeatedResponseBodyOut) { + option (google.api.http) = { + get : "/responsebodies/{data}" + response_body : "response" + }; + } + rpc ListResponseStrings(ResponseBodyIn) returns (RepeatedResponseStrings) { + option (google.api.http) = { + get : "/responsestrings/{data}" + response_body : "values" + }; + } } diff --git a/examples/proto/examplepb/unannotated_echo_service.proto b/examples/proto/examplepb/unannotated_echo_service.proto index 9187f78e2de..6c3dbfeaf9a 100644 --- a/examples/proto/examplepb/unannotated_echo_service.proto +++ b/examples/proto/examplepb/unannotated_echo_service.proto @@ -28,10 +28,10 @@ service UnannotatedEchoService { // The message posted as the id parameter will also be // returned. rpc Echo(UnannotatedSimpleMessage) returns (UnannotatedSimpleMessage); - + // EchoBody method receives a simple message and returns it. rpc EchoBody(UnannotatedSimpleMessage) returns (UnannotatedSimpleMessage); - // EchoDelete method receives a simple message and returns it. + // EchoDelete method receives a simple message and returns it. rpc EchoDelete(UnannotatedSimpleMessage) returns (UnannotatedSimpleMessage); } diff --git a/examples/proto/examplepb/wrappers.pb.go b/examples/proto/examplepb/wrappers.pb.go index 48462f92b92..c0a52fe21bc 100644 --- a/examples/proto/examplepb/wrappers.pb.go +++ b/examples/proto/examplepb/wrappers.pb.go @@ -45,7 +45,7 @@ func (m *Wrappers) Reset() { *m = Wrappers{} } func (m *Wrappers) String() string { return proto.CompactTextString(m) } func (*Wrappers) ProtoMessage() {} func (*Wrappers) Descriptor() ([]byte, []int) { - return fileDescriptor_wrappers_1614a2b17737abd3, []int{0} + return fileDescriptor_wrappers_357c0312be7b0bb0, []int{0} } func (m *Wrappers) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Wrappers.Unmarshal(m, b) @@ -535,10 +535,10 @@ var _WrappersService_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/wrappers.proto", fileDescriptor_wrappers_1614a2b17737abd3) + proto.RegisterFile("examples/proto/examplepb/wrappers.proto", fileDescriptor_wrappers_357c0312be7b0bb0) } -var fileDescriptor_wrappers_1614a2b17737abd3 = []byte{ +var fileDescriptor_wrappers_357c0312be7b0bb0 = []byte{ // 578 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0xdd, 0x6e, 0xd3, 0x30, 0x14, 0xc7, 0xd5, 0x31, 0xca, 0xea, 0x0c, 0xc6, 0x0c, 0x82, 0xcd, 0x9b, 0x18, 0xca, 0x0d, 0xb0, diff --git a/examples/proto/examplepb/wrappers.proto b/examples/proto/examplepb/wrappers.proto index 46b2552a3f7..48ce5a8ec6e 100644 --- a/examples/proto/examplepb/wrappers.proto +++ b/examples/proto/examplepb/wrappers.proto @@ -26,64 +26,64 @@ service WrappersService { }; } - rpc CreateStringValue(google.protobuf.StringValue) returns (google.protobuf.StringValue) { - option (google.api.http) = { - post: "/v1/testString" - body: "*" - }; - } - rpc CreateInt32Value(google.protobuf.Int32Value) returns (google.protobuf.Int32Value) { - option (google.api.http) = { - post: "/v1/testInt32" - body: "*" - }; - } - rpc CreateInt64Value(google.protobuf.Int64Value) returns (google.protobuf.Int64Value){ - option (google.api.http) = { - post: "/v1/testInt64" - body: "*" - }; - } - rpc CreateFloatValue(google.protobuf.FloatValue) returns (google.protobuf.FloatValue){ - option (google.api.http) = { - post: "/v1/testFloat" - body: "*" - }; - } - rpc CreateDoubleValue(google.protobuf.DoubleValue) returns (google.protobuf.DoubleValue){ - option (google.api.http) = { - post: "/v1/testDouble" - body: "*" - }; - } - rpc CreateBoolValue(google.protobuf.BoolValue) returns (google.protobuf.BoolValue){ - option (google.api.http) = { - post: "/v1/testBool" - body: "*" - }; - } - rpc CreateUInt32Value(google.protobuf.UInt32Value) returns (google.protobuf.UInt32Value){ - option (google.api.http) = { - post: "/v1/testUint32" - body: "*" - }; - } - rpc CreateUInt64Value(google.protobuf.UInt64Value) returns (google.protobuf.UInt64Value){ - option (google.api.http) = { - post: "/v1/testUint64" - body: "*" - }; - } - rpc CreateBytesValue(google.protobuf.BytesValue) returns (google.protobuf.BytesValue){ - option (google.api.http) = { - post: "/v1/testBytes" - body: "*" - }; - } - rpc CreateEmpty(google.protobuf.Empty) returns (google.protobuf.Empty){ - option (google.api.http) = { - post: "/v1/testEmpty" - body: "*" - }; - } + rpc CreateStringValue(google.protobuf.StringValue) returns (google.protobuf.StringValue) { + option (google.api.http) = { + post: "/v1/testString" + body: "*" + }; + } + rpc CreateInt32Value(google.protobuf.Int32Value) returns (google.protobuf.Int32Value) { + option (google.api.http) = { + post: "/v1/testInt32" + body: "*" + }; + } + rpc CreateInt64Value(google.protobuf.Int64Value) returns (google.protobuf.Int64Value){ + option (google.api.http) = { + post: "/v1/testInt64" + body: "*" + }; + } + rpc CreateFloatValue(google.protobuf.FloatValue) returns (google.protobuf.FloatValue){ + option (google.api.http) = { + post: "/v1/testFloat" + body: "*" + }; + } + rpc CreateDoubleValue(google.protobuf.DoubleValue) returns (google.protobuf.DoubleValue){ + option (google.api.http) = { + post: "/v1/testDouble" + body: "*" + }; + } + rpc CreateBoolValue(google.protobuf.BoolValue) returns (google.protobuf.BoolValue){ + option (google.api.http) = { + post: "/v1/testBool" + body: "*" + }; + } + rpc CreateUInt32Value(google.protobuf.UInt32Value) returns (google.protobuf.UInt32Value){ + option (google.api.http) = { + post: "/v1/testUint32" + body: "*" + }; + } + rpc CreateUInt64Value(google.protobuf.UInt64Value) returns (google.protobuf.UInt64Value){ + option (google.api.http) = { + post: "/v1/testUint64" + body: "*" + }; + } + rpc CreateBytesValue(google.protobuf.BytesValue) returns (google.protobuf.BytesValue){ + option (google.api.http) = { + post: "/v1/testBytes" + body: "*" + }; + } + rpc CreateEmpty(google.protobuf.Empty) returns (google.protobuf.Empty){ + option (google.api.http) = { + post: "/v1/testEmpty" + body: "*" + }; + } } From 1239278ef3a6264b29b62228e0f322ded5d578e9 Mon Sep 17 00:00:00 2001 From: Dmitry Shemin Date: Wed, 4 Sep 2019 00:14:53 +0700 Subject: [PATCH 465/552] Small performance fix Move static regexp to a global variable in order to avoid multiple regexp pattern compilations. --- protoc-gen-swagger/genswagger/template.go | 7 +- .../genswagger/template_test.go | 22 +++++++ runtime/query.go | 8 +-- runtime/query_test.go | 64 +++++++++++++++++++ 4 files changed, 93 insertions(+), 8 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index dfb8a490854..337fb1a7370 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -612,6 +612,8 @@ func resolveFullyQualifiedNameToSwaggerNames(messages []string, useFQNForSwagger return uniqueNames } +var canRegexp = regexp.MustCompile("{([a-zA-Z][a-zA-Z0-9_.]*).*}") + // Swagger expects paths of the form /path/{string_value} but grpc-gateway paths are expected to be of the form /path/{string_value=strprefix/*}. This should reformat it correctly. func templateToSwaggerPath(path string, reg *descriptor.Registry) string { // It seems like the right thing to do here is to just use @@ -670,14 +672,13 @@ func templateToSwaggerPath(path string, reg *descriptor.Registry) string { // Parts is now an array of segments of the path. Interestingly, since the // syntax for this subsection CAN be handled by a regexp since it has no // memory. - re := regexp.MustCompile("{([a-zA-Z][a-zA-Z0-9_.]*).*}") for index, part := range parts { // If part is a resource name such as "parent", "name", "user.name", the format info must be retained. - prefix := re.ReplaceAllString(part, "$1") + prefix := canRegexp.ReplaceAllString(part, "$1") if isResourceName(prefix) { continue } - parts[index] = re.ReplaceAllString(part, "{$1}") + parts[index] = canRegexp.ReplaceAllString(part, "{$1}") } return strings.Join(parts, "/") diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 06021fe10ce..09902345e65 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -930,6 +930,28 @@ func TestTemplateToSwaggerPath(t *testing.T) { } } +func BenchmarkTemplateToSwaggerPath(b *testing.B) { + const input = "/{user.name=prefix1/*/prefix2/*}:customMethod" + + b.Run("with JSON names", func(b *testing.B) { + reg := descriptor.NewRegistry() + reg.SetUseJSONNamesForFields(false) + + for i := 0; i < b.N; i++ { + _ = templateToSwaggerPath(input, reg) + } + }) + + b.Run("without JSON names", func(b *testing.B) { + reg := descriptor.NewRegistry() + reg.SetUseJSONNamesForFields(true) + + for i := 0; i < b.N; i++ { + _ = templateToSwaggerPath(input, reg) + } + }) +} + func TestResolveFullyQualifiedNameToSwaggerName(t *testing.T) { var tests = []struct { input string diff --git a/runtime/query.go b/runtime/query.go index 5fbba5e8e8b..ee0207e461e 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -15,15 +15,13 @@ import ( "google.golang.org/grpc/grpclog" ) +var valuesKeyRegexp = regexp.MustCompile("^(.*)\\[(.*)\\]$") + // PopulateQueryParameters populates "values" into "msg". // A value is ignored if its key starts with one of the elements in "filter". func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { for key, values := range values { - re, err := regexp.Compile("^(.*)\\[(.*)\\]$") - if err != nil { - return err - } - match := re.FindStringSubmatch(key) + match := valuesKeyRegexp.FindStringSubmatch(key) if len(match) == 3 { key = match[1] values = append([]string{match[2]}, values...) diff --git a/runtime/query_test.go b/runtime/query_test.go index 358847928c8..fb8d27ad769 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -18,6 +18,70 @@ import ( "google.golang.org/genproto/protobuf/field_mask" ) +func BenchmarkPopulateQueryParameters(b *testing.B) { + timeT := time.Date(2016, time.December, 15, 12, 23, 32, 49, time.UTC) + timeStr := timeT.Format(time.RFC3339Nano) + + durationT := 13 * time.Hour + durationStr := durationT.String() + + fieldmaskStr := "float_value,double_value" + + msg := &proto3Message{} + values := url.Values{ + "float_value": {"1.5"}, + "double_value": {"2.5"}, + "int64_value": {"-1"}, + "int32_value": {"-2"}, + "uint64_value": {"3"}, + "uint32_value": {"4"}, + "bool_value": {"true"}, + "string_value": {"str"}, + "bytes_value": {"Ynl0ZXM="}, + "repeated_value": {"a", "b", "c"}, + "enum_value": {"1"}, + "repeated_enum": {"1", "2", "0"}, + "timestamp_value": {timeStr}, + "duration_value": {durationStr}, + "fieldmask_value": {fieldmaskStr}, + "wrapper_float_value": {"1.5"}, + "wrapper_double_value": {"2.5"}, + "wrapper_int64_value": {"-1"}, + "wrapper_int32_value": {"-2"}, + "wrapper_u_int64_value": {"3"}, + "wrapper_u_int32_value": {"4"}, + "wrapper_bool_value": {"true"}, + "wrapper_string_value": {"str"}, + "wrapper_bytes_value": {"Ynl0ZXM="}, + "map_value[key]": {"value"}, + "map_value[second]": {"bar"}, + "map_value[third]": {"zzz"}, + "map_value[fourth]": {""}, + `map_value[~!@#$%^&*()]`: {"value"}, + "map_value2[key]": {"-2"}, + "map_value3[-2]": {"value"}, + "map_value4[key]": {"-1"}, + "map_value5[-1]": {"value"}, + "map_value6[key]": {"3"}, + "map_value7[3]": {"value"}, + "map_value8[key]": {"4"}, + "map_value9[4]": {"value"}, + "map_value10[key]": {"1.5"}, + "map_value11[1.5]": {"value"}, + "map_value12[key]": {"2.5"}, + "map_value13[2.5]": {"value"}, + "map_value14[key]": {"true"}, + "map_value15[true]": {"value"}, + } + filter := utilities.NewDoubleArray([][]string{ + {"bool_value"}, {"repeated_value"}, + }) + + for i := 0; i < b.N; i++ { + _ = runtime.PopulateQueryParameters(msg, values, filter) + } +} + func TestPopulateParameters(t *testing.T) { timeT := time.Date(2016, time.December, 15, 12, 23, 32, 49, time.UTC) timeStr := timeT.Format(time.RFC3339Nano) From a7587413e5b4064396cef49c8c3db3faf94c705a Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Mon, 9 Sep 2019 11:08:39 -0600 Subject: [PATCH 466/552] Configure stale[bot] --- .github/stale.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 00000000000..3a1b5318f38 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,18 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - help wanted + - enhancement + - security +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false From 4d16d216a641cddda3d4c7391eec89821f87c288 Mon Sep 17 00:00:00 2001 From: Cem Enson <23116487+cemenson@users.noreply.github.com> Date: Mon, 9 Sep 2019 19:35:28 +0100 Subject: [PATCH 467/552] added additional info for custom http headers (#1035) * added additional info for custom http headers --- docs/_docs/customizingyourgateway.md | 39 +++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/docs/_docs/customizingyourgateway.md b/docs/_docs/customizingyourgateway.md index a22ce80594c..49dcb1660c4 100644 --- a/docs/_docs/customizingyourgateway.md +++ b/docs/_docs/customizingyourgateway.md @@ -83,18 +83,39 @@ You might not like [the default mapping rule](http://godoc.org/github.com/grpc-e 1. Write a [`HeaderMatcherFunc`](http://godoc.org/github.com/grpc-ecosystem/grpc-gateway/runtime#HeaderMatcherFunc). 2. Register the function with [`WithIncomingHeaderMatcher`](http://godoc.org/github.com/grpc-ecosystem/grpc-gateway/runtime#WithIncomingHeaderMatcher) - e.g. - ```go - func yourMatcher(headerName string) (mdName string, ok bool) { - ... - } - ... - mux := runtime.NewServeMux(runtime.WithIncomingHeaderMatcher(yourMatcher)) + e.g. + ```go + func CustomMatcher(key string) (string, bool) { + switch key { + case "x-custom-header1": + return key, true + case "x-custom-header2": + return "custom-header2", true + default: + return key, false + } + } + ... - ``` + mux := runtime.NewServeMux(runtime.WithIncomingHeaderMatcher(CustomMatcher)) + + ``` ## Mapping from gRPC server metadata to HTTP response headers -ditto. Use [`WithOutgoingHeaderMatcher`](http://godoc.org/github.com/grpc-ecosystem/grpc-gateway/runtime#WithOutgoingHeaderMatcher) +ditto. Use [`WithOutgoingHeaderMatcher`](http://godoc.org/github.com/grpc-ecosystem/grpc-gateway/runtime#WithOutgoingHeaderMatcher). +See [gRPC metadata docs](https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md) +for more info on sending / receiving gRPC metadata. + + e.g. + + ```go + ... + if appendCustomHeader { + grpc.SendHeader(ctx, metadata.New(map[string]string{ + "x-custom-header1": "value", + })) + } + ``` ## Mutate response messages or set response headers You might want to return a subset of response fields as HTTP response headers; From e5b02f92519ebfb07b9673e46cd4932156f0df78 Mon Sep 17 00:00:00 2001 From: Henry Kwan Date: Tue, 10 Sep 2019 22:13:00 +0800 Subject: [PATCH 468/552] Update README.md update case-sensitive url --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb1af895665..9f7493d9bf2 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ More examples are available under `examples` directory. To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRPC-gateway, and a gRPC server, see [this example by CoreOS](https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go) -(and its accompanying [blog post](https://coreos.com/blog/gRPC-protobufs-swagger.html)). +(and its accompanying [blog post](https://coreos.com/blog/grpc-protobufs-swagger.html)). ## Features From 49261d1867f904f17803d4b4448f940d9965ab1e Mon Sep 17 00:00:00 2001 From: James Mills <1290234+prologic@users.noreply.github.com> Date: Wed, 11 Sep 2019 05:01:58 +1000 Subject: [PATCH 469/552] Update ISSUE_TEMPLATE.md (#1014) Fix minor typo --- ISSUE_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index e732a82f019..9cb92f9eecc 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -59,7 +59,7 @@ Your answer here. ```html ``` From d1f030fd3308d842f4f63bdd41bf9804cfbc210d Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 11 Sep 2019 10:57:24 +0200 Subject: [PATCH 470/552] examples/integration: wait for secondary gateway I haven't been able to reproduce #992, but this looks like a likely fix. ;) Signed-off-by: Stephan Renatus --- examples/integration/integration_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index 03aed1a0886..49ed02ac957 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -1479,6 +1479,10 @@ func testResponseStrings(t *testing.T, port int) { } }() + if err := waitForGateway(ctx, 8081); err != nil { + t.Fatalf("waitForGateway(ctx, 8081) failed with %v; want success", err) + } + port = 8081 for i, spec := range []struct { From cb0848610a981caabadec764488355cfd874ffd5 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Fri, 13 Sep 2019 17:02:41 +0200 Subject: [PATCH 471/552] protoc-gen-swagger: add support for arbitrary extensions (#1033) * protoc-gen-swagger: add support for arbitrary top-level extensions Using google.protobuf.Value isn't the nicest solution here, but with map extensions = 15; I could not find a way to specify those in a_bit_of_everything.proto that would have passed through protoc. Signed-off-by: Stephan Renatus * protoc-gen-swagger: ensure keys start with 'x-' Signed-off-by: Stephan Renatus * protoc-gen-swagger: start with tests Signed-off-by: Stephan Renatus * protoc-gen-swagger/genswagger: sort extensions by key, expand test Signed-off-by: Stephan Renatus * protoc-gen-swagger/genswagger: add custom Extensions to SecurityScheme Signed-off-by: Stephan Renatus * protoc-gen-swagger/genswagger: add custom Extensions to Info Signed-off-by: Stephan Renatus * protoc-gen-swagger/genswagger: add custom Extensions to Operation Signed-off-by: Stephan Renatus * protoc-gen-swagger/genswagger: add custom Extensions to Response Signed-off-by: Stephan Renatus * protoc-gen-swagger/genswagger: add comment and links Signed-off-by: Stephan Renatus * update a_bit_of_everything.pb.go Signed-off-by: Stephan Renatus * update protoc-gen-swagger/genswagger/BUILD.bazel Signed-off-by: Stephan Renatus * update protoc-gen-swagger/genswagger: fix internal struct key replacement Dropping the `-` would make `x-foobar` and `x-foo-bar` clash. Replacing with `_` doesn't. Signed-off-by: Stephan Renatus * TestApplyTemplateExtensions: fix test Signed-off-by: Stephan Renatus --- .../proto/examplepb/a_bit_of_everything.pb.go | 456 +++++++++--------- .../proto/examplepb/a_bit_of_everything.proto | 62 +++ .../a_bit_of_everything.swagger.json | 29 +- protoc-gen-swagger/genswagger/BUILD.bazel | 3 + protoc-gen-swagger/genswagger/generator.go | 78 ++- protoc-gen-swagger/genswagger/template.go | 59 ++- .../genswagger/template_test.go | 148 ++++++ protoc-gen-swagger/genswagger/types.go | 15 + protoc-gen-swagger/options/BUILD.bazel | 1 + protoc-gen-swagger/options/openapiv2.pb.go | 410 +++++++++------- protoc-gen-swagger/options/openapiv2.proto | 6 + 11 files changed, 856 insertions(+), 411 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 0799993d5bf..b16115fdfce 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{0} + return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{0, 0, 0} } // Intentionally complicated message type to cover many features of Protobuf. @@ -139,7 +139,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{0} + return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -520,7 +520,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{0, 0} + return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -589,7 +589,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{1} + return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -732,7 +732,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{2} + return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -771,7 +771,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{3} + return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -818,7 +818,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_8015f566ede6db7f, []int{4} + return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -1648,219 +1648,229 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_8015f566ede6db7f) -} - -var fileDescriptor_a_bit_of_everything_8015f566ede6db7f = []byte{ - // 3345 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x3a, 0x4b, 0x73, 0x1b, 0x47, - 0x7a, 0x1c, 0x0c, 0x9f, 0xcd, 0x17, 0xd8, 0x94, 0x28, 0x10, 0xa2, 0xcd, 0x16, 0x24, 0xaf, 0xc7, - 0xb0, 0x80, 0x21, 0x87, 0xb4, 0x4d, 0xc1, 0xb5, 0xab, 0x0c, 0xf8, 0x90, 0x69, 0xd9, 0x14, 0x3d, - 0x92, 0x1d, 0x97, 0xd6, 0x5a, 0x56, 0x03, 0x68, 0x10, 0x23, 0x62, 0x1e, 0x3b, 0xd3, 0x43, 0x09, - 0x61, 0x90, 0x6c, 0x1e, 0x95, 0x54, 0x76, 0x0f, 0xa9, 0xc2, 0x26, 0x87, 0x3c, 0x2a, 0xbf, 0x60, - 0xaf, 0x39, 0x6d, 0x55, 0x92, 0x43, 0x72, 0xca, 0x21, 0x29, 0x27, 0x95, 0x5b, 0x4e, 0xc9, 0x21, - 0xa7, 0x5c, 0x52, 0xb5, 0x55, 0x39, 0x24, 0xb5, 0xd5, 0x3d, 0x33, 0xc0, 0xcc, 0x00, 0x10, 0x05, - 0x69, 0x4b, 0x17, 0x69, 0xba, 0xfb, 0x7b, 0x7f, 0x5f, 0x7f, 0x8f, 0x06, 0x81, 0x42, 0x9e, 0x63, - 0xc3, 0x6e, 0x12, 0x57, 0xb6, 0x1d, 0x8b, 0x5a, 0x72, 0xb0, 0xb4, 0x2b, 0x32, 0x3e, 0xa9, 0xe8, - 0xf4, 0xc4, 0xaa, 0x9f, 0x90, 0x73, 0xe2, 0xb4, 0x68, 0x43, 0x37, 0x4f, 0x8b, 0x1c, 0x06, 0xae, - 0x9f, 0x3a, 0x76, 0xb5, 0x78, 0x8a, 0x29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, 0xe2, 0xf6, 0xc6, 0x36, 0xdc, 0x06, 0xf9, 0x17, 0x10, 0xa8, 0x59, 0xc4, 0x45, - 0xa6, 0x45, 0x11, 0x79, 0xae, 0xbb, 0xb4, 0x08, 0x27, 0x01, 0x7f, 0x83, 0xe3, 0x97, 0xec, 0xc9, - 0xe5, 0x69, 0x82, 0x19, 0x46, 0xbe, 0xf0, 0x1d, 0xf3, 0x78, 0x35, 0x97, 0x8e, 0x16, 0x1c, 0x76, - 0x56, 0xf2, 0x9f, 0x6c, 0x1e, 0x43, 0xd8, 0x77, 0x04, 0xff, 0x5a, 0x00, 0x73, 0x7b, 0x84, 0xd8, - 0xfc, 0x87, 0x29, 0xb6, 0xf1, 0x66, 0x3a, 0x9b, 0xbb, 0x5c, 0xb7, 0x3b, 0xb9, 0xed, 0x4b, 0x53, - 0x7c, 0xec, 0x37, 0xef, 0x22, 0x1b, 0x57, 0x78, 0x15, 0x52, 0x01, 0x38, 0xb2, 0xca, 0xba, 0x59, - 0xd3, 0xcd, 0x53, 0x17, 0xae, 0xf6, 0x65, 0xf0, 0xbd, 0xe0, 0xcf, 0x01, 0x86, 0x26, 0xf7, 0x31, - 0xf8, 0x15, 0x98, 0x7a, 0xa4, 0x1b, 0xc4, 0xf2, 0x28, 0x1c, 0x02, 0x34, 0x14, 0xf9, 0x3a, 0x17, - 0xff, 0x2a, 0x5c, 0x8e, 0xda, 0x93, 0x06, 0xc4, 0x1a, 0x20, 0xbd, 0xef, 0x38, 0x96, 0xc3, 0xca, - 0xf7, 0x1e, 0xa1, 0x58, 0x6f, 0xba, 0x23, 0x33, 0xb8, 0xc5, 0x19, 0xbc, 0x0d, 0xd7, 0x62, 0x0e, - 0x63, 0x54, 0x9f, 0xe9, 0xb4, 0x51, 0x0b, 0xa8, 0xfe, 0xa1, 0x00, 0xe0, 0x3d, 0x42, 0x93, 0xb3, - 0xdb, 0xe5, 0x3d, 0x42, 0x02, 0x63, 0xa8, 0x18, 0xef, 0x72, 0x31, 0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 0xf2, 0x55, 0x78, 0xba, 0x0b, - 0x26, 0x70, 0xcd, 0xd0, 0x4d, 0x58, 0x8a, 0xa1, 0x9a, 0xb5, 0x18, 0x18, 0x77, 0x06, 0x03, 0xd3, - 0x5d, 0xca, 0x5a, 0x84, 0x73, 0x82, 0x74, 0xb3, 0x6e, 0x39, 0x06, 0xf7, 0x77, 0x65, 0x1d, 0xcc, - 0x47, 0x4d, 0x31, 0x96, 0x9c, 0x59, 0x2b, 0xef, 0x0d, 0x9d, 0x5a, 0x93, 0xa0, 0xce, 0x21, 0xb8, - 0xf6, 0x79, 0x2f, 0xfb, 0x44, 0xef, 0xd4, 0xa8, 0x77, 0xe9, 0xf1, 0x4c, 0xd7, 0x73, 0x95, 0x49, - 0x7e, 0x9f, 0xb7, 0x7e, 0x19, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x34, 0x38, 0x21, 0xb4, 0x29, 0x00, - 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_eb14258081b6c54b) +} + +var fileDescriptor_a_bit_of_everything_eb14258081b6c54b = []byte{ + // 3520 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x7a, 0x4b, 0x70, 0x1b, 0x47, + 0x7a, 0x3f, 0x07, 0xc3, 0x67, 0xf3, 0x05, 0x36, 0x45, 0x09, 0x82, 0xb8, 0x66, 0x0b, 0x92, 0xd7, + 0x23, 0xac, 0x80, 0x21, 0x87, 0xb4, 0x2d, 0xc1, 0xff, 0xb5, 0x3d, 0x20, 0x29, 0x99, 0x92, 0x4d, + 0xd1, 0x23, 0x59, 0x7f, 0x47, 0x6b, 0x2d, 0xd3, 0x00, 0x1a, 0xc4, 0x88, 0x98, 0xc7, 0xce, 0xf4, + 0x50, 0x84, 0x18, 0x24, 0x5b, 0x49, 0x2a, 0xa9, 0xca, 0xde, 0xb0, 0x49, 0xe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x51, 0xf9, 0x5a, 0x88, 0x32, + 0x68, 0x80, 0x0f, 0x1e, 0xb3, 0x6f, 0x78, 0x15, 0xcc, 0xd5, 0x2c, 0xaf, 0xd2, 0x24, 0x81, 0xb0, + 0x71, 0x24, 0x48, 0x82, 0x36, 0xeb, 0xcf, 0xf9, 0x24, 0x6b, 0x60, 0x56, 0x37, 0xe9, 0x7b, 0x5b, + 0x01, 0xc5, 0x04, 0x12, 0x24, 0x51, 0x03, 0x7c, 0xaa, 0x2b, 0xc3, 0x8b, 0x52, 0x4c, 0x22, 0x41, + 0x1a, 0xd7, 0x66, 0xbd, 0x08, 0x89, 0x2f, 0x63, 0x53, 0x09, 0x28, 0xa6, 0x90, 0x20, 0x4d, 0x70, + 0x19, 0x9b, 0x8a, 0x4f, 0x70, 0x0d, 0xcc, 0xd7, 0xf5, 0x53, 0x52, 0xeb, 0x0a, 0x99, 0x46, 0x82, + 0x34, 0xa9, 0xcd, 0x05, 0x93, 0x71, 0xa2, 0xae, 0x9c, 0x19, 0x24, 0x48, 0x53, 0x01, 0x51, 0x28, + 0xe9, 0x3b, 0x00, 0x54, 0x2c, 0xab, 0x19, 0x50, 0x00, 0x24, 0x48, 0xd3, 0xda, 0x0c, 0x9b, 0xe9, + 0x82, 0x75, 0xa9, 0xa3, 0x9b, 0x47, 0x01, 0xc1, 0x2c, 0x73, 0x00, 0x6d, 0xd6, 0x9f, 0xeb, 0x82, + 0xad, 0xb4, 0x28, 0x71, 0x03, 0x8a, 0xef, 0x20, 0x41, 0x9a, 0xd3, 0x00, 0x9f, 0x8a, 0x19, 0xdc, + 0x85, 0x31, 0x8f, 0x04, 0x69, 0xde, 0x37, 0x38, 0x44, 0x71, 0x1f, 0x00, 0x76, 0xeb, 0x02, 0x82, + 0x05, 0x24, 0x48, 0x0b, 0xca, 0xcd, 0x73, 0x4f, 0x7e, 0xdf, 0x33, 0x88, 0xa3, 0x57, 0x77, 0x4d, + 0xcf, 0xd0, 0x66, 0x18, 0xbf, 0x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 0x10, 0xc5, 0x7a, 0x75, 0xf4, 0x38, 0x59, 0x56, 0x3a, 0xaa, 0x9c, 0x87, 0xfb, 0xfd, + 0x10, 0x2f, 0xef, 0x0f, 0x45, 0xb6, 0xdc, 0x8d, 0xad, 0x11, 0x58, 0x27, 0x20, 0x9b, 0x0c, 0x05, + 0x11, 0x68, 0x39, 0x16, 0x0f, 0xca, 0xb7, 0x3a, 0xea, 0xbb, 0xf9, 0x95, 0xae, 0xed, 0x3e, 0x59, + 0xa0, 0x6f, 0x35, 0x39, 0x1d, 0x53, 0x99, 0x89, 0x47, 0x92, 0x88, 0xde, 0xbf, 0x16, 0x22, 0x8a, + 0x83, 0x9b, 0x11, 0x51, 0x7c, 0xed, 0xcd, 0xaa, 0x86, 0xf2, 0x9d, 0x8e, 0xba, 0x9d, 0xef, 0x61, + 0xf3, 0x15, 0x20, 0xab, 0xf2, 0x8c, 0x54, 0x69, 0x80, 0xfc, 0xda, 0x90, 0xd5, 0xc1, 0x06, 0xf8, + 0x72, 0x23, 0x06, 0xfc, 0x4c, 0x00, 0x4b, 0xfd, 0xb8, 0xaf, 0xbf, 0x59, 0xbd, 0x56, 0xde, 0xea, + 0xa8, 0x1b, 0xf9, 0xe5, 0xfd, 0x01, 0x70, 0xb3, 0xfb, 0xc3, 0x51, 0xa6, 0xcd, 0x24, 0xba, 0xf7, + 0xc1, 0xb2, 0x9f, 0x03, 0xac, 0x13, 0xe2, 0x38, 0x7a, 0x8d, 0x1c, 0xd2, 0x96, 0x4d, 0x32, 0x6f, + 0xb3, 0x32, 0xa6, 0x3c, 0xd5, 0x51, 0xc7, 0xff, 0x20, 0x25, 0x88, 0xda, 0x12, 0xa7, 0x79, 0x10, + 0x90, 0x3c, 0x6a, 0xd9, 0x24, 0xfb, 0xaf, 0x02, 0x98, 0x0c, 0xaa, 0x45, 0x08, 0xc6, 0x4d, 0x6c, + 0x10, 0xbf, 0x5a, 0xd4, 0xf8, 0x37, 0xbc, 0x08, 0x26, 0xb1, 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21, 0x36, 0xff, 0x15, 0x8b, 0x4d, 0x7c, 0x3b, + 0x65, 0xd0, 0x47, 0xdc, 0xb6, 0xdb, 0xb9, 0xad, 0x73, 0x23, 0x7f, 0xec, 0x07, 0xf2, 0x22, 0xeb, + 0x6d, 0x78, 0xca, 0x52, 0x01, 0xd8, 0xb7, 0xca, 0xba, 0x59, 0xd3, 0xcd, 0x23, 0x17, 0x5e, 0xee, + 0x0b, 0xec, 0x3b, 0xc1, 0xdf, 0x0e, 0x0c, 0x8d, 0xf9, 0x63, 0xf0, 0x31, 0x98, 0x7a, 0xa4, 0x1b, + 0xc4, 0xf2, 0x28, 0x1c, 0x42, 0x34, 0x94, 0xf9, 0x0a, 0x87, 0xbf, 0x02, 0x97, 0xa3, 0xfb, 0x49, + 0x03, 0x61, 0x0d, 0x90, 0xde, 0x75, 0x1c, 0xcb, 0x61, 0xb9, 0x7e, 0x87, 0x50, 0xac, 0x37, 0xdd, + 0x91, 0x15, 0x5c, 0xe7, 0x0a, 0xde, 0x82, 0xab, 0xb1, 0x03, 0x63, 0x52, 0x9f, 0xeb, 0xb4, 0x51, + 0x0b, 0xa4, 0xfe, 0xa6, 0x00, 0xe0, 0x5d, 0x42, 0x93, 0x8d, 0xde, 0xf9, 0x05, 0x45, 0x82, 0x63, + 0x28, 0x8c, 0x77, 0x38, 0x8c, 0xab, 0xb9, 0xcb, 0x51, 0x18, 0x0c, 0x41, 0xc5, 0xaa, 0xb5, 0xe4, + 0x33, 0x56, 0x3e, 0xf0, 0x86, 0x10, 0xfe, 0x9a, 0x00, 0x96, 0x0e, 0x2c, 0x97, 0x32, 0x89, 0x9c, + 0x95, 0x03, 0x79, 0xb5, 0x9e, 0x72, 0xa8, 0x76, 0x99, 0x6b, 0xbf, 0x91, 0xbb, 0x1e, 0xd5, 0x6e, + 0x5b, 0x2e, 0x65, 0x08, 0xf8, 0xef, 0x92, 0x3e, 0x8c, 0xae, 0x53, 0xfc, 0x9d, 0x00, 0x96, 0xb7, + 0x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 0x8f, 0xdc, 0x15, 0x5a, 0x5a, 0x1b, 0x4e, 0xc4, 0x21, 0x94, 0x7f, 0x05, 0x64, 0xfd, 0x36, + 0x17, 0xc2, 0xbb, 0x0e, 0x36, 0xa9, 0x8b, 0xd8, 0x20, 0x38, 0x4b, 0xb0, 0x1a, 0x34, 0xbf, 0x70, + 0x39, 0x58, 0xe4, 0xa3, 0x70, 0x75, 0x1b, 0x4c, 0xe0, 0x9a, 0xa1, 0x9b, 0xb0, 0x14, 0x63, 0x35, + 0x6b, 0x31, 0x32, 0xee, 0x1a, 0x8c, 0x4c, 0x77, 0x29, 0x2b, 0x69, 0x4e, 0x08, 0xd2, 0xcd, 0xba, + 0xe5, 0x18, 0xdc, 0xfb, 0x2a, 0x6b, 0x60, 0x3e, 0x7a, 0x30, 0x63, 0xc9, 0x86, 0xbc, 0x72, 0x63, + 0x68, 0x4b, 0x9e, 0x24, 0x75, 0xf6, 0xc0, 0xa5, 0xcf, 0x7a, 0xd1, 0x32, 0x1a, 0x03, 0x46, 0xbd, + 0xfb, 0x2f, 0xae, 0x00, 0x78, 0x5a, 0x88, 0xce, 0xb0, 0x4b, 0x02, 0x27, 0xb2, 0x62, 0x05, 0x3b, + 0x2f, 0x24, 0x70, 0x29, 0xb1, 0x58, 0xc1, 0x2f, 0x0a, 0x4d, 0xdd, 0xa5, 0x70, 0x5e, 0x99, 0x05, + 0x13, 0x59, 0xd1, 0x32, 0x09, 0x48, 0x21, 0xe1, 0xc9, 0x4c, 0xd7, 0x1d, 0x2b, 0x93, 0x3c, 0x8c, + 0x6d, 0xfe, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x94, 0x65, 0x6b, 0xb3, 0xd8, 0x2a, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index ce0b654823d..767e492e261 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -25,6 +25,12 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { name: "BSD 3-Clause License"; url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt"; }; + extensions: { + key: "x-something-something"; + value { + string_value: "yadda"; + } + } }; // Overwriting host entry breaks tests, so this is not done here. external_docs: { @@ -51,6 +57,31 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { type: TYPE_API_KEY; in: IN_HEADER; name: "X-API-Key"; + extensions: { + key: "x-amazon-apigateway-authtype"; + value { + string_value: "oauth2"; + } + } + extensions: { + key: "x-amazon-apigateway-authorizer"; + value { + struct_value { + fields { + key: "type"; + value { + string_value: "token"; + } + } + fields { + key: "authorizerResultTtlInSeconds"; + value { + number_value: 60; + } + } + } + } + } } } security: { @@ -128,6 +159,25 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { } } } + extensions: { + key: "x-grpc-gateway-foo"; + value { + string_value: "bar"; + } + } + extensions: { + key: "x-grpc-gateway-baz-list"; + value { + list_value: { + values: { + string_value: "one"; + } + values: { + bool_value: true; + } + } + } + } }; @@ -342,6 +392,12 @@ service ABitOfEverythingService { } } } + extensions: { + key: "x-irreversible"; + value { + bool_value: true; + } + } }; } rpc GetQuery(ABitOfEverything) returns (google.protobuf.Empty) { @@ -394,6 +450,12 @@ service ABitOfEverythingService { key: "503"; value: { description: "Returned when the resource is temporarily unavailable."; + extensions: { + key: "x-number"; + value { + number_value: 100; + } + } } } responses: { diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 278c4aaaa2f..58c1b34c74e 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -11,7 +11,8 @@ "license": { "name": "BSD 3-Clause License", "url": "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt" - } + }, + "x-something-something": "yadda" }, "schemes": [ "http", @@ -101,7 +102,8 @@ }, "503": { "description": "Returned when the resource is temporarily unavailable.", - "schema": {} + "schema": {}, + "x-number": 100 } }, "parameters": [ @@ -1133,7 +1135,8 @@ "write" ] } - ] + ], + "x-irreversible": true }, "put": { "operationId": "Update", @@ -1540,7 +1543,8 @@ }, "503": { "description": "Returned when the resource is temporarily unavailable.", - "schema": {} + "schema": {}, + "x-number": 100 } }, "parameters": [ @@ -1590,7 +1594,8 @@ }, "503": { "description": "Returned when the resource is temporarily unavailable.", - "schema": {} + "schema": {}, + "x-number": 100 } }, "parameters": [ @@ -2283,7 +2288,12 @@ "ApiKeyAuth": { "type": "apiKey", "name": "X-API-Key", - "in": "header" + "in": "header", + "x-amazon-apigateway-authorizer": { + "authorizerResultTtlInSeconds": 60, + "type": "token" + }, + "x-amazon-apigateway-authtype": "oauth2" }, "BasicAuth": { "type": "basic" @@ -2316,5 +2326,10 @@ "externalDocs": { "description": "More about gRPC-Gateway", "url": "https://github.com/grpc-ecosystem/grpc-gateway" - } + }, + "x-grpc-gateway-baz-list": [ + "one", + true + ], + "x-grpc-gateway-foo": "bar" } diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/genswagger/BUILD.bazel index 7798e9b99c5..929d0cf11d5 100644 --- a/protoc-gen-swagger/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/genswagger/BUILD.bazel @@ -18,11 +18,13 @@ go_library( "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", + "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", "@io_bazel_rules_go//proto/wkt:any_go_proto", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", + "@io_bazel_rules_go//proto/wkt:struct_go_proto", ], ) @@ -39,5 +41,6 @@ go_test( "@io_bazel_rules_go//proto/wkt:any_go_proto", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", + "@io_bazel_rules_go//proto/wkt:struct_go_proto", ], ) diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go index 749ff4b0d28..31409ac4c19 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/genswagger/generator.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "path/filepath" + "reflect" "strings" "github.com/golang/glog" @@ -66,7 +67,82 @@ func mergeTargetFile(targets []*wrapper, mergeFileName string) *wrapper { return mergedTarget } -// convert swagger file obj to plugin.CodeGeneratorResponse_File +func fieldName(k string) string { + return strings.ReplaceAll(strings.Title(k), "-", "_") +} + +// Q: What's up with the alias types here? +// A: We don't want to completely override how these structs are marshaled into +// JSON, we only want to add fields (see below, extensionMarshalJSON). +// An infinite recursion would happen if we'd call json.Marshal on the struct +// that has swaggerObject as an embedded field. To avoid that, we'll create +// type aliases, and those don't have the custom MarshalJSON methods defined +// on them. See http://choly.ca/post/go-json-marshalling/ (or, if it ever +// goes away, use +// https://web.archive.org/web/20190806073003/http://choly.ca/post/go-json-marshalling/. +func (so swaggerObject) MarshalJSON() ([]byte, error) { + type alias swaggerObject + return extensionMarshalJSON(alias(so), so.extensions) +} + +func (so swaggerInfoObject) MarshalJSON() ([]byte, error) { + type alias swaggerInfoObject + return extensionMarshalJSON(alias(so), so.extensions) +} + +func (so swaggerSecuritySchemeObject) MarshalJSON() ([]byte, error) { + type alias swaggerSecuritySchemeObject + return extensionMarshalJSON(alias(so), so.extensions) +} + +func (so swaggerOperationObject) MarshalJSON() ([]byte, error) { + type alias swaggerOperationObject + return extensionMarshalJSON(alias(so), so.extensions) +} + +func (so swaggerResponseObject) MarshalJSON() ([]byte, error) { + type alias swaggerResponseObject + return extensionMarshalJSON(alias(so), so.extensions) +} + +func extensionMarshalJSON(so interface{}, extensions []extension) ([]byte, error) { + // To append arbitrary keys to the struct we'll render into json, + // we're creating another struct that embeds the original one, and + // its extra fields: + // + // The struct will look like + // struct { + // *swaggerCore + // XGrpcGatewayFoo json.RawMessage `json:"x-grpc-gateway-foo"` + // XGrpcGatewayBar json.RawMessage `json:"x-grpc-gateway-bar"` + // } + // and thus render into what we want -- the JSON of swaggerCore with the + // extensions appended. + fields := []reflect.StructField{ + reflect.StructField{ // embedded + Name: "Embedded", + Type: reflect.TypeOf(so), + Anonymous: true, + }, + } + for _, ext := range extensions { + fields = append(fields, reflect.StructField{ + Name: fieldName(ext.key), + Type: reflect.TypeOf(ext.value), + Tag: reflect.StructTag(fmt.Sprintf("json:\"%s\"", ext.key)), + }) + } + + t := reflect.StructOf(fields) + s := reflect.New(t).Elem() + s.Field(0).Set(reflect.ValueOf(so)) + for _, ext := range extensions { + s.FieldByName(fieldName(ext.key)).Set(reflect.ValueOf(ext.value)) + } + return json.Marshal(s.Interface()) +} + +// encodeSwagger converts swagger file obj to plugin.CodeGeneratorResponse_File func encodeSwagger(file *wrapper) (*plugin.CodeGeneratorResponse_File, error) { var formatted bytes.Buffer enc := json.NewEncoder(&formatted) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 337fb1a7370..3d97207c7eb 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -6,12 +6,15 @@ import ( "os" "reflect" "regexp" + "sort" "strconv" "strings" "sync" "github.com/golang/glog" + "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + structpb "github.com/golang/protobuf/ptypes/struct" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" @@ -953,11 +956,27 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } if opts.Responses != nil { for name, resp := range opts.Responses { - operationObject.Responses[name] = swaggerResponseObject{ + respObj := swaggerResponseObject{ Description: resp.Description, Schema: swaggerSchemaFromProtoSchema(resp.Schema, reg, customRefs), } + if resp.Extensions != nil { + exts, err := processExtensions(resp.Extensions) + if err != nil { + return err + } + respObj.extensions = exts + } + operationObject.Responses[name] = respObj + } + } + + if opts.Extensions != nil { + exts, err := processExtensions(opts.Extensions) + if err != nil { + return err } + operationObject.extensions = exts } // TODO(ivucica): add remaining fields of operation object @@ -1080,6 +1099,13 @@ func applyTemplate(p param) (*swaggerObject, error) { s.Info.License.URL = spb.Info.License.Url } } + if spb.Info.Extensions != nil { + exts, err := processExtensions(spb.Info.Extensions) + if err != nil { + return nil, err + } + s.Info.extensions = exts + } } if spb.Host != "" { s.Host = spb.Host @@ -1162,6 +1188,13 @@ func applyTemplate(p param) (*swaggerObject, error) { newSecDefValue.Scopes[scopeKey] = scopeDesc } } + if secDefValue.Extensions != nil { + exts, err := processExtensions(secDefValue.Extensions) + if err != nil { + return nil, err + } + newSecDefValue.extensions = exts + } s.SecurityDefinitions[secDefKey] = newSecDefValue } } @@ -1220,6 +1253,14 @@ func applyTemplate(p param) (*swaggerObject, error) { } } + if spb.Extensions != nil { + exts, err := processExtensions(spb.Extensions) + if err != nil { + return nil, err + } + s.extensions = exts + } + // Additional fields on the OpenAPI v2 spec's "Swagger" object // should be added here, once supported in the proto. } @@ -1231,6 +1272,22 @@ func applyTemplate(p param) (*swaggerObject, error) { return &s, nil } +func processExtensions(inputExts map[string]*structpb.Value) ([]extension, error) { + exts := []extension{} + for k, v := range inputExts { + if !strings.HasPrefix(k, "x-") { + return nil, fmt.Errorf("Extension keys need to start with \"x-\": %q", k) + } + ext, err := (&jsonpb.Marshaler{Indent: " "}).MarshalToString(v) + if err != nil { + return nil, err + } + exts = append(exts, extension{key: k, value: json.RawMessage(ext)}) + } + sort.Slice(exts, func(i, j int) bool { return exts[i].key < exts[j].key }) + return exts, nil +} + // updateSwaggerDataFromComments updates a Swagger object based on a comment // from the proto file. // diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 09902345e65..5f0adf4f26f 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -11,6 +11,7 @@ import ( protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/golang/protobuf/ptypes/any" + structpb "github.com/golang/protobuf/ptypes/struct" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" @@ -371,6 +372,153 @@ func TestApplyTemplateSimple(t *testing.T) { } } +func TestApplyTemplateExtensions(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Example"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + Options: &protodescriptor.MethodOptions{}, + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, + MessageType: []*protodescriptor.DescriptorProto{msgdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + Options: &protodescriptor.FileOptions{}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + Body: &descriptor.Body{FieldPath: nil}, + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: "/v1/echo", // TODO(achew22): Figure out what this should really be + }, + }, + }, + }, + }, + }, + }, + } + swagger := swagger_options.Swagger{ + Info: &swagger_options.Info{ + Title: "test", + Extensions: map[string]*structpb.Value{ + "x-info-extension": &structpb.Value{Kind: &structpb.Value_StringValue{StringValue: "bar"}}, + }, + }, + Extensions: map[string]*structpb.Value{ + "x-foo": &structpb.Value{Kind: &structpb.Value_StringValue{StringValue: "bar"}}, + "x-bar": &structpb.Value{Kind: &structpb.Value_ListValue{ListValue: &structpb.ListValue{ + Values: []*structpb.Value{{Kind: &structpb.Value_StringValue{StringValue: "baz"}}}, + }}}, + }, + SecurityDefinitions: &swagger_options.SecurityDefinitions{ + Security: map[string]*swagger_options.SecurityScheme{ + "somescheme": &swagger_options.SecurityScheme{ + Extensions: map[string]*structpb.Value{ + "x-security-baz": &structpb.Value{Kind: &structpb.Value_BoolValue{BoolValue: true}}, + }, + }, + }, + }, + } + if err := proto.SetExtension(proto.Message(file.FileDescriptorProto.Options), swagger_options.E_Openapiv2Swagger, &swagger); err != nil { + t.Fatalf("proto.SetExtension(FileDescriptorProto.Options) failed: %v", err) + } + + swaggerOperation := swagger_options.Operation{ + Responses: map[string]*swagger_options.Response{ + "200": &swagger_options.Response{ + Extensions: map[string]*structpb.Value{ + "x-resp-id": &structpb.Value{Kind: &structpb.Value_StringValue{StringValue: "resp1000"}}, + }, + }, + }, + Extensions: map[string]*structpb.Value{ + "x-op-foo": &structpb.Value{Kind: &structpb.Value_StringValue{StringValue: "baz"}}, + }, + } + if err := proto.SetExtension(proto.Message(meth.Options), swagger_options.E_Openapiv2Operation, &swaggerOperation); err != nil { + t.Fatalf("proto.SetExtension(MethodDescriptorProto.Options) failed: %v", err) + } + result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: descriptor.NewRegistry()}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + if want, is, name := "2.0", result.Swagger, "Swagger"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } + if want, is, name := []extension{ + {key: "x-bar", value: json.RawMessage("[\n \"baz\"\n ]")}, + {key: "x-foo", value: json.RawMessage("\"bar\"")}, + }, result.extensions, "Extensions"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } + + var scheme swaggerSecuritySchemeObject + for _, v := range result.SecurityDefinitions { + scheme = v + } + if want, is, name := []extension{ + {key: "x-security-baz", value: json.RawMessage("true")}, + }, scheme.extensions, "SecurityScheme.Extensions"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } + + if want, is, name := []extension{ + {key: "x-info-extension", value: json.RawMessage("\"bar\"")}, + }, result.Info.extensions, "Info.Extensions"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } + + var operation *swaggerOperationObject + var response swaggerResponseObject + for _, v := range result.Paths { + operation = v.Get + response = v.Get.Responses["200"] + } + if want, is, name := []extension{ + {key: "x-op-foo", value: json.RawMessage("\"baz\"")}, + }, operation.extensions, "operation.Extensions"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } + if want, is, name := []extension{ + {key: "x-resp-id", value: json.RawMessage("\"resp1000\"")}, + }, response.extensions, "response.Extensions"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } +} + func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { msgdesc := &protodescriptor.DescriptorProto{ Name: proto.String("ExampleMessage"), diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 66aaf177d23..77db96d877b 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -25,6 +25,8 @@ type swaggerInfoObject struct { Contact *swaggerContactObject `json:"contact,omitempty"` License *swaggerLicenseObject `json:"license,omitempty"` + + extensions []extension } // http://swagger.io/specification/#contactObject @@ -46,6 +48,11 @@ type swaggerExternalDocumentationObject struct { URL string `json:"url,omitempty"` } +type extension struct { + key string + value json.RawMessage +} + // http://swagger.io/specification/#swaggerObject type swaggerObject struct { Swagger string `json:"swagger"` @@ -61,6 +68,8 @@ type swaggerObject struct { SecurityDefinitions swaggerSecurityDefinitionsObject `json:"securityDefinitions,omitempty"` Security []swaggerSecurityRequirementObject `json:"security,omitempty"` ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` + + extensions []extension } // http://swagger.io/specification/#securityDefinitionsObject @@ -76,6 +85,8 @@ type swaggerSecuritySchemeObject struct { AuthorizationURL string `json:"authorizationUrl,omitempty"` TokenURL string `json:"tokenUrl,omitempty"` Scopes swaggerScopesObject `json:"scopes,omitempty"` + + extensions []extension } // http://swagger.io/specification/#scopesObject @@ -108,6 +119,8 @@ type swaggerOperationObject struct { Security *[]swaggerSecurityRequirementObject `json:"security,omitempty"` ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` + + extensions []extension } type swaggerParametersObject []swaggerParameterObject @@ -157,6 +170,8 @@ type swaggerResponsesObject map[string]swaggerResponseObject type swaggerResponseObject struct { Description string `json:"description"` Schema swaggerSchemaObject `json:"schema"` + + extensions []extension } type keyVal struct { diff --git a/protoc-gen-swagger/options/BUILD.bazel b/protoc-gen-swagger/options/BUILD.bazel index 7a51fd7c7f4..8dea43d297d 100644 --- a/protoc-gen-swagger/options/BUILD.bazel +++ b/protoc-gen-swagger/options/BUILD.bazel @@ -26,6 +26,7 @@ proto_library( deps = [ "@com_google_protobuf//:any_proto", "@com_google_protobuf//:descriptor_proto", + "@com_google_protobuf//:struct_proto", ], ) diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index f52414a5ef9..6720071bde0 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -7,6 +7,7 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import any "github.com/golang/protobuf/ptypes/any" +import _struct "github.com/golang/protobuf/ptypes/struct" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -48,7 +49,7 @@ func (x Swagger_SwaggerScheme) String() string { return proto.EnumName(Swagger_SwaggerScheme_name, int32(x)) } func (Swagger_SwaggerScheme) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{0, 0} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{0, 0} } type JSONSchema_JSONSchemaSimpleTypes int32 @@ -89,7 +90,7 @@ func (x JSONSchema_JSONSchemaSimpleTypes) String() string { return proto.EnumName(JSONSchema_JSONSchemaSimpleTypes_name, int32(x)) } func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{8, 0} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{8, 0} } // Required. The type of the security scheme. Valid values are "basic", @@ -120,7 +121,7 @@ func (x SecurityScheme_Type) String() string { return proto.EnumName(SecurityScheme_Type_name, int32(x)) } func (SecurityScheme_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{11, 0} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{11, 0} } // Required. The location of the API key. Valid values are "query" or "header". @@ -147,7 +148,7 @@ func (x SecurityScheme_In) String() string { return proto.EnumName(SecurityScheme_In_name, int32(x)) } func (SecurityScheme_In) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{11, 1} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{11, 1} } // Required. The flow used by the OAuth2 security scheme. Valid values are @@ -181,7 +182,7 @@ func (x SecurityScheme_Flow) String() string { return proto.EnumName(SecurityScheme_Flow_name, int32(x)) } func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{11, 2} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{11, 2} } // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. @@ -199,24 +200,25 @@ type Swagger struct { // Swagger file. If you wish to use `base_path` with relatively generated Swagger paths, the // `base_path` prefix must be manually removed from your `google.api.http` paths and your code changed to // serve the API from the `base_path`. - BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` - Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,proto3,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` - Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` - Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` - Responses map[string]*Response `protobuf:"bytes,10,rep,name=responses,proto3" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,11,opt,name=security_definitions,json=securityDefinitions,proto3" json:"security_definitions,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` + Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,proto3,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` + Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` + Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` + Responses map[string]*Response `protobuf:"bytes,10,rep,name=responses,proto3" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,11,opt,name=security_definitions,json=securityDefinitions,proto3" json:"security_definitions,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + Extensions map[string]*_struct.Value `protobuf:"bytes,15,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Swagger) Reset() { *m = Swagger{} } func (m *Swagger) String() string { return proto.CompactTextString(m) } func (*Swagger) ProtoMessage() {} func (*Swagger) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{0} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{0} } func (m *Swagger) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Swagger.Unmarshal(m, b) @@ -313,33 +315,41 @@ func (m *Swagger) GetExternalDocs() *ExternalDocumentation { return nil } +func (m *Swagger) GetExtensions() map[string]*_struct.Value { + if m != nil { + return m.Extensions + } + return nil +} + // `Operation` is a representation of OpenAPI v2 specification's Operation object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject // // TODO(ivucica): document fields type Operation struct { - Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` - Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` - Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` - Responses map[string]*Response `protobuf:"bytes,9,rep,name=responses,proto3" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Schemes []string `protobuf:"bytes,10,rep,name=schemes,proto3" json:"schemes,omitempty"` - Deprecated bool `protobuf:"varint,11,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` + Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` + Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` + Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` + Responses map[string]*Response `protobuf:"bytes,9,rep,name=responses,proto3" json:"responses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Schemes []string `protobuf:"bytes,10,rep,name=schemes,proto3" json:"schemes,omitempty"` + Deprecated bool `protobuf:"varint,11,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` + Extensions map[string]*_struct.Value `protobuf:"bytes,13,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Operation) Reset() { *m = Operation{} } func (m *Operation) String() string { return proto.CompactTextString(m) } func (*Operation) ProtoMessage() {} func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{1} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{1} } func (m *Operation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Operation.Unmarshal(m, b) @@ -436,6 +446,13 @@ func (m *Operation) GetSecurity() []*SecurityRequirement { return nil } +func (m *Operation) GetExtensions() map[string]*_struct.Value { + if m != nil { + return m.Extensions + } + return nil +} + // `Response` is a representation of OpenAPI v2 specification's Response object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responseObject @@ -446,17 +463,18 @@ type Response struct { Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` // `Schema` optionally defines the structure of the response. // If `Schema` is not provided, it means there is no content to the response. - Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + Extensions map[string]*_struct.Value `protobuf:"bytes,5,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{2} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{2} } func (m *Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Response.Unmarshal(m, b) @@ -490,28 +508,36 @@ func (m *Response) GetSchema() *Schema { return nil } +func (m *Response) GetExtensions() map[string]*_struct.Value { + if m != nil { + return m.Extensions + } + return nil +} + // `Info` is a representation of OpenAPI v2 specification's Info object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject // // TODO(ivucica): document fields type Info struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"` - Contact *Contact `protobuf:"bytes,4,opt,name=contact,proto3" json:"contact,omitempty"` - License *License `protobuf:"bytes,5,opt,name=license,proto3" json:"license,omitempty"` - Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"` + Contact *Contact `protobuf:"bytes,4,opt,name=contact,proto3" json:"contact,omitempty"` + License *License `protobuf:"bytes,5,opt,name=license,proto3" json:"license,omitempty"` + Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` + Extensions map[string]*_struct.Value `protobuf:"bytes,7,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Info) Reset() { *m = Info{} } func (m *Info) String() string { return proto.CompactTextString(m) } func (*Info) ProtoMessage() {} func (*Info) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{3} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{3} } func (m *Info) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Info.Unmarshal(m, b) @@ -573,6 +599,13 @@ func (m *Info) GetVersion() string { return "" } +func (m *Info) GetExtensions() map[string]*_struct.Value { + if m != nil { + return m.Extensions + } + return nil +} + // `Contact` is a representation of OpenAPI v2 specification's Contact object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject @@ -591,7 +624,7 @@ func (m *Contact) Reset() { *m = Contact{} } func (m *Contact) String() string { return proto.CompactTextString(m) } func (*Contact) ProtoMessage() {} func (*Contact) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{4} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{4} } func (m *Contact) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Contact.Unmarshal(m, b) @@ -650,7 +683,7 @@ func (m *License) Reset() { *m = License{} } func (m *License) String() string { return proto.CompactTextString(m) } func (*License) ProtoMessage() {} func (*License) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{5} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{5} } func (m *License) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_License.Unmarshal(m, b) @@ -702,7 +735,7 @@ func (m *ExternalDocumentation) Reset() { *m = ExternalDocumentation{} } func (m *ExternalDocumentation) String() string { return proto.CompactTextString(m) } func (*ExternalDocumentation) ProtoMessage() {} func (*ExternalDocumentation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{6} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{6} } func (m *ExternalDocumentation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExternalDocumentation.Unmarshal(m, b) @@ -756,7 +789,7 @@ func (m *Schema) Reset() { *m = Schema{} } func (m *Schema) String() string { return proto.CompactTextString(m) } func (*Schema) ProtoMessage() {} func (*Schema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{7} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{7} } func (m *Schema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Schema.Unmarshal(m, b) @@ -860,7 +893,7 @@ func (m *JSONSchema) Reset() { *m = JSONSchema{} } func (m *JSONSchema) String() string { return proto.CompactTextString(m) } func (*JSONSchema) ProtoMessage() {} func (*JSONSchema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{8} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{8} } func (m *JSONSchema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JSONSchema.Unmarshal(m, b) @@ -1046,7 +1079,7 @@ func (m *Tag) Reset() { *m = Tag{} } func (m *Tag) String() string { return proto.CompactTextString(m) } func (*Tag) ProtoMessage() {} func (*Tag) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{9} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{9} } func (m *Tag) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Tag.Unmarshal(m, b) @@ -1100,7 +1133,7 @@ func (m *SecurityDefinitions) Reset() { *m = SecurityDefinitions{} } func (m *SecurityDefinitions) String() string { return proto.CompactTextString(m) } func (*SecurityDefinitions) ProtoMessage() {} func (*SecurityDefinitions) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{10} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{10} } func (m *SecurityDefinitions) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityDefinitions.Unmarshal(m, b) @@ -1168,17 +1201,18 @@ type SecurityScheme struct { // Required. The available scopes for the OAuth2 security scheme. // // Valid for oauth2. - Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes,proto3" json:"scopes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes,proto3" json:"scopes,omitempty"` + Extensions map[string]*_struct.Value `protobuf:"bytes,9,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SecurityScheme) Reset() { *m = SecurityScheme{} } func (m *SecurityScheme) String() string { return proto.CompactTextString(m) } func (*SecurityScheme) ProtoMessage() {} func (*SecurityScheme) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{11} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{11} } func (m *SecurityScheme) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityScheme.Unmarshal(m, b) @@ -1254,6 +1288,13 @@ func (m *SecurityScheme) GetScopes() *Scopes { return nil } +func (m *SecurityScheme) GetExtensions() map[string]*_struct.Value { + if m != nil { + return m.Extensions + } + return nil +} + // `SecurityRequirement` is a representation of OpenAPI v2 specification's // Security Requirement object. // @@ -1280,7 +1321,7 @@ func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} } func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) } func (*SecurityRequirement) ProtoMessage() {} func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{12} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{12} } func (m *SecurityRequirement) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement.Unmarshal(m, b) @@ -1325,7 +1366,7 @@ func (m *SecurityRequirement_SecurityRequirementValue) String() string { } func (*SecurityRequirement_SecurityRequirementValue) ProtoMessage() {} func (*SecurityRequirement_SecurityRequirementValue) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{12, 0} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{12, 0} } func (m *SecurityRequirement_SecurityRequirementValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Unmarshal(m, b) @@ -1370,7 +1411,7 @@ func (m *Scopes) Reset() { *m = Scopes{} } func (m *Scopes) String() string { return proto.CompactTextString(m) } func (*Scopes) ProtoMessage() {} func (*Scopes) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_78431ddfac00899a, []int{13} + return fileDescriptor_openapiv2_7182f700aabb5117, []int{13} } func (m *Scopes) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Scopes.Unmarshal(m, b) @@ -1399,11 +1440,15 @@ func (m *Scopes) GetScope() map[string]string { func init() { proto.RegisterType((*Swagger)(nil), "grpc.gateway.protoc_gen_swagger.options.Swagger") + proto.RegisterMapType((map[string]*_struct.Value)(nil), "grpc.gateway.protoc_gen_swagger.options.Swagger.ExtensionsEntry") proto.RegisterMapType((map[string]*Response)(nil), "grpc.gateway.protoc_gen_swagger.options.Swagger.ResponsesEntry") proto.RegisterType((*Operation)(nil), "grpc.gateway.protoc_gen_swagger.options.Operation") + proto.RegisterMapType((map[string]*_struct.Value)(nil), "grpc.gateway.protoc_gen_swagger.options.Operation.ExtensionsEntry") proto.RegisterMapType((map[string]*Response)(nil), "grpc.gateway.protoc_gen_swagger.options.Operation.ResponsesEntry") proto.RegisterType((*Response)(nil), "grpc.gateway.protoc_gen_swagger.options.Response") + proto.RegisterMapType((map[string]*_struct.Value)(nil), "grpc.gateway.protoc_gen_swagger.options.Response.ExtensionsEntry") proto.RegisterType((*Info)(nil), "grpc.gateway.protoc_gen_swagger.options.Info") + proto.RegisterMapType((map[string]*_struct.Value)(nil), "grpc.gateway.protoc_gen_swagger.options.Info.ExtensionsEntry") proto.RegisterType((*Contact)(nil), "grpc.gateway.protoc_gen_swagger.options.Contact") proto.RegisterType((*License)(nil), "grpc.gateway.protoc_gen_swagger.options.License") proto.RegisterType((*ExternalDocumentation)(nil), "grpc.gateway.protoc_gen_swagger.options.ExternalDocumentation") @@ -1413,6 +1458,7 @@ func init() { proto.RegisterType((*SecurityDefinitions)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityDefinitions") proto.RegisterMapType((map[string]*SecurityScheme)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityDefinitions.SecurityEntry") proto.RegisterType((*SecurityScheme)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityScheme") + proto.RegisterMapType((map[string]*_struct.Value)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityScheme.ExtensionsEntry") proto.RegisterType((*SecurityRequirement)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityRequirement") proto.RegisterMapType((map[string]*SecurityRequirement_SecurityRequirementValue)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityRequirement.SecurityRequirementEntry") proto.RegisterType((*SecurityRequirement_SecurityRequirementValue)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityRequirement.SecurityRequirementValue") @@ -1426,121 +1472,127 @@ func init() { } func init() { - proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_78431ddfac00899a) -} - -var fileDescriptor_openapiv2_78431ddfac00899a = []byte{ - // 1777 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x73, 0xdb, 0xc6, - 0x11, 0x0f, 0x48, 0x90, 0x04, 0x97, 0x22, 0x73, 0x3e, 0xcb, 0x2d, 0xa2, 0xc4, 0xae, 0xc2, 0xa6, - 0x53, 0x8d, 0x3d, 0xa6, 0x12, 0xe5, 0xa1, 0x99, 0x4c, 0xa7, 0x1d, 0x4a, 0x62, 0x6c, 0xc0, 0x32, - 0xc9, 0x82, 0x54, 0x14, 0x77, 0x26, 0x83, 0x81, 0xc1, 0x23, 0x85, 0x18, 0x38, 0x20, 0xf8, 0x90, - 0xc4, 0xbe, 0xf5, 0xa9, 0x7d, 0xee, 0xf4, 0xa9, 0x33, 0xf9, 0x33, 0xfa, 0xd6, 0xbf, 0xaa, 0xfd, - 0x03, 0xda, 0xb9, 0x0f, 0x90, 0xa0, 0xc4, 0x64, 0x28, 0x7f, 0xf4, 0x89, 0xb7, 0x5f, 0xbf, 0xdb, - 0xdd, 0xdb, 0xbd, 0x5b, 0x10, 0x1e, 0x46, 0x71, 0x98, 0x86, 0xee, 0xe3, 0x19, 0xa1, 0x8f, 0x93, - 0x4b, 0x67, 0x36, 0x23, 0xf1, 0x7e, 0x18, 0xa5, 0x5e, 0x48, 0x93, 0xfd, 0x30, 0x22, 0xd4, 0x89, - 0xbc, 0x8b, 0x83, 0x0e, 0x57, 0xc2, 0xbf, 0x9e, 0xc5, 0x91, 0xdb, 0x99, 0x39, 0x29, 0xb9, 0x74, - 0xe6, 0x82, 0xe7, 0xda, 0x33, 0x42, 0x6d, 0x69, 0xd8, 0x91, 0x86, 0x3b, 0x1f, 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xec, 0xfd, 0x49, 0xcc, - 0xf4, 0xec, 0x09, 0x17, 0x4f, 0x06, 0x5a, 0x11, 0x9c, 0xc6, 0x3e, 0xbb, 0xdc, 0xd2, 0xf0, 0x15, - 0x11, 0x4a, 0xe2, 0xe5, 0xd0, 0x38, 0x83, 0x09, 0xf9, 0x8c, 0x18, 0x46, 0x24, 0xe1, 0xef, 0xc6, - 0xed, 0x66, 0x44, 0x66, 0x66, 0x49, 0xf3, 0xf6, 0x33, 0x50, 0x59, 0xd2, 0x31, 0x82, 0xad, 0xf1, - 0x8b, 0x61, 0xcf, 0x36, 0xfa, 0x5f, 0x77, 0x4f, 0x8c, 0x63, 0xf4, 0x1e, 0x6e, 0x01, 0x70, 0xce, - 0x61, 0x77, 0x64, 0x1c, 0x21, 0x65, 0xa1, 0xd1, 0x1d, 0x1a, 0xf6, 0xb3, 0xde, 0x0b, 0x54, 0xc2, - 0xef, 0x43, 0x83, 0x73, 0x06, 0xdd, 0xd3, 0xf1, 0xd3, 0x03, 0x54, 0x6e, 0x7f, 0x06, 0x25, 0x83, - 0x32, 0x43, 0xa3, 0x5f, 0x00, 0xda, 0x02, 0xcd, 0xe8, 0xdb, 0x7f, 0x38, 0xed, 0x59, 0xec, 0x8e, - 0x69, 0x42, 0xdd, 0xe8, 0xdb, 0x4f, 0x7b, 0xdd, 0xe3, 0x9e, 0x85, 0x4a, 0xed, 0xef, 0x40, 0x65, - 0x09, 0x62, 0xe8, 0x5f, 0x9d, 0x0c, 0xce, 0x0a, 0x66, 0x77, 0xa0, 0x29, 0x38, 0xcf, 0x87, 0x27, - 0xc6, 0x91, 0x31, 0x46, 0xca, 0x82, 0x35, 0xec, 0x8e, 0x46, 0x67, 0x03, 0xeb, 0x18, 0x95, 0xf0, - 0x36, 0x20, 0xce, 0xea, 0x0e, 0x99, 0x56, 0x77, 0x6c, 0x0c, 0xfa, 0xa8, 0xbc, 0xe4, 0x1e, 0x1d, - 0xf5, 0x46, 0x23, 0xfb, 0x68, 0x70, 0xdc, 0x43, 0x6a, 0xfb, 0xdf, 0xa5, 0x65, 0xb7, 0x16, 0x3e, - 0x10, 0xf0, 0x5f, 0x95, 0xc2, 0x3f, 0x04, 0xf1, 0x52, 0x20, 0x5b, 0xf7, 0xf4, 0x4d, 0xbe, 0x3e, - 0xd6, 0xf1, 0x44, 0x17, 0x2f, 0xfe, 0x3a, 0x28, 0x48, 0x76, 0x3e, 0x05, 0x7d, 0x8d, 0xc1, 0xd7, - 0xac, 0xf5, 0xd8, 0x1b, 0xc2, 0x0f, 0x4d, 0x7e, 0xc3, 0x0a, 0x62, 0xe7, 0x07, 0x65, 0xad, 0xc9, - 0x8f, 0x5d, 0x07, 0xaf, 0x56, 0xaf, 0x83, 0xb7, 0x1e, 0x1b, 0x77, 0xb5, 0x78, 0x59, 0xfc, 0x5d, - 0x61, 0x63, 0x29, 0xab, 0x35, 0x3c, 0x2c, 0x06, 0xd0, 0xb8, 0x4d, 0x7f, 0x72, 0x7b, 0xf1, 0x23, - 0x92, 0x27, 0x83, 0xff, 0x02, 0x60, 0xc9, 0x5c, 0x13, 0xed, 0x76, 0x31, 0xda, 0x7a, 0xc1, 0xad, - 0xc3, 0xa3, 0x3f, 0x76, 0x67, 0x5e, 0x7a, 0x9e, 0xbd, 0xec, 0xb8, 0x61, 0xb0, 0xcf, 0x1c, 0x79, - 0x4c, 0xdc, 0x30, 0x99, 0x27, 0x29, 0x91, 0xa4, 0xf4, 0x6b, 0xff, 0xc7, 0xff, 0x38, 0x7c, 0x59, - 0xe5, 0xb2, 0xcf, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xb3, 0xec, 0xbb, 0xdf, 0x5d, 0x14, 0x00, - 0x00, + proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_7182f700aabb5117) +} + +var fileDescriptor_openapiv2_7182f700aabb5117 = []byte{ + // 1884 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0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e7, 0x60, 0x58, + 0x85, 0x92, 0xc0, 0x55, 0xa5, 0x1d, 0x69, 0xb7, 0x6c, 0xa4, 0x24, 0x6e, 0x81, 0xec, 0xf8, 0xa3, + 0x40, 0xcd, 0xed, 0x48, 0xbb, 0x95, 0xfd, 0xa7, 0xcd, 0x35, 0x8f, 0xd5, 0xd4, 0xfc, 0x51, 0x60, + 0x30, 0x53, 0x8c, 0x41, 0xbe, 0x08, 0xa2, 0x58, 0xcd, 0x33, 0x64, 0xb6, 0xc6, 0x1f, 0x42, 0xf9, + 0xdc, 0x8a, 0x88, 0x39, 0xb1, 0xe2, 0x0b, 0x55, 0x66, 0x02, 0x85, 0x32, 0x7a, 0x56, 0x7c, 0x81, + 0xbf, 0x86, 0x52, 0x64, 0x5f, 0x10, 0x8f, 0x44, 0x6a, 0x61, 0x27, 0xbf, 0x5b, 0xdb, 0xff, 0xf5, + 0xda, 0xdb, 0x8a, 0x0b, 0xa5, 0xbf, 0x7d, 0x06, 0x63, 0xa4, 0x70, 0xb8, 0x0e, 0x8a, 0x1d, 0xf8, + 0x51, 0x42, 0xa1, 0x8b, 0x3b, 0x79, 0xba, 0x6b, 0x4a, 0x53, 0xd9, 0x24, 0x0c, 0x86, 0x89, 0x4d, + 0x22, 0xb5, 0xc4, 0x65, 0x29, 0x8d, 0x5f, 0x41, 0x39, 0x24, 0xd1, 0x24, 0xf0, 0x23, 0x12, 0xa9, + 0xb0, 0x93, 0xdf, 0xad, 0xec, 0xff, 0x66, 0xe3, 0x33, 0x19, 0x29, 0x42, 0xdb, 0x8f, 0xc3, 0xa9, + 0x31, 0x47, 0xc4, 0x01, 0x6c, 0x47, 0xc4, 0x4e, 0x42, 0x27, 0x9e, 0x9a, 0x43, 0x32, 0x72, 0x7c, + 0x87, 0x59, 0xaa, 0x15, 0xe6, 0xf4, 0x5f, 0xae, 0xbf, 0x93, 0x00, 0x39, 0x9a, 0x63, 0x18, 0xf7, + 0xa2, 0x65, 0x26, 0xfe, 0x1a, 0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0x0e, 0x0e, 0x7f, 0xdf, 0x1a, 0x3b, + 0xf1, 0x45, 0x72, 0xde, 0xb4, 0x03, 0x6f, 0x8f, 0x1e, 0xe4, 0x29, 0xb1, 0x83, 0x68, 0x1a, 0xc5, + 0x44, 0x90, 0xe2, 0x5c, 0x7b, 0xdf, 0xff, 0xd7, 0xff, 0x79, 0x91, 0xc9, 0x3e, 0xfb, 0x6f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x29, 0x5a, 0xd3, 0x93, 0x1f, 0x18, 0x00, 0x00, } diff --git a/protoc-gen-swagger/options/openapiv2.proto b/protoc-gen-swagger/options/openapiv2.proto index 1fb248ca144..83cb564fa58 100644 --- a/protoc-gen-swagger/options/openapiv2.proto +++ b/protoc-gen-swagger/options/openapiv2.proto @@ -5,6 +5,7 @@ package grpc.gateway.protoc_gen_swagger.options; option go_package = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"; import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. // @@ -45,6 +46,7 @@ message Swagger { // service objects into OpenAPI v2 Tag objects. reserved 13; ExternalDocumentation external_docs = 14; + map extensions = 15; } // `Operation` is a representation of OpenAPI v2 specification's Operation object. @@ -66,6 +68,7 @@ message Operation { repeated string schemes = 10; bool deprecated = 11; repeated SecurityRequirement security = 12; + map extensions = 13; } // `Response` is a representation of OpenAPI v2 specification's Response object. @@ -83,6 +86,7 @@ message Response { reserved 3; // field 3 is reserved for 'example'. reserved 4; + map extensions = 5; } // `Info` is a representation of OpenAPI v2 specification's Info object. @@ -97,6 +101,7 @@ message Info { Contact contact = 4; License license = 5; string version = 6; + map extensions = 7; } // `Contact` is a representation of OpenAPI v2 specification's Contact object. @@ -334,6 +339,7 @@ message SecurityScheme { // // Valid for oauth2. Scopes scopes = 8; + map extensions = 9; } // `SecurityRequirement` is a representation of OpenAPI v2 specification's From ffb524ece5bffb0c7e1311a48ff11b5ee12d484b Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 20 Sep 2019 09:37:01 +0100 Subject: [PATCH 472/552] Generate changelog for 1.11.2 --- CHANGELOG.md | 34 ++++++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c39858b0b2..686e4934ca6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Change Log +## [v1.11.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.11.2) (2019-09-20) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.11.1...v1.11.2) + +**Implemented enhancements:** + +- Support specifying servers in the swagger generator [\#891](https://github.com/grpc-ecosystem/grpc-gateway/issues/891) + +**Fixed bugs:** + +- Make protoc-gen-swagger build on 1.11 [\#1044](https://github.com/grpc-ecosystem/grpc-gateway/issues/1044) +- jsonpb panics when using numbers for parsing timestamps [\#1025](https://github.com/grpc-ecosystem/grpc-gateway/issues/1025) + +**Closed issues:** + +- Interceptors not called when using new RegisterHandler function [\#1043](https://github.com/grpc-ecosystem/grpc-gateway/issues/1043) +- How to use -grpc-gateway\_out sp that the result is in a specific folder? [\#1042](https://github.com/grpc-ecosystem/grpc-gateway/issues/1042) +- Is there any way to let json int32 can not accept string in grpc-gateway? [\#1029](https://github.com/grpc-ecosystem/grpc-gateway/issues/1029) +- Go integration tests are somewhat flaky [\#992](https://github.com/grpc-ecosystem/grpc-gateway/issues/992) + +**Merged pull requests:** + +- examples/integration: wait for secondary gateway [\#1039](https://github.com/grpc-ecosystem/grpc-gateway/pull/1039) ([srenatus](https://github.com/srenatus)) +- Update README.md [\#1038](https://github.com/grpc-ecosystem/grpc-gateway/pull/1038) ([piengeng](https://github.com/piengeng)) +- Configure stale\[bot\] [\#1036](https://github.com/grpc-ecosystem/grpc-gateway/pull/1036) ([achew22](https://github.com/achew22)) +- added additional info for custom http headers [\#1035](https://github.com/grpc-ecosystem/grpc-gateway/pull/1035) ([cemenson](https://github.com/cemenson)) +- protoc-gen-swagger: add support for arbitrary extensions [\#1033](https://github.com/grpc-ecosystem/grpc-gateway/pull/1033) ([srenatus](https://github.com/srenatus)) +- nitpick spacing in other proto files [\#1032](https://github.com/grpc-ecosystem/grpc-gateway/pull/1032) ([srenatus](https://github.com/srenatus)) +- nitpick a\_bit\_of\_everything.proto [\#1030](https://github.com/grpc-ecosystem/grpc-gateway/pull/1030) ([srenatus](https://github.com/srenatus)) +- runtime: stop using nil ponters with Unmarshal [\#1028](https://github.com/grpc-ecosystem/grpc-gateway/pull/1028) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Small performance fix [\#1027](https://github.com/grpc-ecosystem/grpc-gateway/pull/1027) ([freedemster](https://github.com/freedemster)) +- docs need type assertion on proto.Message [\#1026](https://github.com/grpc-ecosystem/grpc-gateway/pull/1026) ([zachgersh](https://github.com/zachgersh)) +- Update ISSUE\_TEMPLATE.md [\#1014](https://github.com/grpc-ecosystem/grpc-gateway/pull/1014) ([prologic](https://github.com/prologic)) + ## [v1.11.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.11.1) (2019-09-02) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.11.0...v1.11.1) @@ -15,6 +48,7 @@ **Merged pull requests:** +- Generate changelog for 1.11.1 [\#1024](https://github.com/grpc-ecosystem/grpc-gateway/pull/1024) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Fuzzit: use go-fuzz with go-modules support [\#1022](https://github.com/grpc-ecosystem/grpc-gateway/pull/1022) ([yevgenypats](https://github.com/yevgenypats)) - invoke in process server need attach md to incoming context [\#1021](https://github.com/grpc-ecosystem/grpc-gateway/pull/1021) ([hb-chen](https://github.com/hb-chen)) diff --git a/Makefile b/Makefile index f1af53985ce..f39f9d597e7 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.11.1 + --future-release=v1.11.2 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 99870b665aea51a3dcbce9c012187906946ee130 Mon Sep 17 00:00:00 2001 From: mnito Date: Sun, 22 Sep 2019 16:30:52 -0400 Subject: [PATCH 473/552] Pass nested enum values through properly when used as url parameters Template for generating code needed to handle the case of a nested proto that also references an enum value --- .../abe/a_bit_of_everything_service_api.go | 146 +++++ examples/integration/integration_test.go | 8 + .../proto/examplepb/a_bit_of_everything.pb.go | 501 ++++++++++-------- .../examplepb/a_bit_of_everything.pb.gw.go | 123 +++++ .../proto/examplepb/a_bit_of_everything.proto | 5 + .../a_bit_of_everything.swagger.json | 309 +++++++++++ examples/server/a_bit_of_everything.go | 4 + .../gengateway/template.go | 6 + 8 files changed, 869 insertions(+), 233 deletions(-) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 31a5b3c9c1c..731c8146d9f 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -184,6 +184,152 @@ func (a ABitOfEverythingServiceApi) CheckGetQueryParams(singleNestedName string, return successPayload, localVarAPIResponse, err } +/** + * + * + * @param singleNestedOk DeepEnum description. + * @param floatValue Float value field + * @param singleNestedName name is nested field. + * @param singleNestedAmount + * @param uuid + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param bytesValue + * @param uint32Value + * @param enumValue - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param pathEnumValue + * @param nestedPathEnumValue + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param repeatedStringValue + * @param oneofString + * @param nonConventionalNameValue + * @param timestampValue + * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param repeatedEnumAnnotation Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param enumValueAnnotation Numeric enum title. Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param repeatedStringAnnotation Repeated string title. Repeated string description. + * @param nestedAnnotationName name is nested field. + * @param nestedAnnotationAmount + * @param int64OverrideType + * @return *ExamplepbABitOfEverything + */ +func (a ABitOfEverythingServiceApi) CheckNestedEnumGetQueryParams(singleNestedOk string, floatValue float32, singleNestedName string, singleNestedAmount int64, uuid string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationName string, nestedAnnotationAmount int64, int64OverrideType int64) (*ExamplepbABitOfEverything, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}" + localVarPath = strings.Replace(localVarPath, "{"+"single_nested.ok"+"}", fmt.Sprintf("%v", singleNestedOk), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(OAuth2)' required + // oauth required + if a.Configuration.AccessToken != ""{ + localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken + } + // authentication '(BasicAuth)' required + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // authentication '(ApiKeyAuth)' required + // set key with prefix in header + localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + localVarQueryParams.Add("single_nested.name", a.Configuration.APIClient.ParameterToString(singleNestedName, "")) + localVarQueryParams.Add("single_nested.amount", a.Configuration.APIClient.ParameterToString(singleNestedAmount, "")) + localVarQueryParams.Add("uuid", a.Configuration.APIClient.ParameterToString(uuid, "")) + localVarQueryParams.Add("float_value", a.Configuration.APIClient.ParameterToString(floatValue, "")) + localVarQueryParams.Add("double_value", a.Configuration.APIClient.ParameterToString(doubleValue, "")) + localVarQueryParams.Add("int64_value", a.Configuration.APIClient.ParameterToString(int64Value, "")) + localVarQueryParams.Add("uint64_value", a.Configuration.APIClient.ParameterToString(uint64Value, "")) + localVarQueryParams.Add("int32_value", a.Configuration.APIClient.ParameterToString(int32Value, "")) + localVarQueryParams.Add("fixed64_value", a.Configuration.APIClient.ParameterToString(fixed64Value, "")) + localVarQueryParams.Add("fixed32_value", a.Configuration.APIClient.ParameterToString(fixed32Value, "")) + localVarQueryParams.Add("bool_value", a.Configuration.APIClient.ParameterToString(boolValue, "")) + localVarQueryParams.Add("string_value", a.Configuration.APIClient.ParameterToString(stringValue, "")) + localVarQueryParams.Add("bytes_value", a.Configuration.APIClient.ParameterToString(bytesValue, "")) + localVarQueryParams.Add("uint32_value", a.Configuration.APIClient.ParameterToString(uint32Value, "")) + localVarQueryParams.Add("enum_value", a.Configuration.APIClient.ParameterToString(enumValue, "")) + localVarQueryParams.Add("path_enum_value", a.Configuration.APIClient.ParameterToString(pathEnumValue, "")) + localVarQueryParams.Add("nested_path_enum_value", a.Configuration.APIClient.ParameterToString(nestedPathEnumValue, "")) + localVarQueryParams.Add("sfixed32_value", a.Configuration.APIClient.ParameterToString(sfixed32Value, "")) + localVarQueryParams.Add("sfixed64_value", a.Configuration.APIClient.ParameterToString(sfixed64Value, "")) + localVarQueryParams.Add("sint32_value", a.Configuration.APIClient.ParameterToString(sint32Value, "")) + localVarQueryParams.Add("sint64_value", a.Configuration.APIClient.ParameterToString(sint64Value, "")) + var repeatedStringValueCollectionFormat = "multi" + localVarQueryParams.Add("repeated_string_value", a.Configuration.APIClient.ParameterToString(repeatedStringValue, repeatedStringValueCollectionFormat)) + + localVarQueryParams.Add("oneof_string", a.Configuration.APIClient.ParameterToString(oneofString, "")) + localVarQueryParams.Add("nonConventionalNameValue", a.Configuration.APIClient.ParameterToString(nonConventionalNameValue, "")) + localVarQueryParams.Add("timestamp_value", a.Configuration.APIClient.ParameterToString(timestampValue, "")) + var repeatedEnumValueCollectionFormat = "multi" + localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) + + var repeatedEnumAnnotationCollectionFormat = "multi" + localVarQueryParams.Add("repeated_enum_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumAnnotation, repeatedEnumAnnotationCollectionFormat)) + + localVarQueryParams.Add("enum_value_annotation", a.Configuration.APIClient.ParameterToString(enumValueAnnotation, "")) + var repeatedStringAnnotationCollectionFormat = "multi" + localVarQueryParams.Add("repeated_string_annotation", a.Configuration.APIClient.ParameterToString(repeatedStringAnnotation, repeatedStringAnnotationCollectionFormat)) + + localVarQueryParams.Add("nested_annotation.name", a.Configuration.APIClient.ParameterToString(nestedAnnotationName, "")) + localVarQueryParams.Add("nested_annotation.amount", a.Configuration.APIClient.ParameterToString(nestedAnnotationAmount, "")) + localVarQueryParams.Add("int64_override_type", a.Configuration.APIClient.ParameterToString(int64OverrideType, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ExamplepbABitOfEverything) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "CheckNestedEnumGetQueryParams", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + /** * * diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index 49ed02ac957..e7cb6e71016 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -1556,6 +1556,14 @@ func TestRequestQueryParams(t *testing.T) { apiURL: fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/params/get/foo?double_value=%v&bool_value=%v", port, 1234.56, true), wantContent: `{"single_nested":{"name":"foo"},"double_value":1234.56,"bool_value":true}`, }, + { + name: "get nested enum url parameter", + httpMethod: "GET", + contentType: "application/json", + // If nested_enum.OK were FALSE, the content of single_nested would be {} due to how 0 values are serialized + apiURL: fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/params/get/nested_enum/TRUE", port), + wantContent: `{"single_nested":{"ok":"TRUE"}}`, + }, { name: "post url query values", httpMethod: "POST", diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index b16115fdfce..7fd9e28a3e7 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{0} + return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{0, 0, 0} } // Intentionally complicated message type to cover many features of Protobuf. @@ -139,7 +139,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{0} + return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -520,7 +520,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{0, 0} + return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -589,7 +589,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{1} + return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -732,7 +732,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{2} + return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -771,7 +771,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{3} + return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -818,7 +818,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_eb14258081b6c54b, []int{4} + return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -905,6 +905,7 @@ type ABitOfEverythingServiceClient interface { GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*empty.Empty, error) PostWithEmptyBody(ctx context.Context, in *Body, opts ...grpc.CallOption) (*empty.Empty, error) CheckGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) + CheckNestedEnumGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) CheckPostQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) } @@ -1069,6 +1070,15 @@ func (c *aBitOfEverythingServiceClient) CheckGetQueryParams(ctx context.Context, return out, nil } +func (c *aBitOfEverythingServiceClient) CheckNestedEnumGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { + out := new(ABitOfEverything) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckNestedEnumGetQueryParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *aBitOfEverythingServiceClient) CheckPostQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckPostQueryParams", in, out, opts...) @@ -1107,6 +1117,7 @@ type ABitOfEverythingServiceServer interface { GetMessageWithBody(context.Context, *MessageWithBody) (*empty.Empty, error) PostWithEmptyBody(context.Context, *Body) (*empty.Empty, error) CheckGetQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) + CheckNestedEnumGetQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) CheckPostQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) } @@ -1420,6 +1431,24 @@ func _ABitOfEverythingService_CheckGetQueryParams_Handler(srv interface{}, ctx c return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_CheckNestedEnumGetQueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverything) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).CheckNestedEnumGetQueryParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckNestedEnumGetQueryParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).CheckNestedEnumGetQueryParams(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) +} + func _ABitOfEverythingService_CheckPostQueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { @@ -1510,6 +1539,10 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "CheckGetQueryParams", Handler: _ABitOfEverythingService_CheckGetQueryParams_Handler, }, + { + MethodName: "CheckNestedEnumGetQueryParams", + Handler: _ABitOfEverythingService_CheckNestedEnumGetQueryParams_Handler, + }, { MethodName: "CheckPostQueryParams", Handler: _ABitOfEverythingService_CheckPostQueryParams_Handler, @@ -1648,229 +1681,231 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_eb14258081b6c54b) -} - -var fileDescriptor_a_bit_of_everything_eb14258081b6c54b = []byte{ - // 3520 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x7a, 0x4b, 0x70, 0x1b, 0x47, - 0x7a, 0x3f, 0x07, 0xc3, 0x67, 0xf3, 0x05, 0x36, 0x45, 0x09, 0x82, 0xb8, 0x66, 0x0b, 0x92, 0xd7, - 0x23, 0xac, 0x80, 0x21, 0x87, 0xb4, 0x2d, 0xc1, 0xff, 0xb5, 0x3d, 0x20, 0x29, 0x99, 0x92, 0x4d, - 0xd1, 0x23, 0x59, 0x7f, 0x47, 0x6b, 0x2d, 0xd3, 0x00, 0x1a, 0xc4, 0x88, 0x98, 0xc7, 0xce, 0xf4, - 0x50, 0x84, 0x18, 0x24, 0x5b, 0x49, 0x2a, 0xa9, 0xca, 0xde, 0xb0, 0x49, 0xe5, 0xb1, 0xa9, 0x5c, - 0x52, 0xb9, 0xa4, 0x72, 0x4a, 0x55, 0x2a, 0x87, 0x54, 0x25, 0x39, 0xe4, 0x96, 0x43, 0x52, 0x4e, - 0x55, 0x4e, 0xc9, 0x29, 0x39, 0xe7, 0x92, 0x2a, 0x57, 0xe5, 0x90, 0x47, 0x75, 0xcf, 0x0c, 0x30, - 0x33, 0x00, 0x44, 0x41, 0xda, 0xb2, 0x0f, 0xd6, 0x74, 0xf7, 0xf7, 0xf8, 0x7d, 0xdd, 0x5f, 0x7f, - 0x8f, 0x06, 0x81, 0x42, 0x4e, 0xb1, 0x61, 0x37, 0x89, 0x2b, 0xdb, 0x8e, 0x45, 0x2d, 0x39, 0x18, - 0xda, 0x15, 0x19, 0x1f, 0x56, 0x74, 0x7a, 0x68, 0xd5, 0x0f, 0xc9, 0x09, 0x71, 0x5a, 0xb4, 0xa1, - 0x9b, 0x47, 0x45, 0x4e, 0x03, 0xd7, 0x8e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0xc1, 0x06, - 0x18, 0xf7, 0x3c, 0xbd, 0x96, 0x11, 0x90, 0x20, 0xcd, 0x94, 0x1f, 0x75, 0xd4, 0xcf, 0x7f, 0x2c, - 0x08, 0xbf, 0x25, 0xdc, 0xff, 0x01, 0x2e, 0xd4, 0xd5, 0xc2, 0x9d, 0xf5, 0xc2, 0xed, 0xa7, 0x67, - 0xb7, 0xda, 0x85, 0xe8, 0x70, 0x6b, 0x94, 0xe1, 0x86, 0xd2, 0xd6, 0xb8, 0x06, 0x78, 0x00, 0x26, - 0x03, 0x0b, 0x52, 0x48, 0x7c, 0x23, 0x0b, 0x02, 0x39, 0xf0, 0x1e, 0x98, 0xad, 0x37, 0x2d, 0x4c, - 0x0f, 0x4f, 0x70, 0xd3, 0x23, 0x19, 0x11, 0x09, 0x52, 0xaa, 0x7c, 0xa3, 0xa3, 0x7e, 0x57, 0x59, - 0xba, 0xc3, 0xe6, 0x11, 0x9f, 0x47, 0xdc, 0xc3, 0x4a, 0xe2, 0x7a, 0x51, 0xf9, 0x5a, 0x88, 0x32, - 0x68, 0x80, 0x0f, 0x1e, 0xb3, 0x6f, 0x78, 0x15, 0xcc, 0xd5, 0x2c, 0xaf, 0xd2, 0x24, 0x81, 0xb0, - 0x71, 0x24, 0x48, 0x82, 0x36, 0xeb, 0xcf, 0xf9, 0x24, 0x6b, 0x60, 0x56, 0x37, 0xe9, 0x7b, 0x5b, - 0x01, 0xc5, 0x04, 0x12, 0x24, 0x51, 0x03, 0x7c, 0xaa, 0x2b, 0xc3, 0x8b, 0x52, 0x4c, 0x22, 0x41, - 0x1a, 0xd7, 0x66, 0xbd, 0x08, 0x89, 0x2f, 0x63, 0x53, 0x09, 0x28, 0xa6, 0x90, 0x20, 0x4d, 0x70, - 0x19, 0x9b, 0x8a, 0x4f, 0x70, 0x0d, 0xcc, 0xd7, 0xf5, 0x53, 0x52, 0xeb, 0x0a, 0x99, 0x46, 0x82, - 0x34, 0xa9, 0xcd, 0x05, 0x93, 0x71, 0xa2, 0xae, 0x9c, 0x19, 0x24, 0x48, 0x53, 0x01, 0x51, 0x28, - 0xe9, 0x3b, 0x00, 0x54, 0x2c, 0xab, 0x19, 0x50, 0x00, 0x24, 0x48, 0xd3, 0xda, 0x0c, 0x9b, 0xe9, - 0x82, 0x75, 0xa9, 0xa3, 0x9b, 0x47, 0x01, 0xc1, 0x2c, 0x73, 0x00, 0x6d, 0xd6, 0x9f, 0xeb, 0x82, - 0xad, 0xb4, 0x28, 0x71, 0x03, 0x8a, 0xef, 0x20, 0x41, 0x9a, 0xd3, 0x00, 0x9f, 0x8a, 0x19, 0xdc, - 0x85, 0x31, 0x8f, 0x04, 0x69, 0xde, 0x37, 0x38, 0x44, 0x71, 0x1f, 0x00, 0x76, 0xeb, 0x02, 0x82, - 0x05, 0x24, 0x48, 0x0b, 0xca, 0xcd, 0x73, 0x4f, 0x7e, 0xdf, 0x33, 0x88, 0xa3, 0x57, 0x77, 0x4d, - 0xcf, 0xd0, 0x66, 0x18, 0xbf, 0x2f, 0xec, 0x00, 0x2c, 0x76, 0xef, 0x71, 0x20, 0xf1, 0x2d, 0x2e, - 0x51, 0x1a, 0x22, 0x31, 0xbc, 0xfe, 0xc5, 0x03, 0x4c, 0x1b, 0x5c, 0xda, 0xbc, 0x1d, 0x7c, 0xf9, - 0x12, 0x5d, 0x70, 0xd1, 0x77, 0xa6, 0xc3, 0xa4, 0xe0, 0x35, 0x2e, 0xf8, 0xc3, 0xf3, 0x04, 0x7f, - 0xe6, 0x07, 0x84, 0x50, 0x7e, 0xe0, 0xa2, 0x5d, 0x75, 0xcb, 0x66, 0x6c, 0xec, 0x2b, 0x7d, 0x1b, - 0x2c, 0xb8, 0xf1, 0xf3, 0x5b, 0x44, 0x82, 0xb4, 0xa8, 0xcd, 0xbb, 0xb1, 0x03, 0xec, 0x92, 0x75, - 0x7d, 0x21, 0x8d, 0x04, 0x29, 0x1d, 0x92, 0x45, 0xbc, 0xce, 0x8d, 0x1e, 0xc2, 0x12, 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0d, 0x16, 0xbb, 0xe9, 0x2d, 0x40, 0x7c, 0x85, 0x9f, 0x78, 0xb6, 0xef, - 0xc4, 0x1f, 0x85, 0x74, 0xda, 0x42, 0x97, 0xc5, 0x17, 0xf2, 0x15, 0xe8, 0x7a, 0x52, 0xf4, 0xb2, - 0xad, 0x22, 0x71, 0xe4, 0xb8, 0xb0, 0x14, 0x0a, 0xea, 0x5d, 0xac, 0x3f, 0x13, 0x40, 0x26, 0x2e, - 0xbe, 0x97, 0x64, 0x33, 0x68, 0x74, 0x1d, 0xe5, 0x9d, 0x8e, 0xaa, 0xe6, 0xaf, 0x68, 0x81, 0x48, - 0x64, 0xfa, 0x4b, 0x88, 0x89, 0x46, 0x54, 0xa7, 0x4d, 0xa2, 0xe4, 0x06, 0x2f, 0xd6, 0x88, 0x5b, - 0x75, 0x74, 0x9e, 0xe9, 0x8b, 0xda, 0xc5, 0x28, 0x52, 0xb5, 0x8b, 0x08, 0xfe, 0xb6, 0x00, 0x56, - 0x7a, 0x9b, 0x10, 0xc5, 0x7a, 0x75, 0xf4, 0x38, 0x59, 0x56, 0x3a, 0xaa, 0x9c, 0x87, 0xfb, 0xfd, - 0x10, 0x2f, 0xef, 0x0f, 0x45, 0xb6, 0xdc, 0x8d, 0xad, 0x11, 0x58, 0x27, 0x20, 0x9b, 0x0c, 0x05, - 0x11, 0x68, 0x39, 0x16, 0x0f, 0xca, 0xb7, 0x3a, 0xea, 0xbb, 0xf9, 0x95, 0xae, 0xed, 0x3e, 0x59, - 0xa0, 0x6f, 0x35, 0x39, 0x1d, 0x53, 0x99, 0x89, 0x47, 0x92, 0x88, 0xde, 0xbf, 0x16, 0x22, 0x8a, - 0x83, 0x9b, 0x11, 0x51, 0x7c, 0xed, 0xcd, 0xaa, 0x86, 0xf2, 0x9d, 0x8e, 0xba, 0x9d, 0xef, 0x61, - 0xf3, 0x15, 0x20, 0xab, 0xf2, 0x8c, 0x54, 0x69, 0x80, 0xfc, 0xda, 0x90, 0xd5, 0x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 0xd1, 0x32, 0x1a, 0x03, 0x46, 0xbd, - 0xfb, 0x2f, 0xae, 0x00, 0x78, 0x5a, 0x88, 0xce, 0xb0, 0x4b, 0x02, 0x27, 0xb2, 0x62, 0x05, 0x3b, - 0x2f, 0x24, 0x70, 0x29, 0xb1, 0x58, 0xc1, 0x2f, 0x0a, 0x4d, 0xdd, 0xa5, 0x70, 0x5e, 0x99, 0x05, - 0x13, 0x59, 0xd1, 0x32, 0x09, 0x48, 0x21, 0xe1, 0xc9, 0x4c, 0xd7, 0x1d, 0x2b, 0x93, 0x3c, 0x8c, - 0x6d, 0xfe, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x94, 0x65, 0x6b, 0xb3, 0xd8, 0x2a, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71) +} + +var fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71 = []byte{ + // 3551 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4d, 0x6c, 0x1b, 0xc7, + 0x7e, 0xd7, 0x72, 0x25, 0x59, 0x1a, 0x7d, 0x8f, 0x2c, 0x5b, 0xa6, 0x95, 0x68, 0x4c, 0x3b, 0x2f, + 0x6b, 0x3e, 0x93, 0x2b, 0xad, 0x94, 0xc4, 0x66, 0xfa, 0x92, 0x90, 0x92, 0xec, 0xc8, 0x4e, 0x64, + 0x65, 0xed, 0xb8, 0xa9, 0x5f, 0xfc, 0xd4, 0x21, 0x39, 0x14, 0xd7, 0xe2, 0xee, 0xec, 0xdb, 0x9d, + 0x95, 0x45, 0xab, 0x6c, 0x1f, 0xda, 0xa2, 0x05, 0xfa, 0x6e, 0x7c, 0x2d, 0xfa, 0xf1, 0x8a, 0x5e, + 0x8a, 0x5e, 0x8a, 0x9e, 0x0a, 0xf4, 0x54, 0xa0, 0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0x30, 0xf7, 0x3e, 0x02, 0xff, 0x22, 0x75, + 0x5a, 0xee, 0x7f, 0x90, 0x26, 0x64, 0x65, 0x54, 0xbb, 0x1a, 0xfa, 0x5c, 0xc4, 0x41, 0x55, 0x81, + 0x47, 0xed, 0x08, 0x2d, 0xac, 0x0e, 0x26, 0x12, 0x10, 0x4a, 0xbf, 0x06, 0xd2, 0x7e, 0x07, 0x0f, + 0xe1, 0x1d, 0x07, 0x5b, 0xcc, 0x45, 0x7c, 0x10, 0x9c, 0x25, 0x58, 0x09, 0xfa, 0x7a, 0xb8, 0x18, + 0x2c, 0x8a, 0x51, 0xb8, 0xba, 0x05, 0xc6, 0x70, 0xd5, 0x34, 0x2c, 0x58, 0x88, 0xb1, 0x5a, 0xd5, + 0x18, 0x99, 0x70, 0x0d, 0x4e, 0x66, 0xb8, 0x8c, 0x57, 0x6b, 0xc7, 0x04, 0x19, 0x56, 0x8d, 0x3a, + 0xa6, 0xf0, 0xbe, 0xf2, 0x2a, 0x98, 0x89, 0x1e, 0xcc, 0x48, 0xf2, 0xad, 0xa1, 0x7c, 0x7d, 0xe0, + 0x6b, 0x43, 0x92, 0xd4, 0xd9, 0x05, 0x17, 0x3f, 0xed, 0x46, 0xcb, 0x68, 0x0c, 0x18, 0xf6, 0xee, + 0x3f, 0xbf, 0x0c, 0xe0, 0x49, 0x2e, 0x3a, 0xc3, 0x2f, 0x09, 0x1c, 0x4b, 0xcb, 0x65, 0xec, 0x3c, + 0x57, 0xc0, 0xc5, 0xc4, 0x62, 0x19, 0x3f, 0xcf, 0x35, 0x0c, 0x97, 0xc1, 0x19, 0x6d, 0x0a, 0x8c, + 0xa5, 0x65, 0x6a, 0x11, 0x90, 0x42, 0xd2, 0xe3, 0xc9, 0x8e, 0x3b, 0x96, 0xc7, 0x45, 0x18, 0xdb, + 0xf8, 0x59, 0x00, 0x00, 0x00, 0xff, 0xff, 0xae, 0xbe, 0x1f, 0x2b, 0xb3, 0x2b, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index 11bb93e3bca..5724b0525de 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -1894,6 +1894,85 @@ func local_request_ABitOfEverythingService_CheckGetQueryParams_0(ctx context.Con } +var ( + filter_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "ok": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} +) + +func request_ABitOfEverythingService_CheckNestedEnumGetQueryParams_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 + + var ( + val string + e int32 + ok bool + err error + _ = err + ) + + val, ok = pathParams["single_nested.ok"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.ok") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.ok", val) + + e, err = runtime.Enum(val, ABitOfEverything_Nested_DeepEnum_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.ok", err) + } + + protoReq.SingleNested.Ok = ABitOfEverything_Nested_DeepEnum(e) + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CheckNestedEnumGetQueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + var ( + val string + e int32 + ok bool + err error + _ = err + ) + + val, ok = pathParams["single_nested.ok"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.ok") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.ok", val) + + e, err = runtime.Enum(val, ABitOfEverything_Nested_DeepEnum_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "single_nested.ok", err) + } + + protoReq.SingleNested.Ok = ABitOfEverything_Nested_DeepEnum(e) + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CheckNestedEnumGetQueryParams(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_ABitOfEverythingService_CheckPostQueryParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"single_nested": 0, "string_value": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) @@ -2382,6 +2461,26 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt }) + mux.Handle("GET", pattern_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_ABitOfEverythingService_CheckPostQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -2851,6 +2950,26 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) + mux.Handle("GET", pattern_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_ABitOfEverythingService_CheckPostQueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -2913,6 +3032,8 @@ var ( pattern_ABitOfEverythingService_CheckGetQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "get", "single_nested.name"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"v1", "example", "a_bit_of_everything", "params", "get", "nested_enum", "single_nested.ok"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_ABitOfEverythingService_CheckPostQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "post", "string_value"}, "", runtime.AssumeColonVerbOpt(true))) ) @@ -2955,6 +3076,8 @@ var ( forward_ABitOfEverythingService_CheckGetQueryParams_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_CheckPostQueryParams_0 = runtime.ForwardResponseMessage ) diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 767e492e261..37a928f09e0 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -506,6 +506,11 @@ service ABitOfEverythingService { get: "/v1/example/a_bit_of_everything/params/get/{single_nested.name}" }; } + rpc CheckNestedEnumGetQueryParams(ABitOfEverything) returns (ABitOfEverything) { + option (google.api.http) = { + get: "/v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}" + }; + } rpc CheckPostQueryParams(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = { post: "/v1/example/a_bit_of_everything/params/post/{string_value}" diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 58c1b34c74e..b74fac63962 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -124,6 +124,315 @@ } } }, + "/v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}": { + "get": { + "operationId": "CheckNestedEnumGetQueryParams", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + }, + "403": { + "description": "Returned when the user does not have permission to access the resource.", + "schema": {} + }, + "404": { + "description": "Returned when the resource does not exist.", + "schema": { + "type": "string", + "format": "string" + } + }, + "418": { + "description": "I'm a teapot.", + "schema": { + "$ref": "#/definitions/examplepbNumericEnum" + } + } + }, + "parameters": [ + { + "name": "single_nested.ok", + "description": "DeepEnum description.", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "FALSE", + "TRUE" + ] + }, + { + "name": "single_nested.name", + "description": "name is nested field.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "single_nested.amount", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "uuid", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "float_value", + "description": "Float value field", + "in": "query", + "required": true, + "type": "number", + "format": "float", + "default": "0.2" + }, + { + "name": "double_value", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "int64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "uint64_value", + "in": "query", + "required": false, + "type": "string", + "format": "uint64" + }, + { + "name": "int32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "fixed64_value", + "in": "query", + "required": false, + "type": "string", + "format": "uint64" + }, + { + "name": "fixed32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "bool_value", + "in": "query", + "required": false, + "type": "boolean", + "format": "boolean" + }, + { + "name": "string_value", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "bytes_value", + "in": "query", + "required": false, + "type": "string", + "format": "byte" + }, + { + "name": "uint32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "enum_value", + "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "ZERO", + "ONE" + ], + "default": "ZERO" + }, + { + "name": "path_enum_value", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "ABC", + "DEF" + ], + "default": "ABC" + }, + { + "name": "nested_path_enum_value", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "GHI", + "JKL" + ], + "default": "GHI" + }, + { + "name": "sfixed32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "sfixed64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "sint32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "sint64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "repeated_string_value", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "oneof_string", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "nonConventionalNameValue", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "timestamp_value", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "repeated_enum_value", + "description": "repeated enum value. it is comma-separated in query.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + }, + "collectionFormat": "multi" + }, + { + "name": "repeated_enum_annotation", + "description": "Repeated numeric enum title. Repeated numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + }, + "collectionFormat": "multi" + }, + { + "name": "enum_value_annotation", + "description": "Numeric enum title. Numeric enum description.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "ZERO", + "ONE" + ], + "default": "ZERO" + }, + { + "name": "repeated_string_annotation", + "description": "Repeated string title. Repeated string description.", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "nested_annotation.name", + "description": "name is nested field.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "nested_annotation.amount", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "int64_override_type", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, "/v1/example/a_bit_of_everything/params/get/{single_nested.name}": { "get": { "operationId": "CheckGetQueryParams", diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index b2bcf41994d..c37fa47fe10 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -324,6 +324,10 @@ func (s *_ABitOfEverythingServer) CheckGetQueryParams(ctx context.Context, msg * return msg, nil } +func (s *_ABitOfEverythingServer) CheckNestedEnumGetQueryParams(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { + return msg, nil +} + func (s *_ABitOfEverythingServer) CheckPostQueryParams(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { return msg, nil } diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 4dcc9637d5d..ceb3dda1110 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -348,6 +348,9 @@ var ( } {{if $param.IsNestedProto3}} err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) + {{if $enum}} + e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}_value) + {{end}} {{else if $enum}} e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}_value) {{else}} @@ -508,6 +511,9 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct } {{if $param.IsNestedProto3}} err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) + {{if $enum}} + e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}_value) + {{end}} {{else if $enum}} e{{if $param.IsRepeated}}s{{end}}, err = {{$param.ConvertFuncExpr}}(val{{if $param.IsRepeated}}, {{$binding.Registry.GetRepeatedPathParamSeparator | printf "%c" | printf "%q"}}{{end}}, {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}_value) {{else}} From 93934d59bfc9bcba1808fa4db1f2686a83ead324 Mon Sep 17 00:00:00 2001 From: Will Plano <51954103+william-plano-oxb@users.noreply.github.com> Date: Fri, 27 Sep 2019 15:04:38 +0100 Subject: [PATCH 474/552] Fix auto generated fieldmask case in patch requests (#1049) * Fix fieldmask case Fix up tests to check expected behaviour Fix up documentation to match new behaviour * Remove PatchWithFieldMaskInBody Replaced with an additional binding to UpdateV2 * Regenerated code * `bazel run :gazelle` * Added tests for proto file with non snake_case field names * tabs -> spaces * Update patch documentation Add benchmark for patching ABE * Apply suggestions from code review Co-Authored-By: Johan Brandhorst * Move benchmark to fieldmask_test and just measure the FieldMaskFromRequestBody method * Apply suggestions from code review Fix typos (again) Co-Authored-By: Johan Brandhorst * Add more representative benchmark --- Makefile | 1 + docs/_docs/patch.md | 20 +- .../abe/a_bit_of_everything_service_api.go | 60 +- examples/gateway/gateway.go | 1 + examples/integration/integration_test.go | 86 ++- examples/proto/examplepb/BUILD.bazel | 2 + .../proto/examplepb/a_bit_of_everything.pb.go | 490 +++++++------- .../examplepb/a_bit_of_everything.pb.gw.go | 38 +- .../proto/examplepb/a_bit_of_everything.proto | 21 +- .../a_bit_of_everything.swagger.json | 2 +- .../proto/examplepb/non_standard_names.pb.go | 634 ++++++++++++++++++ .../examplepb/non_standard_names.pb.gw.go | 296 ++++++++ .../proto/examplepb/non_standard_names.proto | 75 +++ examples/server/BUILD.bazel | 2 + examples/server/a_bit_of_everything.go | 19 +- examples/server/fieldmask_helper.go | 3 +- examples/server/fieldmask_helper_test.go | 48 +- examples/server/main.go | 1 + examples/server/non_standard_names.go | 40 ++ .../gengateway/template.go | 18 +- .../gengateway/template_test.go | 7 +- runtime/BUILD.bazel | 1 - runtime/fieldmask.go | 23 +- runtime/fieldmask_test.go | 102 ++- 24 files changed, 1560 insertions(+), 430 deletions(-) create mode 100644 examples/proto/examplepb/non_standard_names.pb.go create mode 100644 examples/proto/examplepb/non_standard_names.pb.gw.go create mode 100644 examples/proto/examplepb/non_standard_names.proto create mode 100644 examples/server/non_standard_names.go diff --git a/Makefile b/Makefile index f39f9d597e7..f166c512fdf 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,7 @@ EXAMPLES=examples/proto/examplepb/echo_service.proto \ examples/proto/examplepb/a_bit_of_everything.proto \ examples/proto/examplepb/stream.proto \ examples/proto/examplepb/flow_combination.proto \ + examples/proto/examplepb/non_standard_names.proto \ examples/proto/examplepb/wrappers.proto \ examples/proto/examplepb/unannotated_echo_service.proto \ examples/proto/examplepb/response_body_service.proto diff --git a/docs/_docs/patch.md b/docs/_docs/patch.md index c395b7f61c2..42b96eab25f 100644 --- a/docs/_docs/patch.md +++ b/docs/_docs/patch.md @@ -3,20 +3,20 @@ category: documentation --- # Patch Feature -The HTTP PATCH method allows a resource to be partially updated. +The HTTP PATCH method allows a resource to be partially updated. The idea, If a binding is mapped to patch and the request message has exactly one FieldMask message in it, additional code is rendered for the gateway handler that will populate the FieldMask based on the request body. -This handles two scenarios: -- The FieldMask is hidden from the REST request (as in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto#L286) example). In this case, the FieldMask is updated from the request body and set in the gRPC request message. -- The FieldMask is exposed to the REST request (as in the [PatchWithFieldMaskInBody](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto#L295) example). For this case, a check is made as to whether the FieldMask is nil/empty prior to populating with the request body. +There are two scenarios: +- The FieldMask is hidden from the REST request as per the [Google API design guide](https://cloud.google.com/apis/design/standard_methods#update) (as in the first additional binding in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto#L366) example). In this case, the FieldMask is updated from the request body and set in the gRPC request message. +- The FieldMask is exposed to the REST request (as in the second additional binding in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto#L370) example). For this case, the field mask is left untouched by the gateway. -If it's not nil, then it converts the FieldMask paths from the REST (snake_case) to gRPC (PascalCase) format. Otherwise, it acts like the previous case. +Currently this feature is not compatible with using the JSON marshaller option to use json names in the http request/response described [here](https://grpc-ecosystem.github.io/grpc-gateway/docs/customizingyourgateway.html#using-camelcase-for-json). If you want to use json names then you may with to disable this feature with the command line option `-allow_patch_feature=false` ## Example Usage -1. Create PATCH request. +1. Create PATCH request. The PATCH request needs to include the message and the update mask. -```golang +```golang // UpdateV2Request request for update includes the message and the update mask message UpdateV2Request { ABitOfEverything abe = 1; @@ -40,10 +40,10 @@ rpc UpdateV2(UpdateV2Request) returns (google.protobuf.Empty) { } ``` -If you want to use PATCH wtih fieldmask exposed to the REST request then include the entire request message. +If you want to use PATCH with fieldmask exposed to the REST request then include the entire request message. ```golang -rpc PatchWithFieldMaskInBody(UpdateV2Request) returns (google.protobuf.Empty) { +rpc UpdateV2(UpdateV2Request) returns (google.protobuf.Empty) { option (google.api.http) = { patch: "/v2a/example/a_bit_of_everything/{abe.uuid}" body: "*" @@ -63,4 +63,4 @@ curl --data '{"string_value": "strprefix/foo"}' -X PATCH http://address:port/v2/ If we know what fields we want to update then we can use PATCH with field mask approach. For this we need to pass the resource and the update_mask. Below only the "single_nested" will get updated because that is what we specify in the field_mask. ``` curl --data '{"abe":{"single_nested":{"amount":457},"string_value":"some value that won't get updated because not in the field mask"},"update_mask":{"paths":["single_nested"]}}' -X PATCH http://address:port/v2a/example/a_bit_of_everything/1 -``` \ No newline at end of file +``` diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index 731c8146d9f..ec3f4c49886 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -1204,16 +1204,16 @@ func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEveryth /** * * - * @param abeUuid + * @param name * @param body * @return *interface{} */ -func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, body ExamplepbUpdateV2Request) (*interface{}, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body ExamplepbBody) (*interface{}, *APIResponse, error) { - var localVarHttpMethod = strings.ToUpper("Patch") + var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2a/example/a_bit_of_everything/{abe.uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) + localVarPath := a.Configuration.BasePath + "/v2/example/postwithemptybody/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1265,7 +1265,7 @@ func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, bod var localVarURL, _ = url.Parse(localVarPath) localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "PatchWithFieldMaskInBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + var localVarAPIResponse = &APIResponse{Operation: "PostWithEmptyBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} if localVarHttpResponse != nil { localVarAPIResponse.Response = localVarHttpResponse.RawResponse localVarAPIResponse.Payload = localVarHttpResponse.Body() @@ -1281,16 +1281,13 @@ func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, bod /** * * - * @param name - * @param body * @return *interface{} */ -func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body ExamplepbBody) (*interface{}, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) Timeout() (*interface{}, *APIResponse, error) { - var localVarHttpMethod = strings.ToUpper("Post") + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/postwithemptybody/{name}" - localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + localVarPath := a.Configuration.BasePath + "/v2/example/timeout" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1335,14 +1332,12 @@ func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body Examplep if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - // body params - localVarPostBody = &body var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "PostWithEmptyBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + var localVarAPIResponse = &APIResponse{Operation: "Timeout", Method: localVarHttpMethod, RequestURL: localVarURL.String()} if localVarHttpResponse != nil { localVarAPIResponse.Response = localVarHttpResponse.RawResponse localVarAPIResponse.Payload = localVarHttpResponse.Body() @@ -1358,13 +1353,16 @@ func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body Examplep /** * * + * @param uuid + * @param body * @return *interface{} */ -func (a ABitOfEverythingServiceApi) Timeout() (*interface{}, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { - var localVarHttpMethod = strings.ToUpper("Get") + var localVarHttpMethod = strings.ToUpper("Put") // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/timeout" + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1409,12 +1407,14 @@ func (a ABitOfEverythingServiceApi) Timeout() (*interface{}, *APIResponse, error if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } + // body params + localVarPostBody = &body var successPayload = new(interface{}) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) var localVarURL, _ = url.Parse(localVarPath) localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Timeout", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + var localVarAPIResponse = &APIResponse{Operation: "Update", Method: localVarHttpMethod, RequestURL: localVarURL.String()} if localVarHttpResponse != nil { localVarAPIResponse.Response = localVarHttpResponse.RawResponse localVarAPIResponse.Payload = localVarHttpResponse.Body() @@ -1430,16 +1430,16 @@ func (a ABitOfEverythingServiceApi) Timeout() (*interface{}, *APIResponse, error /** * * - * @param uuid + * @param abeUuid * @param body * @return *interface{} */ -func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Put") // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + localVarPath := a.Configuration.BasePath + "/v2/example/a_bit_of_everything/{abe.uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1491,7 +1491,7 @@ func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEver var localVarURL, _ = url.Parse(localVarPath) localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Update", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + var localVarAPIResponse = &APIResponse{Operation: "UpdateV2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} if localVarHttpResponse != nil { localVarAPIResponse.Response = localVarHttpResponse.RawResponse localVarAPIResponse.Payload = localVarHttpResponse.Body() @@ -1511,9 +1511,9 @@ func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEver * @param body * @return *interface{} */ -func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { - var localVarHttpMethod = strings.ToUpper("Put") + var localVarHttpMethod = strings.ToUpper("Patch") // create path and map variables localVarPath := a.Configuration.BasePath + "/v2/example/a_bit_of_everything/{abe.uuid}" localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) @@ -1568,7 +1568,7 @@ func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitO var localVarURL, _ = url.Parse(localVarPath) localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "UpdateV2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + var localVarAPIResponse = &APIResponse{Operation: "UpdateV22", Method: localVarHttpMethod, RequestURL: localVarURL.String()} if localVarHttpResponse != nil { localVarAPIResponse.Response = localVarHttpResponse.RawResponse localVarAPIResponse.Payload = localVarHttpResponse.Body() @@ -1588,11 +1588,11 @@ func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitO * @param body * @return *interface{} */ -func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { +func (a ABitOfEverythingServiceApi) UpdateV23(abeUuid string, body ExamplepbUpdateV2Request) (*interface{}, *APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Patch") // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/a_bit_of_everything/{abe.uuid}" + localVarPath := a.Configuration.BasePath + "/v2a/example/a_bit_of_everything/{abe.uuid}" localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) localVarHeaderParams := make(map[string]string) @@ -1645,7 +1645,7 @@ func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABit var localVarURL, _ = url.Parse(localVarPath) localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "UpdateV22", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + var localVarAPIResponse = &APIResponse{Operation: "UpdateV23", Method: localVarHttpMethod, RequestURL: localVarURL.String()} if localVarHttpResponse != nil { localVarAPIResponse.Response = localVarHttpResponse.RawResponse localVarAPIResponse.Payload = localVarHttpResponse.Body() diff --git a/examples/gateway/gateway.go b/examples/gateway/gateway.go index 297ebe63d8b..5fccade22ce 100644 --- a/examples/gateway/gateway.go +++ b/examples/gateway/gateway.go @@ -22,6 +22,7 @@ func newGateway(ctx context.Context, conn *grpc.ClientConn, opts []gwruntime.Ser examplepb.RegisterStreamServiceHandler, examplepb.RegisterABitOfEverythingServiceHandler, examplepb.RegisterFlowCombinationHandler, + examplepb.RegisterNonStandardServiceHandler, examplepb.RegisterResponseBodyServiceHandler, } { if err := f(ctx, mux, conn); err != nil { diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index e7cb6e71016..939fecde84a 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -707,6 +707,7 @@ func TestABEPatch(t *testing.T) { } // TestABEPatchBody demonstrates the ability to specify an update mask within the request body. +// This binding does not use an automatically generated update_mask. func TestABEPatchBody(t *testing.T) { port := 8080 @@ -719,6 +720,7 @@ func TestABEPatchBody(t *testing.T) { { name: "with fieldmask provided", originalValue: gw.ABitOfEverything{ + Int32Value: 42, StringValue: "rabbit", SingleNested: &gw.ABitOfEverything_Nested{Name: "some value that will get overwritten", Amount: 345}, }, @@ -726,11 +728,17 @@ func TestABEPatchBody(t *testing.T) { StringValue: "some value that won't get updated because it's not in the field mask", SingleNested: &gw.ABitOfEverything_Nested{Amount: 456}, }, UpdateMask: &field_mask.FieldMask{Paths: []string{"single_nested"}}}, - want: gw.ABitOfEverything{StringValue: "rabbit", SingleNested: &gw.ABitOfEverything_Nested{Amount: 456}}, + want: gw.ABitOfEverything{ + Int32Value: 42, + StringValue: "rabbit", + SingleNested: &gw.ABitOfEverything_Nested{Amount: 456}, + }, }, { + // N.B. This case passes the empty field mask to the UpdateV2 method so falls back to PUT semantics as per the implementation. name: "with empty fieldmask", originalValue: gw.ABitOfEverything{ + Int32Value: 42, StringValue: "some value that will get overwritten", SingleNested: &gw.ABitOfEverything_Nested{Name: "value that will get empty", Amount: 345}, }, @@ -744,8 +752,10 @@ func TestABEPatchBody(t *testing.T) { }, }, { + // N.B. This case passes the nil field mask to the UpdateV2 method so falls back to PUT semantics as per the implementation. name: "with nil fieldmask", originalValue: gw.ABitOfEverything{ + Int32Value: 42, StringValue: "some value that will get overwritten", SingleNested: &gw.ABitOfEverything_Nested{Name: "value that will get empty", Amount: 123}, }, @@ -1617,3 +1627,77 @@ func TestRequestQueryParams(t *testing.T) { }) } } + +func TestNonStandardNames(t *testing.T) { + ctx := context.Background() + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + go func() { + if err := runGateway( + ctx, + ":8081", + runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName: true, EmitDefaults: true}), + ); err != nil { + t.Errorf("runGateway() failed with %v; want success", err) + return + } + }() + + if err := waitForGateway(ctx, 8081); err != nil { + t.Errorf("waitForGateway(ctx, 8081) failed with %v; want success", err) + } + + for _, tc := range []struct { + name string + port int + method string + jsonBody string + }{ + { + "Test standard update method", + 8081, + "update", + `{"id":"foo","Num":"1","line_num":"42","langIdent":"English","STATUS":"good","en_GB":"1","no":"yes","thing":{"subThing":{"sub_value":"hi"}}}`, + }, + { + "Test update method using json_names in message", + 8081, + "update_with_json_names", + // N.B. json_names have no effect if not using OrigName: false + `{"id":"foo","Num":"1","line_num":"42","langIdent":"English","STATUS":"good","en_GB":"1","no":"yes","thing":{"subThing":{"sub_value":"hi"}}}`, + }, + } { + t.Run(tc.name, func(t *testing.T) { + testNonStandardNames(t, tc.port, tc.method, tc.jsonBody) + }) + } +} + +func testNonStandardNames(t *testing.T, port int, method string, jsonBody string) { + req, err := http.NewRequest( + http.MethodPatch, + fmt.Sprintf("http://localhost:%d/v1/example/non_standard/%s", port, method), + strings.NewReader(jsonBody), + ) + if err != nil { + t.Fatalf("http.NewRequest(PATCH) failed with %v; want success", err) + } + patchResp, err := http.DefaultClient.Do(req) + if err != nil { + t.Fatalf("failed to issue PATCH request: %v", err) + } + + body, err := ioutil.ReadAll(patchResp.Body) + if err != nil { + t.Errorf("patchResp body couldn't be read: %v", err) + } + + if got, want := patchResp.StatusCode, http.StatusOK; got != want { + t.Errorf("patchResp.StatusCode= %d; want %d resp: %v", got, want, string(body)) + } + + if got, want := string(body), jsonBody; got != want { + t.Errorf("got %q; want %q", got, want) + } +} diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index dd7a2d45c3c..4888a802ff9 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -7,6 +7,7 @@ package(default_visibility = ["//visibility:public"]) # gazelle:exclude a_bit_of_everything.pb.gw.go # gazelle:exclude echo_service.pb.gw.go # gazelle:exclude flow_combination.pb.gw.go +# gazelle:exclude non_standard_names.pb.gw.go # gazelle:exclude stream.pb.gw.go # gazelle:exclude wrappers.pb.gw.go # gazelle:exclude response_body_service.pb.gw.go @@ -17,6 +18,7 @@ proto_library( "a_bit_of_everything.proto", "echo_service.proto", "flow_combination.proto", + "non_standard_names.proto", "response_body_service.proto", "stream.proto", "unannotated_echo_service.proto", diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 7fd9e28a3e7..7cc2c7209a7 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -55,7 +55,7 @@ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{0} + return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{0} } // DeepEnum is one or zero. @@ -81,7 +81,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{0, 0, 0} } // Intentionally complicated message type to cover many features of Protobuf. @@ -139,7 +139,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{0} + return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -520,7 +520,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{0, 0} + return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -589,7 +589,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{1} + return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) @@ -732,7 +732,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{2} + return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -771,7 +771,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{3} + return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -818,7 +818,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71, []int{4} + return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) @@ -886,7 +886,6 @@ type ABitOfEverythingServiceClient interface { Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*empty.Empty, error) UpdateV2(ctx context.Context, in *UpdateV2Request, opts ...grpc.CallOption) (*empty.Empty, error) - PatchWithFieldMaskInBody(ctx context.Context, in *UpdateV2Request, opts ...grpc.CallOption) (*empty.Empty, error) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*empty.Empty, error) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*empty.Empty, error) GetRepeatedQuery(ctx context.Context, in *ABitOfEverythingRepeated, opts ...grpc.CallOption) (*ABitOfEverythingRepeated, error) @@ -962,15 +961,6 @@ func (c *aBitOfEverythingServiceClient) UpdateV2(ctx context.Context, in *Update return out, nil } -func (c *aBitOfEverythingServiceClient) PatchWithFieldMaskInBody(ctx context.Context, in *UpdateV2Request, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PatchWithFieldMaskInBody", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, opts...) @@ -1098,7 +1088,6 @@ type ABitOfEverythingServiceServer interface { Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, error) Update(context.Context, *ABitOfEverything) (*empty.Empty, error) UpdateV2(context.Context, *UpdateV2Request) (*empty.Empty, error) - PatchWithFieldMaskInBody(context.Context, *UpdateV2Request) (*empty.Empty, error) Delete(context.Context, *sub2.IdMessage) (*empty.Empty, error) GetQuery(context.Context, *ABitOfEverything) (*empty.Empty, error) GetRepeatedQuery(context.Context, *ABitOfEverythingRepeated) (*ABitOfEverythingRepeated, error) @@ -1215,24 +1204,6 @@ func _ABitOfEverythingService_UpdateV2_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_PatchWithFieldMaskInBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateV2Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ABitOfEverythingServiceServer).PatchWithFieldMaskInBody(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PatchWithFieldMaskInBody", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ABitOfEverythingServiceServer).PatchWithFieldMaskInBody(ctx, req.(*UpdateV2Request)) - } - return interceptor(ctx, in, info, handler) -} - func _ABitOfEverythingService_Delete_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 { @@ -1491,10 +1462,6 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateV2", Handler: _ABitOfEverythingService_UpdateV2_Handler, }, - { - MethodName: "PatchWithFieldMaskInBody", - Handler: _ABitOfEverythingService_PatchWithFieldMaskInBody_Handler, - }, { MethodName: "Delete", Handler: _ABitOfEverythingService_Delete_Handler, @@ -1681,231 +1648,230 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71) + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_e0089283b92675c0) } -var fileDescriptor_a_bit_of_everything_4e4f16ccb3b71c71 = []byte{ - // 3551 bytes of a gzipped FileDescriptorProto +var fileDescriptor_a_bit_of_everything_e0089283b92675c0 = []byte{ + // 3529 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4d, 0x6c, 0x1b, 0xc7, 0x7e, 0xd7, 0x72, 0x25, 0x59, 0x1a, 0x7d, 0x8f, 0x2c, 0x5b, 0xa6, 0x95, 0x68, 0x4c, 0x3b, 0x2f, 0x6b, 0x3e, 0x93, 0x2b, 0xad, 0x94, 0xc4, 0x66, 0xfa, 0x92, 0x90, 0x92, 0xec, 0xc8, 0x4e, 0x64, 0x65, 0xed, 0xb8, 0xa9, 0x5f, 0xfc, 0xd4, 0x21, 0x39, 0x14, 0xd7, 0xe2, 0xee, 0xec, 0xdb, 0x9d, - 0x95, 0x45, 0xab, 0x6c, 0x1f, 0xda, 0xa2, 0x05, 0xfa, 0x6e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 0xca, 0xaa, - 0x49, 0x5c, 0x17, 0x1f, 0x92, 0x80, 0xe2, 0x4a, 0x2f, 0x85, 0x96, 0x20, 0x59, 0x4d, 0xa2, 0x61, - 0x86, 0x49, 0x5c, 0x86, 0x4d, 0x3b, 0x20, 0xb8, 0x21, 0xfe, 0xa9, 0xe4, 0x0e, 0x89, 0x95, 0x73, - 0x9f, 0xe1, 0xc3, 0x43, 0xe2, 0xa8, 0xd4, 0x16, 0xfb, 0xd1, 0xbb, 0x37, 0x99, 0x7f, 0xba, 0x0c, - 0xe6, 0x8b, 0x25, 0x83, 0xdd, 0xaf, 0xed, 0x74, 0x76, 0x1d, 0x3e, 0x01, 0x33, 0xae, 0x61, 0x1d, - 0x36, 0xc8, 0x81, 0x45, 0x5c, 0x46, 0xaa, 0xcb, 0x97, 0x90, 0xa4, 0x4c, 0x69, 0x37, 0xf3, 0x67, - 0x9c, 0x43, 0x3e, 0x29, 0x29, 0xbf, 0x27, 0xf8, 0xf5, 0x69, 0x5f, 0x9c, 0x3f, 0x82, 0x75, 0x30, - 0xea, 0x79, 0x46, 0x75, 0x59, 0x42, 0x92, 0x32, 0x59, 0x7a, 0xd8, 0x2e, 0x7e, 0xf6, 0x23, 0x49, - 0xfa, 0x1d, 0xe9, 0xde, 0xf7, 0x71, 0xae, 0x56, 0xcc, 0xdd, 0x5e, 0xcb, 0xdd, 0x7a, 0x72, 0x7a, - 0xb3, 0x95, 0x8b, 0x0e, 0x37, 0x87, 0x19, 0xae, 0x6b, 0x2d, 0x5d, 0x68, 0x80, 0xfb, 0x60, 0x3c, - 0xb0, 0x20, 0x85, 0xe4, 0xd7, 0xb2, 0x20, 0x90, 0x03, 0xef, 0x82, 0xa9, 0x5a, 0x83, 0x62, 0x76, - 0x70, 0x8c, 0x1b, 0x1e, 0x59, 0x96, 0x91, 0xa4, 0xa4, 0x4a, 0xd7, 0xdb, 0xc5, 0xef, 0x68, 0x0b, - 0xb7, 0xf9, 0x3c, 0x12, 0xf3, 0x48, 0x78, 0x58, 0x41, 0x5e, 0xcb, 0x6b, 0x5f, 0x49, 0x51, 0x06, - 0x1d, 0x88, 0xc1, 0x23, 0xfe, 0x0d, 0xaf, 0x80, 0xe9, 0x2a, 0xf5, 0xca, 0x0d, 0x12, 0x08, 0x1b, - 0x45, 0x92, 0x22, 0xe9, 0x53, 0xfe, 0x9c, 0x4f, 0xb2, 0x0a, 0xa6, 0x0c, 0x8b, 0xbd, 0xbb, 0x19, - 0x50, 0x8c, 0x21, 0x49, 0x91, 0x75, 0x20, 0xa6, 0x3a, 0x32, 0xbc, 0x28, 0xc5, 0x38, 0x92, 0x94, - 0x51, 0x7d, 0xca, 0x8b, 0x90, 0xf8, 0x32, 0x36, 0xb4, 0x80, 0xe2, 0x1c, 0x92, 0x94, 0x31, 0x21, - 0x63, 0x43, 0xf3, 0x09, 0xae, 0x82, 0x99, 0x9a, 0x71, 0x42, 0xaa, 0x1d, 0x21, 0x13, 0x48, 0x52, - 0xc6, 0xf5, 0xe9, 0x60, 0x32, 0x4e, 0xd4, 0x91, 0x33, 0x89, 0x24, 0xe5, 0x5c, 0x40, 0x14, 0x4a, - 0x7a, 0x03, 0x80, 0x32, 0xa5, 0x8d, 0x80, 0x02, 0x20, 0x49, 0x99, 0xd0, 0x27, 0xf9, 0x4c, 0x07, - 0xac, 0xcb, 0x1c, 0xc3, 0x3a, 0x0c, 0x08, 0xa6, 0xb8, 0x03, 0xe8, 0x53, 0xfe, 0x5c, 0x07, 0x6c, - 0xb9, 0xc9, 0x88, 0x1b, 0x50, 0xbc, 0x81, 0x24, 0x65, 0x5a, 0x07, 0x62, 0x2a, 0x66, 0x70, 0x07, - 0xc6, 0x0c, 0x92, 0x94, 0x19, 0xdf, 0xe0, 0x10, 0xc5, 0x3d, 0x00, 0xf8, 0xad, 0x0b, 0x08, 0x66, - 0x91, 0xa4, 0xcc, 0x6a, 0x37, 0xce, 0x3c, 0xf9, 0x3d, 0xcf, 0x24, 0x8e, 0x51, 0xd9, 0xb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 0xf8, 0x59, 0x00, 0x00, 0x00, 0xff, 0xff, 0xae, 0xbe, 0x1f, 0x2b, 0xb3, 0x2b, 0x00, 0x00, + 0x95, 0x45, 0xab, 0x6c, 0x1f, 0xda, 0xa2, 0x05, 0xfa, 0x6e, 0x7c, 0xfd, 0x7e, 0x68, 0x2f, 0x45, + 0x51, 0xa0, 0xe8, 0xa9, 0x40, 0x4f, 0x05, 0xda, 0x4b, 0x6f, 0x3d, 0xb4, 0x48, 0x81, 0xa2, 0x87, + 0xf6, 0xd4, 0x9e, 0x7b, 0x69, 0x11, 0xa0, 0x87, 0x7e, 0x60, 0x66, 0x77, 0xc9, 0xdd, 0x25, 0x69, + 0x99, 0x76, 0x91, 0xe4, 0x10, 0xef, 0xcc, 0xfc, 0x3f, 0x7e, 0xff, 0x99, 0xff, 0xfc, 0x3f, 0x86, + 0x02, 0x1a, 0x39, 0xc1, 0xa6, 0xdd, 0x20, 0xae, 0x6a, 0x3b, 0x94, 0x51, 0x35, 0x18, 0xda, 0x65, + 0x15, 0x1f, 0x94, 0x0d, 0x76, 0x40, 0x6b, 0x07, 0xe4, 0x98, 0x38, 0x4d, 0x56, 0x37, 0xac, 0xc3, + 0xbc, 0xa0, 0x81, 0xab, 0x87, 0x8e, 0x5d, 0xc9, 0x1f, 0x62, 0x46, 0x9e, 0xe1, 0x66, 0x3e, 0x14, + 0x90, 0xef, 0xb0, 0xa6, 0x57, 0x0e, 0x29, 0x3d, 0x6c, 0x10, 0x15, 0xdb, 0x86, 0x8a, 0x2d, 0x8b, + 0x32, 0xcc, 0x0c, 0x6a, 0xb9, 0x3e, 0x7b, 0x1a, 0x05, 0xab, 0x62, 0x54, 0xf6, 0x6a, 0x6a, 0xcd, + 0x20, 0x8d, 0xea, 0x81, 0x89, 0xdd, 0xa3, 0x80, 0xe2, 0x72, 0x92, 0x82, 0x98, 0x36, 0x6b, 0x06, + 0x8b, 0x6f, 0x26, 0x17, 0xab, 0x9e, 0x23, 0xe4, 0x07, 0xeb, 0x6f, 0x27, 0x2c, 0xb2, 0x31, 0xab, + 0x13, 0xcb, 0x33, 0xc5, 0xc7, 0x01, 0xff, 0x0a, 0x71, 0x24, 0x08, 0x5d, 0xaf, 0xac, 0x9a, 0xc4, + 0x75, 0xf1, 0x21, 0x09, 0x28, 0xae, 0xf4, 0x52, 0x68, 0x09, 0x92, 0xd5, 0x24, 0x1a, 0x66, 0x98, + 0xc4, 0x65, 0xd8, 0xb4, 0x03, 0x82, 0x1b, 0xe2, 0x9f, 0x4a, 0xee, 0x90, 0x58, 0x39, 0xf7, 0x19, + 0x3e, 0x3c, 0x24, 0x8e, 0x4a, 0x6d, 0xb1, 0x1f, 0xbd, 0x7b, 0x93, 0xf9, 0xfb, 0xcb, 0x60, 0xbe, + 0x58, 0x32, 0xd8, 0xfd, 0xda, 0x4e, 0x67, 0xd7, 0xe1, 0x13, 0x30, 0xe3, 0x1a, 0xd6, 0x61, 0x83, + 0x1c, 0x58, 0xc4, 0x65, 0xa4, 0xba, 0x7c, 0x09, 0x49, 0xca, 0x94, 0x76, 0x33, 0x7f, 0xc6, 0x39, + 0xe4, 0x93, 0x92, 0xf2, 0x7b, 0x82, 0x5f, 0x9f, 0xf6, 0xc5, 0xf9, 0x23, 0x58, 0x07, 0xa3, 0x9e, + 0x67, 0x54, 0x97, 0x25, 0x24, 0x29, 0x93, 0xa5, 0x87, 0xed, 0xe2, 0x67, 0x3f, 0x92, 0xa4, 0xdf, + 0x90, 0xee, 0x7d, 0x1f, 0xe7, 0x6a, 0xc5, 0xdc, 0xed, 0xb5, 0xdc, 0xad, 0x27, 0xa7, 0x37, 0x5b, + 0xb9, 0xe8, 0x70, 0x73, 0x98, 0xe1, 0xba, 0xd6, 0xd2, 0x85, 0x06, 0xb8, 0x0f, 0xc6, 0x03, 0x0b, + 0x52, 0x48, 0x7e, 0x2d, 0x0b, 0x02, 0x39, 0xf0, 0x2e, 0x98, 0xaa, 0x35, 0x28, 0x66, 0x07, 0xc7, + 0xb8, 0xe1, 0x91, 0x65, 0x19, 0x49, 0x4a, 0xaa, 0x74, 0xbd, 0x5d, 0xfc, 0x8e, 0xb6, 0x70, 0x9b, + 0xcf, 0x23, 0x31, 0x8f, 0x84, 0x87, 0x15, 0xe4, 0xb5, 0xbc, 0xf6, 0x95, 0x14, 0x65, 0xd0, 0x81, + 0x18, 0x3c, 0xe2, 0xdf, 0xf0, 0x0a, 0x98, 0xae, 0x52, 0xaf, 0xdc, 0x20, 0x81, 0xb0, 0x51, 0x24, + 0x29, 0x92, 0x3e, 0xe5, 0xcf, 0xf9, 0x24, 0xab, 0x60, 0xca, 0xb0, 0xd8, 0xbb, 0x9b, 0x01, 0xc5, + 0x18, 0x92, 0x14, 0x59, 0x07, 0x62, 0xaa, 0x23, 0xc3, 0x8b, 0x52, 0x8c, 0x23, 0x49, 0x19, 0xd5, + 0xa7, 0xbc, 0x08, 0x89, 0x2f, 0x63, 0x43, 0x0b, 0x28, 0xce, 0x21, 0x49, 0x19, 0x13, 0x32, 0x36, + 0x34, 0x9f, 0xe0, 0x2a, 0x98, 0xa9, 0x19, 0x27, 0xa4, 0xda, 0x11, 0x32, 0x81, 0x24, 0x65, 0x5c, + 0x9f, 0x0e, 0x26, 0xe3, 0x44, 0x1d, 0x39, 0x93, 0x48, 0x52, 0xce, 0x05, 0x44, 0xa1, 0xa4, 0x37, + 0x00, 0x28, 0x53, 0xda, 0x08, 0x28, 0x00, 0x92, 0x94, 0x09, 0x7d, 0x92, 0xcf, 0x74, 0xc0, 0xba, + 0xcc, 0x31, 0xac, 0xc3, 0x80, 0x60, 0x8a, 0x3b, 0x80, 0x3e, 0xe5, 0xcf, 0x75, 0xc0, 0x96, 0x9b, + 0x8c, 0xb8, 0x01, 0xc5, 0x1b, 0x48, 0x52, 0xa6, 0x75, 0x20, 0xa6, 0x62, 0x06, 0x77, 0x60, 0xcc, + 0x20, 0x49, 0x99, 0xf1, 0x0d, 0x0e, 0x51, 0xdc, 0x03, 0x80, 0xdf, 0xba, 0x80, 0x60, 0x16, 0x49, + 0xca, 0xac, 0x76, 0xe3, 0xcc, 0x93, 0xdf, 0xf3, 0x4c, 0xe2, 0x18, 0x95, 0x1d, 0xcb, 0x33, 0xf5, + 0x49, 0xce, 0xef, 0x0b, 0xdb, 0x07, 0x73, 0x9d, 0x7b, 0x1c, 0x48, 0x7c, 0x53, 0x48, 0x54, 0x06, + 0x48, 0x0c, 0xaf, 0x7f, 0x7e, 0x1f, 0xb3, 0xba, 0x90, 0x36, 0x63, 0x07, 0x5f, 0xbe, 0x44, 0x17, + 0x5c, 0xf0, 0x9d, 0xe9, 0x20, 0x29, 0x78, 0x55, 0x08, 0xfe, 0xe0, 0x2c, 0xc1, 0x9f, 0xfa, 0x01, + 0x21, 0x94, 0x1f, 0xb8, 0x68, 0x47, 0xdd, 0xa2, 0x15, 0x1b, 0xfb, 0x4a, 0xdf, 0x02, 0xb3, 0x6e, + 0xfc, 0xfc, 0xe6, 0x90, 0xa4, 0xcc, 0xe9, 0x33, 0x6e, 0xec, 0x00, 0x3b, 0x64, 0x1d, 0x5f, 0x98, + 0x47, 0x92, 0x32, 0x1f, 0x92, 0x45, 0xbc, 0xce, 0x8d, 0x1e, 0xc2, 0x02, 0x92, 0x94, 0x05, 0x7d, + 0xca, 0x8d, 0x1c, 0x42, 0x40, 0xd2, 0x91, 0x03, 0x91, 0xa4, 0x40, 0x9f, 0x24, 0x94, 0xa2, 0x81, + 0x25, 0x87, 0xd8, 0x04, 0xf3, 0xad, 0x88, 0xf9, 0xc5, 0x22, 0x92, 0x95, 0x49, 0x7d, 0x31, 0x5c, + 0x7c, 0x10, 0xf1, 0x8f, 0x5b, 0x60, 0x8a, 0x5a, 0x84, 0x27, 0x09, 0x1e, 0xa1, 0x97, 0xcf, 0x8b, + 0xc0, 0x74, 0x21, 0xef, 0x07, 0xc5, 0x7c, 0x18, 0x14, 0xf3, 0x3b, 0x7c, 0xf5, 0xe3, 0x11, 0x1d, + 0x08, 0x62, 0x31, 0x82, 0x57,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, 0x2b, 0x89, 0xbd, 0x89, 0x1f, 0xca, 0x0c, 0x92, 0x95, 0x39, 0xfd, 0x52, 0x6c, + 0x77, 0x62, 0xfd, 0xd1, 0x00, 0x01, 0x1d, 0xa7, 0x98, 0x45, 0xb2, 0x32, 0xdf, 0x4f, 0xc0, 0x40, + 0x67, 0x8e, 0xf5, 0x51, 0x73, 0x48, 0x56, 0x16, 0x12, 0xa7, 0x13, 0xd9, 0xa5, 0xbe, 0xcc, 0x91, + 0x4e, 0x4d, 0x56, 0x60, 0x2f, 0x73, 0xa0, 0xb9, 0x50, 0x6f, 0x17, 0x89, 0x56, 0x81, 0xf8, 0x14, + 0x65, 0x06, 0x39, 0x56, 0xa6, 0x80, 0xbe, 0xcf, 0x1c, 0x8f, 0xdc, 0x40, 0xfe, 0xff, 0x6b, 0xb8, + 0xe1, 0x06, 0x83, 0x27, 0x37, 0x92, 0x6c, 0x11, 0xdc, 0x9c, 0x6f, 0xfd, 0x06, 0xd2, 0x6e, 0xa0, + 0x8d, 0x27, 0xa8, 0x95, 0x49, 0x83, 0xd1, 0x12, 0xad, 0x36, 0xfb, 0x65, 0xee, 0xcc, 0x97, 0x60, + 0x2e, 0x68, 0x5f, 0x7f, 0xd6, 0x60, 0x75, 0x41, 0x36, 0x0b, 0x52, 0xe1, 0x63, 0x90, 0x9e, 0x32, + 0x78, 0x88, 0x1a, 0xad, 0x62, 0x86, 0x83, 0xec, 0xf1, 0xd6, 0x99, 0xe7, 0xce, 0x85, 0xe8, 0x82, + 0x25, 0xf3, 0x13, 0x09, 0xcc, 0x7d, 0x6e, 0x57, 0x31, 0x23, 0x8f, 0x34, 0x9d, 0xfc, 0xd0, 0x23, + 0x2e, 0x83, 0x5b, 0x40, 0xc6, 0x65, 0x1f, 0xc4, 0x94, 0xb6, 0x3e, 0x74, 0x2e, 0xd2, 0x39, 0x37, + 0x7c, 0x1f, 0x4c, 0x79, 0x42, 0xae, 0x78, 0x35, 0x0c, 0xa0, 0xf5, 0x36, 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, 0xb7, 0x09, 0xb1, 0xc5, 0x4f, 0x4b, 0x7c, 0xe2, 0x9b, 0xa9, 0x4d, 0x3e, 0x14, + 0xb6, 0xdd, 0xca, 0x6c, 0x9e, 0x19, 0xf9, 0x63, 0xbf, 0x5a, 0xe7, 0x79, 0xc3, 0x21, 0x52, 0x56, + 0x11, 0x80, 0x3d, 0x5a, 0x32, 0xac, 0xaa, 0x61, 0x1d, 0xba, 0xf0, 0x52, 0x4f, 0x60, 0xdf, 0x0e, + 0x7e, 0xd0, 0x1f, 0x18, 0xf3, 0x47, 0xe0, 0x23, 0x70, 0xee, 0xa1, 0x61, 0x12, 0xea, 0x31, 0x38, + 0x80, 0x68, 0x20, 0xf3, 0x65, 0x01, 0x7f, 0x09, 0x2e, 0x46, 0xf7, 0x93, 0x05, 0xc2, 0xea, 0x60, + 0x7e, 0xc7, 0x71, 0xa8, 0xc3, 0xbb, 0xa1, 0x6d, 0xc2, 0xb0, 0xd1, 0x70, 0x87, 0x56, 0x70, 0x4d, + 0x28, 0x78, 0x13, 0xae, 0xc4, 0x0e, 0x8c, 0x4b, 0x7d, 0x66, 0xb0, 0x7a, 0x35, 0x90, 0xfa, 0xeb, + 0x12, 0x80, 0x77, 0x08, 0x4b, 0x76, 0x5f, 0x67, 0x17, 0x2e, 0x09, 0x8e, 0x81, 0x30, 0xde, 0x16, + 0x30, 0xae, 0x64, 0x2e, 0x45, 0x61, 0x70, 0x04, 0x65, 0x5a, 0x6d, 0xaa, 0xa7, 0xbc, 0x7c, 0x10, + 0x5d, 0x1a, 0xfc, 0x15, 0x09, 0x2c, 0xec, 0x53, 0x97, 0x71, 0x89, 0x82, 0x55, 0x00, 0x79, 0xb9, + 0x46, 0x6f, 0xa0, 0x76, 0x55, 0x68, 0xbf, 0x9e, 0xb9, 0x16, 0xd5, 0x6e, 0x53, 0x97, 0x71, 0x04, + 0xe2, 0xc7, 0x42, 0x1f, 0x46, 0xc7, 0x29, 0xfe, 0x46, 0x02, 0x8b, 0x5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f, 0x48, 0x2b, 0x00, 0x00, } diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index 5724b0525de..c6aa89f505c 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -773,9 +773,7 @@ func request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marshaler r if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { - runtime.CamelCaseFieldMask(protoReq.UpdateMask) - } else { + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { @@ -824,9 +822,7 @@ func local_request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marsh if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Abe); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { - runtime.CamelCaseFieldMask(protoReq.UpdateMask) - } else { + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { @@ -861,7 +857,7 @@ func local_request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marsh } -func request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_ABitOfEverythingService_UpdateV2_2(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateV2Request var metadata runtime.ServerMetadata @@ -872,9 +868,6 @@ func request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx context.Cont if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { - runtime.CamelCaseFieldMask(protoReq.UpdateMask) - } var ( val string @@ -894,12 +887,12 @@ func request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx context.Cont return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } - msg, err := client.PatchWithFieldMaskInBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.UpdateV2(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_ABitOfEverythingService_UpdateV2_2(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq UpdateV2Request var metadata runtime.ServerMetadata @@ -910,9 +903,6 @@ func local_request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx contex if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 { - runtime.CamelCaseFieldMask(protoReq.UpdateMask) - } var ( val string @@ -932,7 +922,7 @@ func local_request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx contex return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "abe.uuid", err) } - msg, err := server.PatchWithFieldMaskInBody(ctx, &protoReq) + msg, err := server.UpdateV2(ctx, &protoReq) return msg, metadata, err } @@ -2201,7 +2191,7 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt }) - mux.Handle("PATCH", pattern_ABitOfEverythingService_PatchWithFieldMaskInBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("PATCH", pattern_ABitOfEverythingService_UpdateV2_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -2210,14 +2200,14 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ABitOfEverythingService_UpdateV2_2(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_UpdateV2_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -2690,7 +2680,7 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) - mux.Handle("PATCH", pattern_ABitOfEverythingService_PatchWithFieldMaskInBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("PATCH", pattern_ABitOfEverythingService_UpdateV2_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -2699,14 +2689,14 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ABitOfEverythingService_PatchWithFieldMaskInBody_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ABitOfEverythingService_UpdateV2_2(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_ABitOfEverythingService_PatchWithFieldMaskInBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_ABitOfEverythingService_UpdateV2_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -3006,7 +2996,7 @@ var ( pattern_ABitOfEverythingService_UpdateV2_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "example", "a_bit_of_everything", "abe.uuid"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_ABitOfEverythingService_PatchWithFieldMaskInBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2a", "example", "a_bit_of_everything", "abe.uuid"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_ABitOfEverythingService_UpdateV2_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2a", "example", "a_bit_of_everything", "abe.uuid"}, "", runtime.AssumeColonVerbOpt(true))) 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"}, "", runtime.AssumeColonVerbOpt(true))) @@ -3050,7 +3040,7 @@ var ( forward_ABitOfEverythingService_UpdateV2_1 = runtime.ForwardResponseMessage - forward_ABitOfEverythingService_PatchWithFieldMaskInBody_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_UpdateV2_2 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Delete_0 = runtime.ForwardResponseMessage diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 37a928f09e0..6a7a75c2447 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -362,18 +362,19 @@ service ABitOfEverythingService { option (google.api.http) = { put: "/v2/example/a_bit_of_everything/{abe.uuid}" body: "abe" - additional_bindings { - patch: "/v2/example/a_bit_of_everything/{abe.uuid}" - body: "abe" - } - }; - } - rpc PatchWithFieldMaskInBody(UpdateV2Request) returns (google.protobuf.Empty) { - option (google.api.http) = { - patch: "/v2a/example/a_bit_of_everything/{abe.uuid}" - body: "*" + additional_bindings: [ + { + patch: "/v2/example/a_bit_of_everything/{abe.uuid}" + body: "abe" + }, + { + patch: "/v2a/example/a_bit_of_everything/{abe.uuid}" + body: "*" + } + ] }; } + rpc Delete(sub2.IdMessage) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/example/a_bit_of_everything/{uuid}" diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index b74fac63962..41a60607f7d 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -2128,7 +2128,7 @@ }, "/v2a/example/a_bit_of_everything/{abe.uuid}": { "patch": { - "operationId": "PatchWithFieldMaskInBody", + "operationId": "UpdateV23", "responses": { "200": { "description": "A successful response.", diff --git a/examples/proto/examplepb/non_standard_names.pb.go b/examples/proto/examplepb/non_standard_names.pb.go new file mode 100644 index 00000000000..839f5537820 --- /dev/null +++ b/examples/proto/examplepb/non_standard_names.pb.go @@ -0,0 +1,634 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: examples/proto/examplepb/non_standard_names.proto + +package examplepb + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import field_mask "google.golang.org/genproto/protobuf/field_mask" + +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 + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// NonStandardMessage has oddly named fields. +type NonStandardMessage struct { + // Id represents the message identifier. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Num int64 `protobuf:"varint,2,opt,name=Num,proto3" json:"Num,omitempty"` + LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,proto3" json:"line_num,omitempty"` + LangIdent string `protobuf:"bytes,4,opt,name=langIdent,proto3" json:"langIdent,omitempty"` + STATUS string `protobuf:"bytes,5,opt,name=STATUS,proto3" json:"STATUS,omitempty"` + En_GB int64 `protobuf:"varint,6,opt,name=en_GB,json=enGB,proto3" json:"en_GB,omitempty"` + No string `protobuf:"bytes,7,opt,name=no,proto3" json:"no,omitempty"` + Thing *NonStandardMessage_Thing `protobuf:"bytes,8,opt,name=thing,proto3" json:"thing,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NonStandardMessage) Reset() { *m = NonStandardMessage{} } +func (m *NonStandardMessage) String() string { return proto.CompactTextString(m) } +func (*NonStandardMessage) ProtoMessage() {} +func (*NonStandardMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{0} +} +func (m *NonStandardMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NonStandardMessage.Unmarshal(m, b) +} +func (m *NonStandardMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NonStandardMessage.Marshal(b, m, deterministic) +} +func (dst *NonStandardMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessage.Merge(dst, src) +} +func (m *NonStandardMessage) XXX_Size() int { + return xxx_messageInfo_NonStandardMessage.Size(m) +} +func (m *NonStandardMessage) XXX_DiscardUnknown() { + xxx_messageInfo_NonStandardMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_NonStandardMessage proto.InternalMessageInfo + +func (m *NonStandardMessage) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *NonStandardMessage) GetNum() int64 { + if m != nil { + return m.Num + } + return 0 +} + +func (m *NonStandardMessage) GetLineNum() int64 { + if m != nil { + return m.LineNum + } + return 0 +} + +func (m *NonStandardMessage) GetLangIdent() string { + if m != nil { + return m.LangIdent + } + return "" +} + +func (m *NonStandardMessage) GetSTATUS() string { + if m != nil { + return m.STATUS + } + return "" +} + +func (m *NonStandardMessage) GetEn_GB() int64 { + if m != nil { + return m.En_GB + } + return 0 +} + +func (m *NonStandardMessage) GetNo() string { + if m != nil { + return m.No + } + return "" +} + +func (m *NonStandardMessage) GetThing() *NonStandardMessage_Thing { + if m != nil { + return m.Thing + } + return nil +} + +type NonStandardMessage_Thing struct { + SubThing *NonStandardMessage_Thing_SubThing `protobuf:"bytes,1,opt,name=subThing,proto3" json:"subThing,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NonStandardMessage_Thing) Reset() { *m = NonStandardMessage_Thing{} } +func (m *NonStandardMessage_Thing) String() string { return proto.CompactTextString(m) } +func (*NonStandardMessage_Thing) ProtoMessage() {} +func (*NonStandardMessage_Thing) Descriptor() ([]byte, []int) { + return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{0, 0} +} +func (m *NonStandardMessage_Thing) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NonStandardMessage_Thing.Unmarshal(m, b) +} +func (m *NonStandardMessage_Thing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NonStandardMessage_Thing.Marshal(b, m, deterministic) +} +func (dst *NonStandardMessage_Thing) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessage_Thing.Merge(dst, src) +} +func (m *NonStandardMessage_Thing) XXX_Size() int { + return xxx_messageInfo_NonStandardMessage_Thing.Size(m) +} +func (m *NonStandardMessage_Thing) XXX_DiscardUnknown() { + xxx_messageInfo_NonStandardMessage_Thing.DiscardUnknown(m) +} + +var xxx_messageInfo_NonStandardMessage_Thing proto.InternalMessageInfo + +func (m *NonStandardMessage_Thing) GetSubThing() *NonStandardMessage_Thing_SubThing { + if m != nil { + return m.SubThing + } + return nil +} + +type NonStandardMessage_Thing_SubThing struct { + SubValue string `protobuf:"bytes,1,opt,name=sub_value,json=subValue,proto3" json:"sub_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NonStandardMessage_Thing_SubThing) Reset() { *m = NonStandardMessage_Thing_SubThing{} } +func (m *NonStandardMessage_Thing_SubThing) String() string { return proto.CompactTextString(m) } +func (*NonStandardMessage_Thing_SubThing) ProtoMessage() {} +func (*NonStandardMessage_Thing_SubThing) Descriptor() ([]byte, []int) { + return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{0, 0, 0} +} +func (m *NonStandardMessage_Thing_SubThing) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NonStandardMessage_Thing_SubThing.Unmarshal(m, b) +} +func (m *NonStandardMessage_Thing_SubThing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NonStandardMessage_Thing_SubThing.Marshal(b, m, deterministic) +} +func (dst *NonStandardMessage_Thing_SubThing) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessage_Thing_SubThing.Merge(dst, src) +} +func (m *NonStandardMessage_Thing_SubThing) XXX_Size() int { + return xxx_messageInfo_NonStandardMessage_Thing_SubThing.Size(m) +} +func (m *NonStandardMessage_Thing_SubThing) XXX_DiscardUnknown() { + xxx_messageInfo_NonStandardMessage_Thing_SubThing.DiscardUnknown(m) +} + +var xxx_messageInfo_NonStandardMessage_Thing_SubThing proto.InternalMessageInfo + +func (m *NonStandardMessage_Thing_SubThing) GetSubValue() string { + if m != nil { + return m.SubValue + } + return "" +} + +type NonStandardUpdateRequest struct { + Body *NonStandardMessage `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + UpdateMask *field_mask.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NonStandardUpdateRequest) Reset() { *m = NonStandardUpdateRequest{} } +func (m *NonStandardUpdateRequest) String() string { return proto.CompactTextString(m) } +func (*NonStandardUpdateRequest) ProtoMessage() {} +func (*NonStandardUpdateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{1} +} +func (m *NonStandardUpdateRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NonStandardUpdateRequest.Unmarshal(m, b) +} +func (m *NonStandardUpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NonStandardUpdateRequest.Marshal(b, m, deterministic) +} +func (dst *NonStandardUpdateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardUpdateRequest.Merge(dst, src) +} +func (m *NonStandardUpdateRequest) XXX_Size() int { + return xxx_messageInfo_NonStandardUpdateRequest.Size(m) +} +func (m *NonStandardUpdateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NonStandardUpdateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NonStandardUpdateRequest proto.InternalMessageInfo + +func (m *NonStandardUpdateRequest) GetBody() *NonStandardMessage { + if m != nil { + return m.Body + } + return nil +} + +func (m *NonStandardUpdateRequest) GetUpdateMask() *field_mask.FieldMask { + if m != nil { + return m.UpdateMask + } + return nil +} + +// NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion. +type NonStandardMessageWithJSONNames struct { + // Id represents the message identifier. + Id string `protobuf:"bytes,1,opt,name=id,json=ID,proto3" json:"id,omitempty"` + Num int64 `protobuf:"varint,2,opt,name=Num,proto3" json:"Num,omitempty"` + LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=LineNum,proto3" json:"line_num,omitempty"` + LangIdent string `protobuf:"bytes,4,opt,name=langIdent,proto3" json:"langIdent,omitempty"` + STATUS string `protobuf:"bytes,5,opt,name=STATUS,json=status,proto3" json:"STATUS,omitempty"` + En_GB int64 `protobuf:"varint,6,opt,name=en_GB,json=En_GB,proto3" json:"en_GB,omitempty"` + No string `protobuf:"bytes,7,opt,name=no,json=yes,proto3" json:"no,omitempty"` + Thing *NonStandardMessageWithJSONNames_Thing `protobuf:"bytes,8,opt,name=thing,json=Thingy,proto3" json:"thing,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NonStandardMessageWithJSONNames) Reset() { *m = NonStandardMessageWithJSONNames{} } +func (m *NonStandardMessageWithJSONNames) String() string { return proto.CompactTextString(m) } +func (*NonStandardMessageWithJSONNames) ProtoMessage() {} +func (*NonStandardMessageWithJSONNames) Descriptor() ([]byte, []int) { + return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{2} +} +func (m *NonStandardMessageWithJSONNames) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NonStandardMessageWithJSONNames.Unmarshal(m, b) +} +func (m *NonStandardMessageWithJSONNames) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NonStandardMessageWithJSONNames.Marshal(b, m, deterministic) +} +func (dst *NonStandardMessageWithJSONNames) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessageWithJSONNames.Merge(dst, src) +} +func (m *NonStandardMessageWithJSONNames) XXX_Size() int { + return xxx_messageInfo_NonStandardMessageWithJSONNames.Size(m) +} +func (m *NonStandardMessageWithJSONNames) XXX_DiscardUnknown() { + xxx_messageInfo_NonStandardMessageWithJSONNames.DiscardUnknown(m) +} + +var xxx_messageInfo_NonStandardMessageWithJSONNames proto.InternalMessageInfo + +func (m *NonStandardMessageWithJSONNames) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *NonStandardMessageWithJSONNames) GetNum() int64 { + if m != nil { + return m.Num + } + return 0 +} + +func (m *NonStandardMessageWithJSONNames) GetLineNum() int64 { + if m != nil { + return m.LineNum + } + return 0 +} + +func (m *NonStandardMessageWithJSONNames) GetLangIdent() string { + if m != nil { + return m.LangIdent + } + return "" +} + +func (m *NonStandardMessageWithJSONNames) GetSTATUS() string { + if m != nil { + return m.STATUS + } + return "" +} + +func (m *NonStandardMessageWithJSONNames) GetEn_GB() int64 { + if m != nil { + return m.En_GB + } + return 0 +} + +func (m *NonStandardMessageWithJSONNames) GetNo() string { + if m != nil { + return m.No + } + return "" +} + +func (m *NonStandardMessageWithJSONNames) GetThing() *NonStandardMessageWithJSONNames_Thing { + if m != nil { + return m.Thing + } + return nil +} + +type NonStandardMessageWithJSONNames_Thing struct { + SubThing *NonStandardMessageWithJSONNames_Thing_SubThing `protobuf:"bytes,1,opt,name=subThing,json=SubThing,proto3" json:"subThing,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NonStandardMessageWithJSONNames_Thing) Reset() { *m = NonStandardMessageWithJSONNames_Thing{} } +func (m *NonStandardMessageWithJSONNames_Thing) String() string { return proto.CompactTextString(m) } +func (*NonStandardMessageWithJSONNames_Thing) ProtoMessage() {} +func (*NonStandardMessageWithJSONNames_Thing) Descriptor() ([]byte, []int) { + return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{2, 0} +} +func (m *NonStandardMessageWithJSONNames_Thing) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.Unmarshal(m, b) +} +func (m *NonStandardMessageWithJSONNames_Thing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.Marshal(b, m, deterministic) +} +func (dst *NonStandardMessageWithJSONNames_Thing) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.Merge(dst, src) +} +func (m *NonStandardMessageWithJSONNames_Thing) XXX_Size() int { + return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.Size(m) +} +func (m *NonStandardMessageWithJSONNames_Thing) XXX_DiscardUnknown() { + xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.DiscardUnknown(m) +} + +var xxx_messageInfo_NonStandardMessageWithJSONNames_Thing proto.InternalMessageInfo + +func (m *NonStandardMessageWithJSONNames_Thing) GetSubThing() *NonStandardMessageWithJSONNames_Thing_SubThing { + if m != nil { + return m.SubThing + } + return nil +} + +type NonStandardMessageWithJSONNames_Thing_SubThing struct { + SubValue string `protobuf:"bytes,1,opt,name=sub_value,json=sub_Value,proto3" json:"sub_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NonStandardMessageWithJSONNames_Thing_SubThing) Reset() { + *m = NonStandardMessageWithJSONNames_Thing_SubThing{} +} +func (m *NonStandardMessageWithJSONNames_Thing_SubThing) String() string { + return proto.CompactTextString(m) +} +func (*NonStandardMessageWithJSONNames_Thing_SubThing) ProtoMessage() {} +func (*NonStandardMessageWithJSONNames_Thing_SubThing) Descriptor() ([]byte, []int) { + return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{2, 0, 0} +} +func (m *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.Unmarshal(m, b) +} +func (m *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.Marshal(b, m, deterministic) +} +func (dst *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.Merge(dst, src) +} +func (m *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Size() int { + return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.Size(m) +} +func (m *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_DiscardUnknown() { + xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.DiscardUnknown(m) +} + +var xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing proto.InternalMessageInfo + +func (m *NonStandardMessageWithJSONNames_Thing_SubThing) GetSubValue() string { + if m != nil { + return m.SubValue + } + return "" +} + +type NonStandardWithJSONNamesUpdateRequest struct { + Body *NonStandardMessageWithJSONNames `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + UpdateMask *field_mask.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NonStandardWithJSONNamesUpdateRequest) Reset() { *m = NonStandardWithJSONNamesUpdateRequest{} } +func (m *NonStandardWithJSONNamesUpdateRequest) String() string { return proto.CompactTextString(m) } +func (*NonStandardWithJSONNamesUpdateRequest) ProtoMessage() {} +func (*NonStandardWithJSONNamesUpdateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{3} +} +func (m *NonStandardWithJSONNamesUpdateRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.Unmarshal(m, b) +} +func (m *NonStandardWithJSONNamesUpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.Marshal(b, m, deterministic) +} +func (dst *NonStandardWithJSONNamesUpdateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.Merge(dst, src) +} +func (m *NonStandardWithJSONNamesUpdateRequest) XXX_Size() int { + return xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.Size(m) +} +func (m *NonStandardWithJSONNamesUpdateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest proto.InternalMessageInfo + +func (m *NonStandardWithJSONNamesUpdateRequest) GetBody() *NonStandardMessageWithJSONNames { + if m != nil { + return m.Body + } + return nil +} + +func (m *NonStandardWithJSONNamesUpdateRequest) GetUpdateMask() *field_mask.FieldMask { + if m != nil { + return m.UpdateMask + } + return nil +} + +func init() { + proto.RegisterType((*NonStandardMessage)(nil), "grpc.gateway.examples.examplepb.NonStandardMessage") + proto.RegisterType((*NonStandardMessage_Thing)(nil), "grpc.gateway.examples.examplepb.NonStandardMessage.Thing") + proto.RegisterType((*NonStandardMessage_Thing_SubThing)(nil), "grpc.gateway.examples.examplepb.NonStandardMessage.Thing.SubThing") + proto.RegisterType((*NonStandardUpdateRequest)(nil), "grpc.gateway.examples.examplepb.NonStandardUpdateRequest") + proto.RegisterType((*NonStandardMessageWithJSONNames)(nil), "grpc.gateway.examples.examplepb.NonStandardMessageWithJSONNames") + proto.RegisterType((*NonStandardMessageWithJSONNames_Thing)(nil), "grpc.gateway.examples.examplepb.NonStandardMessageWithJSONNames.Thing") + proto.RegisterType((*NonStandardMessageWithJSONNames_Thing_SubThing)(nil), "grpc.gateway.examples.examplepb.NonStandardMessageWithJSONNames.Thing.SubThing") + proto.RegisterType((*NonStandardWithJSONNamesUpdateRequest)(nil), "grpc.gateway.examples.examplepb.NonStandardWithJSONNamesUpdateRequest") +} + +// 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.SupportPackageIsVersion4 + +// NonStandardServiceClient is the client API for NonStandardService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NonStandardServiceClient interface { + // Apply field mask to empty NonStandardMessage and return result. + Update(ctx context.Context, in *NonStandardUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessage, error) + // Apply field mask to empty NonStandardMessageWithJSONNames and return result. + UpdateWithJSONNames(ctx context.Context, in *NonStandardWithJSONNamesUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessageWithJSONNames, error) +} + +type nonStandardServiceClient struct { + cc *grpc.ClientConn +} + +func NewNonStandardServiceClient(cc *grpc.ClientConn) NonStandardServiceClient { + return &nonStandardServiceClient{cc} +} + +func (c *nonStandardServiceClient) Update(ctx context.Context, in *NonStandardUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessage, error) { + out := new(NonStandardMessage) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.NonStandardService/Update", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nonStandardServiceClient) UpdateWithJSONNames(ctx context.Context, in *NonStandardWithJSONNamesUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessageWithJSONNames, error) { + out := new(NonStandardMessageWithJSONNames) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.NonStandardService/UpdateWithJSONNames", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NonStandardServiceServer is the server API for NonStandardService service. +type NonStandardServiceServer interface { + // Apply field mask to empty NonStandardMessage and return result. + Update(context.Context, *NonStandardUpdateRequest) (*NonStandardMessage, error) + // Apply field mask to empty NonStandardMessageWithJSONNames and return result. + UpdateWithJSONNames(context.Context, *NonStandardWithJSONNamesUpdateRequest) (*NonStandardMessageWithJSONNames, error) +} + +func RegisterNonStandardServiceServer(s *grpc.Server, srv NonStandardServiceServer) { + s.RegisterService(&_NonStandardService_serviceDesc, srv) +} + +func _NonStandardService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NonStandardUpdateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NonStandardServiceServer).Update(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.NonStandardService/Update", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NonStandardServiceServer).Update(ctx, req.(*NonStandardUpdateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NonStandardService_UpdateWithJSONNames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NonStandardWithJSONNamesUpdateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NonStandardServiceServer).UpdateWithJSONNames(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.NonStandardService/UpdateWithJSONNames", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NonStandardServiceServer).UpdateWithJSONNames(ctx, req.(*NonStandardWithJSONNamesUpdateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _NonStandardService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.NonStandardService", + HandlerType: (*NonStandardServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Update", + Handler: _NonStandardService_Update_Handler, + }, + { + MethodName: "UpdateWithJSONNames", + Handler: _NonStandardService_UpdateWithJSONNames_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/proto/examplepb/non_standard_names.proto", +} + +func init() { + proto.RegisterFile("examples/proto/examplepb/non_standard_names.proto", fileDescriptor_non_standard_names_1ed497ab0876ca64) +} + +var fileDescriptor_non_standard_names_1ed497ab0876ca64 = []byte{ + // 626 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x41, 0x6f, 0xd3, 0x3c, + 0x18, 0xc7, 0x95, 0x66, 0xed, 0x5a, 0x57, 0x7a, 0x5f, 0xe4, 0x21, 0x14, 0xc2, 0xa4, 0x56, 0x95, + 0xd0, 0x7a, 0x21, 0xd1, 0xb2, 0x03, 0x02, 0x84, 0x04, 0x15, 0xac, 0x1a, 0x62, 0xad, 0x94, 0x74, + 0x20, 0x21, 0x41, 0xe4, 0x2c, 0x5e, 0x1a, 0x9a, 0xda, 0xa1, 0x76, 0x3a, 0x7a, 0xe5, 0x13, 0x4c, + 0xe2, 0x0e, 0xdc, 0xf8, 0x0e, 0xf0, 0x31, 0xb8, 0x73, 0xe2, 0x83, 0xa0, 0xd8, 0x69, 0xa9, 0x55, + 0xa1, 0xb1, 0x6e, 0xa7, 0xfa, 0x79, 0x6c, 0xff, 0x9f, 0xe7, 0x6f, 0xff, 0xe2, 0x82, 0x5d, 0xfc, + 0x1e, 0x8d, 0xd3, 0x04, 0x33, 0x3b, 0x9d, 0x50, 0x4e, 0xed, 0x22, 0x4c, 0x03, 0x9b, 0x50, 0xe2, + 0x33, 0x8e, 0x48, 0x88, 0x26, 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 0xbe, 0xe6, 0x23, 0xb3, 0xbd, 0xc4, 0xd7, 0xf6, 0x2a, 0x5f, 0x22, 0x21, 0x01, + 0xfb, 0xa6, 0x81, 0xdb, 0x4b, 0x65, 0x14, 0x7d, 0x95, 0xb6, 0x81, 0x42, 0xdb, 0xa3, 0xcb, 0x36, + 0x7f, 0x05, 0xe8, 0x39, 0x9f, 0xd5, 0x07, 0xcb, 0xc3, 0x93, 0x69, 0x7c, 0x8c, 0xe1, 0x57, 0x0d, + 0x54, 0x64, 0xef, 0xf0, 0x42, 0x8f, 0x82, 0xe2, 0xd7, 0x5c, 0xe7, 0x7b, 0x6a, 0xdd, 0xf9, 0xf0, + 0xe3, 0xd7, 0xc7, 0xd2, 0x8e, 0xd3, 0xb0, 0xa7, 0xbb, 0xf3, 0x37, 0x5d, 0x79, 0xd1, 0x6d, 0xd9, + 0xfe, 0x7d, 0xe9, 0xfe, 0xa7, 0x06, 0xb6, 0x64, 0x55, 0xf5, 0x7b, 0xb9, 0x10, 0x86, 0x7f, 0xbf, + 0x33, 0xf3, 0xd2, 0xb7, 0xd4, 0x7a, 0x28, 0x0c, 0xdd, 0x75, 0xec, 0x73, 0x0c, 0xf9, 0xa7, 0x31, + 0x1f, 0xfa, 0x6f, 0x19, 0x25, 0xf2, 0x3f, 0x4b, 0x1a, 0xec, 0xd4, 0x5f, 0xd5, 0x16, 0xb5, 0x82, + 0x8a, 0xb8, 0xce, 0xbd, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x18, 0x50, 0x51, 0xb2, 0xfc, 0x06, + 0x00, 0x00, +} diff --git a/examples/proto/examplepb/non_standard_names.pb.gw.go b/examples/proto/examplepb/non_standard_names.pb.gw.go new file mode 100644 index 00000000000..606554372cf --- /dev/null +++ b/examples/proto/examplepb/non_standard_names.pb.gw.go @@ -0,0 +1,296 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: examples/proto/examplepb/non_standard_names.proto + +/* +Package examplepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package examplepb + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray + +var ( + filter_NonStandardService_Update_0 = &utilities.DoubleArray{Encoding: map[string]int{"body": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_NonStandardService_Update_0(ctx context.Context, marshaler runtime.Marshaler, client NonStandardServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonStandardUpdateRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NonStandardService_Update_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NonStandardService_Update_0(ctx context.Context, marshaler runtime.Marshaler, server NonStandardServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonStandardUpdateRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_NonStandardService_Update_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Update(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_NonStandardService_UpdateWithJSONNames_0 = &utilities.DoubleArray{Encoding: map[string]int{"body": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_NonStandardService_UpdateWithJSONNames_0(ctx context.Context, marshaler runtime.Marshaler, client NonStandardServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonStandardWithJSONNamesUpdateRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NonStandardService_UpdateWithJSONNames_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateWithJSONNames(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NonStandardService_UpdateWithJSONNames_0(ctx context.Context, marshaler runtime.Marshaler, server NonStandardServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonStandardWithJSONNamesUpdateRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_NonStandardService_UpdateWithJSONNames_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateWithJSONNames(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterNonStandardServiceHandlerServer registers the http handlers for service NonStandardService to "mux". +// UnaryRPC :call NonStandardServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +func RegisterNonStandardServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NonStandardServiceServer) error { + + mux.Handle("PATCH", pattern_NonStandardService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NonStandardService_Update_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_NonStandardService_Update_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_NonStandardService_UpdateWithJSONNames_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NonStandardService_UpdateWithJSONNames_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_NonStandardService_UpdateWithJSONNames_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterNonStandardServiceHandlerFromEndpoint is same as RegisterNonStandardServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterNonStandardServiceHandlerFromEndpoint(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.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterNonStandardServiceHandler(ctx, mux, conn) +} + +// RegisterNonStandardServiceHandler registers the http handlers for service NonStandardService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterNonStandardServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterNonStandardServiceHandlerClient(ctx, mux, NewNonStandardServiceClient(conn)) +} + +// RegisterNonStandardServiceHandlerClient registers the http handlers for service NonStandardService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NonStandardServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NonStandardServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "NonStandardServiceClient" to call the correct interceptors. +func RegisterNonStandardServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NonStandardServiceClient) error { + + mux.Handle("PATCH", pattern_NonStandardService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NonStandardService_Update_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_NonStandardService_Update_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_NonStandardService_UpdateWithJSONNames_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NonStandardService_UpdateWithJSONNames_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_NonStandardService_UpdateWithJSONNames_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_NonStandardService_Update_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "non_standard", "update"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_NonStandardService_UpdateWithJSONNames_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "non_standard", "update_with_json_names"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_NonStandardService_Update_0 = runtime.ForwardResponseMessage + + forward_NonStandardService_UpdateWithJSONNames_0 = runtime.ForwardResponseMessage +) diff --git a/examples/proto/examplepb/non_standard_names.proto b/examples/proto/examplepb/non_standard_names.proto new file mode 100644 index 00000000000..0bf130239a4 --- /dev/null +++ b/examples/proto/examplepb/non_standard_names.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; +option go_package = "examplepb"; +package grpc.gateway.examples.examplepb; + +import "google/api/annotations.proto"; +import "google/protobuf/field_mask.proto"; + +// NonStandardMessage has oddly named fields. +message NonStandardMessage { + // Id represents the message identifier. + string id = 1; + int64 Num = 2; + int64 line_num = 3; + string langIdent = 4; + string STATUS = 5; + int64 en_GB = 6; + string no = 7; + + message Thing { + message SubThing { + string sub_value = 1; + } + SubThing subThing = 1; + } + Thing thing = 8; +} + +message NonStandardUpdateRequest { + NonStandardMessage body = 1; + google.protobuf.FieldMask update_mask = 2; +} + +// NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion. +message NonStandardMessageWithJSONNames { + // Id represents the message identifier. + string id = 1 [json_name="ID"]; + int64 Num = 2 [json_name="Num"]; + int64 line_num = 3 [json_name="LineNum"]; + string langIdent = 4 [json_name="langIdent"]; + string STATUS = 5 [json_name="status"]; + int64 en_GB = 6 [json_name="En_GB"]; + string no = 7 [json_name="yes"]; + + message Thing { + message SubThing { + string sub_value = 1 [json_name="sub_Value"]; + } + SubThing subThing = 1 [json_name="SubThing"]; + } + Thing thing = 8 [json_name="Thingy"]; +} + +message NonStandardWithJSONNamesUpdateRequest { + NonStandardMessageWithJSONNames body = 1; + google.protobuf.FieldMask update_mask = 2; +} + +// NonStandardService responds to incoming messages, applies a field mask and returns the masked response. +service NonStandardService { + // Apply field mask to empty NonStandardMessage and return result. + rpc Update(NonStandardUpdateRequest) returns (NonStandardMessage) { + option (google.api.http) = { + patch: "/v1/example/non_standard/update" + body: "body" + }; + } + + // Apply field mask to empty NonStandardMessageWithJSONNames and return result. + rpc UpdateWithJSONNames(NonStandardWithJSONNamesUpdateRequest) returns (NonStandardMessageWithJSONNames) { + option (google.api.http) = { + patch: "/v1/example/non_standard/update_with_json_names" + body: "body" + }; + } +} diff --git a/examples/server/BUILD.bazel b/examples/server/BUILD.bazel index 6a35faff50c..61d14a2fde6 100644 --- a/examples/server/BUILD.bazel +++ b/examples/server/BUILD.bazel @@ -10,6 +10,7 @@ go_library( "fieldmask_helper.go", "flow_combination.go", "main.go", + "non_standard_names.go", "responsebody.go", "unannotatedecho.go", ], @@ -20,6 +21,7 @@ go_library( "//examples/proto/sub2:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", "@com_github_rogpeppe_fastuuid//:go_default_library", "@go_googleapis//google/rpc:errdetails_go_proto", "@io_bazel_rules_go//proto/wkt:duration_go_proto", diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index c37fa47fe10..892802fe3fc 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io" - "strings" "sync" "github.com/golang/glog" @@ -83,7 +82,7 @@ func (s *_ABitOfEverythingServer) BulkCreate(stream examples.StreamService_BulkC return err } count++ - glog.Error(msg) + glog.Info(msg) if _, err = s.Create(ctx, msg); err != nil { return err } @@ -186,22 +185,6 @@ func (s *_ABitOfEverythingServer) UpdateV2(ctx context.Context, msg *examples.Up return new(empty.Empty), nil } -// PatchWithFieldMaskInBody differs from UpdateV2 only in that this method exposes the field mask in the request body, -// so that clients can specify their mask explicitly -func (s *_ABitOfEverythingServer) PatchWithFieldMaskInBody(ctx context.Context, request *examples.UpdateV2Request) (*empty.Empty, error) { - // low-effort attempt to modify the field mask to only include paths for the ABE struct. Since this is only for the - // integration tests, this narrow implementaion is fine. - if request.UpdateMask != nil { - var shifted []string - for _, path := range request.UpdateMask.GetPaths() { - shifted = append(shifted, strings.TrimPrefix(path, "Abe.")) - } - request.UpdateMask.Paths = shifted - } - - return s.UpdateV2(ctx, request) -} - func (s *_ABitOfEverythingServer) Delete(ctx context.Context, msg *sub2.IdMessage) (*empty.Empty, error) { s.m.Lock() defer s.m.Unlock() diff --git a/examples/server/fieldmask_helper.go b/examples/server/fieldmask_helper.go index d0cac43c58f..516f19a1628 100644 --- a/examples/server/fieldmask_helper.go +++ b/examples/server/fieldmask_helper.go @@ -5,6 +5,7 @@ import ( "reflect" "strings" + "github.com/golang/protobuf/protoc-gen-go/generator" "google.golang.org/genproto/protobuf/field_mask" ) @@ -39,7 +40,7 @@ func getField(obj interface{}, path string) (val reflect.Value) { if v.Kind() == reflect.Ptr { v = reflect.Indirect(v) } - v = v.FieldByName(s) + v = v.FieldByName(generator.CamelCase(s)) } return v diff --git a/examples/server/fieldmask_helper_test.go b/examples/server/fieldmask_helper_test.go index c735fdd7aca..9ad6584ae21 100644 --- a/examples/server/fieldmask_helper_test.go +++ b/examples/server/fieldmask_helper_test.go @@ -17,9 +17,21 @@ func TestApplyFieldMask(t *testing.T) { }{ {"nil fieldMask", &a{E: 64}, &a{E: 42}, nil, &a{E: 64}}, {"empty paths", &a{E: 63}, &a{E: 42}, &field_mask.FieldMask{}, &a{E: 63}}, - {"simple path", &a{E: 23, F: "test"}, &a{B: &b{}, E: 42}, &field_mask.FieldMask{Paths: []string{"E"}}, &a{E: 42, F: "test"}}, - {"nested", &a{B: &b{C: 85}}, &a{B: &b{C: 58, D: nil}}, &field_mask.FieldMask{Paths: []string{"B.C"}}, &a{B: &b{C: 58}}}, - {"multiple paths", &a{B: &b{C: 40, D: []int{1, 2, 3}}, E: 34, F: "catapult"}, &a{B: &b{C: 56}, F: "lettuce"}, &field_mask.FieldMask{Paths: []string{"B.C", "F"}}, &a{B: &b{C: 56, D: []int{1, 2, 3}}, E: 34, F: "lettuce"}}, + {"simple path", + &a{E: 23, Foo: "test"}, + &a{BeefCake: &b{}, E: 42}, + &field_mask.FieldMask{Paths: []string{"e"}}, + &a{E: 42, Foo: "test"}}, + {"nested", + &a{BeefCake: &b{CowCount: 85}}, + &a{BeefCake: &b{CowCount: 58, Data: nil}}, + &field_mask.FieldMask{Paths: []string{"beef_cake.cow_count"}}, + &a{BeefCake: &b{CowCount: 58}}}, + {"multiple paths", + &a{BeefCake: &b{CowCount: 40, Data: []int{1, 2, 3}}, E: 34, Foo: "catapult"}, + &a{BeefCake: &b{CowCount: 56}, Foo: "lettuce"}, + &field_mask.FieldMask{Paths: []string{"beef_cake.cow_count", "foo"}}, + &a{BeefCake: &b{CowCount: 56, Data: []int{1, 2, 3}}, E: 34, Foo: "lettuce"}}, } { t.Run(test.name, func(t *testing.T) { applyFieldMask(test.patchee, test.patcher, test.fieldMask) @@ -37,15 +49,15 @@ func TestGetValue(t *testing.T) { path string expected interface{} }{ - {"empty", &a{E: 45, F: "test"}, "", &a{E: 45, F: "test"}}, + {"empty", &a{E: 45, Foo: "test"}, "", &a{E: 45, Foo: "test"}}, {"pointer-simple", &a{E: 45}, "E", 45}, - {"pointer-nested", &a{B: &b{C: 42}}, "B.C", 42}, - {"pointer-complex type", &a{B: &b{D: []int{1, 2}}}, "B.D", []int{1, 2}}, - {"pointer-invalid path", &a{F: "test"}, "X.Y", nil}, + {"pointer-nested", &a{BeefCake: &b{CowCount: 42}}, "beef_cake.cow_count", 42}, + {"pointer-complex type", &a{BeefCake: &b{Data: []int{1, 2}}}, "beef_cake.data", []int{1, 2}}, + {"pointer-invalid path", &a{Foo: "test"}, "x.y", nil}, {"simple", a{E: 45}, "E", 45}, - {"nested", a{B: &b{C: 42}}, "B.C", 42}, - {"complex type", a{B: &b{D: []int{1, 2}}}, "B.D", []int{1, 2}}, - {"invalid path", a{F: "test"}, "X.Y", nil}, + {"nested", a{BeefCake: &b{CowCount: 42}}, "beef_cake.cow_count", 42}, + {"complex type", a{BeefCake: &b{Data: []int{1, 2}}}, "beef_cake.data", []int{1, 2}}, + {"invalid path", a{Foo: "test"}, "X.Y", nil}, } { t.Run(test.name, func(t *testing.T) { if actual := getField(test.input, test.path); actual.IsValid() { @@ -67,9 +79,9 @@ func TestSetValue(t *testing.T) { path string expected interface{} }{ - {"simple", &a{E: 45}, 34, "E", 34}, - {"nested", &a{B: &b{C: 54}}, 43, "B.C", 43}, - {"complex type", &a{B: &b{D: []int{1, 2}}}, []int{3, 4}, "B.D", []int{3, 4}}, + {"simple", &a{E: 45}, 34, "e", 34}, + {"nested", &a{BeefCake: &b{CowCount: 54}}, 43, "beef_cake.cow_count", 43}, + {"complex type", &a{BeefCake: &b{Data: []int{1, 2}}}, []int{3, 4}, "beef_cake.data", []int{3, 4}}, } { t.Run(test.name, func(t *testing.T) { setValue(test.obj, reflect.ValueOf(test.newValue), test.path) @@ -81,12 +93,12 @@ func TestSetValue(t *testing.T) { } type a struct { - B *b - E int - F string + BeefCake *b + E int + Foo string } type b struct { - C int - D []int + CowCount int + Data []int } diff --git a/examples/server/main.go b/examples/server/main.go index 179485a3601..d595c367613 100644 --- a/examples/server/main.go +++ b/examples/server/main.go @@ -25,6 +25,7 @@ func Run(ctx context.Context, network, address string) error { s := grpc.NewServer() examples.RegisterEchoServiceServer(s, newEchoServer()) examples.RegisterFlowCombinationServer(s, newFlowCombinationServer()) + examples.RegisterNonStandardServiceServer(s, newNonStandardServer()) abe := newABitOfEverythingServer() examples.RegisterABitOfEverythingServiceServer(s, abe) diff --git a/examples/server/non_standard_names.go b/examples/server/non_standard_names.go new file mode 100644 index 00000000000..c448259a909 --- /dev/null +++ b/examples/server/non_standard_names.go @@ -0,0 +1,40 @@ +package server + +import ( + "context" + + "github.com/golang/glog" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" +) + +// Implements NonStandardServiceServer + +type nonStandardServer struct{} + +func newNonStandardServer() examples.NonStandardServiceServer { + return new(nonStandardServer) +} + +func (s *nonStandardServer) Update(ctx context.Context, msg *examples.NonStandardUpdateRequest) (*examples.NonStandardMessage, error) { + glog.Info(msg) + + newMsg := &examples.NonStandardMessage{ + Thing: &examples.NonStandardMessage_Thing{SubThing: &examples.NonStandardMessage_Thing_SubThing{}}, // The fieldmask_helper doesn't generate nested structs if they are nil + } + applyFieldMask(newMsg, msg.Body, msg.UpdateMask) + + glog.Info(newMsg) + return newMsg, nil +} + +func (s *nonStandardServer) UpdateWithJSONNames(ctx context.Context, msg *examples.NonStandardWithJSONNamesUpdateRequest) (*examples.NonStandardMessageWithJSONNames, error) { + glog.Info(msg) + + newMsg := &examples.NonStandardMessageWithJSONNames{ + Thing: &examples.NonStandardMessageWithJSONNames_Thing{SubThing: &examples.NonStandardMessageWithJSONNames_Thing_SubThing{}}, // The fieldmask_helper doesn't generate nested structs if they are nil + } + applyFieldMask(newMsg, msg.Body, msg.UpdateMask) + + glog.Info(newMsg) + return newMsg, nil +} diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index ceb3dda1110..cd6b1f9e850 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -314,16 +314,14 @@ var ( if err := marshaler.NewDecoder(newReader()).Decode(&{{.Body.AssignableExpr "protoReq"}}); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - {{- if and $AllowPatchFeature (and (eq (.HTTPMethod) "PATCH") (.FieldMaskField))}} - if protoReq.{{.FieldMaskField}} != nil && len(protoReq.{{.FieldMaskField}}.GetPaths()) > 0 { - runtime.CamelCaseFieldMask(protoReq.{{.FieldMaskField}}) - } {{if not (eq "*" .GetBodyFieldPath)}} else { + {{- if and $AllowPatchFeature (eq (.HTTPMethod) "PATCH") (.FieldMaskField) (not (eq "*" .GetBodyFieldPath)) }} + if protoReq.{{.FieldMaskField}} == nil || len(protoReq.{{.FieldMaskField}}.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.{{.FieldMaskField}} = fieldMask } - } {{end}} + } {{end}} {{end}} {{if .PathParams}} @@ -477,16 +475,14 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct if err := marshaler.NewDecoder(newReader()).Decode(&{{.Body.AssignableExpr "protoReq"}}); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - {{- if and $AllowPatchFeature (and (eq (.HTTPMethod) "PATCH") (.FieldMaskField))}} - if protoReq.{{.FieldMaskField}} != nil && len(protoReq.{{.FieldMaskField}}.GetPaths()) > 0 { - runtime.CamelCaseFieldMask(protoReq.{{.FieldMaskField}}) - } {{if not (eq "*" .GetBodyFieldPath)}} else { + {{- if and $AllowPatchFeature (eq (.HTTPMethod) "PATCH") (.FieldMaskField) (not (eq "*" .GetBodyFieldPath)) }} + if protoReq.{{.FieldMaskField}} == nil || len(protoReq.{{.FieldMaskField}}.GetPaths()) == 0 { if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.{{.FieldMaskField}} = fieldMask - } - } {{end}} + } + } {{end}} {{end}} {{if .PathParams}} diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index eca95556c9a..69809792b4c 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -628,7 +628,10 @@ func TestAllowPatchFeature(t *testing.T) { Bindings: []*descriptor.Binding{ { HTTPMethod: "PATCH", - Body: &descriptor.Body{FieldPath: nil}, + Body: &descriptor.Body{FieldPath: descriptor.FieldPath{descriptor.FieldPathComponent{ + Name: "abe", + Target: msg.Fields[0], + }}}, }, }, }, @@ -636,7 +639,7 @@ func TestAllowPatchFeature(t *testing.T) { }, }, } - want := "if protoReq.UpdateMask != nil && len(protoReq.UpdateMask.GetPaths()) > 0 {\n" + want := "if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {\n" for _, allowPatchFeature := range []bool{true, false} { got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler", AllowPatchFeature: allowPatchFeature}, descriptor.NewRegistry()) if err != nil { diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index d03ca5c97a2..2462dc053f7 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -29,7 +29,6 @@ go_library( "//utilities:go_default_library", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", "@go_googleapis//google/api:httpbody_go_proto", "@io_bazel_rules_go//proto/wkt:any_go_proto", "@io_bazel_rules_go//proto/wkt:duration_go_proto", diff --git a/runtime/fieldmask.go b/runtime/fieldmask.go index e1cf7a91461..d3eb5782b70 100644 --- a/runtime/fieldmask.go +++ b/runtime/fieldmask.go @@ -5,7 +5,6 @@ import ( "io" "strings" - "github.com/golang/protobuf/protoc-gen-go/generator" "google.golang.org/genproto/protobuf/field_mask" ) @@ -29,7 +28,7 @@ func FieldMaskFromRequestBody(r io.Reader) (*field_mask.FieldMask, error) { if m, ok := item.node.(map[string]interface{}); ok { // if the item is an object, then enqueue all of its children for k, v := range m { - queue = append(queue, fieldMaskPathItem{path: append(item.path, generator.CamelCase(k)), node: v}) + queue = append(queue, fieldMaskPathItem{path: append(item.path, k), node: v}) } } else if len(item.path) > 0 { // otherwise, it's a leaf node so print its path @@ -48,23 +47,3 @@ type fieldMaskPathItem struct { // a generic decoded json object the current item to inspect for further path extraction node interface{} } - -// CamelCaseFieldMask updates the given FieldMask by converting all of its paths to CamelCase, using the same heuristic -// that's used for naming protobuf fields in Go. -func CamelCaseFieldMask(mask *field_mask.FieldMask) { - if mask == nil || mask.Paths == nil { - return - } - - var newPaths []string - for _, path := range mask.Paths { - lowerCasedParts := strings.Split(path, ".") - var camelCasedParts []string - for _, part := range lowerCasedParts { - camelCasedParts = append(camelCasedParts, generator.CamelCase(part)) - } - newPaths = append(newPaths, strings.Join(camelCasedParts, ".")) - } - - mask.Paths = newPaths -} diff --git a/runtime/fieldmask_test.go b/runtime/fieldmask_test.go index 3c097878aa0..dae968b8284 100644 --- a/runtime/fieldmask_test.go +++ b/runtime/fieldmask_test.go @@ -51,9 +51,9 @@ func TestFieldMaskFromRequestBody(t *testing.T) { expectedErr error }{ {name: "empty", expected: newFieldMask()}, - {name: "simple", input: `{"foo":1, "bar":"baz"}`, expected: newFieldMask("Foo", "Bar")}, - {name: "nested", input: `{"foo": {"bar":1, "baz": 2}, "qux": 3}`, expected: newFieldMask("Foo.Bar", "Foo.Baz", "Qux")}, - {name: "canonical", input: `{"f": {"b": {"d": 1, "x": 2}, "c": 1}}`, expected: newFieldMask("F.B.D", "F.B.X", "F.C")}, + {name: "simple", input: `{"foo":1, "bar":"baz"}`, expected: newFieldMask("foo", "bar")}, + {name: "nested", input: `{"foo": {"bar":1, "baz": 2}, "qux": 3}`, expected: newFieldMask("foo.bar", "foo.baz", "qux")}, + {name: "canonical", input: `{"f": {"b": {"d": 1, "x": 2}, "c": 1}}`, expected: newFieldMask("f.b.d", "f.b.x", "f.c")}, } { t.Run(tc.name, func(t *testing.T) { actual, err := FieldMaskFromRequestBody(bytes.NewReader([]byte(tc.input))) @@ -67,21 +67,85 @@ func TestFieldMaskFromRequestBody(t *testing.T) { } } -func TestCamelCaseFieldMask(t *testing.T) { - for _, tc := range []struct { - name string - input *field_mask.FieldMask - expected *field_mask.FieldMask - }{ - {"nil", nil, nil}, - {"empty", &field_mask.FieldMask{Paths: nil}, &field_mask.FieldMask{Paths: nil}}, - {"main usage", newFieldMask("a", "a.b", "some_field.some_sub_field"), newFieldMask("A", "A.B", "SomeField.SomeSubField")}, - } { - t.Run(tc.name, func(t *testing.T) { - CamelCaseFieldMask(tc.input) - if expected, actual := tc.expected, tc.input; !fieldMasksEqual(expected, actual) { - t.Errorf("want %v; got %v", fieldMaskString(expected), fieldMaskString(actual)) - } - }) +// avoid compiler optimising benchmark away +var result *field_mask.FieldMask + +func BenchmarkABEFieldMaskFromRequestBody(b *testing.B) { + input := `{` + + `"single_nested": {"name": "bar",` + + ` "amount": 10,` + + ` "ok": "TRUE"},` + + `"uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7",` + + `"nested": [{"name": "bar",` + + ` "amount": 10},` + + ` {"name": "baz",` + + ` "amount": 20}],` + + `"float_value": 1.5,` + + `"double_value": 2.5,` + + `"int64_value": 4294967296,` + + `"uint64_value": 9223372036854775807,` + + `"int32_value": -2147483648,` + + `"fixed64_value": 9223372036854775807,` + + `"fixed32_value": 4294967295,` + + `"bool_value": true,` + + `"string_value": "strprefix/foo",` + + `"bytes_value": "132456",` + + `"uint32_value": 4294967295,` + + `"enum_value": "ONE",` + + `"path_enum_value": "DEF",` + + `"nested_path_enum_value": "JKL",` + + `"sfixed32_value": 2147483647,` + + `"sfixed64_value": -4611686018427387904,` + + `"sint32_value": 2147483647,` + + `"sint64_value": 4611686018427387903,` + + `"repeated_string_value": ["a", "b", "c"],` + + `"oneof_value": {"oneof_string":"x"},` + + `"map_value": {"a": "ONE",` + + ` "b": "ZERO"},` + + `"mapped_string_value": {"a": "x",` + + ` "b": "y"},` + + `"mapped_nested_value": {"a": {"name": "x", "amount": 1},` + + ` "b": {"name": "y", "amount": 2}},` + + `"nonConventionalNameValue": "camelCase",` + + `"timestamp_value": "2016-05-10T10:19:13.123Z",` + + `"repeated_enum_value": ["ONE", "ZERO"],` + + `"repeated_enum_annotation": ["ONE", "ZERO"],` + + `"enum_value_annotation": "ONE",` + + `"repeated_string_annotation": ["a", "b"],` + + `"repeated_nested_annotation": [{"name": "hoge",` + + ` "amount": 10},` + + ` {"name": "fuga",` + + ` "amount": 20}],` + + `"nested_annotation": {"name": "hoge",` + + ` "amount": 10},` + + `"int64_override_type": 12345` + + `}` + var r *field_mask.FieldMask + var err error + for i := 0; i < b.N; i++ { + r, err = FieldMaskFromRequestBody(bytes.NewReader([]byte(input))) + } + if err != nil { + b.Error(err) + } + result = r +} + +func BenchmarkNonStandardFieldMaskFromRequestBody(b *testing.B) { + input := `{` + + `"id": "foo",` + + `"Num": 2,` + + `"line_num": 3,` + + `"langIdent": "bar",` + + `"STATUS": "baz"` + + `}` + var r *field_mask.FieldMask + var err error + for i := 0; i < b.N; i++ { + r, err = FieldMaskFromRequestBody(bytes.NewReader([]byte(input))) + } + if err != nil { + b.Error(err) } + result = r } From 4dda983b78eacea8627c763daf7dbb3b31e8a9b6 Mon Sep 17 00:00:00 2001 From: Will Plano <51954103+william-plano-oxb@users.noreply.github.com> Date: Mon, 30 Sep 2019 10:34:02 +0100 Subject: [PATCH 475/552] Support json names in field mask generation (#1050) * Support json names in field mask generation Added tests for using jsonpb with OrigName: false Added benchmarks for FieldMaskFromRequestBody called with a message descriptor * Add descriptor dependency to go_proto_library --- docs/_docs/patch.md | 2 - examples/integration/BUILD.bazel | 2 + examples/integration/fieldmask_test.go | 163 ++++++++++++++++++ examples/integration/integration_test.go | 25 +++ examples/proto/examplepb/BUILD.bazel | 2 + .../examplepb/a_bit_of_everything.pb.gw.go | 9 +- .../proto/examplepb/echo_service.pb.gw.go | 3 + .../proto/examplepb/flow_combination.pb.gw.go | 3 + .../examplepb/non_standard_names.pb.gw.go | 15 +- .../examplepb/response_body_service.pb.gw.go | 3 + examples/proto/examplepb/stream.pb.gw.go | 3 + .../unannotated_echo_service.pb.gw.go | 3 + examples/proto/examplepb/wrappers.pb.gw.go | 3 + .../gengateway/generator.go | 1 + .../gengateway/template.go | 17 +- runtime/BUILD.bazel | 2 + runtime/fieldmask.go | 39 ++++- runtime/fieldmask_test.go | 6 +- 18 files changed, 285 insertions(+), 16 deletions(-) create mode 100644 examples/integration/fieldmask_test.go diff --git a/docs/_docs/patch.md b/docs/_docs/patch.md index 42b96eab25f..2eaac3b0166 100644 --- a/docs/_docs/patch.md +++ b/docs/_docs/patch.md @@ -10,8 +10,6 @@ There are two scenarios: - The FieldMask is hidden from the REST request as per the [Google API design guide](https://cloud.google.com/apis/design/standard_methods#update) (as in the first additional binding in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto#L366) example). In this case, the FieldMask is updated from the request body and set in the gRPC request message. - The FieldMask is exposed to the REST request (as in the second additional binding in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto#L370) example). For this case, the field mask is left untouched by the gateway. -Currently this feature is not compatible with using the JSON marshaller option to use json names in the http request/response described [here](https://grpc-ecosystem.github.io/grpc-gateway/docs/customizingyourgateway.html#using-camelcase-for-json). If you want to use json names then you may with to disable this feature with the command line option `-allow_patch_feature=false` - ## Example Usage 1. Create PATCH request. diff --git a/examples/integration/BUILD.bazel b/examples/integration/BUILD.bazel index b37ad78ec78..cee9f33f7f8 100644 --- a/examples/integration/BUILD.bazel +++ b/examples/integration/BUILD.bazel @@ -4,6 +4,7 @@ go_test( name = "go_default_test", srcs = [ "client_test.go", + "fieldmask_test.go", "integration_test.go", "main_test.go", "proto_error_test.go", @@ -19,6 +20,7 @@ go_test( "//examples/server:go_default_library", "//runtime:go_default_library", "@com_github_golang_glog//:go_default_library", + "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@go_googleapis//google/rpc:status_go_proto", diff --git a/examples/integration/fieldmask_test.go b/examples/integration/fieldmask_test.go new file mode 100644 index 00000000000..2ebe44ff05c --- /dev/null +++ b/examples/integration/fieldmask_test.go @@ -0,0 +1,163 @@ +package integration_test + +import ( + "bytes" + "fmt" + "testing" + + "github.com/golang/protobuf/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "google.golang.org/genproto/protobuf/field_mask" +) + +func fieldMasksEqual(fm1, fm2 *field_mask.FieldMask) bool { + if fm1 == nil && fm2 == nil { + return true + } + if fm1 == nil || fm2 == nil { + return false + } + if len(fm1.GetPaths()) != len(fm2.GetPaths()) { + return false + } + + paths := make(map[string]bool) + for _, path := range fm1.GetPaths() { + paths[path] = true + } + for _, path := range fm2.GetPaths() { + if _, ok := paths[path]; !ok { + return false + } + } + + return true +} + +func newFieldMask(paths ...string) *field_mask.FieldMask { + return &field_mask.FieldMask{Paths: paths} +} + +func fieldMaskString(fm *field_mask.FieldMask) string { + if fm == nil { + return "" + } + return fmt.Sprintf("%v", fm.GetPaths()) +} + +// N.B. These tests are here rather than in the runtime package because they need +// to import examplepb for the descriptor, which would result in a circular +// dependency since examplepb imports runtime from the pb.gw.go files +func TestFieldMaskFromRequestBodyWithDescriptor(t *testing.T) { + _, md := descriptor.ForMessage(new(examplepb.NonStandardMessage)) + jsonInput := `{"id":"foo", "thing":{"subThing":{"sub_value":"bar"}}}` + expected := newFieldMask("id", "thing.subThing.sub_value") + + actual, err := runtime.FieldMaskFromRequestBody(bytes.NewReader([]byte(jsonInput)), md) + if !fieldMasksEqual(actual, expected) { + t.Errorf("want %v; got %v", fieldMaskString(expected), fieldMaskString(actual)) + } + if err != nil { + t.Errorf("err %v", err) + } +} + +func TestFieldMaskFromRequestBodyWithJsonNames(t *testing.T) { + _, md := descriptor.ForMessage(new(examplepb.NonStandardMessageWithJSONNames)) + jsonInput := `{"ID":"foo", "Thingy":{"SubThing":{"sub_Value":"bar"}}}` + expected := newFieldMask("id", "thing.subThing.sub_value") + + actual, err := runtime.FieldMaskFromRequestBody(bytes.NewReader([]byte(jsonInput)), md) + if !fieldMasksEqual(actual, expected) { + t.Errorf("want %v; got %v", fieldMaskString(expected), fieldMaskString(actual)) + } + if err != nil { + t.Errorf("err %v", err) + } +} + +// avoid compiler optimising benchmark away +var result *field_mask.FieldMask + +func BenchmarkABEFieldMaskFromRequestBodyWithDescriptor(b *testing.B) { + _, md := descriptor.ForMessage(new(examplepb.ABitOfEverything)) + input := `{` + + `"single_nested": {"name": "bar",` + + ` "amount": 10,` + + ` "ok": "TRUE"},` + + `"uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7",` + + `"nested": [{"name": "bar",` + + ` "amount": 10},` + + ` {"name": "baz",` + + ` "amount": 20}],` + + `"float_value": 1.5,` + + `"double_value": 2.5,` + + `"int64_value": 4294967296,` + + `"uint64_value": 9223372036854775807,` + + `"int32_value": -2147483648,` + + `"fixed64_value": 9223372036854775807,` + + `"fixed32_value": 4294967295,` + + `"bool_value": true,` + + `"string_value": "strprefix/foo",` + + `"bytes_value": "132456",` + + `"uint32_value": 4294967295,` + + `"enum_value": "ONE",` + + `"path_enum_value": "DEF",` + + `"nested_path_enum_value": "JKL",` + + `"sfixed32_value": 2147483647,` + + `"sfixed64_value": -4611686018427387904,` + + `"sint32_value": 2147483647,` + + `"sint64_value": 4611686018427387903,` + + `"repeated_string_value": ["a", "b", "c"],` + + `"oneof_value": {"oneof_string":"x"},` + + `"map_value": {"a": "ONE",` + + ` "b": "ZERO"},` + + `"mapped_string_value": {"a": "x",` + + ` "b": "y"},` + + `"mapped_nested_value": {"a": {"name": "x", "amount": 1},` + + ` "b": {"name": "y", "amount": 2}},` + + `"nonConventionalNameValue": "camelCase",` + + `"timestamp_value": "2016-05-10T10:19:13.123Z",` + + `"repeated_enum_value": ["ONE", "ZERO"],` + + `"repeated_enum_annotation": ["ONE", "ZERO"],` + + `"enum_value_annotation": "ONE",` + + `"repeated_string_annotation": ["a", "b"],` + + `"repeated_nested_annotation": [{"name": "hoge",` + + ` "amount": 10},` + + ` {"name": "fuga",` + + ` "amount": 20}],` + + `"nested_annotation": {"name": "hoge",` + + ` "amount": 10},` + + `"int64_override_type": 12345` + + `}` + var r *field_mask.FieldMask + var err error + for i := 0; i < b.N; i++ { + r, err = runtime.FieldMaskFromRequestBody(bytes.NewReader([]byte(input)), md) + } + if err != nil { + b.Error(err) + } + result = r +} + +func BenchmarkNonStandardFieldMaskFromRequestBodyWithDescriptor(b *testing.B) { + _, md := descriptor.ForMessage(new(examplepb.NonStandardMessage)) + input := `{` + + `"id": "foo",` + + `"Num": 2,` + + `"line_num": 3,` + + `"langIdent": "bar",` + + `"STATUS": "baz"` + + `}` + var r *field_mask.FieldMask + var err error + for i := 0; i < b.N; i++ { + r, err = runtime.FieldMaskFromRequestBody(bytes.NewReader([]byte(input)), md) + } + if err != nil { + b.Error(err) + } + result = r +} diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index 939fecde84a..febbb75b023 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -1643,10 +1643,23 @@ func TestNonStandardNames(t *testing.T) { return } }() + go func() { + if err := runGateway( + ctx, + ":8082", + runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName: false, EmitDefaults: true}), + ); err != nil { + t.Errorf("runGateway() failed with %v; want success", err) + return + } + }() if err := waitForGateway(ctx, 8081); err != nil { t.Errorf("waitForGateway(ctx, 8081) failed with %v; want success", err) } + if err := waitForGateway(ctx, 8082); err != nil { + t.Errorf("waitForGateway(ctx, 8082) failed with %v; want success", err) + } for _, tc := range []struct { name string @@ -1667,6 +1680,18 @@ func TestNonStandardNames(t *testing.T) { // N.B. json_names have no effect if not using OrigName: false `{"id":"foo","Num":"1","line_num":"42","langIdent":"English","STATUS":"good","en_GB":"1","no":"yes","thing":{"subThing":{"sub_value":"hi"}}}`, }, + { + "Test standard update method with OrigName: false marshaller option", + 8082, + "update", + `{"id":"foo","Num":"1","lineNum":"42","langIdent":"English","STATUS":"good","enGB":"1","no":"yes","thing":{"subThing":{"subValue":"hi"}}}`, + }, + { + "Test update method using json_names in message with OrigName: false marshaller option", + 8082, + "update_with_json_names", + `{"ID":"foo","Num":"1","LineNum":"42","langIdent":"English","status":"good","En_GB":"1","yes":"no","Thingy":{"SubThing":{"sub_Value":"hi"}}}`, + }, } { t.Run(tc.name, func(t *testing.T) { testNonStandardNames(t, tc.port, tc.method, tc.jsonBody) diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index 4888a802ff9..62a3a147115 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -51,6 +51,7 @@ go_proto_library( "//examples/proto/sub:go_default_library", "//examples/proto/sub2:go_default_library", "//protoc-gen-swagger/options:go_default_library", + "@com_github_golang_protobuf//descriptor:go_default_library_gen", # keep "@go_googleapis//google/api:annotations_go_proto", ], ) @@ -63,6 +64,7 @@ go_library( deps = [ "//runtime:go_default_library", "//utilities:go_default_library", + "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index c6aa89f505c..eaa39346919 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -13,6 +13,7 @@ import ( "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" @@ -26,11 +27,13 @@ import ( "google.golang.org/grpc/status" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage var ( filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14, "enum_value": 15, "path_enum_value": 16, "nested_path_enum_value": 17, "enum_value_annotation": 18}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}} @@ -774,7 +777,8 @@ func request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + _, md := descriptor.ForMessage(protoReq.Abe) + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), md); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask @@ -823,7 +827,8 @@ func local_request_ABitOfEverythingService_UpdateV2_1(ctx context.Context, marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + _, md := descriptor.ForMessage(protoReq.Abe) + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), md); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/proto/examplepb/echo_service.pb.gw.go index a0445e04929..001f9661119 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/proto/examplepb/echo_service.pb.gw.go @@ -13,6 +13,7 @@ import ( "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" @@ -22,11 +23,13 @@ import ( "google.golang.org/grpc/status" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage var ( filter_EchoService_Echo_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/proto/examplepb/flow_combination.pb.gw.go index c69b4f1daae..14599e7a759 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/proto/examplepb/flow_combination.pb.gw.go @@ -13,6 +13,7 @@ import ( "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" @@ -22,11 +23,13 @@ import ( "google.golang.org/grpc/status" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage func request_FlowCombination_RpcEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq EmptyProto diff --git a/examples/proto/examplepb/non_standard_names.pb.gw.go b/examples/proto/examplepb/non_standard_names.pb.gw.go index 606554372cf..11cb0b98adc 100644 --- a/examples/proto/examplepb/non_standard_names.pb.gw.go +++ b/examples/proto/examplepb/non_standard_names.pb.gw.go @@ -13,6 +13,7 @@ import ( "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" @@ -22,11 +23,13 @@ import ( "google.golang.org/grpc/status" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage var ( filter_NonStandardService_Update_0 = &utilities.DoubleArray{Encoding: map[string]int{"body": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} @@ -44,7 +47,8 @@ func request_NonStandardService_Update_0(ctx context.Context, marshaler runtime. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + _, md := descriptor.ForMessage(protoReq.Body) + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), md); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask @@ -75,7 +79,8 @@ func local_request_NonStandardService_Update_0(ctx context.Context, marshaler ru return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + _, md := descriptor.ForMessage(protoReq.Body) + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), md); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask @@ -107,7 +112,8 @@ func request_NonStandardService_UpdateWithJSONNames_0(ctx context.Context, marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + _, md := descriptor.ForMessage(protoReq.Body) + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), md); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask @@ -138,7 +144,8 @@ func local_request_NonStandardService_UpdateWithJSONNames_0(ctx context.Context, return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + _, md := descriptor.ForMessage(protoReq.Body) + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), md); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/proto/examplepb/response_body_service.pb.gw.go index e90bba3f44c..86d9c4ed9be 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/proto/examplepb/response_body_service.pb.gw.go @@ -13,6 +13,7 @@ import ( "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" @@ -22,11 +23,13 @@ import ( "google.golang.org/grpc/status" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage func request_ResponseBodyService_GetResponseBody_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ResponseBodyIn diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/proto/examplepb/stream.pb.gw.go index b2629f9a564..8b33ff5c40a 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/proto/examplepb/stream.pb.gw.go @@ -13,6 +13,7 @@ import ( "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" @@ -24,11 +25,13 @@ import ( "google.golang.org/grpc/status" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage 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 diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go index e92b4af943c..27258d252ad 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -13,6 +13,7 @@ import ( "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" @@ -22,11 +23,13 @@ import ( "google.golang.org/grpc/status" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage var ( filter_UnannotatedEchoService_Echo_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index 57ff5f69962..edb9b10a020 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -13,6 +13,7 @@ import ( "io" "net/http" + "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" "github.com/golang/protobuf/ptypes/wrappers" @@ -24,11 +25,13 @@ import ( "google.golang.org/grpc/status" ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage func request_WrappersService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client WrappersServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq Wrappers diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index 43943f95643..0b6bfbd2b93 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -44,6 +44,7 @@ func New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix, p "net/http", "github.com/grpc-ecosystem/grpc-gateway/runtime", "github.com/grpc-ecosystem/grpc-gateway/utilities", + "github.com/golang/protobuf/descriptor", "github.com/golang/protobuf/proto", "google.golang.org/grpc", "google.golang.org/grpc/codes", diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index cd6b1f9e850..1d3d3ca8f19 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -2,6 +2,7 @@ package gengateway import ( "bytes" + "errors" "fmt" "strings" "text/template" @@ -34,6 +35,14 @@ func (b binding) GetBodyFieldPath() string { return "*" } +// GetBodyFieldPath returns the binding body's struct field name. +func (b binding) GetBodyFieldStructName() (string, error) { + if b.Body != nil && len(b.Body.FieldPath) != 0 { + return generator2.CamelCase(b.Body.FieldPath.String()), nil + } + return "", errors.New("No body field found") +} + // HasQueryParam determines if the binding needs parameters in query string. // // It sometimes returns true even though actually the binding does not need. @@ -224,11 +233,13 @@ import ( {{range $i := .Imports}}{{if not $i.Standard}}{{$i | printf "%s\n"}}{{end}}{{end}} ) +// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage `)) handlerTemplate = template.Must(template.New("handler").Parse(` @@ -316,7 +327,8 @@ var ( } {{- if and $AllowPatchFeature (eq (.HTTPMethod) "PATCH") (.FieldMaskField) (not (eq "*" .GetBodyFieldPath)) }} if protoReq.{{.FieldMaskField}} == nil || len(protoReq.{{.FieldMaskField}}.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + _, md := descriptor.ForMessage(protoReq.{{.GetBodyFieldStructName}}) + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), md); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.{{.FieldMaskField}} = fieldMask @@ -477,7 +489,8 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct } {{- if and $AllowPatchFeature (eq (.HTTPMethod) "PATCH") (.FieldMaskField) (not (eq "*" .GetBodyFieldPath)) }} if protoReq.{{.FieldMaskField}} == nil || len(protoReq.{{.FieldMaskField}}.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader()); err != nil { + _, md := descriptor.ForMessage(protoReq.{{.GetBodyFieldStructName}}) + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), md); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.{{.FieldMaskField}} = fieldMask diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index 2462dc053f7..819c45a7657 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -27,10 +27,12 @@ go_library( deps = [ "//internal:go_default_library", "//utilities:go_default_library", + "@com_github_golang_protobuf//descriptor:go_default_library_gen", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", "@go_googleapis//google/api:httpbody_go_proto", "@io_bazel_rules_go//proto/wkt:any_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", "@io_bazel_rules_go//proto/wkt:duration_go_proto", "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", diff --git a/runtime/fieldmask.go b/runtime/fieldmask.go index d3eb5782b70..341aad5a3ea 100644 --- a/runtime/fieldmask.go +++ b/runtime/fieldmask.go @@ -5,11 +5,37 @@ import ( "io" "strings" + descriptor2 "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/protoc-gen-go/descriptor" "google.golang.org/genproto/protobuf/field_mask" ) +func translateName(name string, md *descriptor.DescriptorProto) (string, *descriptor.DescriptorProto) { + // TODO - should really gate this with a test that the marshaller has used json names + if md != nil { + for _, f := range md.Field { + if f.JsonName != nil && f.Name != nil && *f.JsonName == name { + var subType *descriptor.DescriptorProto + + // If the field has a TypeName then we retrieve the nested type for translating the embedded message names. + if f.TypeName != nil { + typeSplit := strings.Split(*f.TypeName, ".") + typeName := typeSplit[len(typeSplit)-1] + for _, t := range md.NestedType { + if typeName == *t.Name { + subType = t + } + } + } + return *f.Name, subType + } + } + } + return name, nil +} + // FieldMaskFromRequestBody creates a FieldMask printing all complete paths from the JSON body. -func FieldMaskFromRequestBody(r io.Reader) (*field_mask.FieldMask, error) { +func FieldMaskFromRequestBody(r io.Reader, md *descriptor.DescriptorProto) (*field_mask.FieldMask, error) { fm := &field_mask.FieldMask{} var root interface{} if err := json.NewDecoder(r).Decode(&root); err != nil { @@ -19,7 +45,7 @@ func FieldMaskFromRequestBody(r io.Reader) (*field_mask.FieldMask, error) { return nil, err } - queue := []fieldMaskPathItem{{node: root}} + queue := []fieldMaskPathItem{{node: root, md: md}} for len(queue) > 0 { // dequeue an item item := queue[0] @@ -28,7 +54,11 @@ func FieldMaskFromRequestBody(r io.Reader) (*field_mask.FieldMask, error) { if m, ok := item.node.(map[string]interface{}); ok { // if the item is an object, then enqueue all of its children for k, v := range m { - queue = append(queue, fieldMaskPathItem{path: append(item.path, k), node: v}) + protoName, subMd := translateName(k, item.md) + if subMsg, ok := v.(descriptor2.Message); ok { + _, subMd = descriptor2.ForMessage(subMsg) + } + queue = append(queue, fieldMaskPathItem{path: append(item.path, protoName), node: v, md: subMd}) } } else if len(item.path) > 0 { // otherwise, it's a leaf node so print its path @@ -46,4 +76,7 @@ type fieldMaskPathItem struct { // a generic decoded json object the current item to inspect for further path extraction node interface{} + + // descriptor for parent message + md *descriptor.DescriptorProto } diff --git a/runtime/fieldmask_test.go b/runtime/fieldmask_test.go index dae968b8284..7a5ddaae957 100644 --- a/runtime/fieldmask_test.go +++ b/runtime/fieldmask_test.go @@ -56,7 +56,7 @@ func TestFieldMaskFromRequestBody(t *testing.T) { {name: "canonical", input: `{"f": {"b": {"d": 1, "x": 2}, "c": 1}}`, expected: newFieldMask("f.b.d", "f.b.x", "f.c")}, } { t.Run(tc.name, func(t *testing.T) { - actual, err := FieldMaskFromRequestBody(bytes.NewReader([]byte(tc.input))) + actual, err := FieldMaskFromRequestBody(bytes.NewReader([]byte(tc.input)), nil) if !fieldMasksEqual(actual, tc.expected) { t.Errorf("want %v; got %v", fieldMaskString(tc.expected), fieldMaskString(actual)) } @@ -123,7 +123,7 @@ func BenchmarkABEFieldMaskFromRequestBody(b *testing.B) { var r *field_mask.FieldMask var err error for i := 0; i < b.N; i++ { - r, err = FieldMaskFromRequestBody(bytes.NewReader([]byte(input))) + r, err = FieldMaskFromRequestBody(bytes.NewReader([]byte(input)), nil) } if err != nil { b.Error(err) @@ -142,7 +142,7 @@ func BenchmarkNonStandardFieldMaskFromRequestBody(b *testing.B) { var r *field_mask.FieldMask var err error for i := 0; i < b.N; i++ { - r, err = FieldMaskFromRequestBody(bytes.NewReader([]byte(input))) + r, err = FieldMaskFromRequestBody(bytes.NewReader([]byte(input)), nil) } if err != nil { b.Error(err) From 863fd7d9678391bc240100c106424e90bc8828e8 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 30 Sep 2019 10:37:36 +0100 Subject: [PATCH 476/552] Generate chagenlog for 1.11.3 --- CHANGELOG.md | 16 ++++++++++++++++ Makefile | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 686e4934ca6..492ee9f74d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Change Log +## [v1.11.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.11.3) (2019-09-30) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.11.2...v1.11.3) + +**Closed issues:** + +- json Custom output support \(with examples\) [\#1051](https://github.com/grpc-ecosystem/grpc-gateway/issues/1051) +- Question: Override TransientFailure error with friendlier response [\#1047](https://github.com/grpc-ecosystem/grpc-gateway/issues/1047) +- Wrong codes generated when nested enum in path [\#1017](https://github.com/grpc-ecosystem/grpc-gateway/issues/1017) + +**Merged pull requests:** + +- Support json names in field mask generation [\#1050](https://github.com/grpc-ecosystem/grpc-gateway/pull/1050) ([william-plano-oxb](https://github.com/william-plano-oxb)) +- Fix auto generated fieldmask case in patch requests [\#1049](https://github.com/grpc-ecosystem/grpc-gateway/pull/1049) ([william-plano-oxb](https://github.com/william-plano-oxb)) +- Pass nested enum values through properly when used as url parameters [\#1048](https://github.com/grpc-ecosystem/grpc-gateway/pull/1048) ([mnito](https://github.com/mnito)) + ## [v1.11.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.11.2) (2019-09-20) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.11.1...v1.11.2) @@ -21,6 +36,7 @@ **Merged pull requests:** +- Generate changelog for 1.11.2 [\#1045](https://github.com/grpc-ecosystem/grpc-gateway/pull/1045) ([johanbrandhorst](https://github.com/johanbrandhorst)) - examples/integration: wait for secondary gateway [\#1039](https://github.com/grpc-ecosystem/grpc-gateway/pull/1039) ([srenatus](https://github.com/srenatus)) - Update README.md [\#1038](https://github.com/grpc-ecosystem/grpc-gateway/pull/1038) ([piengeng](https://github.com/piengeng)) - Configure stale\[bot\] [\#1036](https://github.com/grpc-ecosystem/grpc-gateway/pull/1036) ([achew22](https://github.com/achew22)) diff --git a/Makefile b/Makefile index f166c512fdf..556da62ddf3 100644 --- a/Makefile +++ b/Makefile @@ -195,7 +195,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.11.2 + --future-release=v1.11.3 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 43ec1ec433948583ef1ec1dd59e1c55bfccc1675 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 2 Oct 2019 09:21:18 +0100 Subject: [PATCH 477/552] Bump generators Dockerfile to 1.13.1 --- .circleci/Dockerfile | 13 ++++++------ .circleci/README.md | 2 +- .circleci/config.yml | 12 +++++------ CONTRIBUTING.md | 2 +- Makefile | 3 +-- .../proto/examplepb/non_standard_names.pb.go | 20 +++++++++---------- go.mod | 2 ++ 7 files changed, 28 insertions(+), 26 deletions(-) diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile index 1343053c0e6..5e555123263 100644 --- a/.circleci/Dockerfile +++ b/.circleci/Dockerfile @@ -1,18 +1,18 @@ -FROM golang:1.12 +FROM golang:1.13.1 ## Warm apt cache RUN apt-get update # Install swagger-codegen ENV SWAGGER_CODEGEN_VERSION=2.2.2 -RUN apt-get install -y openjdk-8-jre wget && \ +RUN apt-get install -y openjdk-11-jre wget && \ wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${SWAGGER_CODEGEN_VERSION}/swagger-codegen-cli-${SWAGGER_CODEGEN_VERSION}.jar \ -O /usr/local/bin/swagger-codegen-cli.jar && \ apt-get remove -y wget ENV SWAGGER_CODEGEN="java -jar /usr/local/bin/swagger-codegen-cli.jar" # Install protoc -ENV PROTOC_VERSION=3.7.0 +ENV PROTOC_VERSION=3.9.2 RUN apt-get install -y wget unzip && \ wget https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \ -O /protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ @@ -20,10 +20,11 @@ RUN apt-get install -y wget unzip && \ rm -f /protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ apt-get remove -y unzip wget -# Install node -ENV NODE_VERSION=v10.15.2 +# Install node, used by NVM +ENV NODE_VERSION=v10.16.3 +ENV NVM_VERSION=v0.35.0 RUN apt-get install -y wget bzip2 && \ - wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash && \ + wget -qO- https://raw.githubusercontent.com/creationix/nvm/${NVM_VERSION}/install.sh | bash && \ apt-get remove -y wget # Clean up diff --git a/.circleci/README.md b/.circleci/README.md index 4aa13589bed..aff8c5cf78c 100644 --- a/.circleci/README.md +++ b/.circleci/README.md @@ -7,7 +7,7 @@ Contained within is the CI test setup for the Gateway. It runs on Circle CI. Great, it should be as simple as thus (run from the root of the directory): ```bash -$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.12 \ +$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.13 \ /bin/bash -c 'cd /go/src/github.com/grpc-ecosystem/grpc-gateway && \ make realclean && \ make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' diff --git a/.circleci/config.yml b/.circleci/config.yml index f4332817307..5d2cddb6c26 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,14 +2,14 @@ version: 2 jobs: build: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.12 + - image: jfbrandhorst/grpc-gateway-build-env:1.13 working_directory: /src/grpc-gateway steps: - checkout - run: go build ./... test: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.12 + - image: jfbrandhorst/grpc-gateway-build-env:1.13 working_directory: /src/grpc-gateway environment: GLOG_logtostderr: '1' @@ -19,7 +19,7 @@ jobs: - run: bash <(curl -s https://codecov.io/bash) node_test: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.12 + - image: jfbrandhorst/grpc-gateway-build-env:1.13 working_directory: /src/grpc-gateway steps: - checkout @@ -32,7 +32,7 @@ jobs: ./node_modules/.bin/gulp generate: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.12 + - image: jfbrandhorst/grpc-gateway-build-env:1.13 working_directory: /src/grpc-gateway steps: - checkout @@ -42,7 +42,7 @@ jobs: - run: git diff --exit-code lint: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.12 + - image: jfbrandhorst/grpc-gateway-build-env:1.13 working_directory: /src/grpc-gateway steps: - checkout @@ -84,7 +84,7 @@ jobs: when: always release: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.12 + - image: jfbrandhorst/grpc-gateway-build-env:1.13 working_directory: /src/grpc-gateway steps: - checkout diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c2ac49c2bb1..fc945f7906c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ All submissions, including submissions by project members, require review. Great, it should be as simple as thus (run from the root of the directory): ```bash -docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.12 \ +docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.13 \ /bin/bash -c 'cd /src/grpc-gateway && \ make realclean && \ make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' diff --git a/Makefile b/Makefile index 556da62ddf3..0ea0a74908d 100644 --- a/Makefile +++ b/Makefile @@ -129,8 +129,7 @@ $(GO_PLUGIN): go build -o $(GO_PLUGIN) $(GO_PLUGIN_PKG) $(RUNTIME_GO): $(RUNTIME_PROTO) $(GO_PLUGIN) - go mod vendor - protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I ./vendor/$(GO_PTYPES_ANY_PKG) -I. --go_out=$(PKGMAP),paths=source_relative:. $(RUNTIME_PROTO) + protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP),paths=source_relative:. $(RUNTIME_PROTO) $(OPENAPIV2_GO): $(OPENAPIV2_PROTO) $(GO_PLUGIN) protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP),paths=source_relative:. $(OPENAPIV2_PROTO) diff --git a/examples/proto/examplepb/non_standard_names.pb.go b/examples/proto/examplepb/non_standard_names.pb.go index 839f5537820..7637cf515fe 100644 --- a/examples/proto/examplepb/non_standard_names.pb.go +++ b/examples/proto/examplepb/non_standard_names.pb.go @@ -45,7 +45,7 @@ func (m *NonStandardMessage) Reset() { *m = NonStandardMessage{} } func (m *NonStandardMessage) String() string { return proto.CompactTextString(m) } func (*NonStandardMessage) ProtoMessage() {} func (*NonStandardMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{0} + return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{0} } func (m *NonStandardMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessage.Unmarshal(m, b) @@ -132,7 +132,7 @@ func (m *NonStandardMessage_Thing) Reset() { *m = NonStandardMessage_Thi func (m *NonStandardMessage_Thing) String() string { return proto.CompactTextString(m) } func (*NonStandardMessage_Thing) ProtoMessage() {} func (*NonStandardMessage_Thing) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{0, 0} + return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{0, 0} } func (m *NonStandardMessage_Thing) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessage_Thing.Unmarshal(m, b) @@ -170,7 +170,7 @@ func (m *NonStandardMessage_Thing_SubThing) Reset() { *m = NonStandardMe func (m *NonStandardMessage_Thing_SubThing) String() string { return proto.CompactTextString(m) } func (*NonStandardMessage_Thing_SubThing) ProtoMessage() {} func (*NonStandardMessage_Thing_SubThing) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{0, 0, 0} + return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{0, 0, 0} } func (m *NonStandardMessage_Thing_SubThing) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessage_Thing_SubThing.Unmarshal(m, b) @@ -209,7 +209,7 @@ func (m *NonStandardUpdateRequest) Reset() { *m = NonStandardUpdateReque func (m *NonStandardUpdateRequest) String() string { return proto.CompactTextString(m) } func (*NonStandardUpdateRequest) ProtoMessage() {} func (*NonStandardUpdateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{1} + return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{1} } func (m *NonStandardUpdateRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardUpdateRequest.Unmarshal(m, b) @@ -263,7 +263,7 @@ func (m *NonStandardMessageWithJSONNames) Reset() { *m = NonStandardMess func (m *NonStandardMessageWithJSONNames) String() string { return proto.CompactTextString(m) } func (*NonStandardMessageWithJSONNames) ProtoMessage() {} func (*NonStandardMessageWithJSONNames) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{2} + return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{2} } func (m *NonStandardMessageWithJSONNames) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessageWithJSONNames.Unmarshal(m, b) @@ -350,7 +350,7 @@ func (m *NonStandardMessageWithJSONNames_Thing) Reset() { *m = NonStanda func (m *NonStandardMessageWithJSONNames_Thing) String() string { return proto.CompactTextString(m) } func (*NonStandardMessageWithJSONNames_Thing) ProtoMessage() {} func (*NonStandardMessageWithJSONNames_Thing) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{2, 0} + return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{2, 0} } func (m *NonStandardMessageWithJSONNames_Thing) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.Unmarshal(m, b) @@ -392,7 +392,7 @@ func (m *NonStandardMessageWithJSONNames_Thing_SubThing) String() string { } func (*NonStandardMessageWithJSONNames_Thing_SubThing) ProtoMessage() {} func (*NonStandardMessageWithJSONNames_Thing_SubThing) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{2, 0, 0} + return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{2, 0, 0} } func (m *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.Unmarshal(m, b) @@ -431,7 +431,7 @@ func (m *NonStandardWithJSONNamesUpdateRequest) Reset() { *m = NonStanda func (m *NonStandardWithJSONNamesUpdateRequest) String() string { return proto.CompactTextString(m) } func (*NonStandardWithJSONNamesUpdateRequest) ProtoMessage() {} func (*NonStandardWithJSONNamesUpdateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_1ed497ab0876ca64, []int{3} + return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{3} } func (m *NonStandardWithJSONNamesUpdateRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.Unmarshal(m, b) @@ -586,10 +586,10 @@ var _NonStandardService_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/non_standard_names.proto", fileDescriptor_non_standard_names_1ed497ab0876ca64) + proto.RegisterFile("examples/proto/examplepb/non_standard_names.proto", fileDescriptor_non_standard_names_33e1f510ac1f389a) } -var fileDescriptor_non_standard_names_1ed497ab0876ca64 = []byte{ +var fileDescriptor_non_standard_names_33e1f510ac1f389a = []byte{ // 626 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x41, 0x6f, 0xd3, 0x3c, 0x18, 0xc7, 0x95, 0x66, 0xed, 0x5a, 0x57, 0x7a, 0x5f, 0xe4, 0x21, 0x14, 0xc2, 0xa4, 0x56, 0x95, diff --git a/go.mod b/go.mod index e63e264f1b9..c83df465786 100644 --- a/go.mod +++ b/go.mod @@ -14,3 +14,5 @@ require ( gopkg.in/resty.v1 v1.12.0 gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 // indirect ) + +go 1.13 From 1edbcf7a070226df9dcdad77d34d07aa0686e108 Mon Sep 17 00:00:00 2001 From: Zach Gershman Date: Wed, 2 Oct 2019 08:32:02 -0700 Subject: [PATCH 478/552] Update dependencies (#1053) * makefile now actually tests correctly - sed was removed as it was slow and not the canonical way to implement a replace of a go package now that modules have been introduced - go test commands were correct as the elipsis was not testing the right thing - test.Short was added to the rest of the integration tests just in case users wanted to use the -short directive and skip those (matching the style throughout the rest of the integrations * fixing the bazel bits * re-run generation with newer circle dockerfile * updates contributing to note usage of go.mod - gazelle has a slightly different command you need to use based on us using the go.mod to manage our dependencies * move backwards to resty 1.8.0 - stops all the go.mod craziness since they've switched between gopkg.in and github as their module name. - need to upgrade this to v2 in reality but that will depend on what swagger codegen is doing --- CONTRIBUTING.md | 2 +- Makefile | 5 +- WORKSPACE | 6 +- examples/clients/abe/BUILD.bazel | 2 +- examples/clients/abe/api_client.go | 2 +- examples/clients/echo/BUILD.bazel | 2 +- examples/clients/echo/api_client.go | 2 +- examples/clients/responsebody/BUILD.bazel | 2 +- examples/clients/responsebody/api_client.go | 2 +- examples/clients/unannotatedecho/BUILD.bazel | 2 +- .../clients/unannotatedecho/api_client.go | 2 +- .../proto/examplepb/a_bit_of_everything.pb.go | 686 +++++++++--------- examples/proto/examplepb/echo_service.pb.go | 298 ++------ .../proto/examplepb/flow_combination.pb.go | 183 +++-- .../proto/examplepb/non_standard_names.pb.go | 180 +++-- .../examplepb/response_body_service.pb.go | 149 ++-- examples/proto/examplepb/stream.pb.go | 89 ++- .../examplepb/unannotated_echo_service.pb.go | 104 +-- examples/proto/examplepb/wrappers.pb.go | 154 ++-- examples/proto/pathenum/path_enum.pb.go | 33 +- examples/proto/sub/message.pb.go | 23 +- examples/proto/sub2/message.pb.go | 25 +- go.mod | 21 +- go.sum | 55 +- internal/stream_chunk.pb.go | 25 +- protoc-gen-swagger/options/annotations.pb.go | 28 +- protoc-gen-swagger/options/openapiv2.pb.go | 157 ++-- repositories.bzl | 69 +- 28 files changed, 1208 insertions(+), 1100 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fc945f7906c..ecab022c28f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env: make realclean && \ make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' docker run -itv $(pwd):/grpc-gateway -w /grpc-gateway --entrypoint /bin/bash --rm \ - l.gcr.io/google/bazel -c 'bazel run :gazelle; bazel run :buildifier' + l.gcr.io/google/bazel -c 'bazel run :gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories; bazel run :buildifier' ``` If this has resulted in some file changes in the repo, please ensure you check those in with your merge request. diff --git a/Makefile b/Makefile index 0ea0a74908d..0ee29234c36 100644 --- a/Makefile +++ b/Makefile @@ -177,10 +177,9 @@ $(RESPONSE_BODY_EXAMPLE_SRCS): $(RESPONSE_BODY_EXAMPLE_SPEC) $(EXAMPLE_CLIENT_DIR)/responsebody/git_push.sh examples: $(EXAMPLE_DEPSRCS) $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) - find . -type f -name *.go -exec sed -s -i 's;github.com/go-resty/resty;gopkg.in/resty.v1;g' {} + test: examples - go test -race ... - go test -race examples/integration -args -network=unix -endpoint=test.sock + go test -short -race ./... + go test -race ./examples/integration -args -network=unix -endpoint=test.sock changelog: docker run --rm \ --interactive \ diff --git a/WORKSPACE b/WORKSPACE index 79e4cd83235..280712e741b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -19,10 +19,10 @@ go_register_toolchains() http_archive( name = "bazel_gazelle", - sha256 = "be9296bfd64882e3c08e3283c58fcb461fa6dd3c171764fcc4cf322f60615a9b", + sha256 = "7fc87f4170011201b1690326e8c16c5d802836e3a0d617d8f75c3af2b23180c4", urls = [ - "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/0.18.1/bazel-gazelle-0.18.1.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.18.1/bazel-gazelle-0.18.1.tar.gz", + "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/0.18.2/bazel-gazelle-0.18.2.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.18.2/bazel-gazelle-0.18.2.tar.gz", ], ) diff --git a/examples/clients/abe/BUILD.bazel b/examples/clients/abe/BUILD.bazel index 4c28ed28d6a..4d3c3546e93 100644 --- a/examples/clients/abe/BUILD.bazel +++ b/examples/clients/abe/BUILD.bazel @@ -30,6 +30,6 @@ go_library( "//examples/proto/examplepb:go_default_library", "//examples/proto/pathenum:go_default_library", "//runtime:go_default_library", - "@in_gopkg_resty_v1//:go_default_library", + "@com_github_go_resty_resty//:go_default_library", ], ) diff --git a/examples/clients/abe/api_client.go b/examples/clients/abe/api_client.go index d6bc762e9bd..bf3e21a9fb1 100644 --- a/examples/clients/abe/api_client.go +++ b/examples/clients/abe/api_client.go @@ -18,7 +18,7 @@ import ( "strings" "net/url" "io/ioutil" - "gopkg.in/resty.v1" + "github.com/go-resty/resty" ) type APIClient struct { diff --git a/examples/clients/echo/BUILD.bazel b/examples/clients/echo/BUILD.bazel index 97f3f317ba5..090b56aafab 100644 --- a/examples/clients/echo/BUILD.bazel +++ b/examples/clients/echo/BUILD.bazel @@ -13,5 +13,5 @@ go_library( "examplepb_simple_message.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo", - deps = ["@in_gopkg_resty_v1//:go_default_library"], + deps = ["@com_github_go_resty_resty//:go_default_library"], ) diff --git a/examples/clients/echo/api_client.go b/examples/clients/echo/api_client.go index d3facaa4633..7a517148026 100644 --- a/examples/clients/echo/api_client.go +++ b/examples/clients/echo/api_client.go @@ -18,7 +18,7 @@ import ( "strings" "net/url" "io/ioutil" - "gopkg.in/resty.v1" + "github.com/go-resty/resty" ) type APIClient struct { diff --git a/examples/clients/responsebody/BUILD.bazel b/examples/clients/responsebody/BUILD.bazel index 0f7ce09fc40..e621bea6960 100644 --- a/examples/clients/responsebody/BUILD.bazel +++ b/examples/clients/responsebody/BUILD.bazel @@ -19,5 +19,5 @@ go_library( ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/responsebody", visibility = ["//visibility:public"], - deps = ["@in_gopkg_resty_v1//:go_default_library"], + deps = ["@com_github_go_resty_resty//:go_default_library"], ) diff --git a/examples/clients/responsebody/api_client.go b/examples/clients/responsebody/api_client.go index 1ac422ec895..1f7354b61dc 100644 --- a/examples/clients/responsebody/api_client.go +++ b/examples/clients/responsebody/api_client.go @@ -18,7 +18,7 @@ import ( "strings" "net/url" "io/ioutil" - "gopkg.in/resty.v1" + "github.com/go-resty/resty" ) type APIClient struct { diff --git a/examples/clients/unannotatedecho/BUILD.bazel b/examples/clients/unannotatedecho/BUILD.bazel index c7c60503b9c..611c6c7052d 100644 --- a/examples/clients/unannotatedecho/BUILD.bazel +++ b/examples/clients/unannotatedecho/BUILD.bazel @@ -12,5 +12,5 @@ go_library( "unannotated_echo_service_api.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/unannotatedecho", - deps = ["@in_gopkg_resty_v1//:go_default_library"], + deps = ["@com_github_go_resty_resty//:go_default_library"], ) diff --git a/examples/clients/unannotatedecho/api_client.go b/examples/clients/unannotatedecho/api_client.go index c898727e74b..aa4c1f14e42 100644 --- a/examples/clients/unannotatedecho/api_client.go +++ b/examples/clients/unannotatedecho/api_client.go @@ -18,7 +18,7 @@ import ( "strings" "net/url" "io/ioutil" - "gopkg.in/resty.v1" + "github.com/go-resty/resty" ) type APIClient struct { diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 7cc2c7209a7..e8df7423c79 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -3,22 +3,23 @@ package examplepb -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import duration "github.com/golang/protobuf/ptypes/duration" -import empty "github.com/golang/protobuf/ptypes/empty" -import timestamp "github.com/golang/protobuf/ptypes/timestamp" -import pathenum "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" -import sub "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" -import sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" -import _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import field_mask "google.golang.org/genproto/protobuf/field_mask" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + duration "github.com/golang/protobuf/ptypes/duration" + empty "github.com/golang/protobuf/ptypes/empty" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + pathenum "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" + sub "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" + sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" + _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + field_mask "google.golang.org/genproto/protobuf/field_mask" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -30,7 +31,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // NumericEnum is one or zero. type NumericEnum int32 @@ -46,6 +47,7 @@ var NumericEnum_name = map[int32]string{ 0: "ZERO", 1: "ONE", } + var NumericEnum_value = map[string]int32{ "ZERO": 0, "ONE": 1, @@ -54,8 +56,9 @@ var NumericEnum_value = map[string]int32{ func (x NumericEnum) String() string { return proto.EnumName(NumericEnum_name, int32(x)) } + func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{0} + return fileDescriptor_3978364c010e812a, []int{0} } // DeepEnum is one or zero. @@ -72,6 +75,7 @@ var ABitOfEverything_Nested_DeepEnum_name = map[int32]string{ 0: "FALSE", 1: "TRUE", } + var ABitOfEverything_Nested_DeepEnum_value = map[string]int32{ "FALSE": 0, "TRUE": 1, @@ -80,8 +84,9 @@ var ABitOfEverything_Nested_DeepEnum_value = map[string]int32{ func (x ABitOfEverything_Nested_DeepEnum) String() string { return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) } + func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{0, 0, 0} + return fileDescriptor_3978364c010e812a, []int{0, 0, 0} } // Intentionally complicated message type to cover many features of Protobuf. @@ -139,16 +144,17 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{0} + return fileDescriptor_3978364c010e812a, []int{0} } + func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) } func (m *ABitOfEverything) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ABitOfEverything.Marshal(b, m, deterministic) } -func (dst *ABitOfEverything) XXX_Merge(src proto.Message) { - xxx_messageInfo_ABitOfEverything.Merge(dst, src) +func (m *ABitOfEverything) XXX_Merge(src proto.Message) { + xxx_messageInfo_ABitOfEverything.Merge(m, src) } func (m *ABitOfEverything) XXX_Size() int { return xxx_messageInfo_ABitOfEverything.Size(m) @@ -434,76 +440,14 @@ func (m *ABitOfEverything) GetInt64OverrideType() int64 { return 0 } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ABitOfEverything) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ABitOfEverything_OneofMarshaler, _ABitOfEverything_OneofUnmarshaler, _ABitOfEverything_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ABitOfEverything) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*ABitOfEverything_OneofEmpty)(nil), (*ABitOfEverything_OneofString)(nil), } } -func _ABitOfEverything_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ABitOfEverything) - // oneof_value - switch x := m.OneofValue.(type) { - case *ABitOfEverything_OneofEmpty: - b.EncodeVarint(20<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.OneofEmpty); err != nil { - return err - } - case *ABitOfEverything_OneofString: - b.EncodeVarint(21<<3 | proto.WireBytes) - b.EncodeStringBytes(x.OneofString) - case nil: - default: - return fmt.Errorf("ABitOfEverything.OneofValue has unexpected type %T", x) - } - return nil -} - -func _ABitOfEverything_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ABitOfEverything) - switch tag { - case 20: // oneof_value.oneof_empty - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(empty.Empty) - err := b.DecodeMessage(msg) - m.OneofValue = &ABitOfEverything_OneofEmpty{msg} - return true, err - case 21: // oneof_value.oneof_string - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.OneofValue = &ABitOfEverything_OneofString{x} - return true, err - default: - return false, nil - } -} - -func _ABitOfEverything_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ABitOfEverything) - // oneof_value - switch x := m.OneofValue.(type) { - case *ABitOfEverything_OneofEmpty: - s := proto.Size(x.OneofEmpty) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ABitOfEverything_OneofString: - n += 2 // tag and wire - n += proto.SizeVarint(uint64(len(x.OneofString))) - n += len(x.OneofString) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // Nested is nested type. type ABitOfEverything_Nested struct { // name is nested field. @@ -520,16 +464,17 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{0, 0} + return fileDescriptor_3978364c010e812a, []int{0, 0} } + func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) } func (m *ABitOfEverything_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ABitOfEverything_Nested.Marshal(b, m, deterministic) } -func (dst *ABitOfEverything_Nested) XXX_Merge(src proto.Message) { - xxx_messageInfo_ABitOfEverything_Nested.Merge(dst, src) +func (m *ABitOfEverything_Nested) XXX_Merge(src proto.Message) { + xxx_messageInfo_ABitOfEverything_Nested.Merge(m, src) } func (m *ABitOfEverything_Nested) XXX_Size() int { return xxx_messageInfo_ABitOfEverything_Nested.Size(m) @@ -589,16 +534,17 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{1} + return fileDescriptor_3978364c010e812a, []int{1} } + func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverythingRepeated.Unmarshal(m, b) } func (m *ABitOfEverythingRepeated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ABitOfEverythingRepeated.Marshal(b, m, deterministic) } -func (dst *ABitOfEverythingRepeated) XXX_Merge(src proto.Message) { - xxx_messageInfo_ABitOfEverythingRepeated.Merge(dst, src) +func (m *ABitOfEverythingRepeated) XXX_Merge(src proto.Message) { + xxx_messageInfo_ABitOfEverythingRepeated.Merge(m, src) } func (m *ABitOfEverythingRepeated) XXX_Size() int { return xxx_messageInfo_ABitOfEverythingRepeated.Size(m) @@ -732,16 +678,17 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{2} + return fileDescriptor_3978364c010e812a, []int{2} } + func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) } func (m *Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Body.Marshal(b, m, deterministic) } -func (dst *Body) XXX_Merge(src proto.Message) { - xxx_messageInfo_Body.Merge(dst, src) +func (m *Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_Body.Merge(m, src) } func (m *Body) XXX_Size() int { return xxx_messageInfo_Body.Size(m) @@ -771,16 +718,17 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{3} + return fileDescriptor_3978364c010e812a, []int{3} } + func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) } func (m *MessageWithBody) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MessageWithBody.Marshal(b, m, deterministic) } -func (dst *MessageWithBody) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessageWithBody.Merge(dst, src) +func (m *MessageWithBody) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageWithBody.Merge(m, src) } func (m *MessageWithBody) XXX_Size() int { return xxx_messageInfo_MessageWithBody.Size(m) @@ -818,16 +766,17 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_a_bit_of_everything_e0089283b92675c0, []int{4} + return fileDescriptor_3978364c010e812a, []int{4} } + func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateV2Request.Unmarshal(m, b) } func (m *UpdateV2Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_UpdateV2Request.Marshal(b, m, deterministic) } -func (dst *UpdateV2Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateV2Request.Merge(dst, src) +func (m *UpdateV2Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateV2Request.Merge(m, src) } func (m *UpdateV2Request) XXX_Size() int { return xxx_messageInfo_UpdateV2Request.Size(m) @@ -853,6 +802,8 @@ func (m *UpdateV2Request) GetUpdateMask() *field_mask.FieldMask { } func init() { + proto.RegisterEnum("grpc.gateway.examples.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) + proto.RegisterEnum("grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value) proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything") proto.RegisterMapType((map[string]NumericEnum)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.MapValueEntry") proto.RegisterMapType((map[string]*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.MappedNestedValueEntry") @@ -862,8 +813,235 @@ func init() { proto.RegisterType((*Body)(nil), "grpc.gateway.examples.examplepb.Body") proto.RegisterType((*MessageWithBody)(nil), "grpc.gateway.examples.examplepb.MessageWithBody") proto.RegisterType((*UpdateV2Request)(nil), "grpc.gateway.examples.examplepb.UpdateV2Request") - proto.RegisterEnum("grpc.gateway.examples.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) - proto.RegisterEnum("grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value) +} + +func init() { + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_3978364c010e812a) +} + +var fileDescriptor_3978364c010e812a = []byte{ + // 3529 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4d, 0x6c, 0x1b, 0xc7, + 0x7e, 0xd7, 0x72, 0x25, 0x59, 0x1a, 0x7d, 0x8f, 0x2c, 0x5b, 0xa6, 0x95, 0x68, 0x4c, 0x3b, 0x2f, + 0x6b, 0x3e, 0x93, 0x2b, 0xad, 0x94, 0xc4, 0x66, 0xfa, 0x92, 0x90, 0x92, 0xec, 0xc8, 0x4e, 0x64, + 0x65, 0xed, 0xb8, 0xa9, 0x5f, 0xfc, 0xd4, 0x21, 0x39, 0x14, 0xd7, 0xe2, 0xee, 0xec, 0xdb, 0x9d, + 0x95, 0x45, 0xab, 0x6c, 0x1f, 0xda, 0xa2, 0x05, 0xfa, 0x6e, 0x7c, 0xfd, 0x7e, 0x68, 0x2f, 0x45, + 0x51, 0xa0, 0xe8, 0xa9, 0x40, 0x4f, 0x05, 0xda, 0x4b, 0x6f, 0x3d, 0xb4, 0x48, 0x81, 0xa2, 0x87, + 0xf6, 0xd4, 0x9e, 0x7b, 0x69, 0x11, 0xa0, 0x87, 0x7e, 0x60, 0x66, 0x77, 0xc9, 0xdd, 0x25, 0x69, + 0x99, 0x76, 0x91, 0xe4, 0x10, 0xef, 0xcc, 0xfc, 0x3f, 0x7e, 0xff, 0x99, 0xff, 0xfc, 0x3f, 0x86, + 0x02, 0x1a, 0x39, 0xc1, 0xa6, 0xdd, 0x20, 0xae, 0x6a, 0x3b, 0x94, 0x51, 0x35, 0x18, 0xda, 0x65, + 0x15, 0x1f, 0x94, 0x0d, 0x76, 0x40, 0x6b, 0x07, 0xe4, 0x98, 0x38, 0x4d, 0x56, 0x37, 0xac, 0xc3, + 0xbc, 0xa0, 0x81, 0xab, 0x87, 0x8e, 0x5d, 0xc9, 0x1f, 0x62, 0x46, 0x9e, 0xe1, 0x66, 0x3e, 0x14, + 0x90, 0xef, 0xb0, 0xa6, 0x57, 0x0e, 0x29, 0x3d, 0x6c, 0x10, 0x15, 0xdb, 0x86, 0x8a, 0x2d, 0x8b, + 0x32, 0xcc, 0x0c, 0x6a, 0xb9, 0x3e, 0x7b, 0x1a, 0x05, 0xab, 0x62, 0x54, 0xf6, 0x6a, 0x6a, 0xcd, + 0x20, 0x8d, 0xea, 0x81, 0x89, 0xdd, 0xa3, 0x80, 0xe2, 0x72, 0x92, 0x82, 0x98, 0x36, 0x6b, 0x06, + 0x8b, 0x6f, 0x26, 0x17, 0xab, 0x9e, 0x23, 0xe4, 0x07, 0xeb, 0x6f, 0x27, 0x2c, 0xb2, 0x31, 0xab, + 0x13, 0xcb, 0x33, 0xc5, 0xc7, 0x01, 0xff, 0x0a, 0x71, 0x24, 0x08, 0x5d, 0xaf, 0xac, 0x9a, 0xc4, + 0x75, 0xf1, 0x21, 0x09, 0x28, 0xae, 0xf4, 0x52, 0x68, 0x09, 0x92, 0xd5, 0x24, 0x1a, 0x66, 0x98, + 0xc4,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0x52, 0xaf, 0xdc, 0x20, 0x81, 0xb0, 0x51, 0x24, + 0x29, 0x92, 0x3e, 0xe5, 0xcf, 0xf9, 0x24, 0xab, 0x60, 0xca, 0xb0, 0xd8, 0xbb, 0x9b, 0x01, 0xc5, + 0x18, 0x92, 0x14, 0x59, 0x07, 0x62, 0xaa, 0x23, 0xc3, 0x8b, 0x52, 0x8c, 0x23, 0x49, 0x19, 0xd5, + 0xa7, 0xbc, 0x08, 0x89, 0x2f, 0x63, 0x43, 0x0b, 0x28, 0xce, 0x21, 0x49, 0x19, 0x13, 0x32, 0x36, + 0x34, 0x9f, 0xe0, 0x2a, 0x98, 0xa9, 0x19, 0x27, 0xa4, 0xda, 0x11, 0x32, 0x81, 0x24, 0x65, 0x5c, + 0x9f, 0x0e, 0x26, 0xe3, 0x44, 0x1d, 0x39, 0x93, 0x48, 0x52, 0xce, 0x05, 0x44, 0xa1, 0xa4, 0x37, + 0x00, 0x28, 0x53, 0xda, 0x08, 0x28, 0x00, 0x92, 0x94, 0x09, 0x7d, 0x92, 0xcf, 0x74, 0xc0, 0xba, + 0xcc, 0x31, 0xac, 0xc3, 0x80, 0x60, 0x8a, 0x3b, 0x80, 0x3e, 0xe5, 0xcf, 0x75, 0xc0, 0x96, 0x9b, + 0x8c, 0xb8, 0x01, 0xc5, 0x1b, 0x48, 0x52, 0xa6, 0x75, 0x20, 0xa6, 0x62, 0x06, 0x77, 0x60, 0xcc, + 0x20, 0x49, 0x99, 0xf1, 0x0d, 0x0e, 0x51, 0xdc, 0x03, 0x80, 0xdf, 0xba, 0x80, 0x60, 0x16, 0x49, + 0xca, 0xac, 0x76, 0xe3, 0xcc, 0x93, 0xdf, 0xf3, 0x4c, 0xe2, 0x18, 0x95, 0x1d, 0xcb, 0x33, 0xf5, + 0x49, 0xce, 0xef, 0x0b, 0xdb, 0x07, 0x73, 0x9d, 0x7b, 0x1c, 0x48, 0x7c, 0x53, 0x48, 0x54, 0x06, + 0x48, 0x0c, 0xaf, 0x7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1, 0xd5, 0x44, 0x35, 0x82, + 0x99, 0xe7, 0x10, 0x97, 0xcb, 0xda, 0x0f, 0xf3, 0xc8, 0x57, 0x92, 0x68, 0x1d, 0xbe, 0x92, 0xa2, + 0x85, 0xf7, 0x57, 0x52, 0xac, 0x52, 0xcf, 0x3e, 0x02, 0xd7, 0x6e, 0x1b, 0x56, 0x15, 0x51, 0x8f, + 0x21, 0x93, 0x3a, 0x04, 0xe1, 0x32, 0xff, 0xec, 0x69, 0xa4, 0xf2, 0x75, 0xc6, 0x6c, 0xb7, 0xa0, + 0xaa, 0x87, 0x06, 0xab, 0x7b, 0xe5, 0x7c, 0x85, 0x9a, 0x2a, 0xdf, 0x8c, 0x1c, 0xa9, 0x50, 0xb7, + 0xe9, 0x32, 0x12, 0x0c, 0x83, 0xbd, 0xd1, 0x36, 0xa1, 0x76, 0x8a, 0x32, 0x5c, 0x3f, 0x77, 0x96, + 0xb5, 0x4a, 0x6d, 0xe3, 0xdd, 0x75, 0xb2, 0x9e, 0xdb, 0x2c, 0x6f, 0x6e, 0xe6, 0x36, 0x6f, 0x6e, + 0x54, 0x73, 0x78, 0xfd, 0x9d, 0x5b, 0xb9, 0x77, 0x36, 0xab, 0xb8, 0x5c, 0xad, 0xbd, 0x47, 0x6e, + 0xae, 0x6f, 0x66, 0x50, 0xab, 0x34, 0x13, 0xd6, 0x44, 0x02, 0x5c, 0xe6, 0x7f, 0x26, 0xc0, 0x72, + 0x12, 0x49, 0x18, 0x64, 0xe0, 0x2d, 0x70, 0x49, 0x54, 0x9d, 0x9d, 0xa0, 0x17, 0xed, 0x66, 0x24, + 0x24, 0x2b, 0x29, 0xfd, 0x02, 0x27, 0x08, 0x19, 0x6e, 0x77, 0xdb, 0x95, 0xf7, 0x41, 0x3a, 0xce, + 0x1a, 0x6b, 0x5e, 0x78, 0x83, 0x25, 0xe9, 0x17, 0xa3, 0xbc, 0xdb, 0x91, 0x46, 0xa6, 0x47, 0x6f, + 0xb4, 0x36, 0x94, 0x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, 0xba, 0xf0, 0x52, 0x4f, 0x60, 0xdf, 0x0e, + 0x7e, 0xd0, 0x1f, 0x18, 0xf3, 0x47, 0xe0, 0x23, 0x70, 0xee, 0xa1, 0x61, 0x12, 0xea, 0x31, 0x38, + 0x80, 0x68, 0x20, 0xf3, 0x65, 0x01, 0x7f, 0x09, 0x2e, 0x46, 0xf7, 0x93, 0x05, 0xc2, 0xea, 0x60, + 0x7e, 0xc7, 0x71, 0xa8, 0xc3, 0xbb, 0xa1, 0x6d, 0xc2, 0xb0, 0xd1, 0x70, 0x87, 0x56, 0x70, 0x4d, + 0x28, 0x78, 0x13, 0xae, 0xc4, 0x0e, 0x8c, 0x4b, 0x7d, 0x66, 0xb0, 0x7a, 0x35, 0x90, 0xfa, 0xeb, + 0x12, 0x80, 0x77, 0x08, 0x4b, 0x76, 0x5f, 0x67, 0x17, 0x2e, 0x09, 0x8e, 0x81, 0x30, 0xde, 0x16, + 0x30, 0xae, 0x64, 0x2e, 0x45, 0x61, 0x70, 0x04, 0x65, 0x5a, 0x6d, 0xaa, 0xa7, 0xbc, 0x7c, 0x10, + 0x5d, 0x1a, 0xfc, 0x15, 0x09, 0x2c, 0xec, 0x53, 0x97, 0x71, 0x89, 0x82, 0x55, 0x00, 0x79, 0xb9, + 0x46, 0x6f, 0xa0, 0x76, 0x55, 0x68, 0xbf, 0x9e, 0xb9, 0x16, 0xd5, 0x6e, 0x53, 0x97, 0x71, 0x04, + 0xe2, 0xc7, 0x42, 0x1f, 0x46, 0xc7, 0x29, 0xfe, 0x46, 0x02, 0x8b, 0x5b, 0x75, 0x52, 0x39, 0x0a, + 0x73, 0xf6, 0x3e, 0x76, 0xb0, 0xe9, 0x7e, 0x43, 0x3e, 0x7d, 0x47, 0xc0, 0x2d, 0xc2, 0x0f, 0xcf, + 0xf2, 0x69, 0x5b, 0xa0, 0x52, 0x0f, 0x09, 0xeb, 0xeb, 0xde, 0xf0, 0x9f, 0x24, 0xf0, 0x86, 0x30, + 0xc3, 0x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x7e, 0x09, 0xa4, 0xfd, 0x0e, 0x1e, 0xc2, 0x3b, 0x0e, 0xb6, 0x98, 0x8b, + 0xf8, 0x20, 0x38, 0x4b, 0xb0, 0x12, 0xf4, 0xf5, 0x70, 0x31, 0x58, 0x14, 0xa3, 0x70, 0x75, 0x0b, + 0x8c, 0xe1, 0xaa, 0x69, 0x58, 0xb0, 0x10, 0x63, 0xb5, 0xaa, 0x31, 0x32, 0xe1, 0x1a, 0x9c, 0xcc, + 0x70, 0x19, 0xaf, 0xd6, 0x8e, 0x09, 0x32, 0xac, 0x1a, 0x75, 0x4c, 0xe1, 0x7d, 0xe5, 0x55, 0x30, + 0x13, 0x3d, 0x98, 0x91, 0xe4, 0x5b, 0x43, 0xf9, 0xfa, 0xc0, 0xd7, 0x86, 0x24, 0xa9, 0xb3, 0x0b, + 0x2e, 0x7e, 0xda, 0x8d, 0x96, 0xd1, 0x18, 0x30, 0xec, 0xdd, 0x7f, 0x7e, 0x19, 0xc0, 0x93, 0x5c, + 0x74, 0x86, 0x5f, 0x12, 0x38, 0x96, 0x96, 0xcb, 0xd8, 0x79, 0xae, 0x80, 0x8b, 0x89, 0xc5, 0x32, + 0x7e, 0x9e, 0x6b, 0x18, 0x2e, 0x83, 0x33, 0xda, 0x14, 0x18, 0x4b, 0xcb, 0xd4, 0x22, 0x20, 0x85, + 0xa4, 0xc7, 0x93, 0x1d, 0x77, 0x2c, 0x8f, 0x8b, 0x30, 0xb6, 0xf1, 0x7f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0xe2, 0x53, 0xfe, 0x7f, 0x48, 0x2b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1110,6 +1288,65 @@ type ABitOfEverythingServiceServer interface { CheckPostQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) } +// UnimplementedABitOfEverythingServiceServer can be embedded to have forward compatible implementations. +type UnimplementedABitOfEverythingServiceServer struct { +} + +func (*UnimplementedABitOfEverythingServiceServer) Create(ctx context.Context, req *ABitOfEverything) (*ABitOfEverything, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) CreateBody(ctx context.Context, req *ABitOfEverything) (*ABitOfEverything, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBody not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) Lookup(ctx context.Context, req *sub2.IdMessage) (*ABitOfEverything, error) { + return nil, status.Errorf(codes.Unimplemented, "method Lookup not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) Update(ctx context.Context, req *ABitOfEverything) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) UpdateV2(ctx context.Context, req *UpdateV2Request) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateV2 not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) Delete(ctx context.Context, req *sub2.IdMessage) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) GetQuery(ctx context.Context, req *ABitOfEverything) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetQuery not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) GetRepeatedQuery(ctx context.Context, req *ABitOfEverythingRepeated) (*ABitOfEverythingRepeated, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRepeatedQuery not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) Echo(ctx context.Context, req *sub.StringMessage) (*sub.StringMessage, error) { + return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) DeepPathEcho(ctx context.Context, req *ABitOfEverything) (*ABitOfEverything, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeepPathEcho not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) NoBindings(ctx context.Context, req *duration.Duration) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method NoBindings not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) Timeout(ctx context.Context, req *empty.Empty) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Timeout not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) ErrorWithDetails(ctx context.Context, req *empty.Empty) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ErrorWithDetails not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) GetMessageWithBody(ctx context.Context, req *MessageWithBody) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMessageWithBody not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) PostWithEmptyBody(ctx context.Context, req *Body) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method PostWithEmptyBody not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) CheckGetQueryParams(ctx context.Context, req *ABitOfEverything) (*ABitOfEverything, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckGetQueryParams not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) CheckNestedEnumGetQueryParams(ctx context.Context, req *ABitOfEverything) (*ABitOfEverything, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckNestedEnumGetQueryParams not implemented") +} +func (*UnimplementedABitOfEverythingServiceServer) CheckPostQueryParams(ctx context.Context, req *ABitOfEverything) (*ABitOfEverything, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckPostQueryParams not implemented") +} + func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingServiceServer) { s.RegisterService(&_ABitOfEverythingService_serviceDesc, srv) } @@ -1548,6 +1785,14 @@ type CamelCaseServiceNameServer interface { Empty(context.Context, *empty.Empty) (*empty.Empty, error) } +// UnimplementedCamelCaseServiceNameServer can be embedded to have forward compatible implementations. +type UnimplementedCamelCaseServiceNameServer struct { +} + +func (*UnimplementedCamelCaseServiceNameServer) Empty(ctx context.Context, req *empty.Empty) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Empty not implemented") +} + func RegisterCamelCaseServiceNameServer(s *grpc.Server, srv CamelCaseServiceNameServer) { s.RegisterService(&_CamelCaseServiceName_serviceDesc, srv) } @@ -1612,6 +1857,14 @@ type AnotherServiceWithNoBindingsServer interface { NoBindings(context.Context, *empty.Empty) (*empty.Empty, error) } +// UnimplementedAnotherServiceWithNoBindingsServer can be embedded to have forward compatible implementations. +type UnimplementedAnotherServiceWithNoBindingsServer struct { +} + +func (*UnimplementedAnotherServiceWithNoBindingsServer) NoBindings(ctx context.Context, req *empty.Empty) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method NoBindings not implemented") +} + func RegisterAnotherServiceWithNoBindingsServer(s *grpc.Server, srv AnotherServiceWithNoBindingsServer) { s.RegisterService(&_AnotherServiceWithNoBindings_serviceDesc, srv) } @@ -1646,232 +1899,3 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "examples/proto/examplepb/a_bit_of_everything.proto", } - -func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_e0089283b92675c0) -} - -var fileDescriptor_a_bit_of_everything_e0089283b92675c0 = []byte{ - // 3529 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4d, 0x6c, 0x1b, 0xc7, - 0x7e, 0xd7, 0x72, 0x25, 0x59, 0x1a, 0x7d, 0x8f, 0x2c, 0x5b, 0xa6, 0x95, 0x68, 0x4c, 0x3b, 0x2f, - 0x6b, 0x3e, 0x93, 0x2b, 0xad, 0x94, 0xc4, 0x66, 0xfa, 0x92, 0x90, 0x92, 0xec, 0xc8, 0x4e, 0x64, - 0x65, 0xed, 0xb8, 0xa9, 0x5f, 0xfc, 0xd4, 0x21, 0x39, 0x14, 0xd7, 0xe2, 0xee, 0xec, 0xdb, 0x9d, - 0x95, 0x45, 0xab, 0x6c, 0x1f, 0xda, 0xa2, 0x05, 0xfa, 0x6e, 0x7c, 0xfd, 0x7e, 0x68, 0x2f, 0x45, - 0x51, 0xa0, 0xe8, 0xa9, 0x40, 0x4f, 0x05, 0xda, 0x4b, 0x6f, 0x3d, 0xb4, 0x48, 0x81, 0xa2, 0x87, - 0xf6, 0xd4, 0x9e, 0x7b, 0x69, 0x11, 0xa0, 0x87, 0x7e, 0x60, 0x66, 0x77, 0xc9, 0xdd, 0x25, 0x69, - 0x99, 0x76, 0x91, 0xe4, 0x10, 0xef, 0xcc, 0xfc, 0x3f, 0x7e, 0xff, 0x99, 0xff, 0xfc, 0x3f, 0x86, - 0x02, 0x1a, 0x39, 0xc1, 0xa6, 0xdd, 0x20, 0xae, 0x6a, 0x3b, 0x94, 0x51, 0x35, 0x18, 0xda, 0x65, - 0x15, 0x1f, 0x94, 0x0d, 0x76, 0x40, 0x6b, 0x07, 0xe4, 0x98, 0x38, 0x4d, 0x56, 0x37, 0xac, 0xc3, - 0xbc, 0xa0, 0x81, 0xab, 0x87, 0x8e, 0x5d, 0xc9, 0x1f, 0x62, 0x46, 0x9e, 0xe1, 0x66, 0x3e, 0x14, - 0x90, 0xef, 0xb0, 0xa6, 0x57, 0x0e, 0x29, 0x3d, 0x6c, 0x10, 0x15, 0xdb, 0x86, 0x8a, 0x2d, 0x8b, - 0x32, 0xcc, 0x0c, 0x6a, 0xb9, 0x3e, 0x7b, 0x1a, 0x05, 0xab, 0x62, 0x54, 0xf6, 0x6a, 0x6a, 0xcd, - 0x20, 0x8d, 0xea, 0x81, 0x89, 0xdd, 0xa3, 0x80, 0xe2, 0x72, 0x92, 0x82, 0x98, 0x36, 0x6b, 0x06, - 0x8b, 0x6f, 0x26, 0x17, 0xab, 0x9e, 0x23, 0xe4, 0x07, 0xeb, 0x6f, 0x27, 0x2c, 0xb2, 0x31, 0xab, - 0x13, 0xcb, 0x33, 0x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fc, 0x8e, 0xb6, 0x70, 0x9b, - 0xcf, 0x23, 0x31, 0x8f, 0x84, 0x87, 0x15, 0xe4, 0xb5, 0xbc, 0xf6, 0x95, 0x14, 0x65, 0xd0, 0x81, - 0x18, 0x3c, 0xe2, 0xdf, 0xf0, 0x0a, 0x98, 0xae, 0x52, 0xaf, 0xdc, 0x20, 0x81, 0xb0, 0x51, 0x24, - 0x29, 0x92, 0x3e, 0xe5, 0xcf, 0xf9, 0x24, 0xab, 0x60, 0xca, 0xb0, 0xd8, 0xbb, 0x9b, 0x01, 0xc5, - 0x18, 0x92, 0x14, 0x59, 0x07, 0x62, 0xaa, 0x23, 0xc3, 0x8b, 0x52, 0x8c, 0x23, 0x49, 0x19, 0xd5, - 0xa7, 0xbc, 0x08, 0x89, 0x2f, 0x63, 0x43, 0x0b, 0x28, 0xce, 0x21, 0x49, 0x19, 0x13, 0x32, 0x36, - 0x34, 0x9f, 0xe0, 0x2a, 0x98, 0xa9, 0x19, 0x27, 0xa4, 0xda, 0x11, 0x32, 0x81, 0x24, 0x65, 0x5c, - 0x9f, 0x0e, 0x26, 0xe3, 0x44, 0x1d, 0x39, 0x93, 0x48, 0x52, 0xce, 0x05, 0x44, 0xa1, 0xa4, 0x37, - 0x00, 0x28, 0x53, 0xda, 0x08, 0x28, 0x00, 0x92, 0x94, 0x09, 0x7d, 0x92, 0xcf, 0x74, 0xc0, 0xba, - 0xcc, 0x31, 0xac, 0xc3, 0x80, 0x60, 0x8a, 0x3b, 0x80, 0x3e, 0xe5, 0xcf, 0x75, 0xc0, 0x96, 0x9b, - 0x8c, 0xb8, 0x01, 0xc5, 0x1b, 0x48, 0x52, 0xa6, 0x75, 0x20, 0xa6, 0x62, 0x06, 0x77, 0x60, 0xcc, - 0x20, 0x49, 0x99, 0xf1, 0x0d, 0x0e, 0x51, 0xdc, 0x03, 0x80, 0xdf, 0xba, 0x80, 0x60, 0x16, 0x49, - 0xca, 0xac, 0x76, 0xe3, 0xcc, 0x93, 0xdf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27, 0x6a, - 0xbb, 0xbb, 0x16, 0x0b, 0xd3, 0x47, 0x13, 0x55, 0xa8, 0x69, 0x37, 0x8c, 0x8a, 0xb8, 0x55, 0x41, - 0xf7, 0x84, 0xb8, 0xe3, 0x21, 0x46, 0x51, 0x85, 0xbb, 0x22, 0x32, 0xb1, 0xd5, 0x44, 0x35, 0x82, - 0x99, 0xe7, 0x10, 0x97, 0xcb, 0xda, 0x0f, 0xf3, 0xc8, 0x57, 0x92, 0x68, 0x1d, 0xbe, 0x92, 0xa2, - 0x85, 0xf7, 0x57, 0x52, 0xac, 0x52, 0xcf, 0x3e, 0x02, 0xd7, 0x6e, 0x1b, 0x56, 0x15, 0x51, 0x8f, - 0x21, 0x93, 0x3a, 0x04, 0xe1, 0x32, 0xff, 0xec, 0x69, 0xa4, 0xf2, 0x75, 0xc6, 0x6c, 0xb7, 0xa0, - 0xaa, 0x87, 0x06, 0xab, 0x7b, 0xe5, 0x7c, 0x85, 0x9a, 0x2a, 0xdf, 0x8c, 0x1c, 0xa9, 0x50, 0xb7, - 0xe9, 0x32, 0x12, 0x0c, 0x83, 0xbd, 0xd1, 0x36, 0xa1, 0x76, 0x8a, 0x32, 0x5c, 0x3f, 0x77, 0x96, - 0xb5, 0x4a, 0x6d, 0xe3, 0xdd, 0x75, 0xb2, 0x9e, 0xdb, 0x2c, 0x6f, 0x6e, 0xe6, 0x36, 0x6f, 0x6e, - 0x54, 0x73, 0x78, 0xfd, 0x9d, 0x5b, 0xb9, 0x77, 0x36, 0xab, 0xb8, 0x5c, 0xad, 0xbd, 0x47, 0x6e, - 0xae, 0x6f, 0x66, 0x50, 0xab, 0x34, 0x13, 0xd6, 0x44, 0x02, 0x5c, 0xe6, 0x7f, 0x26, 0xc0, 0x72, - 0x12, 0x49, 0x18, 0x64, 0xe0, 0x2d, 0x70, 0x49, 0x54, 0x9d, 0x9d, 0xa0, 0x17, 0xed, 0x66, 0x24, - 0x24, 0x2b, 0x29, 0xfd, 0x02, 0x27, 0x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 0xfd, 0x52, 0x6c, - 0x77, 0x62, 0xfd, 0xd1, 0x00, 0x01, 0x1d, 0xa7, 0x98, 0x45, 0xb2, 0x32, 0xdf, 0x4f, 0xc0, 0x40, - 0x67, 0x8e, 0xf5, 0x51, 0x73, 0x48, 0x56, 0x16, 0x12, 0xa7, 0x13, 0xd9, 0xa5, 0xbe, 0xcc, 0x91, - 0x4e, 0x4d, 0x56, 0x60, 0x2f, 0x73, 0xa0, 0xb9, 0x50, 0x6f, 0x17, 0x89, 0x56, 0x81, 0xf8, 0x14, - 0x65, 0x06, 0x39, 0x56, 0xa6, 0x80, 0xbe, 0xcf, 0x1c, 0x8f, 0xdc, 0x40, 0xfe, 0xff, 0x6b, 0xb8, - 0xe1, 0x06, 0x83, 0x27, 0x37, 0x92, 0x6c, 0x11, 0xdc, 0x9c, 0x6f, 0xfd, 0x06, 0xd2, 0x6e, 0xa0, - 0x8d, 0x27, 0xa8, 0x95, 0x49, 0x83, 0xd1, 0x12, 0xad, 0x36, 0xfb, 0x65, 0xee, 0xcc, 0x97, 0x60, - 0x2e, 0x68, 0x5f, 0x7f, 0xd6, 0x60, 0x75, 0x41, 0x36, 0x0b, 0x52, 0xe1, 0x63, 0x90, 0x9e, 0x32, - 0x78, 0x88, 0x1a, 0xad, 0x62, 0x86, 0x83, 0xec, 0xf1, 0xd6, 0x99, 0xe7, 0xce, 0x85, 0xe8, 0x82, - 0x25, 0xf3, 0x13, 0x09, 0xcc, 0x7d, 0x6e, 0x57, 0x31, 0x23, 0x8f, 0x34, 0x9d, 0xfc, 0xd0, 0x23, - 0x2e, 0x83, 0x5b, 0x40, 0xc6, 0x65, 0x1f, 0xc4, 0x94, 0xb6, 0x3e, 0x74, 0x2e, 0xd2, 0x39, 0x37, - 0x7c, 0x1f, 0x4c, 0x79, 0x42, 0xae, 0x78, 0x35, 0x0c, 0xa0, 0xf5, 0x36, 0x21, 0xb7, 0x0d, 0xd2, - 0xa8, 0x7e, 0x8a, 0xdd, 0x23, 0x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0xa9, 0x4d, 0x3e, 0x14, - 0xb6, 0xdd, 0xca, 0x6c, 0x9e, 0x19, 0xf9, 0x63, 0xbf, 0x5a, 0xe7, 0x79, 0xc3, 0x21, 0x52, 0x56, - 0x11, 0x80, 0x3d, 0x5a, 0x32, 0xac, 0xaa, 0x61, 0x1d, 0xba, 0xf0, 0x52, 0x4f, 0x60, 0xdf, 0x0e, - 0x7e, 0xd0, 0x1f, 0x18, 0xf3, 0x47, 0xe0, 0x23, 0x70, 0xee, 0xa1, 0x61, 0x12, 0xea, 0x31, 0x38, - 0x80, 0x68, 0x20, 0xf3, 0x65, 0x01, 0x7f, 0x09, 0x2e, 0x46, 0xf7, 0x93, 0x05, 0xc2, 0xea, 0x60, - 0x7e, 0xc7, 0x71, 0xa8, 0xc3, 0xbb, 0xa1, 0x6d, 0xc2, 0xb0, 0xd1, 0x70, 0x87, 0x56, 0x70, 0x4d, - 0x28, 0x78, 0x13, 0xae, 0xc4, 0x0e, 0x8c, 0x4b, 0x7d, 0x66, 0xb0, 0x7a, 0x35, 0x90, 0xfa, 0xeb, - 0x12, 0x80, 0x77, 0x08, 0x4b, 0x76, 0x5f, 0x67, 0x17, 0x2e, 0x09, 0x8e, 0x81, 0x30, 0xde, 0x16, - 0x30, 0xae, 0x64, 0x2e, 0x45, 0x61, 0x70, 0x04, 0x65, 0x5a, 0x6d, 0xaa, 0xa7, 0xbc, 0x7c, 0x10, - 0x5d, 0x1a, 0xfc, 0x15, 0x09, 0x2c, 0xec, 0x53, 0x97, 0x71, 0x89, 0x82, 0x55, 0x00, 0x79, 0xb9, - 0x46, 0x6f, 0xa0, 0x76, 0x55, 0x68, 0xbf, 0x9e, 0xb9, 0x16, 0xd5, 0x6e, 0x53, 0x97, 0x71, 0x04, - 0xe2, 0xc7, 0x42, 0x1f, 0x46, 0xc7, 0x29, 0xfe, 0x46, 0x02, 0x8b, 0x5b, 0x75, 0x52, 0x39, 0x0a, - 0x73, 0xf6, 0x3e, 0x76, 0xb0, 0x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fe, 0x51, 0xea, 0xb4, 0xdc, 0x7f, 0x2b, 0x4d, 0xc8, - 0xca, 0xa8, 0x76, 0x35, 0xf4, 0xb9, 0x88, 0x83, 0xaa, 0x02, 0x8f, 0xda, 0x11, 0x5a, 0x58, 0x1d, - 0x4c, 0x24, 0x20, 0x94, 0x7e, 0x09, 0xa4, 0xfd, 0x0e, 0x1e, 0xc2, 0x3b, 0x0e, 0xb6, 0x98, 0x8b, - 0xf8, 0x20, 0x38, 0x4b, 0xb0, 0x12, 0xf4, 0xf5, 0x70, 0x31, 0x58, 0x14, 0xa3, 0x70, 0x75, 0x0b, - 0x8c, 0xe1, 0xaa, 0x69, 0x58, 0xb0, 0x10, 0x63, 0xb5, 0xaa, 0x31, 0x32, 0xe1, 0x1a, 0x9c, 0xcc, - 0x70, 0x19, 0xaf, 0xd6, 0x8e, 0x09, 0x32, 0xac, 0x1a, 0x75, 0x4c, 0xe1, 0x7d, 0xe5, 0x55, 0x30, - 0x13, 0x3d, 0x98, 0x91, 0xe4, 0x5b, 0x43, 0xf9, 0xfa, 0xc0, 0xd7, 0x86, 0x24, 0xa9, 0xb3, 0x0b, - 0x2e, 0x7e, 0xda, 0x8d, 0x96, 0xd1, 0x18, 0x30, 0xec, 0xdd, 0x7f, 0x7e, 0x19, 0xc0, 0x93, 0x5c, - 0x74, 0x86, 0x5f, 0x12, 0x38, 0x96, 0x96, 0xcb, 0xd8, 0x79, 0xae, 0x80, 0x8b, 0x89, 0xc5, 0x32, - 0x7e, 0x9e, 0x6b, 0x18, 0x2e, 0x83, 0x33, 0xda, 0x14, 0x18, 0x4b, 0xcb, 0xd4, 0x22, 0x20, 0x85, - 0xa4, 0xc7, 0x93, 0x1d, 0x77, 0x2c, 0x8f, 0x8b, 0x30, 0xb6, 0xf1, 0x7f, 0x01, 0x00, 0x00, 0xff, - 0xff, 0xe2, 0x53, 0xfe, 0x7f, 0x48, 0x2b, 0x00, 0x00, -} diff --git a/examples/proto/examplepb/echo_service.pb.go b/examples/proto/examplepb/echo_service.pb.go index 5c1500fb2e5..b9f5743303b 100644 --- a/examples/proto/examplepb/echo_service.pb.go +++ b/examples/proto/examplepb/echo_service.pb.go @@ -1,23 +1,22 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: examples/proto/examplepb/echo_service.proto -package examplepb - -/* -Echo Service - -Echo Service API consists of a single service which returns -a message. -*/ +// Echo Service +// +// Echo Service API consists of a single service which returns +// a message. -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" +package examplepb import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -29,7 +28,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Embedded represents a message embedded in SimpleMessage. type Embedded struct { @@ -46,16 +45,17 @@ func (m *Embedded) Reset() { *m = Embedded{} } func (m *Embedded) String() string { return proto.CompactTextString(m) } func (*Embedded) ProtoMessage() {} func (*Embedded) Descriptor() ([]byte, []int) { - return fileDescriptor_echo_service_8fe0ac1ad649faf8, []int{0} + return fileDescriptor_01041da8d77029c8, []int{0} } + func (m *Embedded) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Embedded.Unmarshal(m, b) } func (m *Embedded) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Embedded.Marshal(b, m, deterministic) } -func (dst *Embedded) XXX_Merge(src proto.Message) { - xxx_messageInfo_Embedded.Merge(dst, src) +func (m *Embedded) XXX_Merge(src proto.Message) { + xxx_messageInfo_Embedded.Merge(m, src) } func (m *Embedded) XXX_Size() int { return xxx_messageInfo_Embedded.Size(m) @@ -103,71 +103,14 @@ func (m *Embedded) GetNote() string { return "" } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Embedded) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Embedded_OneofMarshaler, _Embedded_OneofUnmarshaler, _Embedded_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Embedded) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Embedded_Progress)(nil), (*Embedded_Note)(nil), } } -func _Embedded_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Embedded) - // mark - switch x := m.Mark.(type) { - case *Embedded_Progress: - b.EncodeVarint(1<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Progress)) - case *Embedded_Note: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Note) - case nil: - default: - return fmt.Errorf("Embedded.Mark has unexpected type %T", x) - } - return nil -} - -func _Embedded_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Embedded) - switch tag { - case 1: // mark.progress - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Mark = &Embedded_Progress{int64(x)} - return true, err - case 2: // mark.note - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Mark = &Embedded_Note{x} - return true, err - default: - return false, nil - } -} - -func _Embedded_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Embedded) - // mark - switch x := m.Mark.(type) { - case *Embedded_Progress: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Progress)) - case *Embedded_Note: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Note))) - n += len(x.Note) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // SimpleMessage represents a simple message sent to the Echo service. type SimpleMessage struct { // Id represents the message identifier. @@ -191,16 +134,17 @@ func (m *SimpleMessage) Reset() { *m = SimpleMessage{} } func (m *SimpleMessage) String() string { return proto.CompactTextString(m) } func (*SimpleMessage) ProtoMessage() {} func (*SimpleMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_echo_service_8fe0ac1ad649faf8, []int{1} + return fileDescriptor_01041da8d77029c8, []int{1} } + func (m *SimpleMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleMessage.Unmarshal(m, b) } func (m *SimpleMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SimpleMessage.Marshal(b, m, deterministic) } -func (dst *SimpleMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleMessage.Merge(dst, src) +func (m *SimpleMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleMessage.Merge(m, src) } func (m *SimpleMessage) XXX_Size() int { return xxx_messageInfo_SimpleMessage.Size(m) @@ -306,9 +250,9 @@ func (m *SimpleMessage) GetNo() *Embedded { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*SimpleMessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _SimpleMessage_OneofMarshaler, _SimpleMessage_OneofUnmarshaler, _SimpleMessage_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*SimpleMessage) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*SimpleMessage_LineNum)(nil), (*SimpleMessage_Lang)(nil), (*SimpleMessage_En)(nil), @@ -316,109 +260,47 @@ func (*SimpleMessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) } } -func _SimpleMessage_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*SimpleMessage) - // code - switch x := m.Code.(type) { - case *SimpleMessage_LineNum: - b.EncodeVarint(3<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.LineNum)) - case *SimpleMessage_Lang: - b.EncodeVarint(4<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Lang) - case nil: - default: - return fmt.Errorf("SimpleMessage.Code has unexpected type %T", x) - } - // ext - switch x := m.Ext.(type) { - case *SimpleMessage_En: - b.EncodeVarint(6<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.En)) - case *SimpleMessage_No: - b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.No); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("SimpleMessage.Ext has unexpected type %T", x) - } - return nil -} - -func _SimpleMessage_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*SimpleMessage) - switch tag { - case 3: // code.line_num - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Code = &SimpleMessage_LineNum{int64(x)} - return true, err - case 4: // code.lang - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Code = &SimpleMessage_Lang{x} - return true, err - case 6: // ext.en - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Ext = &SimpleMessage_En{int64(x)} - return true, err - case 7: // ext.no - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Embedded) - err := b.DecodeMessage(msg) - m.Ext = &SimpleMessage_No{msg} - return true, err - default: - return false, nil - } +func init() { + proto.RegisterType((*Embedded)(nil), "grpc.gateway.examples.examplepb.Embedded") + proto.RegisterType((*SimpleMessage)(nil), "grpc.gateway.examples.examplepb.SimpleMessage") } -func _SimpleMessage_OneofSizer(msg proto.Message) (n int) { - m := msg.(*SimpleMessage) - // code - switch x := m.Code.(type) { - case *SimpleMessage_LineNum: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.LineNum)) - case *SimpleMessage_Lang: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Lang))) - n += len(x.Lang) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // ext - switch x := m.Ext.(type) { - case *SimpleMessage_En: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.En)) - case *SimpleMessage_No: - s := proto.Size(x.No) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n +func init() { + proto.RegisterFile("examples/proto/examplepb/echo_service.proto", fileDescriptor_01041da8d77029c8) } -func init() { - proto.RegisterType((*Embedded)(nil), "grpc.gateway.examples.examplepb.Embedded") - proto.RegisterType((*SimpleMessage)(nil), "grpc.gateway.examples.examplepb.SimpleMessage") +var fileDescriptor_01041da8d77029c8 = []byte{ + // 470 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x3f, 0x6f, 0xd3, 0x40, + 0x14, 0xef, 0xd9, 0x6e, 0x9a, 0xbc, 0x08, 0x54, 0x9d, 0x40, 0x98, 0xb4, 0xa8, 0x91, 0xc5, 0x10, + 0x8a, 0xe4, 0x53, 0xc2, 0x06, 0x13, 0x11, 0x45, 0x5d, 0x60, 0x70, 0xb7, 0x2c, 0xd1, 0xc5, 0xf7, + 0xe4, 0x5a, 0xd8, 0x77, 0x96, 0x7d, 0x29, 0x8d, 0xac, 0x2c, 0x48, 0x6c, 0x30, 0xb1, 0xf3, 0x11, + 0xd8, 0xf8, 0x18, 0x4c, 0x7c, 0x05, 0x3e, 0x08, 0xba, 0x4b, 0x1c, 0x09, 0x5a, 0xb5, 0xea, 0x90, + 0xcd, 0xef, 0xcf, 0xef, 0xfd, 0x7e, 0xf7, 0x7b, 0xcf, 0xf0, 0x1c, 0x2f, 0x79, 0x5e, 0x64, 0x58, + 0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 0xff, 0xff, 0xe9, 0xdb, + 0x6f, 0x39, 0x21, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -492,6 +374,20 @@ type EchoServiceServer interface { EchoDelete(context.Context, *SimpleMessage) (*SimpleMessage, error) } +// UnimplementedEchoServiceServer can be embedded to have forward compatible implementations. +type UnimplementedEchoServiceServer struct { +} + +func (*UnimplementedEchoServiceServer) Echo(ctx context.Context, req *SimpleMessage) (*SimpleMessage, error) { + return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") +} +func (*UnimplementedEchoServiceServer) EchoBody(ctx context.Context, req *SimpleMessage) (*SimpleMessage, error) { + return nil, status.Errorf(codes.Unimplemented, "method EchoBody not implemented") +} +func (*UnimplementedEchoServiceServer) EchoDelete(ctx context.Context, req *SimpleMessage) (*SimpleMessage, error) { + return nil, status.Errorf(codes.Unimplemented, "method EchoDelete not implemented") +} + func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer) { s.RegisterService(&_EchoService_serviceDesc, srv) } @@ -570,41 +466,3 @@ var _EchoService_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "examples/proto/examplepb/echo_service.proto", } - -func init() { - proto.RegisterFile("examples/proto/examplepb/echo_service.proto", fileDescriptor_echo_service_8fe0ac1ad649faf8) -} - -var fileDescriptor_echo_service_8fe0ac1ad649faf8 = []byte{ - // 470 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x3f, 0x6f, 0xd3, 0x40, - 0x14, 0xef, 0xd9, 0x6e, 0x9a, 0xbc, 0x08, 0x54, 0x9d, 0x40, 0x98, 0xb4, 0xa8, 0x91, 0xc5, 0x10, - 0x8a, 0xe4, 0x53, 0xc2, 0x06, 0x13, 0x11, 0x45, 0x5d, 0x60, 0x70, 0xb7, 0x2c, 0xd1, 0xc5, 0xf7, - 0xe4, 0x5a, 0xd8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51, 0xef, 0xaa, - 0x45, 0xd3, 0x99, 0x12, 0x8b, 0x97, 0xe4, 0x98, 0x7e, 0x25, 0x00, 0x46, 0xce, 0x1b, 0xcc, 0x50, - 0xe3, 0xd6, 0x05, 0x1d, 0x59, 0x41, 0x8f, 0x8f, 0x1f, 0x5d, 0x11, 0x24, 0xac, 0x80, 0x71, 0x77, - 0xd2, 0xd9, 0x60, 0x67, 0x2d, 0xfb, 0xcf, 0xbe, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xe9, 0xdb, - 0x6f, 0x39, 0x21, 0x04, 0x00, 0x00, -} diff --git a/examples/proto/examplepb/flow_combination.pb.go b/examples/proto/examplepb/flow_combination.pb.go index f50fe51ba5c..fb214da5738 100644 --- a/examples/proto/examplepb/flow_combination.pb.go +++ b/examples/proto/examplepb/flow_combination.pb.go @@ -3,14 +3,15 @@ package examplepb -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -22,7 +23,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type EmptyProto struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -34,16 +35,17 @@ func (m *EmptyProto) Reset() { *m = EmptyProto{} } func (m *EmptyProto) String() string { return proto.CompactTextString(m) } func (*EmptyProto) ProtoMessage() {} func (*EmptyProto) Descriptor() ([]byte, []int) { - return fileDescriptor_flow_combination_63ace3110e4bd00b, []int{0} + return fileDescriptor_53e866bab3f236bf, []int{0} } + func (m *EmptyProto) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyProto.Unmarshal(m, b) } func (m *EmptyProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_EmptyProto.Marshal(b, m, deterministic) } -func (dst *EmptyProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_EmptyProto.Merge(dst, src) +func (m *EmptyProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EmptyProto.Merge(m, src) } func (m *EmptyProto) XXX_Size() int { return xxx_messageInfo_EmptyProto.Size(m) @@ -67,16 +69,17 @@ func (m *NonEmptyProto) Reset() { *m = NonEmptyProto{} } func (m *NonEmptyProto) String() string { return proto.CompactTextString(m) } func (*NonEmptyProto) ProtoMessage() {} func (*NonEmptyProto) Descriptor() ([]byte, []int) { - return fileDescriptor_flow_combination_63ace3110e4bd00b, []int{1} + return fileDescriptor_53e866bab3f236bf, []int{1} } + func (m *NonEmptyProto) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonEmptyProto.Unmarshal(m, b) } func (m *NonEmptyProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NonEmptyProto.Marshal(b, m, deterministic) } -func (dst *NonEmptyProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonEmptyProto.Merge(dst, src) +func (m *NonEmptyProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonEmptyProto.Merge(m, src) } func (m *NonEmptyProto) XXX_Size() int { return xxx_messageInfo_NonEmptyProto.Size(m) @@ -119,16 +122,17 @@ func (m *UnaryProto) Reset() { *m = UnaryProto{} } func (m *UnaryProto) String() string { return proto.CompactTextString(m) } func (*UnaryProto) ProtoMessage() {} func (*UnaryProto) Descriptor() ([]byte, []int) { - return fileDescriptor_flow_combination_63ace3110e4bd00b, []int{2} + return fileDescriptor_53e866bab3f236bf, []int{2} } + func (m *UnaryProto) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UnaryProto.Unmarshal(m, b) } func (m *UnaryProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_UnaryProto.Marshal(b, m, deterministic) } -func (dst *UnaryProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_UnaryProto.Merge(dst, src) +func (m *UnaryProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnaryProto.Merge(m, src) } func (m *UnaryProto) XXX_Size() int { return xxx_messageInfo_UnaryProto.Size(m) @@ -159,16 +163,17 @@ func (m *NestedProto) Reset() { *m = NestedProto{} } func (m *NestedProto) String() string { return proto.CompactTextString(m) } func (*NestedProto) ProtoMessage() {} func (*NestedProto) Descriptor() ([]byte, []int) { - return fileDescriptor_flow_combination_63ace3110e4bd00b, []int{3} + return fileDescriptor_53e866bab3f236bf, []int{3} } + func (m *NestedProto) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NestedProto.Unmarshal(m, b) } func (m *NestedProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NestedProto.Marshal(b, m, deterministic) } -func (dst *NestedProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_NestedProto.Merge(dst, src) +func (m *NestedProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_NestedProto.Merge(m, src) } func (m *NestedProto) XXX_Size() int { return xxx_messageInfo_NestedProto.Size(m) @@ -211,16 +216,17 @@ func (m *SingleNestedProto) Reset() { *m = SingleNestedProto{} } func (m *SingleNestedProto) String() string { return proto.CompactTextString(m) } func (*SingleNestedProto) ProtoMessage() {} func (*SingleNestedProto) Descriptor() ([]byte, []int) { - return fileDescriptor_flow_combination_63ace3110e4bd00b, []int{4} + return fileDescriptor_53e866bab3f236bf, []int{4} } + func (m *SingleNestedProto) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SingleNestedProto.Unmarshal(m, b) } func (m *SingleNestedProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SingleNestedProto.Marshal(b, m, deterministic) } -func (dst *SingleNestedProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_SingleNestedProto.Merge(dst, src) +func (m *SingleNestedProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_SingleNestedProto.Merge(m, src) } func (m *SingleNestedProto) XXX_Size() int { return xxx_messageInfo_SingleNestedProto.Size(m) @@ -246,6 +252,55 @@ func init() { proto.RegisterType((*SingleNestedProto)(nil), "grpc.gateway.examples.examplepb.SingleNestedProto") } +func init() { + proto.RegisterFile("examples/proto/examplepb/flow_combination.proto", fileDescriptor_53e866bab3f236bf) +} + +var fileDescriptor_53e866bab3f236bf = []byte{ + // 655 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0xbf, 0x8f, 0x12, 0x41, + 0x14, 0xc7, 0xf3, 0xb8, 0xc4, 0xe4, 0x86, 0xfb, 0xc1, 0x2d, 0x06, 0x81, 0xc3, 0xe3, 0x6e, 0xbc, + 0x44, 0xe2, 0x8f, 0x5d, 0x82, 0xd5, 0x51, 0x9e, 0xd1, 0x92, 0x5c, 0xb8, 0xd8, 0x6c, 0x63, 0x66, + 0x87, 0x15, 0x48, 0x60, 0x67, 0x6e, 0x77, 0x0d, 0x5e, 0x08, 0x31, 0xb1, 0xb1, 0xb4, 0xf0, 0x0f, + 0xb0, 0xb4, 0xf2, 0x1f, 0xb0, 0xb3, 0xb2, 0x31, 0xb1, 0x30, 0xb1, 0xb3, 0xb3, 0xf3, 0x9f, 0x30, + 0xfb, 0xf6, 0xc7, 0xb0, 0x0a, 0x6e, 0x30, 0x62, 0xb7, 0x6f, 0xe6, 0xbd, 0x37, 0x9f, 0xf9, 0xce, + 0xf7, 0x11, 0x88, 0x61, 0x3f, 0x63, 0x63, 0x39, 0xb2, 0x3d, 0x43, 0xba, 0xc2, 0x17, 0x71, 0x28, + 0x2d, 0xe3, 0xc9, 0x48, 0x4c, 0x1e, 0x73, 0x31, 0x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x03, 0x52, 0x88, 0x08, 0x15, 0xdb, 0x9d, 0xec, 0x77, 0xfd, 0x5b, 0x2a, 0x07, + 0xa9, 0x06, 0xf4, 0x70, 0x29, 0xd5, 0xdc, 0xb3, 0x64, 0xc0, 0x27, 0x8f, 0xb3, 0x64, 0xbf, 0x0d, + 0x5c, 0xfb, 0x98, 0x23, 0xdb, 0x91, 0x63, 0xa3, 0xf9, 0x59, 0xab, 0x69, 0xbf, 0x86, 0xa6, 0xfd, + 0x0c, 0xb4, 0xa0, 0x6c, 0x13, 0x0e, 0x50, 0xe0, 0xdb, 0xf9, 0x0b, 0xa5, 0x7c, 0x1b, 0xa6, 0x98, + 0xf1, 0x4f, 0x52, 0xe8, 0xa0, 0x68, 0x91, 0xd2, 0xeb, 0x4b, 0xdc, 0x1b, 0x37, 0xe6, 0xe6, 0x3e, + 0x2d, 0xfd, 0x6a, 0x60, 0xb5, 0x79, 0x4c, 0xeb, 0x4b, 0x3d, 0xac, 0xb2, 0x6a, 0xd1, 0x90, 0x2c, + 0x4c, 0x68, 0x82, 0xf6, 0x16, 0x48, 0x65, 0x81, 0x97, 0x23, 0x55, 0xd7, 0x6e, 0xe7, 0x9b, 0x28, + 0xec, 0x51, 0x74, 0x95, 0x45, 0x2f, 0x9e, 0x90, 0xfe, 0x00, 0x52, 0x4c, 0x79, 0x3a, 0x62, 0x5c, + 0xa3, 0xad, 0x27, 0x48, 0x77, 0x41, 0x6f, 0xfc, 0xd1, 0xd6, 0x4a, 0xec, 0xec, 0x7b, 0x24, 0xaf, + 0xb6, 0x3c, 0xa5, 0x0d, 0xbc, 0x09, 0xa7, 0x79, 0x73, 0x33, 0x41, 0xb2, 0xae, 0xe0, 0x3f, 0xa0, + 0x7b, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x36, 0xcd, 0x7d, 0x1f, 0x73, 0x09, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -521,6 +576,41 @@ type FlowCombinationServer interface { RpcPathNestedStream(*NestedProto, FlowCombination_RpcPathNestedStreamServer) error } +// UnimplementedFlowCombinationServer can be embedded to have forward compatible implementations. +type UnimplementedFlowCombinationServer struct { +} + +func (*UnimplementedFlowCombinationServer) RpcEmptyRpc(ctx context.Context, req *EmptyProto) (*EmptyProto, error) { + return nil, status.Errorf(codes.Unimplemented, "method RpcEmptyRpc not implemented") +} +func (*UnimplementedFlowCombinationServer) RpcEmptyStream(req *EmptyProto, srv FlowCombination_RpcEmptyStreamServer) error { + return status.Errorf(codes.Unimplemented, "method RpcEmptyStream not implemented") +} +func (*UnimplementedFlowCombinationServer) StreamEmptyRpc(srv FlowCombination_StreamEmptyRpcServer) error { + return status.Errorf(codes.Unimplemented, "method StreamEmptyRpc not implemented") +} +func (*UnimplementedFlowCombinationServer) StreamEmptyStream(srv FlowCombination_StreamEmptyStreamServer) error { + return status.Errorf(codes.Unimplemented, "method StreamEmptyStream not implemented") +} +func (*UnimplementedFlowCombinationServer) RpcBodyRpc(ctx context.Context, req *NonEmptyProto) (*EmptyProto, error) { + return nil, status.Errorf(codes.Unimplemented, "method RpcBodyRpc not implemented") +} +func (*UnimplementedFlowCombinationServer) RpcPathSingleNestedRpc(ctx context.Context, req *SingleNestedProto) (*EmptyProto, error) { + return nil, status.Errorf(codes.Unimplemented, "method RpcPathSingleNestedRpc not implemented") +} +func (*UnimplementedFlowCombinationServer) RpcPathNestedRpc(ctx context.Context, req *NestedProto) (*EmptyProto, error) { + return nil, status.Errorf(codes.Unimplemented, "method RpcPathNestedRpc not implemented") +} +func (*UnimplementedFlowCombinationServer) RpcBodyStream(req *NonEmptyProto, srv FlowCombination_RpcBodyStreamServer) error { + return status.Errorf(codes.Unimplemented, "method RpcBodyStream not implemented") +} +func (*UnimplementedFlowCombinationServer) RpcPathSingleNestedStream(req *SingleNestedProto, srv FlowCombination_RpcPathSingleNestedStreamServer) error { + return status.Errorf(codes.Unimplemented, "method RpcPathSingleNestedStream not implemented") +} +func (*UnimplementedFlowCombinationServer) RpcPathNestedStream(req *NestedProto, srv FlowCombination_RpcPathNestedStreamServer) error { + return status.Errorf(codes.Unimplemented, "method RpcPathNestedStream not implemented") +} + func RegisterFlowCombinationServer(s *grpc.Server, srv FlowCombinationServer) { s.RegisterService(&_FlowCombination_serviceDesc, srv) } @@ -789,52 +879,3 @@ var _FlowCombination_serviceDesc = grpc.ServiceDesc{ }, Metadata: "examples/proto/examplepb/flow_combination.proto", } - -func init() { - proto.RegisterFile("examples/proto/examplepb/flow_combination.proto", fileDescriptor_flow_combination_63ace3110e4bd00b) -} - -var fileDescriptor_flow_combination_63ace3110e4bd00b = []byte{ - // 655 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0xbf, 0x8f, 0x12, 0x41, - 0x14, 0xc7, 0xf3, 0xb8, 0xc4, 0xe4, 0x86, 0xfb, 0xc1, 0x2d, 0x06, 0x81, 0xc3, 0xe3, 0x6e, 0xbc, - 0x44, 0xe2, 0x8f, 0x5d, 0x82, 0xd5, 0x51, 0x9e, 0xd1, 0x92, 0x5c, 0xb8, 0xd8, 0x6c, 0x63, 0x66, - 0x87, 0x15, 0x48, 0x60, 0x67, 0x6e, 0x77, 0x0d, 0x5e, 0x08, 0x31, 0xb1, 0xb1, 0xb4, 0xf0, 0x0f, - 0xb0, 0xb4, 0xf2, 0x1f, 0xb0, 0xb3, 0xb2, 0x31, 0xb1, 0x30, 0xb1, 0xb3, 0xb3, 0xf3, 0x9f, 0x30, - 0xfb, 0xf6, 0xc7, 0xb0, 0x0a, 0x6e, 0x30, 0x62, 0xb7, 0x6f, 0xe6, 0xbd, 0x37, 0x9f, 0xf9, 0xce, - 0xf7, 0x11, 0x88, 0x61, 0x3f, 0x63, 0x63, 0x39, 0xb2, 0x3d, 0x43, 0xba, 0xc2, 0x17, 0x71, 0x28, - 0x2d, 0xe3, 0xc9, 0x48, 0x4c, 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x2f, 0xaf, 0x7d, 0x03, 0x52, 0x88, 0x08, 0x15, 0xdb, 0x9d, 0xec, 0x77, 0xfd, 0x5b, 0x2a, 0x07, - 0xa9, 0x06, 0xf4, 0x70, 0x29, 0xd5, 0xdc, 0xb3, 0x64, 0xc0, 0x27, 0x8f, 0xb3, 0x64, 0xbf, 0x0d, - 0x5c, 0xfb, 0x98, 0x23, 0xdb, 0x91, 0x63, 0xa3, 0xf9, 0x59, 0xab, 0x69, 0xbf, 0x86, 0xa6, 0xfd, - 0x0c, 0xb4, 0xa0, 0x6c, 0x13, 0x0e, 0x50, 0xe0, 0xdb, 0xf9, 0x0b, 0xa5, 0x7c, 0x1b, 0xa6, 0x98, - 0xf1, 0x4f, 0x52, 0xe8, 0xa0, 0x68, 0x91, 0xd2, 0xeb, 0x4b, 0xdc, 0x1b, 0x37, 0xe6, 0xe6, 0x3e, - 0x2d, 0xfd, 0x6a, 0x60, 0xb5, 0x79, 0x4c, 0xeb, 0x4b, 0x3d, 0xac, 0xb2, 0x6a, 0xd1, 0x90, 0x2c, - 0x4c, 0x68, 0x82, 0xf6, 0x16, 0x48, 0x65, 0x81, 0x97, 0x23, 0x55, 0xd7, 0x6e, 0xe7, 0x9b, 0x28, - 0xec, 0x51, 0x74, 0x95, 0x45, 0x2f, 0x9e, 0x90, 0xfe, 0x00, 0x52, 0x4c, 0x79, 0x3a, 0x62, 0x5c, - 0xa3, 0xad, 0x27, 0x48, 0x77, 0x41, 0x6f, 0xfc, 0xd1, 0xd6, 0x4a, 0xec, 0xec, 0x7b, 0x24, 0xaf, - 0xb6, 0x3c, 0xa5, 0x0d, 0xbc, 0x09, 0xa7, 0x79, 0x73, 0x33, 0x41, 0xb2, 0xae, 0xe0, 0x3f, 0xa0, - 0x7b, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x36, 0xcd, 0x7d, 0x1f, 0x73, 0x09, 0x00, 0x00, -} diff --git a/examples/proto/examplepb/non_standard_names.pb.go b/examples/proto/examplepb/non_standard_names.pb.go index 7637cf515fe..2858e1e82d1 100644 --- a/examples/proto/examplepb/non_standard_names.pb.go +++ b/examples/proto/examplepb/non_standard_names.pb.go @@ -3,15 +3,16 @@ package examplepb -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import field_mask "google.golang.org/genproto/protobuf/field_mask" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + field_mask "google.golang.org/genproto/protobuf/field_mask" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,7 +24,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // NonStandardMessage has oddly named fields. type NonStandardMessage struct { @@ -45,16 +46,17 @@ func (m *NonStandardMessage) Reset() { *m = NonStandardMessage{} } func (m *NonStandardMessage) String() string { return proto.CompactTextString(m) } func (*NonStandardMessage) ProtoMessage() {} func (*NonStandardMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{0} + return fileDescriptor_fa36ad8828f19375, []int{0} } + func (m *NonStandardMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessage.Unmarshal(m, b) } func (m *NonStandardMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NonStandardMessage.Marshal(b, m, deterministic) } -func (dst *NonStandardMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonStandardMessage.Merge(dst, src) +func (m *NonStandardMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessage.Merge(m, src) } func (m *NonStandardMessage) XXX_Size() int { return xxx_messageInfo_NonStandardMessage.Size(m) @@ -132,16 +134,17 @@ func (m *NonStandardMessage_Thing) Reset() { *m = NonStandardMessage_Thi func (m *NonStandardMessage_Thing) String() string { return proto.CompactTextString(m) } func (*NonStandardMessage_Thing) ProtoMessage() {} func (*NonStandardMessage_Thing) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{0, 0} + return fileDescriptor_fa36ad8828f19375, []int{0, 0} } + func (m *NonStandardMessage_Thing) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessage_Thing.Unmarshal(m, b) } func (m *NonStandardMessage_Thing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NonStandardMessage_Thing.Marshal(b, m, deterministic) } -func (dst *NonStandardMessage_Thing) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonStandardMessage_Thing.Merge(dst, src) +func (m *NonStandardMessage_Thing) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessage_Thing.Merge(m, src) } func (m *NonStandardMessage_Thing) XXX_Size() int { return xxx_messageInfo_NonStandardMessage_Thing.Size(m) @@ -170,16 +173,17 @@ func (m *NonStandardMessage_Thing_SubThing) Reset() { *m = NonStandardMe func (m *NonStandardMessage_Thing_SubThing) String() string { return proto.CompactTextString(m) } func (*NonStandardMessage_Thing_SubThing) ProtoMessage() {} func (*NonStandardMessage_Thing_SubThing) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{0, 0, 0} + return fileDescriptor_fa36ad8828f19375, []int{0, 0, 0} } + func (m *NonStandardMessage_Thing_SubThing) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessage_Thing_SubThing.Unmarshal(m, b) } func (m *NonStandardMessage_Thing_SubThing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NonStandardMessage_Thing_SubThing.Marshal(b, m, deterministic) } -func (dst *NonStandardMessage_Thing_SubThing) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonStandardMessage_Thing_SubThing.Merge(dst, src) +func (m *NonStandardMessage_Thing_SubThing) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessage_Thing_SubThing.Merge(m, src) } func (m *NonStandardMessage_Thing_SubThing) XXX_Size() int { return xxx_messageInfo_NonStandardMessage_Thing_SubThing.Size(m) @@ -209,16 +213,17 @@ func (m *NonStandardUpdateRequest) Reset() { *m = NonStandardUpdateReque func (m *NonStandardUpdateRequest) String() string { return proto.CompactTextString(m) } func (*NonStandardUpdateRequest) ProtoMessage() {} func (*NonStandardUpdateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{1} + return fileDescriptor_fa36ad8828f19375, []int{1} } + func (m *NonStandardUpdateRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardUpdateRequest.Unmarshal(m, b) } func (m *NonStandardUpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NonStandardUpdateRequest.Marshal(b, m, deterministic) } -func (dst *NonStandardUpdateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonStandardUpdateRequest.Merge(dst, src) +func (m *NonStandardUpdateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardUpdateRequest.Merge(m, src) } func (m *NonStandardUpdateRequest) XXX_Size() int { return xxx_messageInfo_NonStandardUpdateRequest.Size(m) @@ -263,16 +268,17 @@ func (m *NonStandardMessageWithJSONNames) Reset() { *m = NonStandardMess func (m *NonStandardMessageWithJSONNames) String() string { return proto.CompactTextString(m) } func (*NonStandardMessageWithJSONNames) ProtoMessage() {} func (*NonStandardMessageWithJSONNames) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{2} + return fileDescriptor_fa36ad8828f19375, []int{2} } + func (m *NonStandardMessageWithJSONNames) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessageWithJSONNames.Unmarshal(m, b) } func (m *NonStandardMessageWithJSONNames) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NonStandardMessageWithJSONNames.Marshal(b, m, deterministic) } -func (dst *NonStandardMessageWithJSONNames) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonStandardMessageWithJSONNames.Merge(dst, src) +func (m *NonStandardMessageWithJSONNames) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessageWithJSONNames.Merge(m, src) } func (m *NonStandardMessageWithJSONNames) XXX_Size() int { return xxx_messageInfo_NonStandardMessageWithJSONNames.Size(m) @@ -350,16 +356,17 @@ func (m *NonStandardMessageWithJSONNames_Thing) Reset() { *m = NonStanda func (m *NonStandardMessageWithJSONNames_Thing) String() string { return proto.CompactTextString(m) } func (*NonStandardMessageWithJSONNames_Thing) ProtoMessage() {} func (*NonStandardMessageWithJSONNames_Thing) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{2, 0} + return fileDescriptor_fa36ad8828f19375, []int{2, 0} } + func (m *NonStandardMessageWithJSONNames_Thing) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.Unmarshal(m, b) } func (m *NonStandardMessageWithJSONNames_Thing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.Marshal(b, m, deterministic) } -func (dst *NonStandardMessageWithJSONNames_Thing) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.Merge(dst, src) +func (m *NonStandardMessageWithJSONNames_Thing) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.Merge(m, src) } func (m *NonStandardMessageWithJSONNames_Thing) XXX_Size() int { return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing.Size(m) @@ -392,16 +399,17 @@ func (m *NonStandardMessageWithJSONNames_Thing_SubThing) String() string { } func (*NonStandardMessageWithJSONNames_Thing_SubThing) ProtoMessage() {} func (*NonStandardMessageWithJSONNames_Thing_SubThing) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{2, 0, 0} + return fileDescriptor_fa36ad8828f19375, []int{2, 0, 0} } + func (m *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.Unmarshal(m, b) } func (m *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.Marshal(b, m, deterministic) } -func (dst *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.Merge(dst, src) +func (m *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.Merge(m, src) } func (m *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Size() int { return xxx_messageInfo_NonStandardMessageWithJSONNames_Thing_SubThing.Size(m) @@ -431,16 +439,17 @@ func (m *NonStandardWithJSONNamesUpdateRequest) Reset() { *m = NonStanda func (m *NonStandardWithJSONNamesUpdateRequest) String() string { return proto.CompactTextString(m) } func (*NonStandardWithJSONNamesUpdateRequest) ProtoMessage() {} func (*NonStandardWithJSONNamesUpdateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_non_standard_names_33e1f510ac1f389a, []int{3} + return fileDescriptor_fa36ad8828f19375, []int{3} } + func (m *NonStandardWithJSONNamesUpdateRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.Unmarshal(m, b) } func (m *NonStandardWithJSONNamesUpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.Marshal(b, m, deterministic) } -func (dst *NonStandardWithJSONNamesUpdateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.Merge(dst, src) +func (m *NonStandardWithJSONNamesUpdateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.Merge(m, src) } func (m *NonStandardWithJSONNamesUpdateRequest) XXX_Size() int { return xxx_messageInfo_NonStandardWithJSONNamesUpdateRequest.Size(m) @@ -476,6 +485,54 @@ func init() { proto.RegisterType((*NonStandardWithJSONNamesUpdateRequest)(nil), "grpc.gateway.examples.examplepb.NonStandardWithJSONNamesUpdateRequest") } +func init() { + proto.RegisterFile("examples/proto/examplepb/non_standard_names.proto", fileDescriptor_fa36ad8828f19375) +} + +var fileDescriptor_fa36ad8828f19375 = []byte{ + // 626 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x41, 0x6f, 0xd3, 0x3c, + 0x18, 0xc7, 0x95, 0x66, 0xed, 0x5a, 0x57, 0x7a, 0x5f, 0xe4, 0x21, 0x14, 0xc2, 0xa4, 0x56, 0x95, + 0xd0, 0x7a, 0x21, 0xd1, 0xb2, 0x03, 0x02, 0x84, 0x04, 0x15, 0xac, 0x1a, 0x62, 0xad, 0x94, 0x74, + 0x20, 0x21, 0x41, 0xe4, 0x2c, 0x5e, 0x1a, 0x9a, 0xda, 0xa1, 0x76, 0x3a, 0x7a, 0xe5, 0x13, 0x4c, + 0xe2, 0x0e, 0xdc, 0xf8, 0x0e, 0xf0, 0x31, 0xb8, 0x73, 0xe2, 0x83, 0xa0, 0xd8, 0x69, 0xa9, 0x55, + 0xa1, 0xb1, 0x6e, 0xa7, 0xfa, 0x79, 0x6c, 0xff, 0x9f, 0xe7, 0x6f, 0xff, 0xe2, 0x82, 0x5d, 0xfc, + 0x1e, 0x8d, 0xd3, 0x04, 0x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x82, 0xa8, 0x8a, 0xf8, 0x99, 0x99, 0x9f, 0x16, 0x48, 0x8d, 0x56, 0x90, 0xea, 0x5f, + 0x4d, 0xad, 0x25, 0xbe, 0xe6, 0x23, 0xb3, 0xbd, 0xc4, 0xd7, 0xf6, 0x2a, 0x5f, 0x22, 0x21, 0x01, + 0xfb, 0xa6, 0x81, 0xdb, 0x4b, 0x65, 0x14, 0x7d, 0x95, 0xb6, 0x81, 0x42, 0xdb, 0xa3, 0xcb, 0x36, + 0x7f, 0x05, 0xe8, 0x39, 0x9f, 0xd5, 0x07, 0xcb, 0xc3, 0x93, 0x69, 0x7c, 0x8c, 0xe1, 0x57, 0x0d, + 0x54, 0x64, 0xef, 0xf0, 0x42, 0x8f, 0x82, 0xe2, 0xd7, 0x5c, 0xe7, 0x7b, 0x6a, 0xdd, 0xf9, 0xf0, + 0xe3, 0xd7, 0xc7, 0xd2, 0x8e, 0xd3, 0xb0, 0xa7, 0xbb, 0xf3, 0x37, 0x5d, 0x79, 0xd1, 0x6d, 0xd9, + 0xfe, 0x7d, 0xe9, 0xfe, 0xa7, 0x06, 0xb6, 0x64, 0x55, 0xf5, 0x7b, 0xb9, 0x10, 0x86, 0x7f, 0xbf, + 0x33, 0xf3, 0xd2, 0xb7, 0xd4, 0x7a, 0x28, 0x0c, 0xdd, 0x75, 0xec, 0x73, 0x0c, 0xf9, 0xa7, 0x31, + 0x1f, 0xfa, 0x6f, 0x19, 0x25, 0xf2, 0x3f, 0x4b, 0x1a, 0xec, 0xd4, 0x5f, 0xd5, 0x16, 0xb5, 0x82, + 0x8a, 0xb8, 0xce, 0xbd, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x18, 0x50, 0x51, 0xb2, 0xfc, 0x06, + 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -528,6 +585,17 @@ type NonStandardServiceServer interface { UpdateWithJSONNames(context.Context, *NonStandardWithJSONNamesUpdateRequest) (*NonStandardMessageWithJSONNames, error) } +// UnimplementedNonStandardServiceServer can be embedded to have forward compatible implementations. +type UnimplementedNonStandardServiceServer struct { +} + +func (*UnimplementedNonStandardServiceServer) Update(ctx context.Context, req *NonStandardUpdateRequest) (*NonStandardMessage, error) { + return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") +} +func (*UnimplementedNonStandardServiceServer) UpdateWithJSONNames(ctx context.Context, req *NonStandardWithJSONNamesUpdateRequest) (*NonStandardMessageWithJSONNames, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateWithJSONNames not implemented") +} + func RegisterNonStandardServiceServer(s *grpc.Server, srv NonStandardServiceServer) { s.RegisterService(&_NonStandardService_serviceDesc, srv) } @@ -584,51 +652,3 @@ var _NonStandardService_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "examples/proto/examplepb/non_standard_names.proto", } - -func init() { - proto.RegisterFile("examples/proto/examplepb/non_standard_names.proto", fileDescriptor_non_standard_names_33e1f510ac1f389a) -} - -var fileDescriptor_non_standard_names_33e1f510ac1f389a = []byte{ - // 626 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x41, 0x6f, 0xd3, 0x3c, - 0x18, 0xc7, 0x95, 0x66, 0xed, 0x5a, 0x57, 0x7a, 0x5f, 0xe4, 0x21, 0x14, 0xc2, 0xa4, 0x56, 0x95, - 0xd0, 0x7a, 0x21, 0xd1, 0xb2, 0x03, 0x02, 0x84, 0x04, 0x15, 0xac, 0x1a, 0x62, 0xad, 0x94, 0x74, - 0x20, 0x21, 0x41, 0xe4, 0x2c, 0x5e, 0x1a, 0x9a, 0xda, 0xa1, 0x76, 0x3a, 0x7a, 0xe5, 0x13, 0x4c, - 0xe2, 0x0e, 0xdc, 0xf8, 0x0e, 0xf0, 0x31, 0xb8, 0x73, 0xe2, 0x83, 0xa0, 0xd8, 0x69, 0xa9, 0x55, - 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-} diff --git a/examples/proto/examplepb/response_body_service.pb.go b/examples/proto/examplepb/response_body_service.pb.go index ae80ec69077..879091d3e74 100644 --- a/examples/proto/examplepb/response_body_service.pb.go +++ b/examples/proto/examplepb/response_body_service.pb.go @@ -3,14 +3,15 @@ package examplepb -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -22,7 +23,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type RepeatedResponseBodyOut_Response_ResponseType int32 @@ -40,6 +41,7 @@ var RepeatedResponseBodyOut_Response_ResponseType_name = map[int32]string{ 1: "A", 2: "B", } + var RepeatedResponseBodyOut_Response_ResponseType_value = map[string]int32{ "UNKNOWN": 0, "A": 1, @@ -49,8 +51,9 @@ var RepeatedResponseBodyOut_Response_ResponseType_value = map[string]int32{ func (x RepeatedResponseBodyOut_Response_ResponseType) String() string { return proto.EnumName(RepeatedResponseBodyOut_Response_ResponseType_name, int32(x)) } + func (RepeatedResponseBodyOut_Response_ResponseType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_dd1070a6693ff118, []int{2, 0, 0} + return fileDescriptor_df4b27f252df323f, []int{2, 0, 0} } type ResponseBodyIn struct { @@ -64,16 +67,17 @@ func (m *ResponseBodyIn) Reset() { *m = ResponseBodyIn{} } func (m *ResponseBodyIn) String() string { return proto.CompactTextString(m) } func (*ResponseBodyIn) ProtoMessage() {} func (*ResponseBodyIn) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_dd1070a6693ff118, []int{0} + return fileDescriptor_df4b27f252df323f, []int{0} } + func (m *ResponseBodyIn) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyIn.Unmarshal(m, b) } func (m *ResponseBodyIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ResponseBodyIn.Marshal(b, m, deterministic) } -func (dst *ResponseBodyIn) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseBodyIn.Merge(dst, src) +func (m *ResponseBodyIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseBodyIn.Merge(m, src) } func (m *ResponseBodyIn) XXX_Size() int { return xxx_messageInfo_ResponseBodyIn.Size(m) @@ -102,16 +106,17 @@ func (m *ResponseBodyOut) Reset() { *m = ResponseBodyOut{} } func (m *ResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut) ProtoMessage() {} func (*ResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_dd1070a6693ff118, []int{1} + return fileDescriptor_df4b27f252df323f, []int{1} } + func (m *ResponseBodyOut) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyOut.Unmarshal(m, b) } func (m *ResponseBodyOut) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ResponseBodyOut.Marshal(b, m, deterministic) } -func (dst *ResponseBodyOut) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseBodyOut.Merge(dst, src) +func (m *ResponseBodyOut) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseBodyOut.Merge(m, src) } func (m *ResponseBodyOut) XXX_Size() int { return xxx_messageInfo_ResponseBodyOut.Size(m) @@ -140,16 +145,17 @@ func (m *ResponseBodyOut_Response) Reset() { *m = ResponseBodyOut_Respon func (m *ResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut_Response) ProtoMessage() {} func (*ResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_dd1070a6693ff118, []int{1, 0} + return fileDescriptor_df4b27f252df323f, []int{1, 0} } + func (m *ResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseBodyOut_Response.Unmarshal(m, b) } func (m *ResponseBodyOut_Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ResponseBodyOut_Response.Marshal(b, m, deterministic) } -func (dst *ResponseBodyOut_Response) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseBodyOut_Response.Merge(dst, src) +func (m *ResponseBodyOut_Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseBodyOut_Response.Merge(m, src) } func (m *ResponseBodyOut_Response) XXX_Size() int { return xxx_messageInfo_ResponseBodyOut_Response.Size(m) @@ -178,16 +184,17 @@ func (m *RepeatedResponseBodyOut) Reset() { *m = RepeatedResponseBodyOut func (m *RepeatedResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseBodyOut) ProtoMessage() {} func (*RepeatedResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_dd1070a6693ff118, []int{2} + return fileDescriptor_df4b27f252df323f, []int{2} } + func (m *RepeatedResponseBodyOut) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseBodyOut.Unmarshal(m, b) } func (m *RepeatedResponseBodyOut) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RepeatedResponseBodyOut.Marshal(b, m, deterministic) } -func (dst *RepeatedResponseBodyOut) XXX_Merge(src proto.Message) { - xxx_messageInfo_RepeatedResponseBodyOut.Merge(dst, src) +func (m *RepeatedResponseBodyOut) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepeatedResponseBodyOut.Merge(m, src) } func (m *RepeatedResponseBodyOut) XXX_Size() int { return xxx_messageInfo_RepeatedResponseBodyOut.Size(m) @@ -217,16 +224,17 @@ func (m *RepeatedResponseBodyOut_Response) Reset() { *m = RepeatedRespon func (m *RepeatedResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseBodyOut_Response) ProtoMessage() {} func (*RepeatedResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_dd1070a6693ff118, []int{2, 0} + return fileDescriptor_df4b27f252df323f, []int{2, 0} } + func (m *RepeatedResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseBodyOut_Response.Unmarshal(m, b) } func (m *RepeatedResponseBodyOut_Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RepeatedResponseBodyOut_Response.Marshal(b, m, deterministic) } -func (dst *RepeatedResponseBodyOut_Response) XXX_Merge(src proto.Message) { - xxx_messageInfo_RepeatedResponseBodyOut_Response.Merge(dst, src) +func (m *RepeatedResponseBodyOut_Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepeatedResponseBodyOut_Response.Merge(m, src) } func (m *RepeatedResponseBodyOut_Response) XXX_Size() int { return xxx_messageInfo_RepeatedResponseBodyOut_Response.Size(m) @@ -262,16 +270,17 @@ func (m *RepeatedResponseStrings) Reset() { *m = RepeatedResponseStrings func (m *RepeatedResponseStrings) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseStrings) ProtoMessage() {} func (*RepeatedResponseStrings) Descriptor() ([]byte, []int) { - return fileDescriptor_response_body_service_dd1070a6693ff118, []int{3} + return fileDescriptor_df4b27f252df323f, []int{3} } + func (m *RepeatedResponseStrings) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedResponseStrings.Unmarshal(m, b) } func (m *RepeatedResponseStrings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RepeatedResponseStrings.Marshal(b, m, deterministic) } -func (dst *RepeatedResponseStrings) XXX_Merge(src proto.Message) { - xxx_messageInfo_RepeatedResponseStrings.Merge(dst, src) +func (m *RepeatedResponseStrings) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepeatedResponseStrings.Merge(m, src) } func (m *RepeatedResponseStrings) XXX_Size() int { return xxx_messageInfo_RepeatedResponseStrings.Size(m) @@ -290,13 +299,49 @@ func (m *RepeatedResponseStrings) GetValues() []string { } func init() { + proto.RegisterEnum("grpc.gateway.examples.examplepb.RepeatedResponseBodyOut_Response_ResponseType", RepeatedResponseBodyOut_Response_ResponseType_name, RepeatedResponseBodyOut_Response_ResponseType_value) proto.RegisterType((*ResponseBodyIn)(nil), "grpc.gateway.examples.examplepb.ResponseBodyIn") proto.RegisterType((*ResponseBodyOut)(nil), "grpc.gateway.examples.examplepb.ResponseBodyOut") proto.RegisterType((*ResponseBodyOut_Response)(nil), "grpc.gateway.examples.examplepb.ResponseBodyOut.Response") proto.RegisterType((*RepeatedResponseBodyOut)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseBodyOut") proto.RegisterType((*RepeatedResponseBodyOut_Response)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseBodyOut.Response") proto.RegisterType((*RepeatedResponseStrings)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseStrings") - proto.RegisterEnum("grpc.gateway.examples.examplepb.RepeatedResponseBodyOut_Response_ResponseType", RepeatedResponseBodyOut_Response_ResponseType_name, RepeatedResponseBodyOut_Response_ResponseType_value) +} + +func init() { + proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_df4b27f252df323f) +} + +var fileDescriptor_df4b27f252df323f = []byte{ + // 441 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0xcf, 0xaa, 0xd3, 0x40, + 0x14, 0xc6, 0x9d, 0xb4, 0x5e, 0x6f, 0x27, 0x72, 0x6f, 0x99, 0x2b, 0xf7, 0x86, 0x22, 0x1a, 0x07, + 0xd1, 0xb8, 0x49, 0x34, 0xba, 0xd0, 0x65, 0xbb, 0x91, 0xa2, 0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5e, 0x23, 0x67, 0x1a, 0x56, 0x6e, 0x4f, 0x6a, 0xda, 0xaa, 0x1d, + 0x46, 0xe6, 0xb3, 0x9e, 0x56, 0x8b, 0x0e, 0xca, 0x3f, 0xc6, 0xdd, 0xef, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x07, 0xc9, 0xea, 0x62, 0xa8, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -358,6 +403,20 @@ type ResponseBodyServiceServer interface { ListResponseStrings(context.Context, *ResponseBodyIn) (*RepeatedResponseStrings, error) } +// UnimplementedResponseBodyServiceServer can be embedded to have forward compatible implementations. +type UnimplementedResponseBodyServiceServer struct { +} + +func (*UnimplementedResponseBodyServiceServer) GetResponseBody(ctx context.Context, req *ResponseBodyIn) (*ResponseBodyOut, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetResponseBody not implemented") +} +func (*UnimplementedResponseBodyServiceServer) ListResponseBodies(ctx context.Context, req *ResponseBodyIn) (*RepeatedResponseBodyOut, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListResponseBodies not implemented") +} +func (*UnimplementedResponseBodyServiceServer) ListResponseStrings(ctx context.Context, req *ResponseBodyIn) (*RepeatedResponseStrings, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListResponseStrings not implemented") +} + func RegisterResponseBodyServiceServer(s *grpc.Server, srv ResponseBodyServiceServer) { s.RegisterService(&_ResponseBodyService_serviceDesc, srv) } @@ -436,39 +495,3 @@ var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "examples/proto/examplepb/response_body_service.proto", } - -func init() { - proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_response_body_service_dd1070a6693ff118) -} - -var fileDescriptor_response_body_service_dd1070a6693ff118 = []byte{ - // 441 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0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f7, 0x27, 0xbc, 0xff, 0xb7, 0x96, 0x51, 0xa7, 0x24, - 0xa5, 0xe4, 0xb4, 0x49, 0x9a, 0x82, 0x6c, 0x65, 0x3d, 0x69, 0xb2, 0xd6, 0x96, 0xfc, 0x07, 0xd8, - 0x2a, 0x15, 0xbd, 0x59, 0xc2, 0x5e, 0x23, 0x67, 0x1a, 0x56, 0x6e, 0x4f, 0x6a, 0xda, 0xaa, 0x1d, - 0x46, 0xe6, 0xb3, 0x9e, 0x56, 0x8b, 0x0e, 0xca, 0x3f, 0xc6, 0xdd, 0xef, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x07, 0xc9, 0xea, 0x62, 0xa8, 0x04, 0x00, 0x00, -} diff --git a/examples/proto/examplepb/stream.pb.go b/examples/proto/examplepb/stream.pb.go index 8c1cd2e920b..993391ebea5 100644 --- a/examples/proto/examplepb/stream.pb.go +++ b/examples/proto/examplepb/stream.pb.go @@ -3,16 +3,17 @@ package examplepb -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import empty "github.com/golang/protobuf/ptypes/empty" -import sub "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" -import _ "google.golang.org/genproto/googleapis/api/annotations" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + empty "github.com/golang/protobuf/ptypes/empty" + sub "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -24,7 +25,35 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +func init() { + proto.RegisterFile("examples/proto/examplepb/stream.proto", fileDescriptor_a31ab0177843ce10) +} + +var fileDescriptor_a31ab0177843ce10 = []byte{ + // 319 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xb1, 0x4e, 0xc3, 0x30, + 0x10, 0x86, 0x15, 0x40, 0x08, 0x8c, 0x58, 0x3c, 0x30, 0x04, 0xa4, 0x42, 0x05, 0xa2, 0x30, 0xd8, + 0x6d, 0xd9, 0xd8, 0x28, 0xea, 0x06, 0x62, 0xe8, 0xc6, 0x52, 0xd9, 0xd1, 0xd5, 0xb5, 0x9a, 0xc4, + 0x96, 0x7d, 0x29, 0x54, 0x62, 0x62, 0x64, 0xed, 0x8b, 0xf0, 0x2e, 0xbc, 0x02, 0x0f, 0x82, 0xea, + 0xa4, 0x1d, 0x10, 0x51, 0xcb, 0x78, 0xbe, 0xff, 0xf7, 0xfd, 0xdf, 0x4f, 0x2e, 0xe0, 0x55, 0x64, + 0x36, 0x05, 0xcf, 0xad, 0x33, 0x68, 0x78, 0x35, 0x5a, 0xc9, 0x3d, 0x3a, 0x10, 0x19, 0x0b, 0xcf, + 0xb4, 0xa1, 0x9c, 0x4d, 0x98, 0x12, 0x08, 0x2f, 0x62, 0xc6, 0x96, 0x1e, 0xb6, 0x52, 0xc7, 0x27, + 0xca, 0x18, 0x95, 0x02, 0x17, 0x56, 0x73, 0x91, 0xe7, 0x06, 0x05, 0x6a, 0x93, 0xfb, 0xd2, 0x1e, + 0x1f, 0x57, 0xdb, 0x30, 0xc9, 0x62, 0xc4, 0x21, 0xb3, 0x38, 0xab, 0x96, 0xdd, 0xda, 0x08, 0x62, + 0x28, 0x35, 0x0e, 0xcd, 0x68, 0x08, 0x53, 0x70, 0x33, 0x1c, 0xeb, 0x5c, 0x55, 0x9e, 0xd3, 0x5f, + 0x1e, 0x5f, 0x48, 0x9e, 0x81, 0xf7, 0x42, 0x41, 0xa9, 0xe8, 0x7e, 0x6e, 0x93, 0xc3, 0x41, 0x40, + 0x18, 0x80, 0x9b, 0xea, 0x04, 0xe8, 0x47, 0x44, 0x48, 0xaf, 0x48, 0x27, 0xf7, 0x0e, 0x04, 0x02, + 0xed, 0xb0, 0x35, 0x4c, 0xec, 0xae, 0xa7, 0xf1, 0x69, 0xd4, 0x5f, 0xdd, 0x8e, 0x8f, 0x58, 0xc9, + 0xc1, 0x96, 0x1c, 0xac, 0xbf, 0xe0, 0x68, 0xf2, 0xf7, 0xaf, 0xef, 0xf9, 0xd6, 0x55, 0xf3, 0x9c, + 0x4f, 0x3b, 0xcb, 0xf8, 0x7f, 0x85, 0xe7, 0xb2, 0x48, 0x27, 0xb7, 0xd1, 0x75, 0x2b, 0xa2, 0x6f, + 0x64, 0xe7, 0x41, 0x7b, 0xa4, 0x35, 0x5f, 0xc6, 0xff, 0x4f, 0xd7, 0xbc, 0x0c, 0x29, 0xce, 0x68, + 0x63, 0x4d, 0x8a, 0x76, 0x44, 0xe7, 0x11, 0xd9, 0x5b, 0x54, 0xd1, 0x4f, 0xc6, 0x86, 0xb6, 0x6a, + 0x4e, 0xf9, 0x42, 0xb2, 0x01, 0x3a, 0x9d, 0xab, 0xc7, 0xb2, 0xd9, 0x78, 0x63, 0xe5, 0xe6, 0x8d, + 0x40, 0x32, 0x36, 0xa1, 0x91, 0x76, 0xd4, 0x3b, 0x78, 0xde, 0x5f, 0xe1, 0xc9, 0xdd, 0x50, 0xc8, + 0xcd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x63, 0x7a, 0xd9, 0xa1, 0x02, 0x00, 0x00, +} // Reference imports to suppress errors if they are not otherwise used. var _ context.Context @@ -155,6 +184,20 @@ type StreamServiceServer interface { BulkEcho(StreamService_BulkEchoServer) error } +// UnimplementedStreamServiceServer can be embedded to have forward compatible implementations. +type UnimplementedStreamServiceServer struct { +} + +func (*UnimplementedStreamServiceServer) BulkCreate(srv StreamService_BulkCreateServer) error { + return status.Errorf(codes.Unimplemented, "method BulkCreate not implemented") +} +func (*UnimplementedStreamServiceServer) List(req *empty.Empty, srv StreamService_ListServer) error { + return status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (*UnimplementedStreamServiceServer) BulkEcho(srv StreamService_BulkEchoServer) error { + return status.Errorf(codes.Unimplemented, "method BulkEcho not implemented") +} + func RegisterStreamServiceServer(s *grpc.Server, srv StreamServiceServer) { s.RegisterService(&_StreamService_serviceDesc, srv) } @@ -256,31 +299,3 @@ var _StreamService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "examples/proto/examplepb/stream.proto", } - -func init() { - proto.RegisterFile("examples/proto/examplepb/stream.proto", fileDescriptor_stream_44f32a4fe5bf6004) -} - -var fileDescriptor_stream_44f32a4fe5bf6004 = []byte{ - // 319 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xb1, 0x4e, 0xc3, 0x30, - 0x10, 0x86, 0x15, 0x40, 0x08, 0x8c, 0x58, 0x3c, 0x30, 0x04, 0xa4, 0x42, 0x05, 0xa2, 0x30, 0xd8, - 0x6d, 0xd9, 0xd8, 0x28, 0xea, 0x06, 0x62, 0xe8, 0xc6, 0x52, 0xd9, 0xd1, 0xd5, 0xb5, 0x9a, 0xc4, - 0x96, 0x7d, 0x29, 0x54, 0x62, 0x62, 0x64, 0xed, 0x8b, 0xf0, 0x2e, 0xbc, 0x02, 0x0f, 0x82, 0xea, - 0xa4, 0x1d, 0x10, 0x51, 0xcb, 0x78, 0xbe, 0xff, 0xf7, 0xfd, 0xdf, 0x4f, 0x2e, 0xe0, 0x55, 0x64, - 0x36, 0x05, 0xcf, 0xad, 0x33, 0x68, 0x78, 0x35, 0x5a, 0xc9, 0x3d, 0x3a, 0x10, 0x19, 0x0b, 0xcf, - 0xb4, 0xa1, 0x9c, 0x4d, 0x98, 0x12, 0x08, 0x2f, 0x62, 0xc6, 0x96,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32, 0x36, 0xa1, 0x91, 0x76, 0xd4, 0x3b, 0x78, 0xde, 0x5f, 0xe1, 0xc9, 0xdd, 0x50, 0xc8, - 0xcd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x63, 0x7a, 0xd9, 0xa1, 0x02, 0x00, 0x00, -} diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.go b/examples/proto/examplepb/unannotated_echo_service.pb.go index 73699e5c602..ba678e9a081 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.go +++ b/examples/proto/examplepb/unannotated_echo_service.pb.go @@ -1,26 +1,25 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: examples/proto/examplepb/unannotated_echo_service.proto -package examplepb - -/* -Unannotated Echo Service -Similar to echo_service.proto but without annotations. See -unannotated_echo_service.yaml for the equivalent of the annotations in -gRPC API configuration format. - -Echo Service API consists of a single service which returns -a message. -*/ +// Unannotated Echo Service +// Similar to echo_service.proto but without annotations. See +// unannotated_echo_service.yaml for the equivalent of the annotations in +// gRPC API configuration format. +// +// Echo Service API consists of a single service which returns +// a message. -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import duration "github.com/golang/protobuf/ptypes/duration" +package examplepb import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + duration "github.com/golang/protobuf/ptypes/duration" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -32,7 +31,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // UnannotatedSimpleMessage represents a simple message sent to the unannotated Echo service. type UnannotatedSimpleMessage struct { @@ -49,16 +48,17 @@ func (m *UnannotatedSimpleMessage) Reset() { *m = UnannotatedSimpleMessa func (m *UnannotatedSimpleMessage) String() string { return proto.CompactTextString(m) } func (*UnannotatedSimpleMessage) ProtoMessage() {} func (*UnannotatedSimpleMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_unannotated_echo_service_ca2b904682e29806, []int{0} + return fileDescriptor_a57876726ab5dd80, []int{0} } + func (m *UnannotatedSimpleMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UnannotatedSimpleMessage.Unmarshal(m, b) } func (m *UnannotatedSimpleMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_UnannotatedSimpleMessage.Marshal(b, m, deterministic) } -func (dst *UnannotatedSimpleMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_UnannotatedSimpleMessage.Merge(dst, src) +func (m *UnannotatedSimpleMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnannotatedSimpleMessage.Merge(m, src) } func (m *UnannotatedSimpleMessage) XXX_Size() int { return xxx_messageInfo_UnannotatedSimpleMessage.Size(m) @@ -94,6 +94,31 @@ func init() { proto.RegisterType((*UnannotatedSimpleMessage)(nil), "grpc.gateway.examples.examplepb.UnannotatedSimpleMessage") } +func init() { + proto.RegisterFile("examples/proto/examplepb/unannotated_echo_service.proto", fileDescriptor_a57876726ab5dd80) +} + +var fileDescriptor_a57876726ab5dd80 = []byte{ + // 268 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4f, 0xad, 0x48, 0xcc, + 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x72, 0x0b, 0x92, 0xf4, + 0x4b, 0xf3, 0x12, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x52, 0x53, 0xe2, 0x53, 0x93, 0x33, 0xf2, + 0xe3, 0x8b, 0x53, 0x8b, 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x6a, 0x4e, 0x6a, 0x49, 0xea, + 0xc0, 0x38, 0xc2, 0x89, 0x3b, 0x8a, 0x13, 0xae, 0x2a, 0x89, 0x0d, 0x1c, 0x95, 0xc6, 0x80, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x9a, 0xa7, 0x7c, 0x41, 0xa5, 0x02, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -165,6 +190,20 @@ type UnannotatedEchoServiceServer interface { EchoDelete(context.Context, *UnannotatedSimpleMessage) (*UnannotatedSimpleMessage, error) } +// UnimplementedUnannotatedEchoServiceServer can be embedded to have forward compatible implementations. +type UnimplementedUnannotatedEchoServiceServer struct { +} + +func (*UnimplementedUnannotatedEchoServiceServer) Echo(ctx context.Context, req *UnannotatedSimpleMessage) (*UnannotatedSimpleMessage, error) { + return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") +} +func (*UnimplementedUnannotatedEchoServiceServer) EchoBody(ctx context.Context, req *UnannotatedSimpleMessage) (*UnannotatedSimpleMessage, error) { + return nil, status.Errorf(codes.Unimplemented, "method EchoBody not implemented") +} +func (*UnimplementedUnannotatedEchoServiceServer) EchoDelete(ctx context.Context, req *UnannotatedSimpleMessage) (*UnannotatedSimpleMessage, error) { + return nil, status.Errorf(codes.Unimplemented, "method EchoDelete not implemented") +} + func RegisterUnannotatedEchoServiceServer(s *grpc.Server, srv UnannotatedEchoServiceServer) { s.RegisterService(&_UnannotatedEchoService_serviceDesc, srv) } @@ -243,28 +282,3 @@ var _UnannotatedEchoService_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "examples/proto/examplepb/unannotated_echo_service.proto", } - -func init() { - proto.RegisterFile("examples/proto/examplepb/unannotated_echo_service.proto", fileDescriptor_unannotated_echo_service_ca2b904682e29806) -} - -var fileDescriptor_unannotated_echo_service_ca2b904682e29806 = []byte{ - // 268 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08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24, 0x5b, 0x5d, 0x93, 0x33, 0xf2, - 0x83, 0x21, 0xde, 0x12, 0xaa, 0xe1, 0x62, 0x01, 0x71, 0x85, 0x2c, 0xf5, 0x08, 0xf8, 0x4c, 0x0f, - 0x97, 0xb3, 0xa5, 0xc8, 0xd7, 0x2a, 0xd4, 0xc0, 0xc8, 0xc5, 0x01, 0xb2, 0xde, 0x29, 0x3f, 0xa5, - 0x72, 0x80, 0x9c, 0xd0, 0xc4, 0xc8, 0xc5, 0x05, 0x72, 0x82, 0x4b, 0x6a, 0x4e, 0x6a, 0x49, 0xea, - 0xc0, 0x38, 0xc2, 0x89, 0x3b, 0x8a, 0x13, 0xae, 0x2a, 0x89, 0x0d, 0x1c, 0x95, 0xc6, 0x80, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x9a, 0xa7, 0x7c, 0x41, 0xa5, 0x02, 0x00, 0x00, -} diff --git a/examples/proto/examplepb/wrappers.pb.go b/examples/proto/examplepb/wrappers.pb.go index c0a52fe21bc..fa9e68e2d30 100644 --- a/examples/proto/examplepb/wrappers.pb.go +++ b/examples/proto/examplepb/wrappers.pb.go @@ -3,16 +3,17 @@ package examplepb -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import empty "github.com/golang/protobuf/ptypes/empty" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import _ "google.golang.org/genproto/googleapis/api/annotations" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + empty "github.com/golang/protobuf/ptypes/empty" + wrappers "github.com/golang/protobuf/ptypes/wrappers" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -24,7 +25,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Wrappers struct { StringValue *wrappers.StringValue `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` @@ -45,16 +46,17 @@ func (m *Wrappers) Reset() { *m = Wrappers{} } func (m *Wrappers) String() string { return proto.CompactTextString(m) } func (*Wrappers) ProtoMessage() {} func (*Wrappers) Descriptor() ([]byte, []int) { - return fileDescriptor_wrappers_357c0312be7b0bb0, []int{0} + return fileDescriptor_aa1e7ec5682437b9, []int{0} } + func (m *Wrappers) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Wrappers.Unmarshal(m, b) } func (m *Wrappers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Wrappers.Marshal(b, m, deterministic) } -func (dst *Wrappers) XXX_Merge(src proto.Message) { - xxx_messageInfo_Wrappers.Merge(dst, src) +func (m *Wrappers) XXX_Merge(src proto.Message) { + xxx_messageInfo_Wrappers.Merge(m, src) } func (m *Wrappers) XXX_Size() int { return xxx_messageInfo_Wrappers.Size(m) @@ -132,6 +134,51 @@ func init() { proto.RegisterType((*Wrappers)(nil), "grpc.gateway.examples.examplepb.Wrappers") } +func init() { + proto.RegisterFile("examples/proto/examplepb/wrappers.proto", fileDescriptor_aa1e7ec5682437b9) +} + +var fileDescriptor_aa1e7ec5682437b9 = []byte{ + // 578 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0xdd, 0x6e, 0xd3, 0x30, + 0x14, 0xc7, 0xd5, 0x31, 0xca, 0xea, 0x0c, 0xc6, 0x0c, 0x82, 0xcd, 0x9b, 0x18, 0xca, 0x0d, 0xb0, + 0x8b, 0x44, 0x74, 0x55, 0x25, 0x26, 0x24, 0xa4, 0xf2, 0x21, 0x71, 0xcb, 0x34, 0x26, 0x71,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a, 0xa3, 0xbb, 0xc6, 0xab, 0xbe, 0x20, 0x0c, + 0x75, 0x3d, 0x81, 0x44, 0x7f, 0x47, 0x1b, 0x61, 0xff, 0xb6, 0x33, 0xd2, 0xda, 0xaa, 0x8f, 0xbb, + 0x3a, 0x68, 0x3e, 0x08, 0x24, 0x5e, 0xeb, 0x33, 0x9d, 0xb4, 0x7c, 0xea, 0x61, 0xc1, 0xd0, 0x24, + 0x11, 0x48, 0xec, 0xfa, 0x68, 0xad, 0x75, 0x47, 0x8d, 0xa9, 0xc2, 0xe0, 0xcc, 0x11, 0x50, 0xed, + 0xde, 0x91, 0x11, 0x95, 0x17, 0x43, 0x5b, 0xc6, 0xab, 0x1a, 0x41, 0x0c, 0x8c, 0x27, 0x01, 0x34, + 0xff, 0xa1, 0x76, 0xd9, 0xf6, 0x37, 0x9d, 0x8b, 0x92, 0x5a, 0xe7, 0x69, 0x4c, 0x2a, 0x06, 0xe7, + 0x98, 0x80, 0x6a, 0xf7, 0x3c, 0xa7, 0xb1, 0xeb, 0x85, 0x96, 0x97, 0x6b, 0x06, 0x70, 0xe4, 0x09, + 0xa8, 0x5e, 0xef, 0xb5, 0xd2, 0x0f, 0xf5, 0x03, 0x80, 0xa1, 0xd7, 0x81, 0x40, 0x62, 0xb7, 0x1f, + 0xb4, 0xa6, 0x7c, 0xce, 0x90, 0x67, 0x7c, 0xde, 0xaa, 0x7f, 0x28, 0xfc, 0xa0, 0x93, 0x45, 0x7f, + 0x27, 0x3d, 0xdf, 0xbb, 0x89, 0xf5, 0xe7, 0xe3, 0xc1, 0xe1, 0xcc, 0xfb, 0x34, 0xaa, 0xde, 0x10, + 0x36, 0xd4, 0xd8, 0xd1, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x05, 0x83, 0xaf, 0x71, 0xa0, 0x07, + 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -279,6 +326,44 @@ type WrappersServiceServer interface { CreateEmpty(context.Context, *empty.Empty) (*empty.Empty, error) } +// UnimplementedWrappersServiceServer can be embedded to have forward compatible implementations. +type UnimplementedWrappersServiceServer struct { +} + +func (*UnimplementedWrappersServiceServer) Create(ctx context.Context, req *Wrappers) (*Wrappers, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") +} +func (*UnimplementedWrappersServiceServer) CreateStringValue(ctx context.Context, req *wrappers.StringValue) (*wrappers.StringValue, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateStringValue not implemented") +} +func (*UnimplementedWrappersServiceServer) CreateInt32Value(ctx context.Context, req *wrappers.Int32Value) (*wrappers.Int32Value, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateInt32Value not implemented") +} +func (*UnimplementedWrappersServiceServer) CreateInt64Value(ctx context.Context, req *wrappers.Int64Value) (*wrappers.Int64Value, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateInt64Value not implemented") +} +func (*UnimplementedWrappersServiceServer) CreateFloatValue(ctx context.Context, req *wrappers.FloatValue) (*wrappers.FloatValue, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateFloatValue not implemented") +} +func (*UnimplementedWrappersServiceServer) CreateDoubleValue(ctx context.Context, req *wrappers.DoubleValue) (*wrappers.DoubleValue, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateDoubleValue not implemented") +} +func (*UnimplementedWrappersServiceServer) CreateBoolValue(ctx context.Context, req *wrappers.BoolValue) (*wrappers.BoolValue, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBoolValue not implemented") +} +func (*UnimplementedWrappersServiceServer) CreateUInt32Value(ctx context.Context, req *wrappers.UInt32Value) (*wrappers.UInt32Value, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateUInt32Value not implemented") +} +func (*UnimplementedWrappersServiceServer) CreateUInt64Value(ctx context.Context, req *wrappers.UInt64Value) (*wrappers.UInt64Value, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateUInt64Value not implemented") +} +func (*UnimplementedWrappersServiceServer) CreateBytesValue(ctx context.Context, req *wrappers.BytesValue) (*wrappers.BytesValue, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBytesValue not implemented") +} +func (*UnimplementedWrappersServiceServer) CreateEmpty(ctx context.Context, req *empty.Empty) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateEmpty not implemented") +} + func RegisterWrappersServiceServer(s *grpc.Server, srv WrappersServiceServer) { s.RegisterService(&_WrappersService_serviceDesc, srv) } @@ -533,48 +618,3 @@ var _WrappersService_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "examples/proto/examplepb/wrappers.proto", } - -func init() { - proto.RegisterFile("examples/proto/examplepb/wrappers.proto", fileDescriptor_wrappers_357c0312be7b0bb0) -} - -var fileDescriptor_wrappers_357c0312be7b0bb0 = []byte{ - // 578 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0xdd, 0x6e, 0xd3, 0x30, - 0x14, 0xc7, 0xd5, 0x31, 0xca, 0xea, 0x0c, 0xc6, 0x0c, 0x82, 0xcd, 0x9b, 0x18, 0xca, 0x0d, 0xb0, - 0x8b, 0x44, 0x74, 0x55, 0x25, 0x26, 0x24, 0xa4, 0xf2, 0x21, 0x71, 0xcb, 0x34, 0x26, 0x71, 0x83, - 0xec, 0xcd, 0x8d, 0x82, 0xb2, 0x38, 0x4a, 0x9c, 0x8e, 0x5e, 0x21, 0xf1, 0x0a, 0x3c, 0x00, 0xcf, - 0xc2, 0x33, 0xf0, 0x0a, 0x3c, 0x08, 0xf2, 0x57, 0x3e, 0x9a, 0xe5, 0xc0, 0x9d, 0x9d, 0xff, 0xf9, - 0x9d, 0x7f, 0x7d, 0x7c, 0x8e, 0x8b, 0x9e, 0xf0, 0xaf, 0xf4, 0x32, 0x4b, 0x78, 0x11, 0x66, 0xb9, - 0x90, 0x22, 0xb4, 0xd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0xed, - 0xde, 0x91, 0x11, 0x95, 0x17, 0x43, 0x5b, 0xc6, 0xab, 0x1a, 0x41, 0x0c, 0x8c, 0x27, 0x01, 0x34, - 0xff, 0xa1, 0x76, 0xd9, 0xf6, 0x37, 0x9d, 0x8b, 0x92, 0x5a, 0xe7, 0x69, 0x4c, 0x2a, 0x06, 0xe7, - 0x98, 0x80, 0x6a, 0xf7, 0x3c, 0xa7, 0xb1, 0xeb, 0x85, 0x96, 0x97, 0x6b, 0x06, 0x70, 0xe4, 0x09, - 0xa8, 0x5e, 0xef, 0xb5, 0xd2, 0x0f, 0xf5, 0x03, 0x80, 0xa1, 0xd7, 0x81, 0x40, 0x62, 0xb7, 0x1f, - 0xb4, 0xa6, 0x7c, 0xce, 0x90, 0x67, 0x7c, 0xde, 0xaa, 0x7f, 0x28, 0xfc, 0xa0, 0x93, 0x45, 0x7f, - 0x27, 0x3d, 0xdf, 0xbb, 0x89, 0xf5, 0xe7, 0xe3, 0xc1, 0xe1, 0xcc, 0xfb, 0x34, 0xaa, 0xde, 0x10, - 0x36, 0xd4, 0xd8, 0xd1, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x05, 0x83, 0xaf, 0x71, 0xa0, 0x07, - 0x00, 0x00, -} diff --git a/examples/proto/pathenum/path_enum.pb.go b/examples/proto/pathenum/path_enum.pb.go index a3daa1953d4..2a2e6a5e96e 100644 --- a/examples/proto/pathenum/path_enum.pb.go +++ b/examples/proto/pathenum/path_enum.pb.go @@ -1,11 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: examples/proto/pathenum/path_enum.proto -package pathenum // import "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" +package pathenum -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type PathEnum int32 @@ -29,6 +31,7 @@ var PathEnum_name = map[int32]string{ 0: "ABC", 1: "DEF", } + var PathEnum_value = map[string]int32{ "ABC": 0, "DEF": 1, @@ -37,8 +40,9 @@ var PathEnum_value = map[string]int32{ func (x PathEnum) String() string { return proto.EnumName(PathEnum_name, int32(x)) } + func (PathEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_path_enum_802d5f52757a97bd, []int{0} + return fileDescriptor_dfe1d80fc8dac3c4, []int{0} } type MessagePathEnum_NestedPathEnum int32 @@ -52,6 +56,7 @@ var MessagePathEnum_NestedPathEnum_name = map[int32]string{ 0: "GHI", 1: "JKL", } + var MessagePathEnum_NestedPathEnum_value = map[string]int32{ "GHI": 0, "JKL": 1, @@ -60,8 +65,9 @@ var MessagePathEnum_NestedPathEnum_value = map[string]int32{ func (x MessagePathEnum_NestedPathEnum) String() string { return proto.EnumName(MessagePathEnum_NestedPathEnum_name, int32(x)) } + func (MessagePathEnum_NestedPathEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_path_enum_802d5f52757a97bd, []int{0, 0} + return fileDescriptor_dfe1d80fc8dac3c4, []int{0, 0} } type MessagePathEnum struct { @@ -74,16 +80,17 @@ func (m *MessagePathEnum) Reset() { *m = MessagePathEnum{} } func (m *MessagePathEnum) String() string { return proto.CompactTextString(m) } func (*MessagePathEnum) ProtoMessage() {} func (*MessagePathEnum) Descriptor() ([]byte, []int) { - return fileDescriptor_path_enum_802d5f52757a97bd, []int{0} + return fileDescriptor_dfe1d80fc8dac3c4, []int{0} } + func (m *MessagePathEnum) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessagePathEnum.Unmarshal(m, b) } func (m *MessagePathEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MessagePathEnum.Marshal(b, m, deterministic) } -func (dst *MessagePathEnum) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessagePathEnum.Merge(dst, src) +func (m *MessagePathEnum) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessagePathEnum.Merge(m, src) } func (m *MessagePathEnum) XXX_Size() int { return xxx_messageInfo_MessagePathEnum.Size(m) @@ -95,16 +102,16 @@ func (m *MessagePathEnum) XXX_DiscardUnknown() { var xxx_messageInfo_MessagePathEnum proto.InternalMessageInfo func init() { - proto.RegisterType((*MessagePathEnum)(nil), "grpc.gateway.examples.pathenum.MessagePathEnum") proto.RegisterEnum("grpc.gateway.examples.pathenum.PathEnum", PathEnum_name, PathEnum_value) proto.RegisterEnum("grpc.gateway.examples.pathenum.MessagePathEnum_NestedPathEnum", MessagePathEnum_NestedPathEnum_name, MessagePathEnum_NestedPathEnum_value) + proto.RegisterType((*MessagePathEnum)(nil), "grpc.gateway.examples.pathenum.MessagePathEnum") } func init() { - proto.RegisterFile("examples/proto/pathenum/path_enum.proto", fileDescriptor_path_enum_802d5f52757a97bd) + proto.RegisterFile("examples/proto/pathenum/path_enum.proto", fileDescriptor_dfe1d80fc8dac3c4) } -var fileDescriptor_path_enum_802d5f52757a97bd = []byte{ +var fileDescriptor_dfe1d80fc8dac3c4 = []byte{ // 175 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4f, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x48, 0x2c, 0xc9, 0x48, diff --git a/examples/proto/sub/message.pb.go b/examples/proto/sub/message.pb.go index cc5381674f7..093f92acf00 100644 --- a/examples/proto/sub/message.pb.go +++ b/examples/proto/sub/message.pb.go @@ -3,9 +3,11 @@ package sub -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type StringMessage struct { Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` @@ -29,16 +31,17 @@ func (m *StringMessage) Reset() { *m = StringMessage{} } func (m *StringMessage) String() string { return proto.CompactTextString(m) } func (*StringMessage) ProtoMessage() {} func (*StringMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_message_6a35c3d524a65df7, []int{0} + return fileDescriptor_fcc527d41fdbced2, []int{0} } + func (m *StringMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StringMessage.Unmarshal(m, b) } func (m *StringMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StringMessage.Marshal(b, m, deterministic) } -func (dst *StringMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_StringMessage.Merge(dst, src) +func (m *StringMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_StringMessage.Merge(m, src) } func (m *StringMessage) XXX_Size() int { return xxx_messageInfo_StringMessage.Size(m) @@ -60,11 +63,9 @@ func init() { proto.RegisterType((*StringMessage)(nil), "grpc.gateway.examples.sub.StringMessage") } -func init() { - proto.RegisterFile("examples/proto/sub/message.proto", fileDescriptor_message_6a35c3d524a65df7) -} +func init() { proto.RegisterFile("examples/proto/sub/message.proto", fileDescriptor_fcc527d41fdbced2) } -var fileDescriptor_message_6a35c3d524a65df7 = []byte{ +var fileDescriptor_fcc527d41fdbced2 = []byte{ // 114 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x2e, 0x4d, 0xd2, 0xcf, diff --git a/examples/proto/sub2/message.pb.go b/examples/proto/sub2/message.pb.go index 586c6440b98..afda91bd768 100644 --- a/examples/proto/sub2/message.pb.go +++ b/examples/proto/sub2/message.pb.go @@ -1,11 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: examples/proto/sub2/message.proto -package sub2 // import "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" +package sub2 -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type IdMessage struct { Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` @@ -29,16 +31,17 @@ func (m *IdMessage) Reset() { *m = IdMessage{} } func (m *IdMessage) String() string { return proto.CompactTextString(m) } func (*IdMessage) ProtoMessage() {} func (*IdMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_message_9619dbc3ad374621, []int{0} + return fileDescriptor_3490899b8414eb79, []int{0} } + func (m *IdMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IdMessage.Unmarshal(m, b) } func (m *IdMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_IdMessage.Marshal(b, m, deterministic) } -func (dst *IdMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_IdMessage.Merge(dst, src) +func (m *IdMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_IdMessage.Merge(m, src) } func (m *IdMessage) XXX_Size() int { return xxx_messageInfo_IdMessage.Size(m) @@ -60,11 +63,9 @@ func init() { proto.RegisterType((*IdMessage)(nil), "sub2.IdMessage") } -func init() { - proto.RegisterFile("examples/proto/sub2/message.proto", fileDescriptor_message_9619dbc3ad374621) -} +func init() { proto.RegisterFile("examples/proto/sub2/message.proto", fileDescriptor_3490899b8414eb79) } -var fileDescriptor_message_9619dbc3ad374621 = []byte{ +var fileDescriptor_3490899b8414eb79 = []byte{ // 130 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, diff --git a/go.mod b/go.mod index c83df465786..73fe8d8d48b 100644 --- a/go.mod +++ b/go.mod @@ -1,18 +1,15 @@ module github.com/grpc-ecosystem/grpc-gateway +go 1.13 + require ( github.com/ghodss/yaml v1.0.0 + github.com/go-resty/resty v1.8.0 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b - github.com/golang/protobuf v1.2.0 - github.com/kr/pretty v0.1.0 // indirect - github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af - golang.org/x/net v0.0.0-20181220203305-927f97764cc3 - golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect - google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 - google.golang.org/grpc v1.19.0 - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect - gopkg.in/resty.v1 v1.12.0 - gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 // indirect + github.com/golang/protobuf v1.3.2 + github.com/rogpeppe/fastuuid v1.2.0 + golang.org/x/net v0.0.0-20191002035440-2ec189313ef0 + google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c + google.golang.org/grpc v1.24.0 + gopkg.in/yaml.v2 v2.2.3 // indirect ) - -go 1.13 diff --git a/go.sum b/go.sum index 186bc4101fc..50fdb09d1b5 100644 --- a/go.sum +++ b/go.sum @@ -3,40 +3,53 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-resty/resty v1.8.0 h1:vbNCxbHOWCototzwxf3L63PQCKx6xgT6v8SHfoqkp6U= +github.com/go-resty/resty v1.8.0/go.mod h1:n37daLLGIHq2FFYHxg+FYQiwA95FpfNI+A9uxoIYGRk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3 h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0 h1:2mqDk8w/o6UmeUCu5Qiq2y7iMf6anbx+YA8d1JFoFrs= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 h1:YoY1wS6JYVRpIfFngRf2HHo9R9dAne3xbkGOQ5rJXjU= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= +google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c h1:hrpEMCZ2O7DR5gC1n2AJGVhrwiEjOi35+jxtIuZpTMo= +google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 h1:+t9dhfO+GNOIGJof6kPOAenx7YgrZMTdRPV+EsnPabk= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.3 h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/stream_chunk.pb.go b/internal/stream_chunk.pb.go index 8858f069046..1eca68e3350 100644 --- a/internal/stream_chunk.pb.go +++ b/internal/stream_chunk.pb.go @@ -3,10 +3,12 @@ package internal -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import any "github.com/golang/protobuf/ptypes/any" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + any "github.com/golang/protobuf/ptypes/any" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -17,7 +19,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // StreamError is a response type which is returned when // streaming rpc returns an error. @@ -36,16 +38,17 @@ func (m *StreamError) Reset() { *m = StreamError{} } func (m *StreamError) String() string { return proto.CompactTextString(m) } func (*StreamError) ProtoMessage() {} func (*StreamError) Descriptor() ([]byte, []int) { - return fileDescriptor_stream_chunk_a2afb657504565d7, []int{0} + return fileDescriptor_9d15b670e96bbb5a, []int{0} } + func (m *StreamError) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamError.Unmarshal(m, b) } func (m *StreamError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamError.Marshal(b, m, deterministic) } -func (dst *StreamError) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamError.Merge(dst, src) +func (m *StreamError) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamError.Merge(m, src) } func (m *StreamError) XXX_Size() int { return xxx_messageInfo_StreamError.Size(m) @@ -95,11 +98,9 @@ func init() { proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError") } -func init() { - proto.RegisterFile("internal/stream_chunk.proto", fileDescriptor_stream_chunk_a2afb657504565d7) -} +func init() { proto.RegisterFile("internal/stream_chunk.proto", fileDescriptor_9d15b670e96bbb5a) } -var fileDescriptor_stream_chunk_a2afb657504565d7 = []byte{ +var fileDescriptor_9d15b670e96bbb5a = []byte{ // 223 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x41, 0x4e, 0xc3, 0x30, 0x10, 0x45, 0x15, 0x4a, 0x69, 0x3b, 0xd9, 0x45, 0x5d, 0x18, 0xba, 0x20, 0x62, 0x95, 0x95, 0x23, diff --git a/protoc-gen-swagger/options/annotations.pb.go b/protoc-gen-swagger/options/annotations.pb.go index 9fc282bb7bd..851af51231a 100644 --- a/protoc-gen-swagger/options/annotations.pb.go +++ b/protoc-gen-swagger/options/annotations.pb.go @@ -1,12 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: protoc-gen-swagger/options/annotations.proto -package options // import "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" +package options -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -17,14 +19,14 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package var E_Openapiv2Swagger = &proto.ExtensionDesc{ ExtendedType: (*descriptor.FileOptions)(nil), ExtensionType: (*Swagger)(nil), Field: 1042, Name: "grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger", - Tag: "bytes,1042,opt,name=openapiv2_swagger,json=openapiv2Swagger", + Tag: "bytes,1042,opt,name=openapiv2_swagger", Filename: "protoc-gen-swagger/options/annotations.proto", } @@ -33,7 +35,7 @@ var E_Openapiv2Operation = &proto.ExtensionDesc{ ExtensionType: (*Operation)(nil), Field: 1042, Name: "grpc.gateway.protoc_gen_swagger.options.openapiv2_operation", - Tag: "bytes,1042,opt,name=openapiv2_operation,json=openapiv2Operation", + Tag: "bytes,1042,opt,name=openapiv2_operation", Filename: "protoc-gen-swagger/options/annotations.proto", } @@ -42,7 +44,7 @@ var E_Openapiv2Schema = &proto.ExtensionDesc{ ExtensionType: (*Schema)(nil), Field: 1042, Name: "grpc.gateway.protoc_gen_swagger.options.openapiv2_schema", - Tag: "bytes,1042,opt,name=openapiv2_schema,json=openapiv2Schema", + Tag: "bytes,1042,opt,name=openapiv2_schema", Filename: "protoc-gen-swagger/options/annotations.proto", } @@ -51,7 +53,7 @@ var E_Openapiv2Tag = &proto.ExtensionDesc{ ExtensionType: (*Tag)(nil), Field: 1042, Name: "grpc.gateway.protoc_gen_swagger.options.openapiv2_tag", - Tag: "bytes,1042,opt,name=openapiv2_tag,json=openapiv2Tag", + Tag: "bytes,1042,opt,name=openapiv2_tag", Filename: "protoc-gen-swagger/options/annotations.proto", } @@ -60,7 +62,7 @@ var E_Openapiv2Field = &proto.ExtensionDesc{ ExtensionType: (*JSONSchema)(nil), Field: 1042, Name: "grpc.gateway.protoc_gen_swagger.options.openapiv2_field", - Tag: "bytes,1042,opt,name=openapiv2_field,json=openapiv2Field", + Tag: "bytes,1042,opt,name=openapiv2_field", Filename: "protoc-gen-swagger/options/annotations.proto", } @@ -73,10 +75,10 @@ func init() { } func init() { - proto.RegisterFile("protoc-gen-swagger/options/annotations.proto", fileDescriptor_annotations_8378bd63c2853a5a) + proto.RegisterFile("protoc-gen-swagger/options/annotations.proto", fileDescriptor_a6a34ca6badab664) } -var fileDescriptor_annotations_8378bd63c2853a5a = []byte{ +var fileDescriptor_a6a34ca6badab664 = []byte{ // 346 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x4f, 0xea, 0x40, 0x14, 0xc5, 0xc3, 0xe6, 0xe5, 0xa5, 0xef, 0xa9, 0x58, 0x37, 0x86, 0xf8, 0x87, 0x9d, 0xc6, 0xc0, diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index 6720071bde0..727ca52783c 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -1,13 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: protoc-gen-swagger/options/openapiv2.proto -package options // import "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import any "github.com/golang/protobuf/ptypes/any" -import _struct "github.com/golang/protobuf/ptypes/struct" +package options + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + any "github.com/golang/protobuf/ptypes/any" + _struct "github.com/golang/protobuf/ptypes/struct" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -18,7 +20,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Swagger_SwaggerScheme int32 @@ -37,6 +39,7 @@ var Swagger_SwaggerScheme_name = map[int32]string{ 3: "WS", 4: "WSS", } + var Swagger_SwaggerScheme_value = map[string]int32{ "UNKNOWN": 0, "HTTP": 1, @@ -48,8 +51,9 @@ var Swagger_SwaggerScheme_value = map[string]int32{ func (x Swagger_SwaggerScheme) String() string { return proto.EnumName(Swagger_SwaggerScheme_name, int32(x)) } + func (Swagger_SwaggerScheme) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{0, 0} + return fileDescriptor_ba35ad8af024fb48, []int{0, 0} } type JSONSchema_JSONSchemaSimpleTypes int32 @@ -75,6 +79,7 @@ var JSONSchema_JSONSchemaSimpleTypes_name = map[int32]string{ 6: "OBJECT", 7: "STRING", } + var JSONSchema_JSONSchemaSimpleTypes_value = map[string]int32{ "UNKNOWN": 0, "ARRAY": 1, @@ -89,8 +94,9 @@ var JSONSchema_JSONSchemaSimpleTypes_value = map[string]int32{ func (x JSONSchema_JSONSchemaSimpleTypes) String() string { return proto.EnumName(JSONSchema_JSONSchemaSimpleTypes_name, int32(x)) } + func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{8, 0} + return fileDescriptor_ba35ad8af024fb48, []int{8, 0} } // Required. The type of the security scheme. Valid values are "basic", @@ -110,6 +116,7 @@ var SecurityScheme_Type_name = map[int32]string{ 2: "TYPE_API_KEY", 3: "TYPE_OAUTH2", } + var SecurityScheme_Type_value = map[string]int32{ "TYPE_INVALID": 0, "TYPE_BASIC": 1, @@ -120,8 +127,9 @@ var SecurityScheme_Type_value = map[string]int32{ func (x SecurityScheme_Type) String() string { return proto.EnumName(SecurityScheme_Type_name, int32(x)) } + func (SecurityScheme_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{11, 0} + return fileDescriptor_ba35ad8af024fb48, []int{11, 0} } // Required. The location of the API key. Valid values are "query" or "header". @@ -138,6 +146,7 @@ var SecurityScheme_In_name = map[int32]string{ 1: "IN_QUERY", 2: "IN_HEADER", } + var SecurityScheme_In_value = map[string]int32{ "IN_INVALID": 0, "IN_QUERY": 1, @@ -147,8 +156,9 @@ var SecurityScheme_In_value = map[string]int32{ func (x SecurityScheme_In) String() string { return proto.EnumName(SecurityScheme_In_name, int32(x)) } + func (SecurityScheme_In) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{11, 1} + return fileDescriptor_ba35ad8af024fb48, []int{11, 1} } // Required. The flow used by the OAuth2 security scheme. Valid values are @@ -170,6 +180,7 @@ var SecurityScheme_Flow_name = map[int32]string{ 3: "FLOW_APPLICATION", 4: "FLOW_ACCESS_CODE", } + var SecurityScheme_Flow_value = map[string]int32{ "FLOW_INVALID": 0, "FLOW_IMPLICIT": 1, @@ -181,8 +192,9 @@ var SecurityScheme_Flow_value = map[string]int32{ func (x SecurityScheme_Flow) String() string { return proto.EnumName(SecurityScheme_Flow_name, int32(x)) } + func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{11, 2} + return fileDescriptor_ba35ad8af024fb48, []int{11, 2} } // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. @@ -218,16 +230,17 @@ func (m *Swagger) Reset() { *m = Swagger{} } func (m *Swagger) String() string { return proto.CompactTextString(m) } func (*Swagger) ProtoMessage() {} func (*Swagger) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{0} + return fileDescriptor_ba35ad8af024fb48, []int{0} } + func (m *Swagger) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Swagger.Unmarshal(m, b) } func (m *Swagger) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Swagger.Marshal(b, m, deterministic) } -func (dst *Swagger) XXX_Merge(src proto.Message) { - xxx_messageInfo_Swagger.Merge(dst, src) +func (m *Swagger) XXX_Merge(src proto.Message) { + xxx_messageInfo_Swagger.Merge(m, src) } func (m *Swagger) XXX_Size() int { return xxx_messageInfo_Swagger.Size(m) @@ -349,16 +362,17 @@ func (m *Operation) Reset() { *m = Operation{} } func (m *Operation) String() string { return proto.CompactTextString(m) } func (*Operation) ProtoMessage() {} func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{1} + return fileDescriptor_ba35ad8af024fb48, []int{1} } + func (m *Operation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Operation.Unmarshal(m, b) } func (m *Operation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Operation.Marshal(b, m, deterministic) } -func (dst *Operation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Operation.Merge(dst, src) +func (m *Operation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Operation.Merge(m, src) } func (m *Operation) XXX_Size() int { return xxx_messageInfo_Operation.Size(m) @@ -474,16 +488,17 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{2} + return fileDescriptor_ba35ad8af024fb48, []int{2} } + func (m *Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Response.Unmarshal(m, b) } func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Response.Marshal(b, m, deterministic) } -func (dst *Response) XXX_Merge(src proto.Message) { - xxx_messageInfo_Response.Merge(dst, src) +func (m *Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_Response.Merge(m, src) } func (m *Response) XXX_Size() int { return xxx_messageInfo_Response.Size(m) @@ -537,16 +552,17 @@ func (m *Info) Reset() { *m = Info{} } func (m *Info) String() string { return proto.CompactTextString(m) } func (*Info) ProtoMessage() {} func (*Info) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{3} + return fileDescriptor_ba35ad8af024fb48, []int{3} } + func (m *Info) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Info.Unmarshal(m, b) } func (m *Info) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Info.Marshal(b, m, deterministic) } -func (dst *Info) XXX_Merge(src proto.Message) { - xxx_messageInfo_Info.Merge(dst, src) +func (m *Info) XXX_Merge(src proto.Message) { + xxx_messageInfo_Info.Merge(m, src) } func (m *Info) XXX_Size() int { return xxx_messageInfo_Info.Size(m) @@ -624,16 +640,17 @@ func (m *Contact) Reset() { *m = Contact{} } func (m *Contact) String() string { return proto.CompactTextString(m) } func (*Contact) ProtoMessage() {} func (*Contact) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{4} + return fileDescriptor_ba35ad8af024fb48, []int{4} } + func (m *Contact) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Contact.Unmarshal(m, b) } func (m *Contact) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Contact.Marshal(b, m, deterministic) } -func (dst *Contact) XXX_Merge(src proto.Message) { - xxx_messageInfo_Contact.Merge(dst, src) +func (m *Contact) XXX_Merge(src proto.Message) { + xxx_messageInfo_Contact.Merge(m, src) } func (m *Contact) XXX_Size() int { return xxx_messageInfo_Contact.Size(m) @@ -683,16 +700,17 @@ func (m *License) Reset() { *m = License{} } func (m *License) String() string { return proto.CompactTextString(m) } func (*License) ProtoMessage() {} func (*License) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{5} + return fileDescriptor_ba35ad8af024fb48, []int{5} } + func (m *License) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_License.Unmarshal(m, b) } func (m *License) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_License.Marshal(b, m, deterministic) } -func (dst *License) XXX_Merge(src proto.Message) { - xxx_messageInfo_License.Merge(dst, src) +func (m *License) XXX_Merge(src proto.Message) { + xxx_messageInfo_License.Merge(m, src) } func (m *License) XXX_Size() int { return xxx_messageInfo_License.Size(m) @@ -735,16 +753,17 @@ func (m *ExternalDocumentation) Reset() { *m = ExternalDocumentation{} } func (m *ExternalDocumentation) String() string { return proto.CompactTextString(m) } func (*ExternalDocumentation) ProtoMessage() {} func (*ExternalDocumentation) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{6} + return fileDescriptor_ba35ad8af024fb48, []int{6} } + func (m *ExternalDocumentation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExternalDocumentation.Unmarshal(m, b) } func (m *ExternalDocumentation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ExternalDocumentation.Marshal(b, m, deterministic) } -func (dst *ExternalDocumentation) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExternalDocumentation.Merge(dst, src) +func (m *ExternalDocumentation) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExternalDocumentation.Merge(m, src) } func (m *ExternalDocumentation) XXX_Size() int { return xxx_messageInfo_ExternalDocumentation.Size(m) @@ -789,16 +808,17 @@ func (m *Schema) Reset() { *m = Schema{} } func (m *Schema) String() string { return proto.CompactTextString(m) } func (*Schema) ProtoMessage() {} func (*Schema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{7} + return fileDescriptor_ba35ad8af024fb48, []int{7} } + func (m *Schema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Schema.Unmarshal(m, b) } func (m *Schema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Schema.Marshal(b, m, deterministic) } -func (dst *Schema) XXX_Merge(src proto.Message) { - xxx_messageInfo_Schema.Merge(dst, src) +func (m *Schema) XXX_Merge(src proto.Message) { + xxx_messageInfo_Schema.Merge(m, src) } func (m *Schema) XXX_Size() int { return xxx_messageInfo_Schema.Size(m) @@ -893,16 +913,17 @@ func (m *JSONSchema) Reset() { *m = JSONSchema{} } func (m *JSONSchema) String() string { return proto.CompactTextString(m) } func (*JSONSchema) ProtoMessage() {} func (*JSONSchema) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{8} + return fileDescriptor_ba35ad8af024fb48, []int{8} } + func (m *JSONSchema) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JSONSchema.Unmarshal(m, b) } func (m *JSONSchema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_JSONSchema.Marshal(b, m, deterministic) } -func (dst *JSONSchema) XXX_Merge(src proto.Message) { - xxx_messageInfo_JSONSchema.Merge(dst, src) +func (m *JSONSchema) XXX_Merge(src proto.Message) { + xxx_messageInfo_JSONSchema.Merge(m, src) } func (m *JSONSchema) XXX_Size() int { return xxx_messageInfo_JSONSchema.Size(m) @@ -1079,16 +1100,17 @@ func (m *Tag) Reset() { *m = Tag{} } func (m *Tag) String() string { return proto.CompactTextString(m) } func (*Tag) ProtoMessage() {} func (*Tag) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{9} + return fileDescriptor_ba35ad8af024fb48, []int{9} } + func (m *Tag) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Tag.Unmarshal(m, b) } func (m *Tag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Tag.Marshal(b, m, deterministic) } -func (dst *Tag) XXX_Merge(src proto.Message) { - xxx_messageInfo_Tag.Merge(dst, src) +func (m *Tag) XXX_Merge(src proto.Message) { + xxx_messageInfo_Tag.Merge(m, src) } func (m *Tag) XXX_Size() int { return xxx_messageInfo_Tag.Size(m) @@ -1133,16 +1155,17 @@ func (m *SecurityDefinitions) Reset() { *m = SecurityDefinitions{} } func (m *SecurityDefinitions) String() string { return proto.CompactTextString(m) } func (*SecurityDefinitions) ProtoMessage() {} func (*SecurityDefinitions) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{10} + return fileDescriptor_ba35ad8af024fb48, []int{10} } + func (m *SecurityDefinitions) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityDefinitions.Unmarshal(m, b) } func (m *SecurityDefinitions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SecurityDefinitions.Marshal(b, m, deterministic) } -func (dst *SecurityDefinitions) XXX_Merge(src proto.Message) { - xxx_messageInfo_SecurityDefinitions.Merge(dst, src) +func (m *SecurityDefinitions) XXX_Merge(src proto.Message) { + xxx_messageInfo_SecurityDefinitions.Merge(m, src) } func (m *SecurityDefinitions) XXX_Size() int { return xxx_messageInfo_SecurityDefinitions.Size(m) @@ -1212,16 +1235,17 @@ func (m *SecurityScheme) Reset() { *m = SecurityScheme{} } func (m *SecurityScheme) String() string { return proto.CompactTextString(m) } func (*SecurityScheme) ProtoMessage() {} func (*SecurityScheme) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{11} + return fileDescriptor_ba35ad8af024fb48, []int{11} } + func (m *SecurityScheme) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityScheme.Unmarshal(m, b) } func (m *SecurityScheme) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SecurityScheme.Marshal(b, m, deterministic) } -func (dst *SecurityScheme) XXX_Merge(src proto.Message) { - xxx_messageInfo_SecurityScheme.Merge(dst, src) +func (m *SecurityScheme) XXX_Merge(src proto.Message) { + xxx_messageInfo_SecurityScheme.Merge(m, src) } func (m *SecurityScheme) XXX_Size() int { return xxx_messageInfo_SecurityScheme.Size(m) @@ -1321,16 +1345,17 @@ func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} } func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) } func (*SecurityRequirement) ProtoMessage() {} func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{12} + return fileDescriptor_ba35ad8af024fb48, []int{12} } + func (m *SecurityRequirement) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement.Unmarshal(m, b) } func (m *SecurityRequirement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SecurityRequirement.Marshal(b, m, deterministic) } -func (dst *SecurityRequirement) XXX_Merge(src proto.Message) { - xxx_messageInfo_SecurityRequirement.Merge(dst, src) +func (m *SecurityRequirement) XXX_Merge(src proto.Message) { + xxx_messageInfo_SecurityRequirement.Merge(m, src) } func (m *SecurityRequirement) XXX_Size() int { return xxx_messageInfo_SecurityRequirement.Size(m) @@ -1366,16 +1391,17 @@ func (m *SecurityRequirement_SecurityRequirementValue) String() string { } func (*SecurityRequirement_SecurityRequirementValue) ProtoMessage() {} func (*SecurityRequirement_SecurityRequirementValue) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{12, 0} + return fileDescriptor_ba35ad8af024fb48, []int{12, 0} } + func (m *SecurityRequirement_SecurityRequirementValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Unmarshal(m, b) } func (m *SecurityRequirement_SecurityRequirementValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Marshal(b, m, deterministic) } -func (dst *SecurityRequirement_SecurityRequirementValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Merge(dst, src) +func (m *SecurityRequirement_SecurityRequirementValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Merge(m, src) } func (m *SecurityRequirement_SecurityRequirementValue) XXX_Size() int { return xxx_messageInfo_SecurityRequirement_SecurityRequirementValue.Size(m) @@ -1411,16 +1437,17 @@ func (m *Scopes) Reset() { *m = Scopes{} } func (m *Scopes) String() string { return proto.CompactTextString(m) } func (*Scopes) ProtoMessage() {} func (*Scopes) Descriptor() ([]byte, []int) { - return fileDescriptor_openapiv2_7182f700aabb5117, []int{13} + return fileDescriptor_ba35ad8af024fb48, []int{13} } + func (m *Scopes) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Scopes.Unmarshal(m, b) } func (m *Scopes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Scopes.Marshal(b, m, deterministic) } -func (dst *Scopes) XXX_Merge(src proto.Message) { - xxx_messageInfo_Scopes.Merge(dst, src) +func (m *Scopes) XXX_Merge(src proto.Message) { + xxx_messageInfo_Scopes.Merge(m, src) } func (m *Scopes) XXX_Size() int { return xxx_messageInfo_Scopes.Size(m) @@ -1439,6 +1466,11 @@ func (m *Scopes) GetScope() map[string]string { } func init() { + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme", Swagger_SwaggerScheme_name, Swagger_SwaggerScheme_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.JSONSchema_JSONSchemaSimpleTypes", JSONSchema_JSONSchemaSimpleTypes_name, JSONSchema_JSONSchemaSimpleTypes_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Type", SecurityScheme_Type_name, SecurityScheme_Type_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_In", SecurityScheme_In_name, SecurityScheme_In_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Flow", SecurityScheme_Flow_name, SecurityScheme_Flow_value) proto.RegisterType((*Swagger)(nil), "grpc.gateway.protoc_gen_swagger.options.Swagger") proto.RegisterMapType((map[string]*_struct.Value)(nil), "grpc.gateway.protoc_gen_swagger.options.Swagger.ExtensionsEntry") proto.RegisterMapType((map[string]*Response)(nil), "grpc.gateway.protoc_gen_swagger.options.Swagger.ResponsesEntry") @@ -1464,18 +1496,13 @@ func init() { proto.RegisterType((*SecurityRequirement_SecurityRequirementValue)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityRequirement.SecurityRequirementValue") proto.RegisterType((*Scopes)(nil), "grpc.gateway.protoc_gen_swagger.options.Scopes") proto.RegisterMapType((map[string]string)(nil), "grpc.gateway.protoc_gen_swagger.options.Scopes.ScopeEntry") - proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme", Swagger_SwaggerScheme_name, Swagger_SwaggerScheme_value) - proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.JSONSchema_JSONSchemaSimpleTypes", JSONSchema_JSONSchemaSimpleTypes_name, JSONSchema_JSONSchemaSimpleTypes_value) - proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Type", SecurityScheme_Type_name, SecurityScheme_Type_value) - proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_In", SecurityScheme_In_name, SecurityScheme_In_value) - proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Flow", SecurityScheme_Flow_name, SecurityScheme_Flow_value) } func init() { - proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_openapiv2_7182f700aabb5117) + proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor_ba35ad8af024fb48) } -var fileDescriptor_openapiv2_7182f700aabb5117 = []byte{ +var fileDescriptor_ba35ad8af024fb48 = []byte{ // 1884 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0x5b, 0x73, 0xdb, 0xc6, 0xf5, 0x0f, 0x48, 0x90, 0x04, 0x0f, 0x45, 0x7a, 0xbd, 0x96, 0xf3, 0x47, 0x18, 0xdb, 0x7f, 0x85, diff --git a/repositories.bzl b/repositories.bzl index 9477332b07a..2ea561e1faf 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -4,8 +4,8 @@ def go_repositories(): go_repository( name = "co_honnef_go_tools", importpath = "honnef.co/go/tools", - sum = "h1:XJP7lxbSxWLOMNdBE4B/STaqVy6L73o0knwj2vIlxnw=", - version = "v0.0.0-20190102054323-c2f93a96b099", + sum = "h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=", + version = "v0.0.0-20190523083050-ea95bdfd59fc", ) go_repository( name = "com_github_burntsushi_toml", @@ -40,8 +40,8 @@ def go_repositories(): go_repository( name = "com_github_golang_protobuf", importpath = "github.com/golang/protobuf", - sum = "h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=", - version = "v1.2.0", + sum = "h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=", + version = "v1.3.2", ) go_repository( name = "com_github_kr_pretty", @@ -94,32 +94,32 @@ def go_repositories(): go_repository( name = "org_golang_google_appengine", importpath = "google.golang.org/appengine", - sum = "h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs=", - version = "v1.1.0", + sum = "h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=", + version = "v1.4.0", ) go_repository( name = "org_golang_google_genproto", importpath = "google.golang.org/genproto", - sum = "h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=", - version = "v0.0.0-20180817151627-c66870c02cf8", + sum = "h1:hrpEMCZ2O7DR5gC1n2AJGVhrwiEjOi35+jxtIuZpTMo=", + version = "v0.0.0-20190927181202-20e1ac93f88c", ) go_repository( name = "org_golang_google_grpc", importpath = "google.golang.org/grpc", - sum = "h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8=", - version = "v1.19.0", + sum = "h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s=", + version = "v1.24.0", ) go_repository( name = "org_golang_x_lint", importpath = "golang.org/x/lint", - sum = "h1:x/bBzNauLQAlE3fLku/xy92Y8QwKX5HZymrMz2IiKFc=", - version = "v0.0.0-20181026193005-c67002cb31c3", + sum = "h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=", + version = "v0.0.0-20190313153728-d0100b6bd8b3", ) go_repository( name = "org_golang_x_net", importpath = "golang.org/x/net", - sum = "h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis=", - version = "v0.0.0-20181220203305-927f97764cc3", + sum = "h1:6KET3Sqa7fkVfD63QnAM81ZeYg5n4HwApOJkufONnHA=", + version = "v0.0.0-20190930134127-c5a3c61f89f3", ) go_repository( name = "org_golang_x_oauth2", @@ -130,24 +130,49 @@ def go_repositories(): go_repository( name = "org_golang_x_sync", importpath = "golang.org/x/sync", - sum = "h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=", - version = "v0.0.0-20180314180146-1d60e4601c6f", + sum = "h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=", + version = "v0.0.0-20190423024810-112230192c58", ) go_repository( name = "org_golang_x_sys", importpath = "golang.org/x/sys", - sum = "h1:YoY1wS6JYVRpIfFngRf2HHo9R9dAne3xbkGOQ5rJXjU=", - version = "v0.0.0-20181107165924-66b7b1311ac8", + sum = "h1:q9u40nxWT5zRClI/uU9dHCiYGottAg6Nzz4YUQyHxdA=", + version = "v0.0.0-20190927073244-c990c680b611", ) go_repository( name = "org_golang_x_text", importpath = "golang.org/x/text", - sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=", - version = "v0.3.0", + sum = "h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=", + version = "v0.3.2", ) go_repository( name = "org_golang_x_tools", importpath = "golang.org/x/tools", - sum = "h1:qMK98NmNCRVDIYFycQ5yVRkvgDUFfdP8Ip4KqmDEB7g=", - version = "v0.0.0-20190114222345-bf090417da8b", + sum = "h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A=", + version = "v0.0.0-20190524140312-2c0ae7006135", + ) + go_repository( + name = "com_github_go_resty_resty", + importpath = "github.com/go-resty/resty", + replace = "gopkg.in/resty.v1", + sum = "h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI=", + version = "v1.12.0", + ) + go_repository( + name = "com_github_google_go_cmp", + importpath = "github.com/google/go-cmp", + sum = "h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=", + version = "v0.2.0", + ) + go_repository( + name = "org_golang_x_crypto", + importpath = "golang.org/x/crypto", + sum = "h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=", + version = "v0.0.0-20190308221718-c2843e01d9a2", + ) + go_repository( + name = "org_golang_x_exp", + importpath = "golang.org/x/exp", + sum = "h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA=", + version = "v0.0.0-20190121172915-509febef88a4", ) From 88066c2c7f5b573de65e7900c23a7350a1b91234 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 11 Sep 2019 10:58:11 +0100 Subject: [PATCH 479/552] Remove "make test" recommendation from CONTRIBUTING.md This is not even how we run tests in CI anymore. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ecab022c28f..09951e3c4f9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ Here's the recommended process of contribution. 4. Make sure that your change follows best practices in Go * [Effective Go](https://golang.org/doc/effective_go.html) * [Go Code Review Comments](https://golang.org/wiki/CodeReviewComments) -5. Make sure that `make test` passes. (use swagger-codegen 2.2.2, not newer versions) +5. Make sure that `go test ./...` passes. 6. Sign [a Contributor License Agreement](https://cla.developers.google.com/clas) 7. Open a pull request in Github From a53104e4390fff43fe0f03550437aa0aa6f1b669 Mon Sep 17 00:00:00 2001 From: Zach Gershman Date: Wed, 2 Oct 2019 08:46:38 -0700 Subject: [PATCH 480/552] Align bazel deps with mod file (#1057) --- repositories.bzl | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/repositories.bzl b/repositories.bzl index 2ea561e1faf..2d83853dfc7 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -64,8 +64,8 @@ def go_repositories(): go_repository( name = "com_github_rogpeppe_fastuuid", importpath = "github.com/rogpeppe/fastuuid", - sum = "h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng=", - version = "v0.0.0-20150106093220-6724a57986af", + sum = "h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s=", + version = "v1.2.0", ) go_repository( name = "com_google_cloud_go", @@ -76,8 +76,8 @@ def go_repositories(): go_repository( name = "in_gopkg_check_v1", importpath = "gopkg.in/check.v1", - sum = "h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=", - version = "v1.0.0-20180628173108-788fd7840127", + sum = "h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=", + version = "v0.0.0-20161208181325-20d25e280405", ) go_repository( name = "in_gopkg_resty_v1", @@ -88,8 +88,8 @@ def go_repositories(): go_repository( name = "in_gopkg_yaml_v2", importpath = "gopkg.in/yaml.v2", - sum = "h1:+t9dhfO+GNOIGJof6kPOAenx7YgrZMTdRPV+EsnPabk=", - version = "v2.0.0-20170812160011-eb3733d160e7", + sum = "h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI=", + version = "v2.2.3", ) go_repository( name = "org_golang_google_appengine", @@ -118,8 +118,8 @@ def go_repositories(): go_repository( name = "org_golang_x_net", importpath = "golang.org/x/net", - sum = "h1:6KET3Sqa7fkVfD63QnAM81ZeYg5n4HwApOJkufONnHA=", - version = "v0.0.0-20190930134127-c5a3c61f89f3", + sum = "h1:2mqDk8w/o6UmeUCu5Qiq2y7iMf6anbx+YA8d1JFoFrs=", + version = "v0.0.0-20191002035440-2ec189313ef0", ) go_repository( name = "org_golang_x_oauth2", @@ -136,14 +136,14 @@ def go_repositories(): go_repository( name = "org_golang_x_sys", importpath = "golang.org/x/sys", - sum = "h1:q9u40nxWT5zRClI/uU9dHCiYGottAg6Nzz4YUQyHxdA=", - version = "v0.0.0-20190927073244-c990c680b611", + sum = "h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=", + version = "v0.0.0-20190215142949-d0b11bdaac8a", ) go_repository( name = "org_golang_x_text", importpath = "golang.org/x/text", - sum = "h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=", - version = "v0.3.2", + sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=", + version = "v0.3.0", ) go_repository( name = "org_golang_x_tools", @@ -154,9 +154,8 @@ def go_repositories(): go_repository( name = "com_github_go_resty_resty", importpath = "github.com/go-resty/resty", - replace = "gopkg.in/resty.v1", - sum = "h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI=", - version = "v1.12.0", + sum = "h1:vbNCxbHOWCototzwxf3L63PQCKx6xgT6v8SHfoqkp6U=", + version = "v1.8.0", ) go_repository( name = "com_github_google_go_cmp", From 4f649406ddb0510f0703e20eb4f16ed9fe98d9fa Mon Sep 17 00:00:00 2001 From: Zach Gershman Date: Fri, 4 Oct 2019 08:05:33 -0700 Subject: [PATCH 481/552] Update test swagger generator to 2.4.8 (#1058) * generate files with swagger-codegen 2.4.8 * swagger-codegen 2.4.8 is now the base requirement - had to update the makefile as the generated file names have all moved around a little bit - moved bazel forward to use go 1.13.1 as well - test that was using a deep reflect to do equality has changed to be per struct field equality (deep reflect no longer works with the enum types). * remove need for env var * adds -e plus refactors tools to top * Update .circleci/Dockerfile Co-Authored-By: Johan Brandhorst --- .circleci/Dockerfile | 33 +- .circleci/config.yml | 2 +- Makefile | 58 +- WORKSPACE | 6 +- examples/clients/abe/.swagger-codegen/VERSION | 1 + examples/clients/abe/BUILD.bazel | 36 +- .../abe/a_bit_of_everything_service_api.go | 1660 --------- examples/clients/abe/api/swagger.yaml | 2202 ++++++++++++ .../abe/api_a_bit_of_everything_service.go | 3054 +++++++++++++++++ .../abe/api_camel_case_service_name.go | 159 + examples/clients/abe/api_client.go | 164 - examples/clients/abe/api_echo_rpc.go | 475 +++ .../abe/camel_case_service_name_api.go | 111 - examples/clients/abe/client.go | 471 +++ examples/clients/abe/configuration.go | 72 +- examples/clients/abe/echo_rpc_api.go | 265 -- examples/clients/abe/echo_service_api.go | 265 -- .../clients/abe/examplepb_numeric_enum.go | 15 - .../abe/examplepb_update_v2_request.go | 18 - .../abe/message_path_enum_nested_path_enum.go | 14 - ...go => model_a_bit_of_everything_nested.go} | 11 +- ...=> model_examplepb_a_bit_of_everything.go} | 56 +- ...examplepb_a_bit_of_everything_repeated.go} | 22 +- ...mplepb_body.go => model_examplepb_body.go} | 7 +- .../abe/model_examplepb_numeric_enum.go | 19 + .../abe/model_examplepb_update_v2_request.go | 16 + ...odel_message_path_enum_nested_path_enum.go | 19 + .../clients/abe/model_nested_deep_enum.go | 19 + .../clients/abe/model_pathenum_path_enum.go | 19 + ...d_mask.go => model_protobuf_field_mask.go} | 7 +- ...message.go => model_sub_string_message.go} | 7 +- examples/clients/abe/nested_deep_enum.go | 15 - examples/clients/abe/pathenum_path_enum.go | 14 - .../abe/{api_response.go => response.go} | 14 +- .../clients/echo/.swagger-codegen/VERSION | 1 + examples/clients/echo/BUILD.bazel | 15 +- examples/clients/echo/api/swagger.yaml | 441 +++ examples/clients/echo/api_client.go | 164 - examples/clients/echo/api_echo_service.go | 852 +++++ examples/clients/echo/client.go | 464 +++ examples/clients/echo/configuration.go | 73 +- examples/clients/echo/echo_service_api.go | 541 --- ...mbedded.go => model_examplepb_embedded.go} | 9 +- ...e.go => model_examplepb_simple_message.go} | 18 +- .../echo/{api_response.go => response.go} | 15 +- .../responsebody/.swagger-codegen/VERSION | 1 + examples/clients/responsebody/BUILD.bazel | 23 +- .../clients/responsebody/api/swagger.yaml | 110 + examples/clients/responsebody/api_client.go | 164 - .../responsebody/api_response_body_service.go | 290 ++ examples/clients/responsebody/client.go | 464 +++ .../clients/responsebody/configuration.go | 73 +- ...xamplepbRepeatedResponseBodyOutResponse.md | 2 +- .../docs/ExamplepbResponseBodyOut.md | 2 +- .../docs/ResponseBodyServiceApi.md | 27 +- .../examplepb_response_body_message.go | 18 - ...xamplepb_response_body_message_response.go | 16 - .../examplepb_response_body_req.go | 16 - ...l_examplepb_repeated_response_body_out.go} | 8 +- ...pb_repeated_response_body_out_response.go} | 11 +- ...el_examplepb_repeated_response_strings.go} | 8 +- ...o => model_examplepb_response_body_out.go} | 10 +- ...l_examplepb_response_body_out_response.go} | 8 +- .../model_response_response_type.go | 19 + .../{api_response.go => response.go} | 15 +- .../responsebody/response_body_service_api.go | 219 -- .../responsebody/response_response_type.go | 14 - .../unannotatedecho/.swagger-codegen/VERSION | 1 + examples/clients/unannotatedecho/BUILD.bazel | 13 +- .../clients/unannotatedecho/api/swagger.yaml | 135 + .../clients/unannotatedecho/api_client.go | 164 - .../api_unannotated_echo_service.go | 412 +++ examples/clients/unannotatedecho/client.go | 464 +++ .../clients/unannotatedecho/configuration.go | 73 +- ...l_examplepb_unannotated_simple_message.go} | 10 +- .../{api_response.go => response.go} | 15 +- .../unannotated_echo_service_api.go | 290 -- examples/integration/client_test.go | 176 +- examples/integration/fieldmask_test.go | 20 + examples/integration/integration_test.go | 55 + examples/integration/proto_error_test.go | 15 + .../proto/examplepb/a_bit_of_everything.pb.go | 442 +-- .../proto/examplepb/a_bit_of_everything.proto | 1 - .../a_bit_of_everything.swagger.json | 3 - go.mod | 3 +- go.sum | 7 +- repositories.bzl | 39 +- 87 files changed, 10880 insertions(+), 4895 deletions(-) create mode 100644 examples/clients/abe/.swagger-codegen/VERSION delete mode 100644 examples/clients/abe/a_bit_of_everything_service_api.go create mode 100644 examples/clients/abe/api/swagger.yaml create mode 100644 examples/clients/abe/api_a_bit_of_everything_service.go create mode 100644 examples/clients/abe/api_camel_case_service_name.go delete mode 100644 examples/clients/abe/api_client.go create mode 100644 examples/clients/abe/api_echo_rpc.go delete mode 100644 examples/clients/abe/camel_case_service_name_api.go create mode 100644 examples/clients/abe/client.go delete mode 100644 examples/clients/abe/echo_rpc_api.go delete mode 100644 examples/clients/abe/echo_service_api.go delete mode 100644 examples/clients/abe/examplepb_numeric_enum.go delete mode 100644 examples/clients/abe/examplepb_update_v2_request.go delete mode 100644 examples/clients/abe/message_path_enum_nested_path_enum.go rename examples/clients/abe/{a_bit_of_everything_nested.go => model_a_bit_of_everything_nested.go} (71%) rename examples/clients/abe/{examplepb_a_bit_of_everything.go => model_examplepb_a_bit_of_everything.go} (77%) rename examples/clients/abe/{examplepb_a_bit_of_everything_repeated.go => model_examplepb_a_bit_of_everything_repeated.go} (92%) rename examples/clients/abe/{examplepb_body.go => model_examplepb_body.go} (69%) create mode 100644 examples/clients/abe/model_examplepb_numeric_enum.go create mode 100644 examples/clients/abe/model_examplepb_update_v2_request.go create mode 100644 examples/clients/abe/model_message_path_enum_nested_path_enum.go create mode 100644 examples/clients/abe/model_nested_deep_enum.go create mode 100644 examples/clients/abe/model_pathenum_path_enum.go rename examples/clients/abe/{protobuf_field_mask.go => model_protobuf_field_mask.go} (98%) rename examples/clients/abe/{sub_string_message.go => model_sub_string_message.go} (69%) delete mode 100644 examples/clients/abe/nested_deep_enum.go delete mode 100644 examples/clients/abe/pathenum_path_enum.go rename examples/clients/abe/{api_response.go => response.go} (77%) create mode 100644 examples/clients/echo/.swagger-codegen/VERSION create mode 100644 examples/clients/echo/api/swagger.yaml delete mode 100644 examples/clients/echo/api_client.go create mode 100644 examples/clients/echo/api_echo_service.go create mode 100644 examples/clients/echo/client.go delete mode 100644 examples/clients/echo/echo_service_api.go rename examples/clients/echo/{examplepb_embedded.go => model_examplepb_embedded.go} (70%) rename examples/clients/echo/{examplepb_simple_message.go => model_examplepb_simple_message.go} (67%) rename examples/clients/echo/{api_response.go => response.go} (75%) create mode 100644 examples/clients/responsebody/.swagger-codegen/VERSION create mode 100644 examples/clients/responsebody/api/swagger.yaml delete mode 100644 examples/clients/responsebody/api_client.go create mode 100644 examples/clients/responsebody/api_response_body_service.go create mode 100644 examples/clients/responsebody/client.go delete mode 100644 examples/clients/responsebody/examplepb_response_body_message.go delete mode 100644 examples/clients/responsebody/examplepb_response_body_message_response.go delete mode 100644 examples/clients/responsebody/examplepb_response_body_req.go rename examples/clients/responsebody/{examplepb_repeated_response_body_out.go => model_examplepb_repeated_response_body_out.go} (72%) rename examples/clients/responsebody/{examplepb_repeated_response_body_out_response.go => model_examplepb_repeated_response_body_out_response.go} (62%) rename examples/clients/responsebody/{examplepb_repeated_response_strings.go => model_examplepb_repeated_response_strings.go} (70%) rename examples/clients/responsebody/{examplepb_response_body_out.go => model_examplepb_response_body_out.go} (54%) rename examples/clients/responsebody/{examplepb_response_body_out_response.go => model_examplepb_response_body_out_response.go} (69%) create mode 100644 examples/clients/responsebody/model_response_response_type.go rename examples/clients/responsebody/{api_response.go => response.go} (76%) delete mode 100644 examples/clients/responsebody/response_body_service_api.go delete mode 100644 examples/clients/responsebody/response_response_type.go create mode 100644 examples/clients/unannotatedecho/.swagger-codegen/VERSION create mode 100644 examples/clients/unannotatedecho/api/swagger.yaml delete mode 100644 examples/clients/unannotatedecho/api_client.go create mode 100644 examples/clients/unannotatedecho/api_unannotated_echo_service.go create mode 100644 examples/clients/unannotatedecho/client.go rename examples/clients/unannotatedecho/{examplepb_unannotated_simple_message.go => model_examplepb_unannotated_simple_message.go} (84%) rename examples/clients/unannotatedecho/{api_response.go => response.go} (79%) delete mode 100644 examples/clients/unannotatedecho/unannotated_echo_service_api.go diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile index 5e555123263..a6a2f688857 100644 --- a/.circleci/Dockerfile +++ b/.circleci/Dockerfile @@ -1,32 +1,35 @@ FROM golang:1.13.1 -## Warm apt cache -RUN apt-get update +# Warm apt cache +RUN apt-get update && \ + apt-get install -y wget unzip \ + openjdk-11-jre \ + bzip2 # Install swagger-codegen -ENV SWAGGER_CODEGEN_VERSION=2.2.2 -RUN apt-get install -y openjdk-11-jre wget && \ - wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${SWAGGER_CODEGEN_VERSION}/swagger-codegen-cli-${SWAGGER_CODEGEN_VERSION}.jar \ - -O /usr/local/bin/swagger-codegen-cli.jar && \ - apt-get remove -y wget -ENV SWAGGER_CODEGEN="java -jar /usr/local/bin/swagger-codegen-cli.jar" +ENV SWAGGER_CODEGEN_VERSION=2.4.8 +RUN wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${SWAGGER_CODEGEN_VERSION}/swagger-codegen-cli-${SWAGGER_CODEGEN_VERSION}.jar \ + -O /usr/local/bin/swagger-codegen-cli.jar + +# Wrap the jar for swagger-codgen +RUN echo -e '#!/bin/bash\njava -jar /usr/local/bin/swagger-codegen-cli.jar "$@"' > /usr/local/bin/swagger-codegen && \ + chmod +x /usr/local/bin/swagger-codegen # Install protoc ENV PROTOC_VERSION=3.9.2 -RUN apt-get install -y wget unzip && \ - wget https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \ +RUN wget https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \ -O /protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ unzip /protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local/ && \ - rm -f /protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ - apt-get remove -y unzip wget + rm -f /protoc-${PROTOC_VERSION}-linux-x86_64.zip # Install node, used by NVM ENV NODE_VERSION=v10.16.3 ENV NVM_VERSION=v0.35.0 -RUN apt-get install -y wget bzip2 && \ - wget -qO- https://raw.githubusercontent.com/creationix/nvm/${NVM_VERSION}/install.sh | bash && \ - apt-get remove -y wget +RUN wget -qO- https://raw.githubusercontent.com/creationix/nvm/${NVM_VERSION}/install.sh | bash # Clean up RUN apt-get autoremove -y && \ + apt-get remove -y wget \ + unzip \ + bzip2 && \ rm -rf /var/lib/apt/lists/* diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d2cddb6c26..f9554d0dc95 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,7 +37,7 @@ jobs: steps: - checkout - run: make realclean - - run: make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}" # Set in Docker image + - run: make examples - run: go mod tidy - run: git diff --exit-code lint: diff --git a/Makefile b/Makefile index 0ee29234c36..a591c77baaa 100644 --- a/Makefile +++ b/Makefile @@ -83,38 +83,46 @@ EXAMPLE_DEPSRCS=$(EXAMPLE_DEPS:.proto=.pb.go) EXAMPLE_CLIENT_DIR=examples/clients ECHO_EXAMPLE_SPEC=examples/proto/examplepb/echo_service.swagger.json -ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/echo/api_client.go \ - $(EXAMPLE_CLIENT_DIR)/echo/api_response.go \ +ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/echo/client.go \ + $(EXAMPLE_CLIENT_DIR)/echo/response.go \ $(EXAMPLE_CLIENT_DIR)/echo/configuration.go \ - $(EXAMPLE_CLIENT_DIR)/echo/echo_service_api.go \ - $(EXAMPLE_CLIENT_DIR)/echo/examplepb_simple_message.go \ - $(EXAMPLE_CLIENT_DIR)/echo/examplepb_embedded.go + $(EXAMPLE_CLIENT_DIR)/echo/api_echo_service.go \ + $(EXAMPLE_CLIENT_DIR)/echo/model_examplepb_simple_message.go \ + $(EXAMPLE_CLIENT_DIR)/echo/model_examplepb_embedded.go ABE_EXAMPLE_SPEC=examples/proto/examplepb/a_bit_of_everything.swagger.json -ABE_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/abe/a_bit_of_everything_nested.go \ - $(EXAMPLE_CLIENT_DIR)/abe/a_bit_of_everything_service_api.go \ - $(EXAMPLE_CLIENT_DIR)/abe/api_client.go \ - $(EXAMPLE_CLIENT_DIR)/abe/api_response.go \ - $(EXAMPLE_CLIENT_DIR)/abe/camel_case_service_name_api.go \ +ABE_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/abe/model_a_bit_of_everything_nested.go \ + $(EXAMPLE_CLIENT_DIR)/abe/api_a_bit_of_everything_service.go \ + $(EXAMPLE_CLIENT_DIR)/abe/client.go \ + $(EXAMPLE_CLIENT_DIR)/abe/api_camel_case_service_name.go \ $(EXAMPLE_CLIENT_DIR)/abe/configuration.go \ - $(EXAMPLE_CLIENT_DIR)/abe/echo_rpc_api.go \ - $(EXAMPLE_CLIENT_DIR)/abe/echo_service_api.go \ - $(EXAMPLE_CLIENT_DIR)/abe/examplepb_a_bit_of_everything.go \ - $(EXAMPLE_CLIENT_DIR)/abe/examplepb_body.go \ - $(EXAMPLE_CLIENT_DIR)/abe/examplepb_numeric_enum.go \ - $(EXAMPLE_CLIENT_DIR)/abe/nested_deep_enum.go \ - $(EXAMPLE_CLIENT_DIR)/abe/sub_string_message.go + $(EXAMPLE_CLIENT_DIR)/abe/api_echo_rpc.go \ + $(EXAMPLE_CLIENT_DIR)/abe/model_examplepb_a_bit_of_everything.go \ + $(EXAMPLE_CLIENT_DIR)/abe/model_examplepb_a_bit_of_everything_repeated.go \ + $(EXAMPLE_CLIENT_DIR)/abe/model_examplepb_body.go \ + $(EXAMPLE_CLIENT_DIR)/abe/model_examplepb_numeric_enum.go \ + $(EXAMPLE_CLIENT_DIR)/abe/model_examplepb_update_v2_request.go \ + $(EXAMPLE_CLIENT_DIR)/abe/model_message_path_enum_nested_path_enum.go \ + $(EXAMPLE_CLIENT_DIR)/abe/model_nested_deep_enum.go \ + $(EXAMPLE_CLIENT_DIR)/abe/model_pathenum_path_enum.go \ + $(EXAMPLE_CLIENT_DIR)/abe/model_protobuf_field_mask.go \ + $(EXAMPLE_CLIENT_DIR)/abe/response.go UNANNOTATED_ECHO_EXAMPLE_SPEC=examples/proto/examplepb/unannotated_echo_service.swagger.json -UNANNOTATED_ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/unannotatedecho/api_client.go \ - $(EXAMPLE_CLIENT_DIR)/unannotatedecho/api_response.go \ +UNANNOTATED_ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/unannotatedecho/client.go \ + $(EXAMPLE_CLIENT_DIR)/unannotatedecho/response.go \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/configuration.go \ - $(EXAMPLE_CLIENT_DIR)/unannotatedecho/examplepb_unannotated_simple_message.go \ - $(EXAMPLE_CLIENT_DIR)/unannotatedecho/unannotated_echo_service_api.go + $(EXAMPLE_CLIENT_DIR)/unannotatedecho/model_examplepb_unannotated_simple_message.go \ + $(EXAMPLE_CLIENT_DIR)/unannotatedecho/api_unannotated_echo_service.go RESPONSE_BODY_EXAMPLE_SPEC=examples/proto/examplepb/response_body_service.swagger.json -RESPONSE_BODY_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/responsebody/api_client.go \ - $(EXAMPLE_CLIENT_DIR)/responsebody/api_response.go \ +RESPONSE_BODY_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/responsebody/client.go \ + $(EXAMPLE_CLIENT_DIR)/responsebody/response.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/configuration.go \ - $(EXAMPLE_CLIENT_DIR)/responsebody/examplepb_response_body.go \ - $(EXAMPLE_CLIENT_DIR)/responsebody/response_body_service_api.go + $(EXAMPLE_CLIENT_DIR)/responsebody/model_examplepb_repeated_response_body_out.go \ + $(EXAMPLE_CLIENT_DIR)/responsebody/model_examplepb_repeated_response_body_out_response.go \ + $(EXAMPLE_CLIENT_DIR)/responsebody/model_examplepb_repeated_response_strings.go \ + $(EXAMPLE_CLIENT_DIR)/responsebody/model_examplepb_response_body_out.go \ + $(EXAMPLE_CLIENT_DIR)/responsebody/model_examplepb_response_body_out_response.go \ + $(EXAMPLE_CLIENT_DIR)/responsebody/model_response_response_type.go \ + $(EXAMPLE_CLIENT_DIR)/responsebody/api_response_body_service.go EXAMPLE_CLIENT_SRCS=$(ECHO_EXAMPLE_SRCS) $(ABE_EXAMPLE_SRCS) $(UNANNOTATED_ECHO_EXAMPLE_SRCS) $(RESPONSE_BODY_EXAMPLE_SRCS) SWAGGER_CODEGEN=swagger-codegen diff --git a/WORKSPACE b/WORKSPACE index 280712e741b..7430c6bc260 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,10 +4,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - sha256 = "8df59f11fb697743cbb3f26cfb8750395f30471e9eabde0d174c3aebc7a1cd39", + sha256 = "513c12397db1bc9aa46dd62f02dd94b49a9b5d17444d49b5a04c5a89f3053c1c", urls = [ - "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.19.1/rules_go-0.19.1.tar.gz", - "https://github.com/bazelbuild/rules_go/releases/download/0.19.1/rules_go-0.19.1.tar.gz", + "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/v0.19.5/rules_go-v0.19.5.tar.gz", + "https://github.com/bazelbuild/rules_go/releases/download/v0.19.5/rules_go-v0.19.5.tar.gz", ], ) diff --git a/examples/clients/abe/.swagger-codegen/VERSION b/examples/clients/abe/.swagger-codegen/VERSION new file mode 100644 index 00000000000..752a79ef362 --- /dev/null +++ b/examples/clients/abe/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.4.8 \ No newline at end of file diff --git a/examples/clients/abe/BUILD.bazel b/examples/clients/abe/BUILD.bazel index 4d3c3546e93..d64c856782d 100644 --- a/examples/clients/abe/BUILD.bazel +++ b/examples/clients/abe/BUILD.bazel @@ -5,31 +5,31 @@ package(default_visibility = ["//visibility:public"]) go_library( name = "go_default_library", srcs = [ - "a_bit_of_everything_nested.go", - "a_bit_of_everything_service_api.go", - "api_client.go", - "api_response.go", - "camel_case_service_name_api.go", + "api_a_bit_of_everything_service.go", + "api_camel_case_service_name.go", + "api_echo_rpc.go", + "client.go", "configuration.go", - "echo_rpc_api.go", - "echo_service_api.go", "enum_helper.go", - "examplepb_a_bit_of_everything.go", - "examplepb_a_bit_of_everything_repeated.go", - "examplepb_body.go", - "examplepb_numeric_enum.go", - "examplepb_update_v2_request.go", - "message_path_enum_nested_path_enum.go", - "nested_deep_enum.go", - "pathenum_path_enum.go", - "protobuf_field_mask.go", - "sub_string_message.go", + "model_a_bit_of_everything_nested.go", + "model_examplepb_a_bit_of_everything.go", + "model_examplepb_a_bit_of_everything_repeated.go", + "model_examplepb_body.go", + "model_examplepb_numeric_enum.go", + "model_examplepb_update_v2_request.go", + "model_message_path_enum_nested_path_enum.go", + "model_nested_deep_enum.go", + "model_pathenum_path_enum.go", + "model_protobuf_field_mask.go", + "model_sub_string_message.go", + "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe", deps = [ "//examples/proto/examplepb:go_default_library", "//examples/proto/pathenum:go_default_library", "//runtime:go_default_library", - "@com_github_go_resty_resty//:go_default_library", + "@com_github_antihax_optional//:go_default_library", + "@org_golang_x_oauth2//:go_default_library", ], ) diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go deleted file mode 100644 index ec3f4c49886..00000000000 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ /dev/null @@ -1,1660 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -import ( - "net/url" - "strings" - "time" - "encoding/json" - "fmt" -) - -type ABitOfEverythingServiceApi struct { - Configuration *Configuration -} - -func NewABitOfEverythingServiceApi() *ABitOfEverythingServiceApi { - configuration := NewConfiguration() - return &ABitOfEverythingServiceApi{ - Configuration: configuration, - } -} - -func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythingServiceApi { - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &ABitOfEverythingServiceApi{ - Configuration: configuration, - } -} - -/** - * - * - * @param singleNestedName name is nested field. - * @param floatValue Float value field - * @param singleNestedAmount - * @param singleNestedOk DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param uuid - * @param doubleValue - * @param int64Value - * @param uint64Value - * @param int32Value - * @param fixed64Value - * @param fixed32Value - * @param boolValue - * @param stringValue - * @param bytesValue - * @param uint32Value - * @param enumValue - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param pathEnumValue - * @param nestedPathEnumValue - * @param sfixed32Value - * @param sfixed64Value - * @param sint32Value - * @param sint64Value - * @param repeatedStringValue - * @param oneofString - * @param nonConventionalNameValue - * @param timestampValue - * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param repeatedEnumAnnotation Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param enumValueAnnotation Numeric enum title. Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param repeatedStringAnnotation Repeated string title. Repeated string description. - * @param nestedAnnotationAmount - * @param nestedAnnotationOk DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param int64OverrideType - * @return *ExamplepbABitOfEverything - */ -func (a ABitOfEverythingServiceApi) CheckGetQueryParams(singleNestedName string, floatValue float32, singleNestedAmount int64, singleNestedOk string, uuid string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationAmount int64, nestedAnnotationOk string, int64OverrideType int64) (*ExamplepbABitOfEverything, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/params/get/{single_nested.name}" - localVarPath = strings.Replace(localVarPath, "{"+"single_nested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("single_nested.amount", a.Configuration.APIClient.ParameterToString(singleNestedAmount, "")) - localVarQueryParams.Add("single_nested.ok", a.Configuration.APIClient.ParameterToString(singleNestedOk, "")) - localVarQueryParams.Add("uuid", a.Configuration.APIClient.ParameterToString(uuid, "")) - localVarQueryParams.Add("float_value", a.Configuration.APIClient.ParameterToString(floatValue, "")) - localVarQueryParams.Add("double_value", a.Configuration.APIClient.ParameterToString(doubleValue, "")) - localVarQueryParams.Add("int64_value", a.Configuration.APIClient.ParameterToString(int64Value, "")) - localVarQueryParams.Add("uint64_value", a.Configuration.APIClient.ParameterToString(uint64Value, "")) - localVarQueryParams.Add("int32_value", a.Configuration.APIClient.ParameterToString(int32Value, "")) - localVarQueryParams.Add("fixed64_value", a.Configuration.APIClient.ParameterToString(fixed64Value, "")) - localVarQueryParams.Add("fixed32_value", a.Configuration.APIClient.ParameterToString(fixed32Value, "")) - localVarQueryParams.Add("bool_value", a.Configuration.APIClient.ParameterToString(boolValue, "")) - localVarQueryParams.Add("string_value", a.Configuration.APIClient.ParameterToString(stringValue, "")) - localVarQueryParams.Add("bytes_value", a.Configuration.APIClient.ParameterToString(bytesValue, "")) - localVarQueryParams.Add("uint32_value", a.Configuration.APIClient.ParameterToString(uint32Value, "")) - localVarQueryParams.Add("enum_value", a.Configuration.APIClient.ParameterToString(enumValue, "")) - localVarQueryParams.Add("path_enum_value", a.Configuration.APIClient.ParameterToString(pathEnumValue, "")) - localVarQueryParams.Add("nested_path_enum_value", a.Configuration.APIClient.ParameterToString(nestedPathEnumValue, "")) - localVarQueryParams.Add("sfixed32_value", a.Configuration.APIClient.ParameterToString(sfixed32Value, "")) - localVarQueryParams.Add("sfixed64_value", a.Configuration.APIClient.ParameterToString(sfixed64Value, "")) - localVarQueryParams.Add("sint32_value", a.Configuration.APIClient.ParameterToString(sint32Value, "")) - localVarQueryParams.Add("sint64_value", a.Configuration.APIClient.ParameterToString(sint64Value, "")) - var repeatedStringValueCollectionFormat = "multi" - localVarQueryParams.Add("repeated_string_value", a.Configuration.APIClient.ParameterToString(repeatedStringValue, repeatedStringValueCollectionFormat)) - - localVarQueryParams.Add("oneof_string", a.Configuration.APIClient.ParameterToString(oneofString, "")) - localVarQueryParams.Add("nonConventionalNameValue", a.Configuration.APIClient.ParameterToString(nonConventionalNameValue, "")) - localVarQueryParams.Add("timestamp_value", a.Configuration.APIClient.ParameterToString(timestampValue, "")) - var repeatedEnumValueCollectionFormat = "multi" - localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) - - var repeatedEnumAnnotationCollectionFormat = "multi" - localVarQueryParams.Add("repeated_enum_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumAnnotation, repeatedEnumAnnotationCollectionFormat)) - - localVarQueryParams.Add("enum_value_annotation", a.Configuration.APIClient.ParameterToString(enumValueAnnotation, "")) - var repeatedStringAnnotationCollectionFormat = "multi" - localVarQueryParams.Add("repeated_string_annotation", a.Configuration.APIClient.ParameterToString(repeatedStringAnnotation, repeatedStringAnnotationCollectionFormat)) - - localVarQueryParams.Add("nested_annotation.amount", a.Configuration.APIClient.ParameterToString(nestedAnnotationAmount, "")) - localVarQueryParams.Add("nested_annotation.ok", a.Configuration.APIClient.ParameterToString(nestedAnnotationOk, "")) - localVarQueryParams.Add("int64_override_type", a.Configuration.APIClient.ParameterToString(int64OverrideType, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbABitOfEverything) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "CheckGetQueryParams", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param singleNestedOk DeepEnum description. - * @param floatValue Float value field - * @param singleNestedName name is nested field. - * @param singleNestedAmount - * @param uuid - * @param doubleValue - * @param int64Value - * @param uint64Value - * @param int32Value - * @param fixed64Value - * @param fixed32Value - * @param boolValue - * @param stringValue - * @param bytesValue - * @param uint32Value - * @param enumValue - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param pathEnumValue - * @param nestedPathEnumValue - * @param sfixed32Value - * @param sfixed64Value - * @param sint32Value - * @param sint64Value - * @param repeatedStringValue - * @param oneofString - * @param nonConventionalNameValue - * @param timestampValue - * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param repeatedEnumAnnotation Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param enumValueAnnotation Numeric enum title. Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param repeatedStringAnnotation Repeated string title. Repeated string description. - * @param nestedAnnotationName name is nested field. - * @param nestedAnnotationAmount - * @param int64OverrideType - * @return *ExamplepbABitOfEverything - */ -func (a ABitOfEverythingServiceApi) CheckNestedEnumGetQueryParams(singleNestedOk string, floatValue float32, singleNestedName string, singleNestedAmount int64, uuid string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationName string, nestedAnnotationAmount int64, int64OverrideType int64) (*ExamplepbABitOfEverything, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}" - localVarPath = strings.Replace(localVarPath, "{"+"single_nested.ok"+"}", fmt.Sprintf("%v", singleNestedOk), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("single_nested.name", a.Configuration.APIClient.ParameterToString(singleNestedName, "")) - localVarQueryParams.Add("single_nested.amount", a.Configuration.APIClient.ParameterToString(singleNestedAmount, "")) - localVarQueryParams.Add("uuid", a.Configuration.APIClient.ParameterToString(uuid, "")) - localVarQueryParams.Add("float_value", a.Configuration.APIClient.ParameterToString(floatValue, "")) - localVarQueryParams.Add("double_value", a.Configuration.APIClient.ParameterToString(doubleValue, "")) - localVarQueryParams.Add("int64_value", a.Configuration.APIClient.ParameterToString(int64Value, "")) - localVarQueryParams.Add("uint64_value", a.Configuration.APIClient.ParameterToString(uint64Value, "")) - localVarQueryParams.Add("int32_value", a.Configuration.APIClient.ParameterToString(int32Value, "")) - localVarQueryParams.Add("fixed64_value", a.Configuration.APIClient.ParameterToString(fixed64Value, "")) - localVarQueryParams.Add("fixed32_value", a.Configuration.APIClient.ParameterToString(fixed32Value, "")) - localVarQueryParams.Add("bool_value", a.Configuration.APIClient.ParameterToString(boolValue, "")) - localVarQueryParams.Add("string_value", a.Configuration.APIClient.ParameterToString(stringValue, "")) - localVarQueryParams.Add("bytes_value", a.Configuration.APIClient.ParameterToString(bytesValue, "")) - localVarQueryParams.Add("uint32_value", a.Configuration.APIClient.ParameterToString(uint32Value, "")) - localVarQueryParams.Add("enum_value", a.Configuration.APIClient.ParameterToString(enumValue, "")) - localVarQueryParams.Add("path_enum_value", a.Configuration.APIClient.ParameterToString(pathEnumValue, "")) - localVarQueryParams.Add("nested_path_enum_value", a.Configuration.APIClient.ParameterToString(nestedPathEnumValue, "")) - localVarQueryParams.Add("sfixed32_value", a.Configuration.APIClient.ParameterToString(sfixed32Value, "")) - localVarQueryParams.Add("sfixed64_value", a.Configuration.APIClient.ParameterToString(sfixed64Value, "")) - localVarQueryParams.Add("sint32_value", a.Configuration.APIClient.ParameterToString(sint32Value, "")) - localVarQueryParams.Add("sint64_value", a.Configuration.APIClient.ParameterToString(sint64Value, "")) - var repeatedStringValueCollectionFormat = "multi" - localVarQueryParams.Add("repeated_string_value", a.Configuration.APIClient.ParameterToString(repeatedStringValue, repeatedStringValueCollectionFormat)) - - localVarQueryParams.Add("oneof_string", a.Configuration.APIClient.ParameterToString(oneofString, "")) - localVarQueryParams.Add("nonConventionalNameValue", a.Configuration.APIClient.ParameterToString(nonConventionalNameValue, "")) - localVarQueryParams.Add("timestamp_value", a.Configuration.APIClient.ParameterToString(timestampValue, "")) - var repeatedEnumValueCollectionFormat = "multi" - localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) - - var repeatedEnumAnnotationCollectionFormat = "multi" - localVarQueryParams.Add("repeated_enum_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumAnnotation, repeatedEnumAnnotationCollectionFormat)) - - localVarQueryParams.Add("enum_value_annotation", a.Configuration.APIClient.ParameterToString(enumValueAnnotation, "")) - var repeatedStringAnnotationCollectionFormat = "multi" - localVarQueryParams.Add("repeated_string_annotation", a.Configuration.APIClient.ParameterToString(repeatedStringAnnotation, repeatedStringAnnotationCollectionFormat)) - - localVarQueryParams.Add("nested_annotation.name", a.Configuration.APIClient.ParameterToString(nestedAnnotationName, "")) - localVarQueryParams.Add("nested_annotation.amount", a.Configuration.APIClient.ParameterToString(nestedAnnotationAmount, "")) - localVarQueryParams.Add("int64_override_type", a.Configuration.APIClient.ParameterToString(int64OverrideType, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbABitOfEverything) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "CheckNestedEnumGetQueryParams", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param stringValue - * @param body - * @return *ExamplepbABitOfEverything - */ -func (a ABitOfEverythingServiceApi) CheckPostQueryParams(stringValue string, body ABitOfEverythingNested) (*ExamplepbABitOfEverything, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/params/post/{string_value}" - localVarPath = strings.Replace(localVarPath, "{"+"string_value"+"}", fmt.Sprintf("%v", stringValue), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(ExamplepbABitOfEverything) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "CheckPostQueryParams", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Create a new ABitOfEverything - * This API creates a new ABitOfEverything - * - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param uint64Value - * @param int32Value - * @param fixed64Value - * @param fixed32Value - * @param boolValue - * @param stringValue - * @param uint32Value - * @param sfixed32Value - * @param sfixed64Value - * @param sint32Value - * @param sint64Value - * @param nonConventionalNameValue - * @param enumValue - * @param pathEnumValue - * @param nestedPathEnumValue - * @param enumValueAnnotation Numeric enum description. - * @return *ExamplepbABitOfEverything - */ -func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, enumValueAnnotation string) (*ExamplepbABitOfEverything, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{enum_value_annotation}" - localVarPath = strings.Replace(localVarPath, "{"+"float_value"+"}", fmt.Sprintf("%v", floatValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"double_value"+"}", fmt.Sprintf("%v", doubleValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"int64_value"+"}", fmt.Sprintf("%v", int64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"uint64_value"+"}", fmt.Sprintf("%v", uint64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"int32_value"+"}", fmt.Sprintf("%v", int32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"fixed64_value"+"}", fmt.Sprintf("%v", fixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"fixed32_value"+"}", fmt.Sprintf("%v", fixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"bool_value"+"}", fmt.Sprintf("%v", boolValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"string_value"+"}", fmt.Sprintf("%v", stringValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"uint32_value"+"}", fmt.Sprintf("%v", uint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sfixed32_value"+"}", fmt.Sprintf("%v", sfixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sfixed64_value"+"}", fmt.Sprintf("%v", sfixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sint32_value"+"}", fmt.Sprintf("%v", sint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sint64_value"+"}", fmt.Sprintf("%v", sint64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nonConventionalNameValue"+"}", fmt.Sprintf("%v", nonConventionalNameValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"enum_value"+"}", fmt.Sprintf("%v", enumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_enum_value"+"}", fmt.Sprintf("%v", pathEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nested_path_enum_value"+"}", fmt.Sprintf("%v", nestedPathEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"enum_value_annotation"+"}", fmt.Sprintf("%v", enumValueAnnotation), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbABitOfEverything) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Create", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param body - * @return *ExamplepbABitOfEverything - */ -func (a ABitOfEverythingServiceApi) CreateBody(body ExamplepbABitOfEverything) (*ExamplepbABitOfEverything, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(ExamplepbABitOfEverything) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "CreateBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param singleNestedName name is nested field. - * @param body - * @return *ExamplepbABitOfEverything - */ -func (a ABitOfEverythingServiceApi) DeepPathEcho(singleNestedName string, body ExamplepbABitOfEverything) (*ExamplepbABitOfEverything, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/{single_nested.name}" - localVarPath = strings.Replace(localVarPath, "{"+"single_nested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(ExamplepbABitOfEverything) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "DeepPathEcho", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param uuid - * @return *interface{} - */ -func (a ABitOfEverythingServiceApi) Delete(uuid string) (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Delete") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Delete", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @return *interface{} - */ -func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/errorwithdetails" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "ErrorWithDetails", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param id - * @param body - * @return *interface{} - */ -func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body ExamplepbBody) (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/withbody/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "GetMessageWithBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param uuid - * @param floatValue Float value field - * @param singleNestedName name is nested field. - * @param singleNestedAmount - * @param singleNestedOk DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param doubleValue - * @param int64Value - * @param uint64Value - * @param int32Value - * @param fixed64Value - * @param fixed32Value - * @param boolValue - * @param stringValue - * @param bytesValue - * @param uint32Value - * @param enumValue - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param pathEnumValue - * @param nestedPathEnumValue - * @param sfixed32Value - * @param sfixed64Value - * @param sint32Value - * @param sint64Value - * @param repeatedStringValue - * @param oneofString - * @param nonConventionalNameValue - * @param timestampValue - * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param repeatedEnumAnnotation Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param enumValueAnnotation Numeric enum title. Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param repeatedStringAnnotation Repeated string title. Repeated string description. - * @param nestedAnnotationName name is nested field. - * @param nestedAnnotationAmount - * @param nestedAnnotationOk DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param int64OverrideType - * @return *interface{} - */ -func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, singleNestedName string, singleNestedAmount int64, singleNestedOk string, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string, repeatedEnumAnnotation []string, enumValueAnnotation string, repeatedStringAnnotation []string, nestedAnnotationName string, nestedAnnotationAmount int64, nestedAnnotationOk string, int64OverrideType int64) (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/query/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("single_nested.name", a.Configuration.APIClient.ParameterToString(singleNestedName, "")) - localVarQueryParams.Add("single_nested.amount", a.Configuration.APIClient.ParameterToString(singleNestedAmount, "")) - localVarQueryParams.Add("single_nested.ok", a.Configuration.APIClient.ParameterToString(singleNestedOk, "")) - localVarQueryParams.Add("float_value", a.Configuration.APIClient.ParameterToString(floatValue, "")) - localVarQueryParams.Add("double_value", a.Configuration.APIClient.ParameterToString(doubleValue, "")) - localVarQueryParams.Add("int64_value", a.Configuration.APIClient.ParameterToString(int64Value, "")) - localVarQueryParams.Add("uint64_value", a.Configuration.APIClient.ParameterToString(uint64Value, "")) - localVarQueryParams.Add("int32_value", a.Configuration.APIClient.ParameterToString(int32Value, "")) - localVarQueryParams.Add("fixed64_value", a.Configuration.APIClient.ParameterToString(fixed64Value, "")) - localVarQueryParams.Add("fixed32_value", a.Configuration.APIClient.ParameterToString(fixed32Value, "")) - localVarQueryParams.Add("bool_value", a.Configuration.APIClient.ParameterToString(boolValue, "")) - localVarQueryParams.Add("string_value", a.Configuration.APIClient.ParameterToString(stringValue, "")) - localVarQueryParams.Add("bytes_value", a.Configuration.APIClient.ParameterToString(bytesValue, "")) - localVarQueryParams.Add("uint32_value", a.Configuration.APIClient.ParameterToString(uint32Value, "")) - localVarQueryParams.Add("enum_value", a.Configuration.APIClient.ParameterToString(enumValue, "")) - localVarQueryParams.Add("path_enum_value", a.Configuration.APIClient.ParameterToString(pathEnumValue, "")) - localVarQueryParams.Add("nested_path_enum_value", a.Configuration.APIClient.ParameterToString(nestedPathEnumValue, "")) - localVarQueryParams.Add("sfixed32_value", a.Configuration.APIClient.ParameterToString(sfixed32Value, "")) - localVarQueryParams.Add("sfixed64_value", a.Configuration.APIClient.ParameterToString(sfixed64Value, "")) - localVarQueryParams.Add("sint32_value", a.Configuration.APIClient.ParameterToString(sint32Value, "")) - localVarQueryParams.Add("sint64_value", a.Configuration.APIClient.ParameterToString(sint64Value, "")) - var repeatedStringValueCollectionFormat = "multi" - localVarQueryParams.Add("repeated_string_value", a.Configuration.APIClient.ParameterToString(repeatedStringValue, repeatedStringValueCollectionFormat)) - - localVarQueryParams.Add("oneof_string", a.Configuration.APIClient.ParameterToString(oneofString, "")) - localVarQueryParams.Add("nonConventionalNameValue", a.Configuration.APIClient.ParameterToString(nonConventionalNameValue, "")) - localVarQueryParams.Add("timestamp_value", a.Configuration.APIClient.ParameterToString(timestampValue, "")) - var repeatedEnumValueCollectionFormat = "multi" - localVarQueryParams.Add("repeated_enum_value", a.Configuration.APIClient.ParameterToString(repeatedEnumValue, repeatedEnumValueCollectionFormat)) - - var repeatedEnumAnnotationCollectionFormat = "multi" - localVarQueryParams.Add("repeated_enum_annotation", a.Configuration.APIClient.ParameterToString(repeatedEnumAnnotation, repeatedEnumAnnotationCollectionFormat)) - - localVarQueryParams.Add("enum_value_annotation", a.Configuration.APIClient.ParameterToString(enumValueAnnotation, "")) - var repeatedStringAnnotationCollectionFormat = "multi" - localVarQueryParams.Add("repeated_string_annotation", a.Configuration.APIClient.ParameterToString(repeatedStringAnnotation, repeatedStringAnnotationCollectionFormat)) - - localVarQueryParams.Add("nested_annotation.name", a.Configuration.APIClient.ParameterToString(nestedAnnotationName, "")) - localVarQueryParams.Add("nested_annotation.amount", a.Configuration.APIClient.ParameterToString(nestedAnnotationAmount, "")) - localVarQueryParams.Add("nested_annotation.ok", a.Configuration.APIClient.ParameterToString(nestedAnnotationOk, "")) - localVarQueryParams.Add("int64_override_type", a.Configuration.APIClient.ParameterToString(int64OverrideType, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "GetQuery", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param pathRepeatedFloatValue repeated values. they are comma-separated in path - * @param pathRepeatedDoubleValue - * @param pathRepeatedInt64Value - * @param pathRepeatedUint64Value - * @param pathRepeatedInt32Value - * @param pathRepeatedFixed64Value - * @param pathRepeatedFixed32Value - * @param pathRepeatedBoolValue - * @param pathRepeatedStringValue - * @param pathRepeatedBytesValue - * @param pathRepeatedUint32Value - * @param pathRepeatedEnumValue - * @param pathRepeatedSfixed32Value - * @param pathRepeatedSfixed64Value - * @param pathRepeatedSint32Value - * @param pathRepeatedSint64Value - * @return *ExamplepbABitOfEverythingRepeated - */ -func (a ABitOfEverythingServiceApi) GetRepeatedQuery(pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (*ExamplepbABitOfEverythingRepeated, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything_repeated/{path_repeated_float_value}/{path_repeated_double_value}/{path_repeated_int64_value}/{path_repeated_uint64_value}/{path_repeated_int32_value}/{path_repeated_fixed64_value}/{path_repeated_fixed32_value}/{path_repeated_bool_value}/{path_repeated_string_value}/{path_repeated_bytes_value}/{path_repeated_uint32_value}/{path_repeated_enum_value}/{path_repeated_sfixed32_value}/{path_repeated_sfixed64_value}/{path_repeated_sint32_value}/{path_repeated_sint64_value}" - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_float_value"+"}", fmt.Sprintf("%v", pathRepeatedFloatValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_double_value"+"}", fmt.Sprintf("%v", pathRepeatedDoubleValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_int64_value"+"}", fmt.Sprintf("%v", pathRepeatedInt64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_uint64_value"+"}", fmt.Sprintf("%v", pathRepeatedUint64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_int32_value"+"}", fmt.Sprintf("%v", pathRepeatedInt32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_fixed64_value"+"}", fmt.Sprintf("%v", pathRepeatedFixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_fixed32_value"+"}", fmt.Sprintf("%v", pathRepeatedFixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_bool_value"+"}", fmt.Sprintf("%v", pathRepeatedBoolValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_string_value"+"}", fmt.Sprintf("%v", pathRepeatedStringValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_bytes_value"+"}", fmt.Sprintf("%v", pathRepeatedBytesValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_uint32_value"+"}", fmt.Sprintf("%v", pathRepeatedUint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_enum_value"+"}", fmt.Sprintf("%v", pathRepeatedEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_sfixed32_value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_sfixed64_value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_sint32_value"+"}", fmt.Sprintf("%v", pathRepeatedSint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_sint64_value"+"}", fmt.Sprintf("%v", pathRepeatedSint64Value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbABitOfEverythingRepeated) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "GetRepeatedQuery", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param uuid - * @return *ExamplepbABitOfEverything - */ -func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEverything, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbABitOfEverything) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Lookup", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param name - * @param body - * @return *interface{} - */ -func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body ExamplepbBody) (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/postwithemptybody/{name}" - localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "PostWithEmptyBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @return *interface{} - */ -func (a ABitOfEverythingServiceApi) Timeout() (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/timeout" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Timeout", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param uuid - * @param body - * @return *interface{} - */ -func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Put") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Update", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param abeUuid - * @param body - * @return *interface{} - */ -func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Put") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/a_bit_of_everything/{abe.uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "UpdateV2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param abeUuid - * @param body - * @return *interface{} - */ -func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Patch") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/a_bit_of_everything/{abe.uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "UpdateV22", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param abeUuid - * @param body - * @return *interface{} - */ -func (a ABitOfEverythingServiceApi) UpdateV23(abeUuid string, body ExamplepbUpdateV2Request) (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Patch") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2a/example/a_bit_of_everything/{abe.uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "UpdateV23", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - diff --git a/examples/clients/abe/api/swagger.yaml b/examples/clients/abe/api/swagger.yaml new file mode 100644 index 00000000000..bcb92338096 --- /dev/null +++ b/examples/clients/abe/api/swagger.yaml @@ -0,0 +1,2202 @@ +--- +swagger: "2.0" +info: + version: "1.0" + title: "A Bit of Everything" + contact: + name: "gRPC-Gateway project" + url: "https://github.com/grpc-ecosystem/grpc-gateway" + email: "none@example.com" + license: + name: "BSD 3-Clause License" + url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt" + x-something-something: "yadda" +schemes: +- "http" +- "https" +- "wss" +consumes: +- "application/json" +- "application/x-foo-mime" +produces: +- "application/json" +- "application/x-foo-mime" +security: +- ApiKeyAuth: [] + BasicAuth: [] +- ApiKeyAuth: [] + OAuth2: + - "read" + - "write" +paths: + /v1/example/a_bit_of_everything: + post: + tags: + - "ABitOfEverythingService" + operationId: "CreateBody" + parameters: + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/examplepbABitOfEverything" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbABitOfEverything" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v1/example/a_bit_of_everything/echo/{value}: + get: + tags: + - "echo rpc" + summary: "Summary: Echo rpc" + description: "Description Echo" + operationId: "Echo" + parameters: + - name: "value" + in: "path" + required: true + type: "string" + x-exportParamName: "Value" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/subStringMessage" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "integer" + format: "integer" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + 503: + description: "Returned when the resource is temporarily unavailable." + schema: {} + x-number: 100 + externalDocs: + description: "Find out more Echo" + url: "https://github.com/grpc-ecosystem/grpc-gateway" + /v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}: + get: + tags: + - "ABitOfEverythingService" + operationId: "CheckNestedEnumGetQueryParams" + parameters: + - name: "single_nested.ok" + in: "path" + description: "DeepEnum description." + required: true + type: "string" + enum: + - "FALSE" + - "TRUE" + x-exportParamName: "SingleNestedOk" + - name: "single_nested.name" + in: "query" + description: "name is nested field." + required: false + type: "string" + x-exportParamName: "SingleNestedName" + x-optionalDataType: "String" + - name: "single_nested.amount" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "SingleNestedAmount" + x-optionalDataType: "Int64" + - name: "uuid" + in: "query" + required: false + type: "string" + x-exportParamName: "Uuid" + x-optionalDataType: "String" + - name: "float_value" + in: "query" + description: "Float value field" + required: true + type: "number" + default: 0.2 + format: "float" + x-exportParamName: "FloatValue" + - name: "double_value" + in: "query" + required: false + type: "number" + format: "double" + x-exportParamName: "DoubleValue" + x-optionalDataType: "Float64" + - name: "int64_value" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Int64Value" + x-optionalDataType: "String" + - name: "uint64_value" + in: "query" + required: false + type: "string" + format: "uint64" + x-exportParamName: "Uint64Value" + x-optionalDataType: "String" + - name: "int32_value" + in: "query" + required: false + type: "integer" + format: "int32" + x-exportParamName: "Int32Value" + x-optionalDataType: "Int32" + - name: "fixed64_value" + in: "query" + required: false + type: "string" + format: "uint64" + x-exportParamName: "Fixed64Value" + x-optionalDataType: "String" + - name: "fixed32_value" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "Fixed32Value" + x-optionalDataType: "Int64" + - name: "bool_value" + in: "query" + required: false + type: "boolean" + format: "boolean" + x-exportParamName: "BoolValue" + x-optionalDataType: "Bool" + - name: "string_value" + in: "query" + required: false + type: "string" + x-exportParamName: "StringValue" + x-optionalDataType: "String" + - name: "bytes_value" + in: "query" + required: false + type: "string" + format: "byte" + x-exportParamName: "BytesValue" + x-optionalDataType: "String" + - name: "uint32_value" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "Uint32Value" + x-optionalDataType: "Int64" + - name: "enum_value" + in: "query" + description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" + required: false + type: "string" + default: "ZERO" + enum: + - "ZERO" + - "ONE" + x-exportParamName: "EnumValue" + x-optionalDataType: "String" + - name: "path_enum_value" + in: "query" + required: false + type: "string" + default: "ABC" + enum: + - "ABC" + - "DEF" + x-exportParamName: "PathEnumValue" + x-optionalDataType: "String" + - name: "nested_path_enum_value" + in: "query" + required: false + type: "string" + default: "GHI" + enum: + - "GHI" + - "JKL" + x-exportParamName: "NestedPathEnumValue" + x-optionalDataType: "String" + - name: "sfixed32_value" + in: "query" + required: false + type: "integer" + format: "int32" + x-exportParamName: "Sfixed32Value" + x-optionalDataType: "Int32" + - name: "sfixed64_value" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Sfixed64Value" + x-optionalDataType: "String" + - name: "sint32_value" + in: "query" + required: false + type: "integer" + format: "int32" + x-exportParamName: "Sint32Value" + x-optionalDataType: "Int32" + - name: "sint64_value" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Sint64Value" + x-optionalDataType: "String" + - name: "repeated_string_value" + in: "query" + required: false + type: "array" + items: + type: "string" + collectionFormat: "multi" + x-exportParamName: "RepeatedStringValue" + - name: "oneof_string" + in: "query" + required: false + type: "string" + x-exportParamName: "OneofString" + x-optionalDataType: "String" + - name: "nonConventionalNameValue" + in: "query" + required: false + type: "string" + x-exportParamName: "NonConventionalNameValue" + x-optionalDataType: "String" + - name: "timestamp_value" + in: "query" + required: false + type: "string" + format: "date-time" + x-exportParamName: "TimestampValue" + x-optionalDataType: "Time" + - name: "repeated_enum_value" + in: "query" + description: "repeated enum value. it is comma-separated in query.\n\n - ZERO:\ + \ ZERO means 0\n - ONE: ONE means 1" + required: false + type: "array" + items: + type: "string" + enum: + - "ZERO" + - "ONE" + collectionFormat: "multi" + x-exportParamName: "RepeatedEnumValue" + - name: "repeated_enum_annotation" + in: "query" + description: "Repeated numeric enum title. Repeated numeric enum description.\n\ + \n - ZERO: ZERO means 0\n - ONE: ONE means 1" + required: false + type: "array" + items: + type: "string" + enum: + - "ZERO" + - "ONE" + collectionFormat: "multi" + x-exportParamName: "RepeatedEnumAnnotation" + - name: "enum_value_annotation" + in: "query" + description: "Numeric enum title. Numeric enum description.\n\n - ZERO: ZERO\ + \ means 0\n - ONE: ONE means 1" + required: false + type: "string" + default: "ZERO" + enum: + - "ZERO" + - "ONE" + x-exportParamName: "EnumValueAnnotation" + x-optionalDataType: "String" + - name: "repeated_string_annotation" + in: "query" + description: "Repeated string title. Repeated string description." + required: false + type: "array" + items: + type: "string" + collectionFormat: "multi" + x-exportParamName: "RepeatedStringAnnotation" + - name: "nested_annotation.name" + in: "query" + description: "name is nested field." + required: false + type: "string" + x-exportParamName: "NestedAnnotationName" + x-optionalDataType: "String" + - name: "nested_annotation.amount" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "NestedAnnotationAmount" + x-optionalDataType: "Int64" + - name: "int64_override_type" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "Int64OverrideType" + x-optionalDataType: "Int64" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbABitOfEverything" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v1/example/a_bit_of_everything/params/get/{single_nested.name}: + get: + tags: + - "ABitOfEverythingService" + operationId: "CheckGetQueryParams" + parameters: + - name: "single_nested.name" + in: "path" + description: "name is nested field." + required: true + type: "string" + x-exportParamName: "SingleNestedName" + - name: "single_nested.amount" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "SingleNestedAmount" + x-optionalDataType: "Int64" + - name: "single_nested.ok" + in: "query" + description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ + \ TRUE is true." + required: false + type: "string" + default: "FALSE" + enum: + - "FALSE" + - "TRUE" + x-exportParamName: "SingleNestedOk" + x-optionalDataType: "String" + - name: "uuid" + in: "query" + required: false + type: "string" + x-exportParamName: "Uuid" + x-optionalDataType: "String" + - name: "float_value" + in: "query" + description: "Float value field" + required: true + type: "number" + default: 0.2 + format: "float" + x-exportParamName: "FloatValue" + - name: "double_value" + in: "query" + required: false + type: "number" + format: "double" + x-exportParamName: "DoubleValue" + x-optionalDataType: "Float64" + - name: "int64_value" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Int64Value" + x-optionalDataType: "String" + - name: "uint64_value" + in: "query" + required: false + type: "string" + format: "uint64" + x-exportParamName: "Uint64Value" + x-optionalDataType: "String" + - name: "int32_value" + in: "query" + required: false + type: "integer" + format: "int32" + x-exportParamName: "Int32Value" + x-optionalDataType: "Int32" + - name: "fixed64_value" + in: "query" + required: false + type: "string" + format: "uint64" + x-exportParamName: "Fixed64Value" + x-optionalDataType: "String" + - name: "fixed32_value" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "Fixed32Value" + x-optionalDataType: "Int64" + - name: "bool_value" + in: "query" + required: false + type: "boolean" + format: "boolean" + x-exportParamName: "BoolValue" + x-optionalDataType: "Bool" + - name: "string_value" + in: "query" + required: false + type: "string" + x-exportParamName: "StringValue" + x-optionalDataType: "String" + - name: "bytes_value" + in: "query" + required: false + type: "string" + format: "byte" + x-exportParamName: "BytesValue" + x-optionalDataType: "String" + - name: "uint32_value" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "Uint32Value" + x-optionalDataType: "Int64" + - name: "enum_value" + in: "query" + description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" + required: false + type: "string" + default: "ZERO" + enum: + - "ZERO" + - "ONE" + x-exportParamName: "EnumValue" + x-optionalDataType: "String" + - name: "path_enum_value" + in: "query" + required: false + type: "string" + default: "ABC" + enum: + - "ABC" + - "DEF" + x-exportParamName: "PathEnumValue" + x-optionalDataType: "String" + - name: "nested_path_enum_value" + in: "query" + required: false + type: "string" + default: "GHI" + enum: + - "GHI" + - "JKL" + x-exportParamName: "NestedPathEnumValue" + x-optionalDataType: "String" + - name: "sfixed32_value" + in: "query" + required: false + type: "integer" + format: "int32" + x-exportParamName: "Sfixed32Value" + x-optionalDataType: "Int32" + - name: "sfixed64_value" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Sfixed64Value" + x-optionalDataType: "String" + - name: "sint32_value" + in: "query" + required: false + type: "integer" + format: "int32" + x-exportParamName: "Sint32Value" + x-optionalDataType: "Int32" + - name: "sint64_value" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Sint64Value" + x-optionalDataType: "String" + - name: "repeated_string_value" + in: "query" + required: false + type: "array" + items: + type: "string" + collectionFormat: "multi" + x-exportParamName: "RepeatedStringValue" + - name: "oneof_string" + in: "query" + required: false + type: "string" + x-exportParamName: "OneofString" + x-optionalDataType: "String" + - name: "nonConventionalNameValue" + in: "query" + required: false + type: "string" + x-exportParamName: "NonConventionalNameValue" + x-optionalDataType: "String" + - name: "timestamp_value" + in: "query" + required: false + type: "string" + format: "date-time" + x-exportParamName: "TimestampValue" + x-optionalDataType: "Time" + - name: "repeated_enum_value" + in: "query" + description: "repeated enum value. it is comma-separated in query.\n\n - ZERO:\ + \ ZERO means 0\n - ONE: ONE means 1" + required: false + type: "array" + items: + type: "string" + enum: + - "ZERO" + - "ONE" + collectionFormat: "multi" + x-exportParamName: "RepeatedEnumValue" + - name: "repeated_enum_annotation" + in: "query" + description: "Repeated numeric enum title. Repeated numeric enum description.\n\ + \n - ZERO: ZERO means 0\n - ONE: ONE means 1" + required: false + type: "array" + items: + type: "string" + enum: + - "ZERO" + - "ONE" + collectionFormat: "multi" + x-exportParamName: "RepeatedEnumAnnotation" + - name: "enum_value_annotation" + in: "query" + description: "Numeric enum title. Numeric enum description.\n\n - ZERO: ZERO\ + \ means 0\n - ONE: ONE means 1" + required: false + type: "string" + default: "ZERO" + enum: + - "ZERO" + - "ONE" + x-exportParamName: "EnumValueAnnotation" + x-optionalDataType: "String" + - name: "repeated_string_annotation" + in: "query" + description: "Repeated string title. Repeated string description." + required: false + type: "array" + items: + type: "string" + collectionFormat: "multi" + x-exportParamName: "RepeatedStringAnnotation" + - name: "nested_annotation.amount" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "NestedAnnotationAmount" + x-optionalDataType: "Int64" + - name: "nested_annotation.ok" + in: "query" + description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ + \ TRUE is true." + required: false + type: "string" + default: "FALSE" + enum: + - "FALSE" + - "TRUE" + x-exportParamName: "NestedAnnotationOk" + x-optionalDataType: "String" + - name: "int64_override_type" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "Int64OverrideType" + x-optionalDataType: "Int64" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbABitOfEverything" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v1/example/a_bit_of_everything/params/post/{string_value}: + post: + tags: + - "ABitOfEverythingService" + operationId: "CheckPostQueryParams" + parameters: + - name: "string_value" + in: "path" + required: true + type: "string" + x-exportParamName: "StringValue" + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/ABitOfEverythingNested" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbABitOfEverything" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v1/example/a_bit_of_everything/query/{uuid}: + get: + tags: + - "ABitOfEverythingService" + operationId: "GetQuery" + parameters: + - name: "uuid" + in: "path" + required: true + type: "string" + x-exportParamName: "Uuid" + - name: "single_nested.name" + in: "query" + description: "name is nested field." + required: false + type: "string" + x-exportParamName: "SingleNestedName" + x-optionalDataType: "String" + - name: "single_nested.amount" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "SingleNestedAmount" + x-optionalDataType: "Int64" + - name: "single_nested.ok" + in: "query" + description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ + \ TRUE is true." + required: false + type: "string" + default: "FALSE" + enum: + - "FALSE" + - "TRUE" + x-exportParamName: "SingleNestedOk" + x-optionalDataType: "String" + - name: "float_value" + in: "query" + description: "Float value field" + required: true + type: "number" + default: 0.2 + format: "float" + x-exportParamName: "FloatValue" + - name: "double_value" + in: "query" + required: false + type: "number" + format: "double" + x-exportParamName: "DoubleValue" + x-optionalDataType: "Float64" + - name: "int64_value" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Int64Value" + x-optionalDataType: "String" + - name: "uint64_value" + in: "query" + required: false + type: "string" + format: "uint64" + x-exportParamName: "Uint64Value" + x-optionalDataType: "String" + - name: "int32_value" + in: "query" + required: false + type: "integer" + format: "int32" + x-exportParamName: "Int32Value" + x-optionalDataType: "Int32" + - name: "fixed64_value" + in: "query" + required: false + type: "string" + format: "uint64" + x-exportParamName: "Fixed64Value" + x-optionalDataType: "String" + - name: "fixed32_value" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "Fixed32Value" + x-optionalDataType: "Int64" + - name: "bool_value" + in: "query" + required: false + type: "boolean" + format: "boolean" + x-exportParamName: "BoolValue" + x-optionalDataType: "Bool" + - name: "string_value" + in: "query" + required: false + type: "string" + x-exportParamName: "StringValue" + x-optionalDataType: "String" + - name: "bytes_value" + in: "query" + required: false + type: "string" + format: "byte" + x-exportParamName: "BytesValue" + x-optionalDataType: "String" + - name: "uint32_value" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "Uint32Value" + x-optionalDataType: "Int64" + - name: "enum_value" + in: "query" + description: " - ZERO: ZERO means 0\n - ONE: ONE means 1" + required: false + type: "string" + default: "ZERO" + enum: + - "ZERO" + - "ONE" + x-exportParamName: "EnumValue" + x-optionalDataType: "String" + - name: "path_enum_value" + in: "query" + required: false + type: "string" + default: "ABC" + enum: + - "ABC" + - "DEF" + x-exportParamName: "PathEnumValue" + x-optionalDataType: "String" + - name: "nested_path_enum_value" + in: "query" + required: false + type: "string" + default: "GHI" + enum: + - "GHI" + - "JKL" + x-exportParamName: "NestedPathEnumValue" + x-optionalDataType: "String" + - name: "sfixed32_value" + in: "query" + required: false + type: "integer" + format: "int32" + x-exportParamName: "Sfixed32Value" + x-optionalDataType: "Int32" + - name: "sfixed64_value" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Sfixed64Value" + x-optionalDataType: "String" + - name: "sint32_value" + in: "query" + required: false + type: "integer" + format: "int32" + x-exportParamName: "Sint32Value" + x-optionalDataType: "Int32" + - name: "sint64_value" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Sint64Value" + x-optionalDataType: "String" + - name: "repeated_string_value" + in: "query" + required: false + type: "array" + items: + type: "string" + collectionFormat: "multi" + x-exportParamName: "RepeatedStringValue" + - name: "oneof_string" + in: "query" + required: false + type: "string" + x-exportParamName: "OneofString" + x-optionalDataType: "String" + - name: "nonConventionalNameValue" + in: "query" + required: false + type: "string" + x-exportParamName: "NonConventionalNameValue" + x-optionalDataType: "String" + - name: "timestamp_value" + in: "query" + required: false + type: "string" + format: "date-time" + x-exportParamName: "TimestampValue" + x-optionalDataType: "Time" + - name: "repeated_enum_value" + in: "query" + description: "repeated enum value. it is comma-separated in query.\n\n - ZERO:\ + \ ZERO means 0\n - ONE: ONE means 1" + required: false + type: "array" + items: + type: "string" + enum: + - "ZERO" + - "ONE" + collectionFormat: "multi" + x-exportParamName: "RepeatedEnumValue" + - name: "repeated_enum_annotation" + in: "query" + description: "Repeated numeric enum title. Repeated numeric enum description.\n\ + \n - ZERO: ZERO means 0\n - ONE: ONE means 1" + required: false + type: "array" + items: + type: "string" + enum: + - "ZERO" + - "ONE" + collectionFormat: "multi" + x-exportParamName: "RepeatedEnumAnnotation" + - name: "enum_value_annotation" + in: "query" + description: "Numeric enum title. Numeric enum description.\n\n - ZERO: ZERO\ + \ means 0\n - ONE: ONE means 1" + required: false + type: "string" + default: "ZERO" + enum: + - "ZERO" + - "ONE" + x-exportParamName: "EnumValueAnnotation" + x-optionalDataType: "String" + - name: "repeated_string_annotation" + in: "query" + description: "Repeated string title. Repeated string description." + required: false + type: "array" + items: + type: "string" + collectionFormat: "multi" + x-exportParamName: "RepeatedStringAnnotation" + - name: "nested_annotation.name" + in: "query" + description: "name is nested field." + required: false + type: "string" + x-exportParamName: "NestedAnnotationName" + x-optionalDataType: "String" + - name: "nested_annotation.amount" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "NestedAnnotationAmount" + x-optionalDataType: "Int64" + - name: "nested_annotation.ok" + in: "query" + description: "DeepEnum description.\n\n - FALSE: FALSE is false.\n - TRUE:\ + \ TRUE is true." + required: false + type: "string" + default: "FALSE" + enum: + - "FALSE" + - "TRUE" + x-exportParamName: "NestedAnnotationOk" + x-optionalDataType: "String" + - name: "int64_override_type" + in: "query" + required: false + type: "integer" + format: "int64" + x-exportParamName: "Int64OverrideType" + x-optionalDataType: "Int64" + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + security: [] + externalDocs: + description: "Find out more about GetQuery" + url: "https://github.com/grpc-ecosystem/grpc-gateway" + deprecated: true + ? /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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{enum_value_annotation} + : post: + tags: + - "ABitOfEverythingService" + summary: "Create a new ABitOfEverything" + description: "This API creates a new ABitOfEverything" + operationId: "Create" + parameters: + - name: "float_value" + in: "path" + description: "Float value field" + required: true + type: "number" + default: 0.2 + format: "float" + x-exportParamName: "FloatValue" + - name: "double_value" + in: "path" + required: true + type: "number" + format: "double" + x-exportParamName: "DoubleValue" + - name: "int64_value" + in: "path" + required: true + type: "string" + format: "int64" + x-exportParamName: "Int64Value" + - name: "uint64_value" + in: "path" + required: true + type: "string" + format: "uint64" + x-exportParamName: "Uint64Value" + - name: "int32_value" + in: "path" + required: true + type: "integer" + format: "int32" + x-exportParamName: "Int32Value" + - name: "fixed64_value" + in: "path" + required: true + type: "string" + format: "uint64" + x-exportParamName: "Fixed64Value" + - name: "fixed32_value" + in: "path" + required: true + type: "integer" + format: "int64" + x-exportParamName: "Fixed32Value" + - name: "bool_value" + in: "path" + required: true + type: "boolean" + format: "boolean" + x-exportParamName: "BoolValue" + - name: "string_value" + in: "path" + required: true + type: "string" + x-exportParamName: "StringValue" + - name: "uint32_value" + in: "path" + required: true + type: "integer" + format: "int64" + x-exportParamName: "Uint32Value" + - name: "sfixed32_value" + in: "path" + required: true + type: "integer" + format: "int32" + x-exportParamName: "Sfixed32Value" + - name: "sfixed64_value" + in: "path" + required: true + type: "string" + format: "int64" + x-exportParamName: "Sfixed64Value" + - name: "sint32_value" + in: "path" + required: true + type: "integer" + format: "int32" + x-exportParamName: "Sint32Value" + - name: "sint64_value" + in: "path" + required: true + type: "string" + format: "int64" + x-exportParamName: "Sint64Value" + - name: "nonConventionalNameValue" + in: "path" + required: true + type: "string" + x-exportParamName: "NonConventionalNameValue" + - name: "enum_value" + in: "path" + required: true + type: "string" + enum: + - "ZERO" + - "ONE" + x-exportParamName: "EnumValue" + - name: "path_enum_value" + in: "path" + required: true + type: "string" + enum: + - "ABC" + - "DEF" + x-exportParamName: "PathEnumValue" + - name: "nested_path_enum_value" + in: "path" + required: true + type: "string" + enum: + - "GHI" + - "JKL" + x-exportParamName: "NestedPathEnumValue" + - name: "enum_value_annotation" + in: "path" + description: "Numeric enum description." + required: true + type: "string" + enum: + - "ZERO" + - "ONE" + x-exportParamName: "EnumValueAnnotation" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbABitOfEverything" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v1/example/a_bit_of_everything/{single_nested.name}: + post: + tags: + - "ABitOfEverythingService" + operationId: "DeepPathEcho" + parameters: + - name: "single_nested.name" + in: "path" + description: "name is nested field." + required: true + type: "string" + x-exportParamName: "SingleNestedName" + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/examplepbABitOfEverything" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbABitOfEverything" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v1/example/a_bit_of_everything/{uuid}: + get: + tags: + - "ABitOfEverythingService" + operationId: "Lookup" + parameters: + - name: "uuid" + in: "path" + required: true + type: "string" + x-exportParamName: "Uuid" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbABitOfEverything" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + put: + tags: + - "ABitOfEverythingService" + operationId: "Update" + parameters: + - name: "uuid" + in: "path" + required: true + type: "string" + x-exportParamName: "Uuid" + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/examplepbABitOfEverything" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + delete: + tags: + - "ABitOfEverythingService" + operationId: "Delete" + parameters: + - name: "uuid" + in: "path" + required: true + type: "string" + x-exportParamName: "Uuid" + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + security: + - ApiKeyAuth: [] + OAuth2: + - "read" + - "write" + x-irreversible: true + ? /v1/example/a_bit_of_everything_repeated/{path_repeated_float_value}/{path_repeated_double_value}/{path_repeated_int64_value}/{path_repeated_uint64_value}/{path_repeated_int32_value}/{path_repeated_fixed64_value}/{path_repeated_fixed32_value}/{path_repeated_bool_value}/{path_repeated_string_value}/{path_repeated_bytes_value}/{path_repeated_uint32_value}/{path_repeated_enum_value}/{path_repeated_sfixed32_value}/{path_repeated_sfixed64_value}/{path_repeated_sint32_value}/{path_repeated_sint64_value} + : get: + tags: + - "ABitOfEverythingService" + operationId: "GetRepeatedQuery" + parameters: + - name: "path_repeated_float_value" + in: "path" + description: "repeated values. they are comma-separated in path" + required: true + type: "array" + items: + type: "number" + format: "float" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedFloatValue" + - name: "path_repeated_double_value" + in: "path" + required: true + type: "array" + items: + type: "number" + format: "double" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedDoubleValue" + - name: "path_repeated_int64_value" + in: "path" + required: true + type: "array" + items: + type: "string" + format: "int64" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedInt64Value" + - name: "path_repeated_uint64_value" + in: "path" + required: true + type: "array" + items: + type: "string" + format: "uint64" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedUint64Value" + - name: "path_repeated_int32_value" + in: "path" + required: true + type: "array" + items: + type: "integer" + format: "int32" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedInt32Value" + - name: "path_repeated_fixed64_value" + in: "path" + required: true + type: "array" + items: + type: "string" + format: "uint64" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedFixed64Value" + - name: "path_repeated_fixed32_value" + in: "path" + required: true + type: "array" + items: + type: "integer" + format: "int64" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedFixed32Value" + - name: "path_repeated_bool_value" + in: "path" + required: true + type: "array" + items: + type: "boolean" + format: "boolean" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedBoolValue" + - name: "path_repeated_string_value" + in: "path" + required: true + type: "array" + items: + type: "string" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedStringValue" + - name: "path_repeated_bytes_value" + in: "path" + required: true + type: "array" + items: + type: "string" + format: "byte" + pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedBytesValue" + - name: "path_repeated_uint32_value" + in: "path" + required: true + type: "array" + items: + type: "integer" + format: "int64" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedUint32Value" + - name: "path_repeated_enum_value" + in: "path" + required: true + type: "array" + items: + type: "string" + enum: + - "ZERO" + - "ONE" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedEnumValue" + - name: "path_repeated_sfixed32_value" + in: "path" + required: true + type: "array" + items: + type: "integer" + format: "int32" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedSfixed32Value" + - name: "path_repeated_sfixed64_value" + in: "path" + required: true + type: "array" + items: + type: "string" + format: "int64" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedSfixed64Value" + - name: "path_repeated_sint32_value" + in: "path" + required: true + type: "array" + items: + type: "integer" + format: "int32" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedSint32Value" + - name: "path_repeated_sint64_value" + in: "path" + required: true + type: "array" + items: + type: "string" + format: "int64" + collectionFormat: "csv" + minItems: 1 + x-exportParamName: "PathRepeatedSint64Value" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbABitOfEverythingRepeated" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v2/example/a_bit_of_everything/{abe.uuid}: + put: + tags: + - "ABitOfEverythingService" + operationId: "UpdateV2" + parameters: + - name: "abe.uuid" + in: "path" + required: true + type: "string" + x-exportParamName: "AbeUuid" + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/examplepbABitOfEverything" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + patch: + tags: + - "ABitOfEverythingService" + operationId: "UpdateV22" + parameters: + - name: "abe.uuid" + in: "path" + required: true + type: "string" + x-exportParamName: "AbeUuid" + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/examplepbABitOfEverything" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v2/example/echo: + get: + tags: + - "echo rpc" + summary: "Summary: Echo rpc" + description: "Description Echo" + operationId: "Echo3" + parameters: + - name: "value" + in: "query" + required: false + type: "string" + x-exportParamName: "Value" + x-optionalDataType: "String" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/subStringMessage" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "integer" + format: "integer" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + 503: + description: "Returned when the resource is temporarily unavailable." + schema: {} + x-number: 100 + externalDocs: + description: "Find out more Echo" + url: "https://github.com/grpc-ecosystem/grpc-gateway" + post: + tags: + - "echo rpc" + summary: "Summary: Echo rpc" + description: "Description Echo" + operationId: "Echo2" + parameters: + - in: "body" + name: "body" + required: true + schema: + type: "string" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/subStringMessage" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "integer" + format: "integer" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + 503: + description: "Returned when the resource is temporarily unavailable." + schema: {} + x-number: 100 + externalDocs: + description: "Find out more Echo" + url: "https://github.com/grpc-ecosystem/grpc-gateway" + /v2/example/empty: + get: + tags: + - "camelCaseServiceName" + summary: "Create a new ABitOfEverything" + description: "This API creates a new ABitOfEverything" + operationId: "Empty" + parameters: [] + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v2/example/errorwithdetails: + get: + tags: + - "ABitOfEverythingService" + operationId: "ErrorWithDetails" + parameters: [] + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v2/example/postwithemptybody/{name}: + post: + tags: + - "ABitOfEverythingService" + operationId: "PostWithEmptyBody" + parameters: + - name: "name" + in: "path" + required: true + type: "string" + x-exportParamName: "Name" + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/examplepbBody" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v2/example/timeout: + get: + tags: + - "ABitOfEverythingService" + operationId: "Timeout" + parameters: [] + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v2/example/withbody/{id}: + post: + tags: + - "ABitOfEverythingService" + operationId: "GetMessageWithBody" + parameters: + - name: "id" + in: "path" + required: true + type: "string" + x-exportParamName: "Id" + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/examplepbBody" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + /v2a/example/a_bit_of_everything/{abe.uuid}: + patch: + tags: + - "ABitOfEverythingService" + operationId: "UpdateV23" + parameters: + - name: "abe.uuid" + in: "path" + required: true + type: "string" + x-exportParamName: "AbeUuid" + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/examplepbUpdateV2Request" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: {} + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" +securityDefinitions: + ApiKeyAuth: + type: "apiKey" + name: "X-API-Key" + in: "header" + x-amazon-apigateway-authorizer: + authorizerResultTtlInSeconds: 60 + type: "token" + x-amazon-apigateway-authtype: "oauth2" + BasicAuth: + type: "basic" + OAuth2: + type: "oauth2" + authorizationUrl: "https://example.com/oauth/authorize" + tokenUrl: "https://example.com/oauth/token" + flow: "accessCode" + scopes: + admin: "Grants read and write access to administrative information" + read: "Grants read access" + write: "Grants write access" +definitions: + ABitOfEverythingNested: + type: "object" + properties: + name: + type: "string" + description: "name is nested field." + amount: + type: "integer" + format: "int64" + ok: + description: "DeepEnum description." + $ref: "#/definitions/NestedDeepEnum" + description: "Nested is nested type." + example: + ok: "TRUE" + MessagePathEnumNestedPathEnum: + type: "string" + enum: + - "GHI" + - "JKL" + default: "GHI" + NestedDeepEnum: + type: "string" + description: "DeepEnum is one or zero.\n\n - FALSE: FALSE is false.\n - TRUE:\ + \ TRUE is true." + enum: + - "FALSE" + - "TRUE" + default: "FALSE" + examplepbABitOfEverything: + type: "object" + required: + - "double_value" + - "int64_value" + - "uuid" + properties: + single_nested: + $ref: "#/definitions/ABitOfEverythingNested" + uuid: + type: "string" + minLength: 1 + pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" + nested: + type: "array" + items: + $ref: "#/definitions/ABitOfEverythingNested" + float_value: + type: "number" + format: "float" + description: "Float value field" + default: 0.2 + double_value: + type: "number" + format: "double" + int64_value: + type: "string" + format: "int64" + uint64_value: + type: "string" + format: "uint64" + int32_value: + type: "integer" + format: "int32" + fixed64_value: + type: "string" + format: "uint64" + fixed32_value: + type: "integer" + format: "int64" + bool_value: + type: "boolean" + format: "boolean" + string_value: + type: "string" + bytes_value: + type: "string" + format: "byte" + pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" + uint32_value: + type: "integer" + format: "int64" + enum_value: + $ref: "#/definitions/examplepbNumericEnum" + path_enum_value: + $ref: "#/definitions/pathenumPathEnum" + nested_path_enum_value: + $ref: "#/definitions/MessagePathEnumNestedPathEnum" + sfixed32_value: + type: "integer" + format: "int32" + sfixed64_value: + type: "string" + format: "int64" + sint32_value: + type: "integer" + format: "int32" + sint64_value: + type: "string" + format: "int64" + repeated_string_value: + type: "array" + items: + type: "string" + oneof_empty: + type: "object" + properties: {} + oneof_string: + type: "string" + map_value: + type: "object" + additionalProperties: + $ref: "#/definitions/examplepbNumericEnum" + mapped_string_value: + type: "object" + additionalProperties: + type: "string" + mapped_nested_value: + type: "object" + additionalProperties: + $ref: "#/definitions/ABitOfEverythingNested" + nonConventionalNameValue: + type: "string" + timestamp_value: + type: "string" + format: "date-time" + repeated_enum_value: + type: "array" + title: "repeated enum value. it is comma-separated in query" + items: + $ref: "#/definitions/examplepbNumericEnum" + repeated_enum_annotation: + type: "array" + description: "Repeated numeric enum description." + title: "Repeated numeric enum title" + items: + $ref: "#/definitions/examplepbNumericEnum" + enum_value_annotation: + description: "Numeric enum description." + title: "Numeric enum title" + $ref: "#/definitions/examplepbNumericEnum" + repeated_string_annotation: + type: "array" + description: "Repeated string description." + title: "Repeated string title" + items: + type: "string" + repeated_nested_annotation: + type: "array" + description: "Repeated nested object description." + title: "Repeated nested object title" + items: + $ref: "#/definitions/ABitOfEverythingNested" + nested_annotation: + description: "Nested object description." + title: "Nested object title" + $ref: "#/definitions/ABitOfEverythingNested" + int64_override_type: + type: "integer" + format: "int64" + externalDocs: + description: "Find out more about ABitOfEverything" + url: "https://github.com/grpc-ecosystem/grpc-gateway" + title: "A bit of everything" + description: "Intentionaly complicated message type to cover many features of\ + \ Protobuf." + example: + uuid: "0cf361e1-4b44-483d-a159-54dabdf7e814" + examplepbABitOfEverythingRepeated: + type: "object" + properties: + path_repeated_float_value: + type: "array" + title: "repeated values. they are comma-separated in path" + items: + type: "number" + format: "float" + path_repeated_double_value: + type: "array" + items: + type: "number" + format: "double" + path_repeated_int64_value: + type: "array" + items: + type: "string" + format: "int64" + path_repeated_uint64_value: + type: "array" + items: + type: "string" + format: "uint64" + path_repeated_int32_value: + type: "array" + items: + type: "integer" + format: "int32" + path_repeated_fixed64_value: + type: "array" + items: + type: "string" + format: "uint64" + path_repeated_fixed32_value: + type: "array" + items: + type: "integer" + format: "int64" + path_repeated_bool_value: + type: "array" + items: + type: "boolean" + format: "boolean" + path_repeated_string_value: + type: "array" + items: + type: "string" + path_repeated_bytes_value: + type: "array" + items: + type: "string" + format: "byte" + pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" + path_repeated_uint32_value: + type: "array" + items: + type: "integer" + format: "int64" + path_repeated_enum_value: + type: "array" + items: + $ref: "#/definitions/examplepbNumericEnum" + path_repeated_sfixed32_value: + type: "array" + items: + type: "integer" + format: "int32" + path_repeated_sfixed64_value: + type: "array" + items: + type: "string" + format: "int64" + path_repeated_sint32_value: + type: "array" + items: + type: "integer" + format: "int32" + path_repeated_sint64_value: + type: "array" + items: + type: "string" + format: "int64" + title: "ABitOfEverythingRepeated is used to validate repeated path parameter functionality" + example: + path_repeated_bool_value: + - true + - true + - false + - true + path_repeated_int32_value: + - 1 + - 2 + - 3 + examplepbBody: + type: "object" + properties: + name: + type: "string" + examplepbNumericEnum: + type: "string" + description: "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE\ + \ means 1" + enum: + - "ZERO" + - "ONE" + default: "ZERO" + examplepbUpdateV2Request: + type: "object" + properties: + abe: + $ref: "#/definitions/examplepbABitOfEverything" + update_mask: + $ref: "#/definitions/protobufFieldMask" + title: "UpdateV2Request request for update includes the message and the update\ + \ mask" + pathenumPathEnum: + type: "string" + enum: + - "ABC" + - "DEF" + default: "ABC" + protobufFieldMask: + type: "object" + properties: + paths: + type: "array" + description: "The set of field mask paths." + items: + type: "string" + title: "`FieldMask` represents a set of symbolic field paths, for example:" + description: "paths: \"f.a\"\n paths: \"f.b.d\"\n\nHere `f` represents a field\ + \ in some root message, `a` and `b`\nfields in the message found in `f`, and\ + \ `d` a field found in the\nmessage in `f.b`.\n\nField masks are used to specify\ + \ a subset of fields that should be\nreturned by a get operation or modified\ + \ by an update operation.\nField masks also have a custom JSON encoding (see\ + \ below).\n\n# Field Masks in Projections\n\nWhen used in the context of a projection,\ + \ a response message or\nsub-message is filtered by the API to only contain\ + \ those fields as\nspecified in the mask. For example, if the mask in the previous\n\ + example is applied to a response message as follows:\n\n f {\n a : 22\n\ + \ b {\n d : 1\n x : 2\n }\n y : 13\n }\n \ + \ z: 8\n\nThe result will not contain specific values for fields x,y and z\n\ + (their value will be set to the default, and omitted in proto text\noutput):\n\ + \n\n f {\n a : 22\n b {\n d : 1\n }\n }\n\nA repeated\ + \ field is not allowed except at the last position of a\npaths string.\n\nIf\ + \ a FieldMask object is not present in a get operation, the\noperation applies\ + \ to all fields (as if a FieldMask of all fields\nhad been specified).\n\nNote\ + \ that a field mask does not necessarily apply to the\ntop-level response message.\ + \ In case of a REST get operation, the\nfield mask applies directly to the response,\ + \ but in case of a REST\nlist operation, the mask instead applies to each individual\ + \ message\nin the returned resource list. In case of a REST custom method,\n\ + other definitions may be used. Where the mask applies will be\nclearly documented\ + \ together with its declaration in the API. In\nany case, the effect on the\ + \ returned resource/resources is required\nbehavior for APIs.\n\n# Field Masks\ + \ in Update Operations\n\nA field mask in update operations specifies which\ + \ fields of the\ntargeted resource are going to be updated. The API is required\n\ + to only change the values of the fields as specified in the mask\nand leave\ + \ the others untouched. If a resource is passed in to\ndescribe the updated\ + \ values, the API ignores the values of all\nfields not covered by the mask.\n\ + \nIf a repeated field is specified for an update operation, new values will\n\ + be appended to the existing repeated field in the target resource. Note that\n\ + a repeated field is only allowed in the last position of a `paths` string.\n\ + \nIf a sub-message is specified in the last position of the field mask for an\n\ + update operation, then new value will be merged into the existing sub-message\n\ + in the target resource.\n\nFor example, given the target message:\n\n f {\n\ + \ b {\n d: 1\n x: 2\n }\n c: [1]\n }\n\nAnd\ + \ an update message:\n\n f {\n b {\n d: 10\n }\n c:\ + \ [2]\n }\n\nthen if the field mask is:\n\n paths: [\"f.b\", \"f.c\"]\n\n\ + then the result will be:\n\n f {\n b {\n d: 10\n x: 2\n\ + \ }\n c: [1, 2]\n }\n\nAn implementation may provide options to\ + \ override this default behavior for\nrepeated and message fields.\n\nIn order\ + \ to reset a field's value to the default, the field must\nbe in the mask and\ + \ set to the default value in the provided resource.\nHence, in order to reset\ + \ all fields of a resource, provide a default\ninstance of the resource and\ + \ set all fields in the mask, or do\nnot provide a mask as described below.\n\ + \nIf a field mask is not present on update, the operation applies to\nall fields\ + \ (as if a field mask of all fields has been specified).\nNote that in the presence\ + \ of schema evolution, this may mean that\nfields the client does not know and\ + \ has therefore not filled into\nthe request will be reset to their default.\ + \ If this is unwanted\nbehavior, a specific service may require a client to\ + \ always specify\na field mask, producing an error if not.\n\nAs with get operations,\ + \ the location of the resource which\ndescribes the updated values in the request\ + \ message depends on the\noperation kind. In any case, the effect of the field\ + \ mask is\nrequired to be honored by the API.\n\n## Considerations for HTTP\ + \ REST\n\nThe HTTP kind of an update operation which uses a field mask must\n\ + be set to PATCH instead of PUT in order to satisfy HTTP semantics\n(PUT must\ + \ only be used for full updates).\n\n# JSON Encoding of Field Masks\n\nIn JSON,\ + \ a field mask is encoded as a single string where paths are\nseparated by a\ + \ comma. Fields name in each path are converted\nto/from lower-camel naming\ + \ conventions.\n\nAs an example, consider the following message declarations:\n\ + \n message Profile {\n User user = 1;\n Photo photo = 2;\n }\n\ + \ message User {\n string display_name = 1;\n string address =\ + \ 2;\n }\n\nIn proto a field mask for `Profile` may look as such:\n\n \ + \ mask {\n paths: \"user.display_name\"\n paths: \"photo\"\n }\n\ + \nIn JSON, the same mask is represented as below:\n\n {\n mask: \"user.displayName,photo\"\ + \n }\n\n# Field Masks and Oneof Fields\n\nField masks treat fields in oneofs\ + \ just as regular fields. Consider the\nfollowing message:\n\n message SampleMessage\ + \ {\n oneof test_oneof {\n string name = 4;\n SubMessage\ + \ sub_message = 9;\n }\n }\n\nThe field mask can be:\n\n mask {\n\ + \ paths: \"name\"\n }\n\nOr:\n\n mask {\n paths: \"sub_message\"\ + \n }\n\nNote that oneof type names (\"test_oneof\" in this case) cannot be\ + \ used in\npaths.\n\n## Field Mask Verification\n\nThe implementation of any\ + \ API method which has a FieldMask type field in the\nrequest should verify\ + \ the included field paths, and return an\n`INVALID_ARGUMENT` error if any path\ + \ is duplicated or unmappable." + subStringMessage: + type: "object" + properties: + value: + type: "string" + example: + value: "value" +externalDocs: + description: "More about gRPC-Gateway" + url: "https://github.com/grpc-ecosystem/grpc-gateway" +x-grpc-gateway-baz-list: +- "one" +- true +x-grpc-gateway-foo: "bar" diff --git a/examples/clients/abe/api_a_bit_of_everything_service.go b/examples/clients/abe/api_a_bit_of_everything_service.go new file mode 100644 index 00000000000..2bd1d972c20 --- /dev/null +++ b/examples/clients/abe/api_a_bit_of_everything_service.go @@ -0,0 +1,3054 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type ABitOfEverythingServiceApiService service + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param singleNestedName name is nested field. + * @param floatValue Float value field + * @param optional nil or *CheckGetQueryParamsOpts - Optional Parameters: + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uuid" (optional.String) - + * @param "DoubleValue" (optional.Float64) - + * @param "Int64Value" (optional.String) - + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofString" (optional.String) - + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title. Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title. Repeated string description. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + +@return ExamplepbABitOfEverything +*/ + +type CheckGetQueryParamsOpts struct { + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uuid optional.String + DoubleValue optional.Float64 + Int64Value optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofString optional.String + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 +} + +func (a *ABitOfEverythingServiceApiService) CheckGetQueryParams(ctx context.Context, singleNestedName string, floatValue float32, localVarOptionals *CheckGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/{single_nested.name}" + localVarPath = strings.Replace(localVarPath, "{"+"single_nested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("single_nested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("single_nested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuid.IsSet() { + localVarQueryParams.Add("uuid", parameterToString(localVarOptionals.Uuid.Value(), "")) + } + localVarQueryParams.Add("float_value", parameterToString(floatValue, "")) + if localVarOptionals != nil && localVarOptionals.DoubleValue.IsSet() { + localVarQueryParams.Add("double_value", parameterToString(localVarOptionals.DoubleValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64Value.IsSet() { + localVarQueryParams.Add("int64_value", parameterToString(localVarOptionals.Int64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64_value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32_value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64_value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32_value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("bool_value", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("string_value", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytes_value", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32_value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enum_value", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("path_enum_value", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nested_path_enum_value", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32_value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64_value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32_value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64_value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeated_string_value", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneof_string", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestamp_value", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeated_enum_value", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeated_enum_annotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enum_value_annotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeated_string_annotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nested_annotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nested_annotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64_override_type", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param singleNestedOk DeepEnum description. + * @param floatValue Float value field + * @param optional nil or *CheckNestedEnumGetQueryParamsOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "Uuid" (optional.String) - + * @param "DoubleValue" (optional.Float64) - + * @param "Int64Value" (optional.String) - + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofString" (optional.String) - + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title. Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title. Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "Int64OverrideType" (optional.Int64) - + +@return ExamplepbABitOfEverything +*/ + +type CheckNestedEnumGetQueryParamsOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + Uuid optional.String + DoubleValue optional.Float64 + Int64Value optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofString optional.String + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + Int64OverrideType optional.Int64 +} + +func (a *ABitOfEverythingServiceApiService) CheckNestedEnumGetQueryParams(ctx context.Context, singleNestedOk string, floatValue float32, localVarOptionals *CheckNestedEnumGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}" + localVarPath = strings.Replace(localVarPath, "{"+"single_nested.ok"+"}", fmt.Sprintf("%v", singleNestedOk), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("single_nested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("single_nested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuid.IsSet() { + localVarQueryParams.Add("uuid", parameterToString(localVarOptionals.Uuid.Value(), "")) + } + localVarQueryParams.Add("float_value", parameterToString(floatValue, "")) + if localVarOptionals != nil && localVarOptionals.DoubleValue.IsSet() { + localVarQueryParams.Add("double_value", parameterToString(localVarOptionals.DoubleValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64Value.IsSet() { + localVarQueryParams.Add("int64_value", parameterToString(localVarOptionals.Int64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64_value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32_value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64_value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32_value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("bool_value", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("string_value", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytes_value", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32_value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enum_value", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("path_enum_value", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nested_path_enum_value", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32_value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64_value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32_value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64_value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeated_string_value", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneof_string", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestamp_value", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeated_enum_value", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeated_enum_annotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enum_value_annotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeated_string_annotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nested_annotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nested_annotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64_override_type", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stringValue + * @param body + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingServiceApiService) CheckPostQueryParams(ctx context.Context, stringValue string, body ABitOfEverythingNested) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/post/{string_value}" + localVarPath = strings.Replace(localVarPath, "{"+"string_value"+"}", fmt.Sprintf("%v", stringValue), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService Create a new ABitOfEverything +This API creates a new ABitOfEverything + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param uint32Value + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param nonConventionalNameValue + * @param enumValue + * @param pathEnumValue + * @param nestedPathEnumValue + * @param enumValueAnnotation Numeric enum description. + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingServiceApiService) Create(ctx context.Context, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, enumValueAnnotation string) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/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}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}/{path_enum_value}/{nested_path_enum_value}/{enum_value_annotation}" + localVarPath = strings.Replace(localVarPath, "{"+"float_value"+"}", fmt.Sprintf("%v", floatValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"double_value"+"}", fmt.Sprintf("%v", doubleValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"int64_value"+"}", fmt.Sprintf("%v", int64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uint64_value"+"}", fmt.Sprintf("%v", uint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"int32_value"+"}", fmt.Sprintf("%v", int32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fixed64_value"+"}", fmt.Sprintf("%v", fixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fixed32_value"+"}", fmt.Sprintf("%v", fixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"bool_value"+"}", fmt.Sprintf("%v", boolValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"string_value"+"}", fmt.Sprintf("%v", stringValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uint32_value"+"}", fmt.Sprintf("%v", uint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sfixed32_value"+"}", fmt.Sprintf("%v", sfixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sfixed64_value"+"}", fmt.Sprintf("%v", sfixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sint32_value"+"}", fmt.Sprintf("%v", sint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sint64_value"+"}", fmt.Sprintf("%v", sint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nonConventionalNameValue"+"}", fmt.Sprintf("%v", nonConventionalNameValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"enum_value"+"}", fmt.Sprintf("%v", enumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_enum_value"+"}", fmt.Sprintf("%v", pathEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nested_path_enum_value"+"}", fmt.Sprintf("%v", nestedPathEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"enum_value_annotation"+"}", fmt.Sprintf("%v", enumValueAnnotation), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingServiceApiService) CreateBody(ctx context.Context, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param singleNestedName name is nested field. + * @param body + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingServiceApiService) DeepPathEcho(ctx context.Context, singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{single_nested.name}" + localVarPath = strings.Replace(localVarPath, "{"+"single_nested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuid + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) Delete(ctx context.Context, uuid string) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ErrorWithDetails(ctx context.Context) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/errorwithdetails" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) GetMessageWithBody(ctx context.Context, id string, body ExamplepbBody) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/withbody/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuid + * @param floatValue Float value field + * @param optional nil or *GetQueryOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "DoubleValue" (optional.Float64) - + * @param "Int64Value" (optional.String) - + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofString" (optional.String) - + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title. Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title. Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title. Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + +@return interface{} +*/ + +type GetQueryOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + DoubleValue optional.Float64 + Int64Value optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofString optional.String + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 +} + +func (a *ABitOfEverythingServiceApiService) GetQuery(ctx context.Context, uuid string, floatValue float32, localVarOptionals *GetQueryOpts) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/query/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("single_nested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("single_nested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("single_nested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("float_value", parameterToString(floatValue, "")) + if localVarOptionals != nil && localVarOptionals.DoubleValue.IsSet() { + localVarQueryParams.Add("double_value", parameterToString(localVarOptionals.DoubleValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64Value.IsSet() { + localVarQueryParams.Add("int64_value", parameterToString(localVarOptionals.Int64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64_value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32_value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64_value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32_value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("bool_value", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("string_value", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytes_value", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32_value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enum_value", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("path_enum_value", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nested_path_enum_value", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32_value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64_value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32_value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64_value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeated_string_value", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneof_string", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestamp_value", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeated_enum_value", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeated_enum_annotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enum_value_annotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeated_string_annotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nested_annotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nested_annotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nested_annotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64_override_type", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param pathRepeatedFloatValue repeated values. they are comma-separated in path + * @param pathRepeatedDoubleValue + * @param pathRepeatedInt64Value + * @param pathRepeatedUint64Value + * @param pathRepeatedInt32Value + * @param pathRepeatedFixed64Value + * @param pathRepeatedFixed32Value + * @param pathRepeatedBoolValue + * @param pathRepeatedStringValue + * @param pathRepeatedBytesValue + * @param pathRepeatedUint32Value + * @param pathRepeatedEnumValue + * @param pathRepeatedSfixed32Value + * @param pathRepeatedSfixed64Value + * @param pathRepeatedSint32Value + * @param pathRepeatedSint64Value + +@return ExamplepbABitOfEverythingRepeated +*/ +func (a *ABitOfEverythingServiceApiService) GetRepeatedQuery(ctx context.Context, pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (ExamplepbABitOfEverythingRepeated, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverythingRepeated + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything_repeated/{path_repeated_float_value}/{path_repeated_double_value}/{path_repeated_int64_value}/{path_repeated_uint64_value}/{path_repeated_int32_value}/{path_repeated_fixed64_value}/{path_repeated_fixed32_value}/{path_repeated_bool_value}/{path_repeated_string_value}/{path_repeated_bytes_value}/{path_repeated_uint32_value}/{path_repeated_enum_value}/{path_repeated_sfixed32_value}/{path_repeated_sfixed64_value}/{path_repeated_sint32_value}/{path_repeated_sint64_value}" + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_float_value"+"}", fmt.Sprintf("%v", pathRepeatedFloatValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_double_value"+"}", fmt.Sprintf("%v", pathRepeatedDoubleValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_int64_value"+"}", fmt.Sprintf("%v", pathRepeatedInt64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_uint64_value"+"}", fmt.Sprintf("%v", pathRepeatedUint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_int32_value"+"}", fmt.Sprintf("%v", pathRepeatedInt32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_fixed64_value"+"}", fmt.Sprintf("%v", pathRepeatedFixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_fixed32_value"+"}", fmt.Sprintf("%v", pathRepeatedFixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_bool_value"+"}", fmt.Sprintf("%v", pathRepeatedBoolValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_string_value"+"}", fmt.Sprintf("%v", pathRepeatedStringValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_bytes_value"+"}", fmt.Sprintf("%v", pathRepeatedBytesValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_uint32_value"+"}", fmt.Sprintf("%v", pathRepeatedUint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_enum_value"+"}", fmt.Sprintf("%v", pathRepeatedEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_sfixed32_value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_sfixed64_value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_sint32_value"+"}", fmt.Sprintf("%v", pathRepeatedSint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_repeated_sint64_value"+"}", fmt.Sprintf("%v", pathRepeatedSint64Value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if len(pathRepeatedFloatValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFloatValue must have at least 1 elements") + } + if len(pathRepeatedDoubleValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedDoubleValue must have at least 1 elements") + } + if len(pathRepeatedInt64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedInt64Value must have at least 1 elements") + } + if len(pathRepeatedUint64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedUint64Value must have at least 1 elements") + } + if len(pathRepeatedInt32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedInt32Value must have at least 1 elements") + } + if len(pathRepeatedFixed64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFixed64Value must have at least 1 elements") + } + if len(pathRepeatedFixed32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFixed32Value must have at least 1 elements") + } + if len(pathRepeatedBoolValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedBoolValue must have at least 1 elements") + } + if len(pathRepeatedStringValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedStringValue must have at least 1 elements") + } + if len(pathRepeatedBytesValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedBytesValue must have at least 1 elements") + } + if len(pathRepeatedUint32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedUint32Value must have at least 1 elements") + } + if len(pathRepeatedEnumValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedEnumValue must have at least 1 elements") + } + if len(pathRepeatedSfixed32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSfixed32Value must have at least 1 elements") + } + if len(pathRepeatedSfixed64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSfixed64Value must have at least 1 elements") + } + if len(pathRepeatedSint32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSint32Value must have at least 1 elements") + } + if len(pathRepeatedSint64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSint64Value must have at least 1 elements") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverythingRepeated + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuid + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingServiceApiService) Lookup(ctx context.Context, uuid string) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) PostWithEmptyBody(ctx context.Context, name string, body ExamplepbBody) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/postwithemptybody/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) Timeout(ctx context.Context) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/timeout" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuid + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) Update(ctx context.Context, uuid string, body ExamplepbABitOfEverything) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param abeUuid + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) UpdateV2(ctx context.Context, abeUuid string, body ExamplepbABitOfEverything) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{abe.uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param abeUuid + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) UpdateV22(ctx context.Context, abeUuid string, body ExamplepbABitOfEverything) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{abe.uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param abeUuid + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) UpdateV23(ctx context.Context, abeUuid string, body ExamplepbUpdateV2Request) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2a/example/a_bit_of_everything/{abe.uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"abe.uuid"+"}", fmt.Sprintf("%v", abeUuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/examples/clients/abe/api_camel_case_service_name.go b/examples/clients/abe/api_camel_case_service_name.go new file mode 100644 index 00000000000..f5835bbe031 --- /dev/null +++ b/examples/clients/abe/api_camel_case_service_name.go @@ -0,0 +1,159 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type CamelCaseServiceNameApiService service + +/* +CamelCaseServiceNameApiService Create a new ABitOfEverything +This API creates a new ABitOfEverything + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return interface{} +*/ +func (a *CamelCaseServiceNameApiService) Empty(ctx context.Context) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/empty" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/examples/clients/abe/api_client.go b/examples/clients/abe/api_client.go deleted file mode 100644 index bf3e21a9fb1..00000000000 --- a/examples/clients/abe/api_client.go +++ /dev/null @@ -1,164 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -import ( - "bytes" - "fmt" - "path/filepath" - "reflect" - "strings" - "net/url" - "io/ioutil" - "github.com/go-resty/resty" -) - -type APIClient struct { - config *Configuration -} - -func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { - - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -func (c *APIClient) SelectHeaderAccept(accepts []string) string { - - if len(accepts) == 0 { - return "" - } - if contains(accepts, "application/json") { - return "application/json" - } - return strings.Join(accepts, ",") -} - -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { - return true - } - } - return false -} - -func (c *APIClient) CallAPI(path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams map[string]string, - fileName string, - fileBytes []byte) (*resty.Response, error) { - - rClient := c.prepareClient() - request := c.prepareRequest(rClient, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - switch strings.ToUpper(method) { - case "GET": - response, err := request.Get(path) - return response, err - case "POST": - response, err := request.Post(path) - return response, err - case "PUT": - response, err := request.Put(path) - return response, err - case "PATCH": - response, err := request.Patch(path) - return response, err - case "DELETE": - response, err := request.Delete(path) - return response, err - } - - return nil, fmt.Errorf("invalid method %v", method) -} - -func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string { - delimiter := "" - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," - } - - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } - - return fmt.Sprintf("%v", obj) -} - -func (c *APIClient) prepareClient() *resty.Client { - - rClient := resty.New() - - rClient.SetDebug(c.config.Debug) - if c.config.Transport != nil { - rClient.SetTransport(c.config.Transport) - } - - if c.config.Timeout != nil { - rClient.SetTimeout(*c.config.Timeout) - } - rClient.SetLogger(ioutil.Discard) - return rClient -} - -func (c *APIClient) prepareRequest( - rClient *resty.Client, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams map[string]string, - fileName string, - fileBytes []byte) *resty.Request { - - - request := rClient.R() - request.SetBody(postBody) - - if c.config.UserAgent != "" { - request.SetHeader("User-Agent", c.config.UserAgent) - } - - // add header parameter, if any - if len(headerParams) > 0 { - request.SetHeaders(headerParams) - } - - // add query parameter, if any - if len(queryParams) > 0 { - request.SetMultiValueQueryParams(queryParams) - } - - // add form parameter, if any - if len(formParams) > 0 { - request.SetFormData(formParams) - } - - if len(fileBytes) > 0 && fileName != "" { - _, fileNm := filepath.Split(fileName) - request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) - } - return request -} diff --git a/examples/clients/abe/api_echo_rpc.go b/examples/clients/abe/api_echo_rpc.go new file mode 100644 index 00000000000..1dab0dc55f0 --- /dev/null +++ b/examples/clients/abe/api_echo_rpc.go @@ -0,0 +1,475 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type EchoRpcApiService service + +/* +EchoRpcApiService Summary: Echo rpc +Description Echo + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param value + +@return SubStringMessage +*/ +func (a *EchoRpcApiService) Echo(ctx context.Context, value string) (SubStringMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue SubStringMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" + localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v SubStringMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v int32 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 503 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +EchoRpcApiService Summary: Echo rpc +Description Echo + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + +@return SubStringMessage +*/ +func (a *EchoRpcApiService) Echo2(ctx context.Context, body string) (SubStringMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue SubStringMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v SubStringMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v int32 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 503 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +EchoRpcApiService Summary: Echo rpc +Description Echo + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *Echo3Opts - Optional Parameters: + * @param "Value" (optional.String) - + +@return SubStringMessage +*/ + +type Echo3Opts struct { + Value optional.String +} + +func (a *EchoRpcApiService) Echo3(ctx context.Context, localVarOptionals *Echo3Opts) (SubStringMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue SubStringMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Value.IsSet() { + localVarQueryParams.Add("value", parameterToString(localVarOptionals.Value.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v SubStringMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v int32 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 503 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/examples/clients/abe/camel_case_service_name_api.go b/examples/clients/abe/camel_case_service_name_api.go deleted file mode 100644 index cb8cb48fd99..00000000000 --- a/examples/clients/abe/camel_case_service_name_api.go +++ /dev/null @@ -1,111 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -import ( - "net/url" - "strings" - "encoding/json" -) - -type CamelCaseServiceNameApi struct { - Configuration *Configuration -} - -func NewCamelCaseServiceNameApi() *CamelCaseServiceNameApi { - configuration := NewConfiguration() - return &CamelCaseServiceNameApi{ - Configuration: configuration, - } -} - -func NewCamelCaseServiceNameApiWithBasePath(basePath string) *CamelCaseServiceNameApi { - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &CamelCaseServiceNameApi{ - Configuration: configuration, - } -} - -/** - * Create a new ABitOfEverything - * This API creates a new ABitOfEverything - * - * @return *interface{} - */ -func (a CamelCaseServiceNameApi) Empty() (*interface{}, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/empty" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(interface{}) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Empty", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - diff --git a/examples/clients/abe/client.go b/examples/clients/abe/client.go new file mode 100644 index 00000000000..1bf9497bd2d --- /dev/null +++ b/examples/clients/abe/client.go @@ -0,0 +1,471 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") + xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") +) + +// APIClient manages communication with the A Bit of Everything API v1.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + ABitOfEverythingServiceApi *ABitOfEverythingServiceApiService + + CamelCaseServiceNameApi *CamelCaseServiceNameApiService + + EchoRpcApi *EchoRpcApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.ABitOfEverythingServiceApi = (*ABitOfEverythingServiceApiService)(&c.common) + c.CamelCaseServiceNameApi = (*CamelCaseServiceNameApiService)(&c.common) + c.EchoRpcApi = (*EchoRpcApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } + + return fmt.Sprintf("%v", obj) +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + return c.cfg.HTTPClient.Do(request) +} + +// Change base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile("file", filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + } + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Override request host, if applicable + if c.cfg.Host != "" { + localVarRequest.Host = c.cfg.Host + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } + expires = now.Add(lifetime) + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericSwaggerError Provides access to the body, error and model on returned errors. +type GenericSwaggerError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericSwaggerError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericSwaggerError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericSwaggerError) Model() interface{} { + return e.model +} \ No newline at end of file diff --git a/examples/clients/abe/configuration.go b/examples/clients/abe/configuration.go index ccc319c34aa..3e85ff02f0f 100644 --- a/examples/clients/abe/configuration.go +++ b/examples/clients/abe/configuration.go @@ -1,67 +1,73 @@ -/* +/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0 + * API version: 1.0 * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( - "encoding/base64" "net/http" - "time" ) +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} type Configuration struct { - Username string `json:"userName,omitempty"` - Password string `json:"password,omitempty"` - APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` - APIKey map[string]string `json:"APIKey,omitempty"` - Debug bool `json:"debug,omitempty"` - DebugFile string `json:"debugFile,omitempty"` - OAuthToken string `json:"oAuthToken,omitempty"` BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` - AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` - APIClient *APIClient - Transport *http.Transport - Timeout *time.Duration `json:"timeout,omitempty"` + HTTPClient *http.Client } func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "http://localhost", DefaultHeader: make(map[string]string), - APIKey: make(map[string]string), - APIKeyPrefix: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", - APIClient: &APIClient{}, } - - cfg.APIClient.config = cfg return cfg } -func (c *Configuration) GetBasicAuthEncodedString() string { - return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password)) -} - func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } - -func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string { - if c.APIKeyPrefix[APIKeyIdentifier] != "" { - return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] - } - - return c.APIKey[APIKeyIdentifier] -} diff --git a/examples/clients/abe/echo_rpc_api.go b/examples/clients/abe/echo_rpc_api.go deleted file mode 100644 index 8afbbdd437f..00000000000 --- a/examples/clients/abe/echo_rpc_api.go +++ /dev/null @@ -1,265 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -import ( - "net/url" - "strings" - "encoding/json" - "fmt" -) - -type EchoRpcApi struct { - Configuration *Configuration -} - -func NewEchoRpcApi() *EchoRpcApi { - configuration := NewConfiguration() - return &EchoRpcApi{ - Configuration: configuration, - } -} - -func NewEchoRpcApiWithBasePath(basePath string) *EchoRpcApi { - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &EchoRpcApi{ - Configuration: configuration, - } -} - -/** - * Summary: Echo rpc - * Description Echo - * - * @param value - * @return *SubStringMessage - */ -func (a EchoRpcApi) Echo(value string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" - localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Summary: Echo rpc - * Description Echo - * - * @param body - * @return *SubStringMessage - */ -func (a EchoRpcApi) Echo2(body string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/echo" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Summary: Echo rpc - * Description Echo - * - * @param value - * @return *SubStringMessage - */ -func (a EchoRpcApi) Echo3(value string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/echo" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo3", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - diff --git a/examples/clients/abe/echo_service_api.go b/examples/clients/abe/echo_service_api.go deleted file mode 100644 index 568177715d2..00000000000 --- a/examples/clients/abe/echo_service_api.go +++ /dev/null @@ -1,265 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -import ( - "net/url" - "strings" - "encoding/json" - "fmt" -) - -type EchoServiceApi struct { - Configuration *Configuration -} - -func NewEchoServiceApi() *EchoServiceApi { - configuration := NewConfiguration() - return &EchoServiceApi{ - Configuration: configuration, - } -} - -func NewEchoServiceApiWithBasePath(basePath string) *EchoServiceApi { - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &EchoServiceApi{ - Configuration: configuration, - } -} - -/** - * Summary: Echo rpc - * Description Echo - * - * @param value - * @return *SubStringMessage - */ -func (a EchoServiceApi) Echo(value string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" - localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Summary: Echo rpc - * Description Echo - * - * @param body - * @return *SubStringMessage - */ -func (a EchoServiceApi) Echo2(body string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/echo" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Summary: Echo rpc - * Description Echo - * - * @param value - * @return *SubStringMessage - */ -func (a EchoServiceApi) Echo3(value string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/echo" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // authentication '(OAuth2)' required - // oauth required - if a.Configuration.AccessToken != ""{ - localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken - } - // authentication '(BasicAuth)' required - // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != ""{ - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() - } - // authentication '(ApiKeyAuth)' required - // set key with prefix in header - localVarHeaderParams["X-API-Key"] = a.Configuration.GetAPIKeyWithPrefix("X-API-Key") - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo3", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - diff --git a/examples/clients/abe/examplepb_numeric_enum.go b/examples/clients/abe/examplepb_numeric_enum.go deleted file mode 100644 index e953bbe34e8..00000000000 --- a/examples/clients/abe/examplepb_numeric_enum.go +++ /dev/null @@ -1,15 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -// NumericEnum is one or zero. - ZERO: ZERO means 0 - ONE: ONE means 1 -type ExamplepbNumericEnum struct { -} diff --git a/examples/clients/abe/examplepb_update_v2_request.go b/examples/clients/abe/examplepb_update_v2_request.go deleted file mode 100644 index 9d021f8241c..00000000000 --- a/examples/clients/abe/examplepb_update_v2_request.go +++ /dev/null @@ -1,18 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -type ExamplepbUpdateV2Request struct { - - Abe ExamplepbABitOfEverything `json:"abe,omitempty"` - - UpdateMask ProtobufFieldMask `json:"update_mask,omitempty"` -} diff --git a/examples/clients/abe/message_path_enum_nested_path_enum.go b/examples/clients/abe/message_path_enum_nested_path_enum.go deleted file mode 100644 index a6d9a579f6c..00000000000 --- a/examples/clients/abe/message_path_enum_nested_path_enum.go +++ /dev/null @@ -1,14 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -type MessagePathEnumNestedPathEnum struct { -} diff --git a/examples/clients/abe/a_bit_of_everything_nested.go b/examples/clients/abe/model_a_bit_of_everything_nested.go similarity index 71% rename from examples/clients/abe/a_bit_of_everything_nested.go rename to examples/clients/abe/model_a_bit_of_everything_nested.go index c5b1dc53c75..586778feaaa 100644 --- a/examples/clients/abe/a_bit_of_everything_nested.go +++ b/examples/clients/abe/model_a_bit_of_everything_nested.go @@ -1,23 +1,20 @@ -/* +/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0 + * API version: 1.0 * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // Nested is nested type. type ABitOfEverythingNested struct { - // name is nested field. Name string `json:"name,omitempty"` - Amount int64 `json:"amount,omitempty"` - // DeepEnum description. - Ok NestedDeepEnum `json:"ok,omitempty"` + Ok *NestedDeepEnum `json:"ok,omitempty"` } diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/model_examplepb_a_bit_of_everything.go similarity index 77% rename from examples/clients/abe/examplepb_a_bit_of_everything.go rename to examples/clients/abe/model_examplepb_a_bit_of_everything.go index f14edb018dd..d97adde4a02 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/model_examplepb_a_bit_of_everything.go @@ -1,11 +1,11 @@ -/* +/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0 + * API version: 1.0 * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe @@ -16,82 +16,46 @@ import ( // Intentionaly complicated message type to cover many features of Protobuf. type ExamplepbABitOfEverything struct { - - SingleNested ABitOfEverythingNested `json:"single_nested,omitempty"` - + SingleNested *ABitOfEverythingNested `json:"single_nested,omitempty"` Uuid string `json:"uuid"` - Nested []ABitOfEverythingNested `json:"nested,omitempty"` - // Float value field FloatValue float32 `json:"float_value,omitempty"` - DoubleValue float64 `json:"double_value"` - Int64Value string `json:"int64_value"` - Uint64Value string `json:"uint64_value,omitempty"` - Int32Value int32 `json:"int32_value,omitempty"` - Fixed64Value string `json:"fixed64_value,omitempty"` - Fixed32Value int64 `json:"fixed32_value,omitempty"` - BoolValue bool `json:"bool_value,omitempty"` - StringValue string `json:"string_value,omitempty"` - BytesValue string `json:"bytes_value,omitempty"` - Uint32Value int64 `json:"uint32_value,omitempty"` - - EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"` - - PathEnumValue PathenumPathEnum `json:"path_enum_value,omitempty"` - - NestedPathEnumValue MessagePathEnumNestedPathEnum `json:"nested_path_enum_value,omitempty"` - + EnumValue *ExamplepbNumericEnum `json:"enum_value,omitempty"` + PathEnumValue *PathenumPathEnum `json:"path_enum_value,omitempty"` + NestedPathEnumValue *MessagePathEnumNestedPathEnum `json:"nested_path_enum_value,omitempty"` Sfixed32Value int32 `json:"sfixed32_value,omitempty"` - Sfixed64Value string `json:"sfixed64_value,omitempty"` - Sint32Value int32 `json:"sint32_value,omitempty"` - Sint64Value string `json:"sint64_value,omitempty"` - RepeatedStringValue []string `json:"repeated_string_value,omitempty"` - - OneofEmpty interface{} `json:"oneof_empty,omitempty"` - + OneofEmpty *interface{} `json:"oneof_empty,omitempty"` OneofString string `json:"oneof_string,omitempty"` - MapValue map[string]ExamplepbNumericEnum `json:"map_value,omitempty"` - MappedStringValue map[string]string `json:"mapped_string_value,omitempty"` - MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"` - NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` - TimestampValue time.Time `json:"timestamp_value,omitempty"` - RepeatedEnumValue []ExamplepbNumericEnum `json:"repeated_enum_value,omitempty"` - // Repeated numeric enum description. RepeatedEnumAnnotation []ExamplepbNumericEnum `json:"repeated_enum_annotation,omitempty"` - // Numeric enum description. - EnumValueAnnotation ExamplepbNumericEnum `json:"enum_value_annotation,omitempty"` - + EnumValueAnnotation *ExamplepbNumericEnum `json:"enum_value_annotation,omitempty"` // Repeated string description. RepeatedStringAnnotation []string `json:"repeated_string_annotation,omitempty"` - // Repeated nested object description. RepeatedNestedAnnotation []ABitOfEverythingNested `json:"repeated_nested_annotation,omitempty"` - // Nested object description. - NestedAnnotation ABitOfEverythingNested `json:"nested_annotation,omitempty"` - + NestedAnnotation *ABitOfEverythingNested `json:"nested_annotation,omitempty"` Int64OverrideType int64 `json:"int64_override_type,omitempty"` } diff --git a/examples/clients/abe/examplepb_a_bit_of_everything_repeated.go b/examples/clients/abe/model_examplepb_a_bit_of_everything_repeated.go similarity index 92% rename from examples/clients/abe/examplepb_a_bit_of_everything_repeated.go rename to examples/clients/abe/model_examplepb_a_bit_of_everything_repeated.go index 35f588ccf3d..3bde251e8d5 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything_repeated.go +++ b/examples/clients/abe/model_examplepb_a_bit_of_everything_repeated.go @@ -1,46 +1,30 @@ -/* +/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0 + * API version: 1.0 * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbABitOfEverythingRepeated struct { - PathRepeatedFloatValue []float32 `json:"path_repeated_float_value,omitempty"` - PathRepeatedDoubleValue []float64 `json:"path_repeated_double_value,omitempty"` - PathRepeatedInt64Value []string `json:"path_repeated_int64_value,omitempty"` - PathRepeatedUint64Value []string `json:"path_repeated_uint64_value,omitempty"` - PathRepeatedInt32Value []int32 `json:"path_repeated_int32_value,omitempty"` - PathRepeatedFixed64Value []string `json:"path_repeated_fixed64_value,omitempty"` - PathRepeatedFixed32Value []int64 `json:"path_repeated_fixed32_value,omitempty"` - PathRepeatedBoolValue []bool `json:"path_repeated_bool_value,omitempty"` - PathRepeatedStringValue []string `json:"path_repeated_string_value,omitempty"` - PathRepeatedBytesValue []string `json:"path_repeated_bytes_value,omitempty"` - PathRepeatedUint32Value []int64 `json:"path_repeated_uint32_value,omitempty"` - PathRepeatedEnumValue []ExamplepbNumericEnum `json:"path_repeated_enum_value,omitempty"` - PathRepeatedSfixed32Value []int32 `json:"path_repeated_sfixed32_value,omitempty"` - PathRepeatedSfixed64Value []string `json:"path_repeated_sfixed64_value,omitempty"` - PathRepeatedSint32Value []int32 `json:"path_repeated_sint32_value,omitempty"` - PathRepeatedSint64Value []string `json:"path_repeated_sint64_value,omitempty"` } diff --git a/examples/clients/abe/examplepb_body.go b/examples/clients/abe/model_examplepb_body.go similarity index 69% rename from examples/clients/abe/examplepb_body.go rename to examples/clients/abe/model_examplepb_body.go index 13f4c2dc1e1..0c3d9c9b5b1 100644 --- a/examples/clients/abe/examplepb_body.go +++ b/examples/clients/abe/model_examplepb_body.go @@ -1,16 +1,15 @@ -/* +/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0 + * API version: 1.0 * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type ExamplepbBody struct { - Name string `json:"name,omitempty"` } diff --git a/examples/clients/abe/model_examplepb_numeric_enum.go b/examples/clients/abe/model_examplepb_numeric_enum.go new file mode 100644 index 00000000000..ab6cd12909d --- /dev/null +++ b/examples/clients/abe/model_examplepb_numeric_enum.go @@ -0,0 +1,19 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe +// ExamplepbNumericEnum : NumericEnum is one or zero. - ZERO: ZERO means 0 - ONE: ONE means 1 +type ExamplepbNumericEnum string + +// List of examplepbNumericEnum +const ( + ZERO_ExamplepbNumericEnum ExamplepbNumericEnum = "ZERO" + ONE_ExamplepbNumericEnum ExamplepbNumericEnum = "ONE" +) diff --git a/examples/clients/abe/model_examplepb_update_v2_request.go b/examples/clients/abe/model_examplepb_update_v2_request.go new file mode 100644 index 00000000000..544c83ad794 --- /dev/null +++ b/examples/clients/abe/model_examplepb_update_v2_request.go @@ -0,0 +1,16 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +type ExamplepbUpdateV2Request struct { + Abe *ExamplepbABitOfEverything `json:"abe,omitempty"` + UpdateMask *ProtobufFieldMask `json:"update_mask,omitempty"` +} diff --git a/examples/clients/abe/model_message_path_enum_nested_path_enum.go b/examples/clients/abe/model_message_path_enum_nested_path_enum.go new file mode 100644 index 00000000000..ef64b6b71e8 --- /dev/null +++ b/examples/clients/abe/model_message_path_enum_nested_path_enum.go @@ -0,0 +1,19 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +type MessagePathEnumNestedPathEnum string + +// List of MessagePathEnumNestedPathEnum +const ( + GHI_MessagePathEnumNestedPathEnum MessagePathEnumNestedPathEnum = "GHI" + JKL_MessagePathEnumNestedPathEnum MessagePathEnumNestedPathEnum = "JKL" +) diff --git a/examples/clients/abe/model_nested_deep_enum.go b/examples/clients/abe/model_nested_deep_enum.go new file mode 100644 index 00000000000..da1c7e372ec --- /dev/null +++ b/examples/clients/abe/model_nested_deep_enum.go @@ -0,0 +1,19 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe +// NestedDeepEnum : DeepEnum is one or zero. - FALSE: FALSE is false. - TRUE: TRUE is true. +type NestedDeepEnum string + +// List of NestedDeepEnum +const ( + FALSE_NestedDeepEnum NestedDeepEnum = "FALSE" + TRUE_NestedDeepEnum NestedDeepEnum = "TRUE" +) diff --git a/examples/clients/abe/model_pathenum_path_enum.go b/examples/clients/abe/model_pathenum_path_enum.go new file mode 100644 index 00000000000..810e1abe1a7 --- /dev/null +++ b/examples/clients/abe/model_pathenum_path_enum.go @@ -0,0 +1,19 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +type PathenumPathEnum string + +// List of pathenumPathEnum +const ( + ABC_PathenumPathEnum PathenumPathEnum = "ABC" + DEF_PathenumPathEnum PathenumPathEnum = "DEF" +) diff --git a/examples/clients/abe/protobuf_field_mask.go b/examples/clients/abe/model_protobuf_field_mask.go similarity index 98% rename from examples/clients/abe/protobuf_field_mask.go rename to examples/clients/abe/model_protobuf_field_mask.go index 2e21bc72874..9de81c0d600 100644 --- a/examples/clients/abe/protobuf_field_mask.go +++ b/examples/clients/abe/model_protobuf_field_mask.go @@ -1,18 +1,17 @@ -/* +/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0 + * API version: 1.0 * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe // paths: \"f.a\" paths: \"f.b.d\" Here `f` represents a field in some root message, `a` and `b` fields in the message found in `f`, and `d` a field found in the message in `f.b`. Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below). # Field Masks in Projections When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows: f { a : 22 b { d : 1 x : 2 } y : 13 } z: 8 The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output): f { a : 22 b { d : 1 } } A repeated field is not allowed except at the last position of a paths string. If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified). Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs. # Field Masks in Update Operations A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask. If a repeated field is specified for an update operation, new values will be appended to the existing repeated field in the target resource. Note that a repeated field is only allowed in the last position of a `paths` string. If a sub-message is specified in the last position of the field mask for an update operation, then new value will be merged into the existing sub-message in the target resource. For example, given the target message: f { b { d: 1 x: 2 } c: [1] } And an update message: f { b { d: 10 } c: [2] } then if the field mask is: paths: [\"f.b\", \"f.c\"] then the result will be: f { b { d: 10 x: 2 } c: [1, 2] } An implementation may provide options to override this default behavior for repeated and message fields. In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below. If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not. As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API. ## Considerations for HTTP REST The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates). # JSON Encoding of Field Masks In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions. As an example, consider the following message declarations: message Profile { User user = 1; Photo photo = 2; } message User { string display_name = 1; string address = 2; } In proto a field mask for `Profile` may look as such: mask { paths: \"user.display_name\" paths: \"photo\" } In JSON, the same mask is represented as below: { mask: \"user.displayName,photo\" } # Field Masks and Oneof Fields Field masks treat fields in oneofs just as regular fields. Consider the following message: message SampleMessage { oneof test_oneof { string name = 4; SubMessage sub_message = 9; } } The field mask can be: mask { paths: \"name\" } Or: mask { paths: \"sub_message\" } Note that oneof type names (\"test_oneof\" in this case) cannot be used in paths. ## Field Mask Verification The implementation of any API method which has a FieldMask type field in the request should verify the included field paths, and return an `INVALID_ARGUMENT` error if any path is duplicated or unmappable. type ProtobufFieldMask struct { - // The set of field mask paths. Paths []string `json:"paths,omitempty"` } diff --git a/examples/clients/abe/sub_string_message.go b/examples/clients/abe/model_sub_string_message.go similarity index 69% rename from examples/clients/abe/sub_string_message.go rename to examples/clients/abe/model_sub_string_message.go index 2a0874fc5fa..d4dcf4ebf16 100644 --- a/examples/clients/abe/sub_string_message.go +++ b/examples/clients/abe/model_sub_string_message.go @@ -1,16 +1,15 @@ -/* +/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0 + * API version: 1.0 * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe type SubStringMessage struct { - Value string `json:"value,omitempty"` } diff --git a/examples/clients/abe/nested_deep_enum.go b/examples/clients/abe/nested_deep_enum.go deleted file mode 100644 index e5fc17d50a4..00000000000 --- a/examples/clients/abe/nested_deep_enum.go +++ /dev/null @@ -1,15 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -// DeepEnum is one or zero. - FALSE: FALSE is false. - TRUE: TRUE is true. -type NestedDeepEnum struct { -} diff --git a/examples/clients/abe/pathenum_path_enum.go b/examples/clients/abe/pathenum_path_enum.go deleted file mode 100644 index 76e4f87650d..00000000000 --- a/examples/clients/abe/pathenum_path_enum.go +++ /dev/null @@ -1,14 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0 - * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package abe - -type PathenumPathEnum struct { -} diff --git a/examples/clients/abe/api_response.go b/examples/clients/abe/response.go similarity index 77% rename from examples/clients/abe/api_response.go rename to examples/clients/abe/response.go index ee1315f513c..a42d47cd7ab 100644 --- a/examples/clients/abe/api_response.go +++ b/examples/clients/abe/response.go @@ -1,11 +1,11 @@ -/* +/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0 + * API version: 1.0 * Contact: none@example.com - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe @@ -16,15 +16,15 @@ import ( type APIResponse struct { *http.Response `json:"-"` - Message string `json:"message,omitempty"` + Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. - Operation string `json:"operation,omitempty"` + Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. - RequestURL string `json:"url,omitempty"` + RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. - Method string `json:"method,omitempty"` + Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. diff --git a/examples/clients/echo/.swagger-codegen/VERSION b/examples/clients/echo/.swagger-codegen/VERSION new file mode 100644 index 00000000000..752a79ef362 --- /dev/null +++ b/examples/clients/echo/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.4.8 \ No newline at end of file diff --git a/examples/clients/echo/BUILD.bazel b/examples/clients/echo/BUILD.bazel index 090b56aafab..31ac6d56986 100644 --- a/examples/clients/echo/BUILD.bazel +++ b/examples/clients/echo/BUILD.bazel @@ -5,13 +5,16 @@ package(default_visibility = ["//visibility:public"]) go_library( name = "go_default_library", srcs = [ - "api_client.go", - "api_response.go", + "api_echo_service.go", + "client.go", "configuration.go", - "echo_service_api.go", - "examplepb_embedded.go", - "examplepb_simple_message.go", + "model_examplepb_embedded.go", + "model_examplepb_simple_message.go", + "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo", - deps = ["@com_github_go_resty_resty//:go_default_library"], + deps = [ + "@com_github_antihax_optional//:go_default_library", + "@org_golang_x_oauth2//:go_default_library", + ], ) diff --git a/examples/clients/echo/api/swagger.yaml b/examples/clients/echo/api/swagger.yaml new file mode 100644 index 00000000000..884e7ad6bfb --- /dev/null +++ b/examples/clients/echo/api/swagger.yaml @@ -0,0 +1,441 @@ +--- +swagger: "2.0" +info: + description: "Echo Service API consists of a single service which returns\na message." + version: "version not set" + title: "Echo Service" +schemes: +- "http" +- "https" +consumes: +- "application/json" +produces: +- "application/json" +paths: + /v1/example/echo/{id}: + post: + tags: + - "EchoService" + summary: "Echo method receives a simple message and returns it." + description: "The message posted as the id parameter will also be\nreturned." + operationId: "Echo" + parameters: + - name: "id" + in: "path" + description: "Id represents the message identifier." + required: true + type: "string" + x-exportParamName: "Id" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbSimpleMessage" + /v1/example/echo/{id}/{num}: + get: + tags: + - "EchoService" + summary: "Echo method receives a simple message and returns it." + description: "The message posted as the id parameter will also be\nreturned." + operationId: "Echo2" + parameters: + - name: "id" + in: "path" + description: "Id represents the message identifier." + required: true + type: "string" + x-exportParamName: "Id" + - name: "num" + in: "path" + required: true + type: "string" + format: "int64" + x-exportParamName: "Num" + - name: "line_num" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "LineNum" + x-optionalDataType: "String" + - name: "lang" + in: "query" + required: false + type: "string" + x-exportParamName: "Lang" + x-optionalDataType: "String" + - name: "status.progress" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "StatusProgress" + x-optionalDataType: "String" + - name: "status.note" + in: "query" + required: false + type: "string" + x-exportParamName: "StatusNote" + x-optionalDataType: "String" + - name: "en" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "En" + x-optionalDataType: "String" + - name: "no.progress" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "NoProgress" + x-optionalDataType: "String" + - name: "no.note" + in: "query" + required: false + type: "string" + x-exportParamName: "NoNote" + x-optionalDataType: "String" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbSimpleMessage" + /v1/example/echo/{id}/{num}/{lang}: + get: + tags: + - "EchoService" + summary: "Echo method receives a simple message and returns it." + description: "The message posted as the id parameter will also be\nreturned." + operationId: "Echo3" + parameters: + - name: "id" + in: "path" + description: "Id represents the message identifier." + required: true + type: "string" + x-exportParamName: "Id" + - name: "num" + in: "path" + required: true + type: "string" + format: "int64" + x-exportParamName: "Num" + - name: "lang" + in: "path" + required: true + type: "string" + x-exportParamName: "Lang" + - name: "line_num" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "LineNum" + x-optionalDataType: "String" + - name: "status.progress" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "StatusProgress" + x-optionalDataType: "String" + - name: "status.note" + in: "query" + required: false + type: "string" + x-exportParamName: "StatusNote" + x-optionalDataType: "String" + - name: "en" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "En" + x-optionalDataType: "String" + - name: "no.progress" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "NoProgress" + x-optionalDataType: "String" + - name: "no.note" + in: "query" + required: false + type: "string" + x-exportParamName: "NoNote" + x-optionalDataType: "String" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbSimpleMessage" + /v1/example/echo1/{id}/{line_num}/{status.note}: + get: + tags: + - "EchoService" + summary: "Echo method receives a simple message and returns it." + description: "The message posted as the id parameter will also be\nreturned." + operationId: "Echo4" + parameters: + - name: "id" + in: "path" + description: "Id represents the message identifier." + required: true + type: "string" + x-exportParamName: "Id" + - name: "line_num" + in: "path" + required: true + type: "string" + format: "int64" + x-exportParamName: "LineNum" + - name: "status.note" + in: "path" + required: true + type: "string" + x-exportParamName: "StatusNote" + - name: "num" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Num" + x-optionalDataType: "String" + - name: "lang" + in: "query" + required: false + type: "string" + x-exportParamName: "Lang" + x-optionalDataType: "String" + - name: "status.progress" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "StatusProgress" + x-optionalDataType: "String" + - name: "en" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "En" + x-optionalDataType: "String" + - name: "no.progress" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "NoProgress" + x-optionalDataType: "String" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbSimpleMessage" + /v1/example/echo2/{no.note}: + get: + tags: + - "EchoService" + summary: "Echo method receives a simple message and returns it." + description: "The message posted as the id parameter will also be\nreturned." + operationId: "Echo5" + parameters: + - name: "no.note" + in: "path" + required: true + type: "string" + x-exportParamName: "NoNote" + - name: "id" + in: "query" + description: "Id represents the message identifier." + required: false + type: "string" + x-exportParamName: "Id" + x-optionalDataType: "String" + - name: "num" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Num" + x-optionalDataType: "String" + - name: "line_num" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "LineNum" + x-optionalDataType: "String" + - name: "lang" + in: "query" + required: false + type: "string" + x-exportParamName: "Lang" + x-optionalDataType: "String" + - name: "status.progress" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "StatusProgress" + x-optionalDataType: "String" + - name: "en" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "En" + x-optionalDataType: "String" + - name: "no.progress" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "NoProgress" + x-optionalDataType: "String" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbSimpleMessage" + /v1/example/echo_body: + post: + tags: + - "EchoService" + summary: "EchoBody method receives a simple message and returns it." + operationId: "EchoBody" + parameters: + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/examplepbSimpleMessage" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbSimpleMessage" + /v1/example/echo_delete: + delete: + tags: + - "EchoService" + summary: "EchoDelete method receives a simple message and returns it." + operationId: "EchoDelete" + parameters: + - name: "id" + in: "query" + description: "Id represents the message identifier." + required: false + type: "string" + x-exportParamName: "Id" + x-optionalDataType: "String" + - name: "num" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Num" + x-optionalDataType: "String" + - name: "line_num" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "LineNum" + x-optionalDataType: "String" + - name: "lang" + in: "query" + required: false + type: "string" + x-exportParamName: "Lang" + x-optionalDataType: "String" + - name: "status.progress" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "StatusProgress" + x-optionalDataType: "String" + - name: "status.note" + in: "query" + required: false + type: "string" + x-exportParamName: "StatusNote" + x-optionalDataType: "String" + - name: "en" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "En" + x-optionalDataType: "String" + - name: "no.progress" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "NoProgress" + x-optionalDataType: "String" + - name: "no.note" + in: "query" + required: false + type: "string" + x-exportParamName: "NoNote" + x-optionalDataType: "String" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbSimpleMessage" +definitions: + examplepbEmbedded: + type: "object" + properties: + progress: + type: "string" + format: "int64" + note: + type: "string" + description: "Embedded represents a message embedded in SimpleMessage." + example: + note: "note" + progress: "progress" + examplepbSimpleMessage: + type: "object" + properties: + id: + type: "string" + description: "Id represents the message identifier." + num: + type: "string" + format: "int64" + line_num: + type: "string" + format: "int64" + lang: + type: "string" + status: + $ref: "#/definitions/examplepbEmbedded" + en: + type: "string" + format: "int64" + "no": + $ref: "#/definitions/examplepbEmbedded" + description: "SimpleMessage represents a simple message sent to the Echo service." + example: + "no": + note: "note" + progress: "progress" + line_num: "line_num" + num: "num" + en: "en" + id: "id" + lang: "lang" + status: + note: "note" + progress: "progress" diff --git a/examples/clients/echo/api_client.go b/examples/clients/echo/api_client.go deleted file mode 100644 index 7a517148026..00000000000 --- a/examples/clients/echo/api_client.go +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Echo Service - * - * Echo Service API consists of a single service which returns a message. - * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package echo - -import ( - "bytes" - "fmt" - "path/filepath" - "reflect" - "strings" - "net/url" - "io/ioutil" - "github.com/go-resty/resty" -) - -type APIClient struct { - config *Configuration -} - -func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { - - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -func (c *APIClient) SelectHeaderAccept(accepts []string) string { - - if len(accepts) == 0 { - return "" - } - if contains(accepts, "application/json") { - return "application/json" - } - return strings.Join(accepts, ",") -} - -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { - return true - } - } - return false -} - -func (c *APIClient) CallAPI(path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams map[string]string, - fileName string, - fileBytes []byte) (*resty.Response, error) { - - rClient := c.prepareClient() - request := c.prepareRequest(rClient, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - switch strings.ToUpper(method) { - case "GET": - response, err := request.Get(path) - return response, err - case "POST": - response, err := request.Post(path) - return response, err - case "PUT": - response, err := request.Put(path) - return response, err - case "PATCH": - response, err := request.Patch(path) - return response, err - case "DELETE": - response, err := request.Delete(path) - return response, err - } - - return nil, fmt.Errorf("invalid method %v", method) -} - -func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string { - delimiter := "" - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," - } - - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } - - return fmt.Sprintf("%v", obj) -} - -func (c *APIClient) prepareClient() *resty.Client { - - rClient := resty.New() - - rClient.SetDebug(c.config.Debug) - if c.config.Transport != nil { - rClient.SetTransport(c.config.Transport) - } - - if c.config.Timeout != nil { - rClient.SetTimeout(*c.config.Timeout) - } - rClient.SetLogger(ioutil.Discard) - return rClient -} - -func (c *APIClient) prepareRequest( - rClient *resty.Client, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams map[string]string, - fileName string, - fileBytes []byte) *resty.Request { - - - request := rClient.R() - request.SetBody(postBody) - - if c.config.UserAgent != "" { - request.SetHeader("User-Agent", c.config.UserAgent) - } - - // add header parameter, if any - if len(headerParams) > 0 { - request.SetHeaders(headerParams) - } - - // add query parameter, if any - if len(queryParams) > 0 { - request.SetMultiValueQueryParams(queryParams) - } - - // add form parameter, if any - if len(formParams) > 0 { - request.SetFormData(formParams) - } - - if len(fileBytes) > 0 && fileName != "" { - _, fileNm := filepath.Split(fileName) - request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) - } - return request -} diff --git a/examples/clients/echo/api_echo_service.go b/examples/clients/echo/api_echo_service.go new file mode 100644 index 00000000000..5e5b44b450d --- /dev/null +++ b/examples/clients/echo/api_echo_service.go @@ -0,0 +1,852 @@ +/* + * Echo Service + * + * Echo Service API consists of a single service which returns a message. + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package echo + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type EchoServiceApiService service + +/* +EchoServiceApiService Echo method receives a simple message and returns it. +The message posted as the id parameter will also be returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id Id represents the message identifier. + +@return ExamplepbSimpleMessage +*/ +func (a *EchoServiceApiService) Echo(ctx context.Context, id string) (ExamplepbSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +EchoServiceApiService Echo method receives a simple message and returns it. +The message posted as the id parameter will also be returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id Id represents the message identifier. + * @param num + * @param optional nil or *Echo2Opts - Optional Parameters: + * @param "LineNum" (optional.String) - + * @param "Lang" (optional.String) - + * @param "StatusProgress" (optional.String) - + * @param "StatusNote" (optional.String) - + * @param "En" (optional.String) - + * @param "NoProgress" (optional.String) - + * @param "NoNote" (optional.String) - + +@return ExamplepbSimpleMessage +*/ + +type Echo2Opts struct { + LineNum optional.String + Lang optional.String + StatusProgress optional.String + StatusNote optional.String + En optional.String + NoProgress optional.String + NoNote optional.String +} + +func (a *EchoServiceApiService) Echo2(ctx context.Context, id string, num string, localVarOptionals *Echo2Opts) (ExamplepbSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo/{id}/{num}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { + localVarQueryParams.Add("line_num", parameterToString(localVarOptionals.LineNum.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { + localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { + localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { + localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.En.IsSet() { + localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { + localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { + localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +EchoServiceApiService Echo method receives a simple message and returns it. +The message posted as the id parameter will also be returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id Id represents the message identifier. + * @param num + * @param lang + * @param optional nil or *Echo3Opts - Optional Parameters: + * @param "LineNum" (optional.String) - + * @param "StatusProgress" (optional.String) - + * @param "StatusNote" (optional.String) - + * @param "En" (optional.String) - + * @param "NoProgress" (optional.String) - + * @param "NoNote" (optional.String) - + +@return ExamplepbSimpleMessage +*/ + +type Echo3Opts struct { + LineNum optional.String + StatusProgress optional.String + StatusNote optional.String + En optional.String + NoProgress optional.String + NoNote optional.String +} + +func (a *EchoServiceApiService) Echo3(ctx context.Context, id string, num string, lang string, localVarOptionals *Echo3Opts) (ExamplepbSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo/{id}/{num}/{lang}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lang"+"}", fmt.Sprintf("%v", lang), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { + localVarQueryParams.Add("line_num", parameterToString(localVarOptionals.LineNum.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { + localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { + localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.En.IsSet() { + localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { + localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { + localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +EchoServiceApiService Echo method receives a simple message and returns it. +The message posted as the id parameter will also be returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id Id represents the message identifier. + * @param lineNum + * @param statusNote + * @param optional nil or *Echo4Opts - Optional Parameters: + * @param "Num" (optional.String) - + * @param "Lang" (optional.String) - + * @param "StatusProgress" (optional.String) - + * @param "En" (optional.String) - + * @param "NoProgress" (optional.String) - + +@return ExamplepbSimpleMessage +*/ + +type Echo4Opts struct { + Num optional.String + Lang optional.String + StatusProgress optional.String + En optional.String + NoProgress optional.String +} + +func (a *EchoServiceApiService) Echo4(ctx context.Context, id string, lineNum string, statusNote string, localVarOptionals *Echo4Opts) (ExamplepbSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo1/{id}/{line_num}/{status.note}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"line_num"+"}", fmt.Sprintf("%v", lineNum), -1) + localVarPath = strings.Replace(localVarPath, "{"+"status.note"+"}", fmt.Sprintf("%v", statusNote), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Num.IsSet() { + localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { + localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { + localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.En.IsSet() { + localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { + localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +EchoServiceApiService Echo method receives a simple message and returns it. +The message posted as the id parameter will also be returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param noNote + * @param optional nil or *Echo5Opts - Optional Parameters: + * @param "Id" (optional.String) - Id represents the message identifier. + * @param "Num" (optional.String) - + * @param "LineNum" (optional.String) - + * @param "Lang" (optional.String) - + * @param "StatusProgress" (optional.String) - + * @param "En" (optional.String) - + * @param "NoProgress" (optional.String) - + +@return ExamplepbSimpleMessage +*/ + +type Echo5Opts struct { + Id optional.String + Num optional.String + LineNum optional.String + Lang optional.String + StatusProgress optional.String + En optional.String + NoProgress optional.String +} + +func (a *EchoServiceApiService) Echo5(ctx context.Context, noNote string, localVarOptionals *Echo5Opts) (ExamplepbSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo2/{no.note}" + localVarPath = strings.Replace(localVarPath, "{"+"no.note"+"}", fmt.Sprintf("%v", noNote), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Id.IsSet() { + localVarQueryParams.Add("id", parameterToString(localVarOptionals.Id.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Num.IsSet() { + localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { + localVarQueryParams.Add("line_num", parameterToString(localVarOptionals.LineNum.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { + localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { + localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.En.IsSet() { + localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { + localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +EchoServiceApiService EchoBody method receives a simple message and returns it. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + +@return ExamplepbSimpleMessage +*/ +func (a *EchoServiceApiService) EchoBody(ctx context.Context, body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo_body" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +EchoServiceApiService EchoDelete method receives a simple message and returns it. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *EchoDeleteOpts - Optional Parameters: + * @param "Id" (optional.String) - Id represents the message identifier. + * @param "Num" (optional.String) - + * @param "LineNum" (optional.String) - + * @param "Lang" (optional.String) - + * @param "StatusProgress" (optional.String) - + * @param "StatusNote" (optional.String) - + * @param "En" (optional.String) - + * @param "NoProgress" (optional.String) - + * @param "NoNote" (optional.String) - + +@return ExamplepbSimpleMessage +*/ + +type EchoDeleteOpts struct { + Id optional.String + Num optional.String + LineNum optional.String + Lang optional.String + StatusProgress optional.String + StatusNote optional.String + En optional.String + NoProgress optional.String + NoNote optional.String +} + +func (a *EchoServiceApiService) EchoDelete(ctx context.Context, localVarOptionals *EchoDeleteOpts) (ExamplepbSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo_delete" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Id.IsSet() { + localVarQueryParams.Add("id", parameterToString(localVarOptionals.Id.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Num.IsSet() { + localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.LineNum.IsSet() { + localVarQueryParams.Add("line_num", parameterToString(localVarOptionals.LineNum.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Lang.IsSet() { + localVarQueryParams.Add("lang", parameterToString(localVarOptionals.Lang.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StatusProgress.IsSet() { + localVarQueryParams.Add("status.progress", parameterToString(localVarOptionals.StatusProgress.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StatusNote.IsSet() { + localVarQueryParams.Add("status.note", parameterToString(localVarOptionals.StatusNote.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.En.IsSet() { + localVarQueryParams.Add("en", parameterToString(localVarOptionals.En.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NoProgress.IsSet() { + localVarQueryParams.Add("no.progress", parameterToString(localVarOptionals.NoProgress.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NoNote.IsSet() { + localVarQueryParams.Add("no.note", parameterToString(localVarOptionals.NoNote.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/examples/clients/echo/client.go b/examples/clients/echo/client.go new file mode 100644 index 00000000000..d0e2045800c --- /dev/null +++ b/examples/clients/echo/client.go @@ -0,0 +1,464 @@ +/* + * Echo Service + * + * Echo Service API consists of a single service which returns a message. + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package echo + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") + xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") +) + +// APIClient manages communication with the Echo Service API vversion not set +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + EchoServiceApi *EchoServiceApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.EchoServiceApi = (*EchoServiceApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } + + return fmt.Sprintf("%v", obj) +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + return c.cfg.HTTPClient.Do(request) +} + +// Change base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile("file", filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + } + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Override request host, if applicable + if c.cfg.Host != "" { + localVarRequest.Host = c.cfg.Host + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } + expires = now.Add(lifetime) + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericSwaggerError Provides access to the body, error and model on returned errors. +type GenericSwaggerError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericSwaggerError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericSwaggerError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericSwaggerError) Model() interface{} { + return e.model +} \ No newline at end of file diff --git a/examples/clients/echo/configuration.go b/examples/clients/echo/configuration.go index 9a75a30aeec..5f730c12ab7 100644 --- a/examples/clients/echo/configuration.go +++ b/examples/clients/echo/configuration.go @@ -1,67 +1,72 @@ -/* +/* * Echo Service * * Echo Service API consists of a single service which returns a message. * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo import ( - "encoding/base64" "net/http" - "time" ) +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} type Configuration struct { - Username string `json:"userName,omitempty"` - Password string `json:"password,omitempty"` - APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` - APIKey map[string]string `json:"APIKey,omitempty"` - Debug bool `json:"debug,omitempty"` - DebugFile string `json:"debugFile,omitempty"` - OAuthToken string `json:"oAuthToken,omitempty"` BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` - AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` - APIClient *APIClient - Transport *http.Transport - Timeout *time.Duration `json:"timeout,omitempty"` + HTTPClient *http.Client } func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "http://localhost", DefaultHeader: make(map[string]string), - APIKey: make(map[string]string), - APIKeyPrefix: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", - APIClient: &APIClient{}, } - - cfg.APIClient.config = cfg return cfg } -func (c *Configuration) GetBasicAuthEncodedString() string { - return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password)) -} - func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } - -func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string { - if c.APIKeyPrefix[APIKeyIdentifier] != "" { - return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] - } - - return c.APIKey[APIKeyIdentifier] -} diff --git a/examples/clients/echo/echo_service_api.go b/examples/clients/echo/echo_service_api.go deleted file mode 100644 index 6ae7cf85a32..00000000000 --- a/examples/clients/echo/echo_service_api.go +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Echo Service - * - * Echo Service API consists of a single service which returns a message. - * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package echo - -import ( - "net/url" - "strings" - "encoding/json" - "fmt" -) - -type EchoServiceApi struct { - Configuration *Configuration -} - -func NewEchoServiceApi() *EchoServiceApi { - configuration := NewConfiguration() - return &EchoServiceApi{ - Configuration: configuration, - } -} - -func NewEchoServiceApiWithBasePath(basePath string) *EchoServiceApi { - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &EchoServiceApi{ - Configuration: configuration, - } -} - -/** - * Echo method receives a simple message and returns it. - * The message posted as the id parameter will also be returned. - * - * @param id Id represents the message identifier. - * @return *ExamplepbSimpleMessage - */ -func (a EchoServiceApi) Echo(id string) (*ExamplepbSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Echo method receives a simple message and returns it. - * The message posted as the id parameter will also be returned. - * - * @param id Id represents the message identifier. - * @param num - * @param lineNum - * @param lang - * @param statusProgress - * @param statusNote - * @param en - * @param noProgress - * @param noNote - * @return *ExamplepbSimpleMessage - */ -func (a EchoServiceApi) Echo2(id string, num string, lineNum string, lang string, statusProgress string, statusNote string, en string, noProgress string, noNote string) (*ExamplepbSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}/{num}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) - localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("line_num", a.Configuration.APIClient.ParameterToString(lineNum, "")) - localVarQueryParams.Add("lang", a.Configuration.APIClient.ParameterToString(lang, "")) - localVarQueryParams.Add("status.progress", a.Configuration.APIClient.ParameterToString(statusProgress, "")) - localVarQueryParams.Add("status.note", a.Configuration.APIClient.ParameterToString(statusNote, "")) - localVarQueryParams.Add("en", a.Configuration.APIClient.ParameterToString(en, "")) - localVarQueryParams.Add("no.progress", a.Configuration.APIClient.ParameterToString(noProgress, "")) - localVarQueryParams.Add("no.note", a.Configuration.APIClient.ParameterToString(noNote, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Echo method receives a simple message and returns it. - * The message posted as the id parameter will also be returned. - * - * @param id Id represents the message identifier. - * @param num - * @param lang - * @param lineNum - * @param statusProgress - * @param statusNote - * @param en - * @param noProgress - * @param noNote - * @return *ExamplepbSimpleMessage - */ -func (a EchoServiceApi) Echo3(id string, num string, lang string, lineNum string, statusProgress string, statusNote string, en string, noProgress string, noNote string) (*ExamplepbSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}/{num}/{lang}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) - localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) - localVarPath = strings.Replace(localVarPath, "{"+"lang"+"}", fmt.Sprintf("%v", lang), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("line_num", a.Configuration.APIClient.ParameterToString(lineNum, "")) - localVarQueryParams.Add("status.progress", a.Configuration.APIClient.ParameterToString(statusProgress, "")) - localVarQueryParams.Add("status.note", a.Configuration.APIClient.ParameterToString(statusNote, "")) - localVarQueryParams.Add("en", a.Configuration.APIClient.ParameterToString(en, "")) - localVarQueryParams.Add("no.progress", a.Configuration.APIClient.ParameterToString(noProgress, "")) - localVarQueryParams.Add("no.note", a.Configuration.APIClient.ParameterToString(noNote, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo3", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Echo method receives a simple message and returns it. - * The message posted as the id parameter will also be returned. - * - * @param id Id represents the message identifier. - * @param lineNum - * @param statusNote - * @param num - * @param lang - * @param statusProgress - * @param en - * @param noProgress - * @return *ExamplepbSimpleMessage - */ -func (a EchoServiceApi) Echo4(id string, lineNum string, statusNote string, num string, lang string, statusProgress string, en string, noProgress string) (*ExamplepbSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo1/{id}/{line_num}/{status.note}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) - localVarPath = strings.Replace(localVarPath, "{"+"line_num"+"}", fmt.Sprintf("%v", lineNum), -1) - localVarPath = strings.Replace(localVarPath, "{"+"status.note"+"}", fmt.Sprintf("%v", statusNote), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("num", a.Configuration.APIClient.ParameterToString(num, "")) - localVarQueryParams.Add("lang", a.Configuration.APIClient.ParameterToString(lang, "")) - localVarQueryParams.Add("status.progress", a.Configuration.APIClient.ParameterToString(statusProgress, "")) - localVarQueryParams.Add("en", a.Configuration.APIClient.ParameterToString(en, "")) - localVarQueryParams.Add("no.progress", a.Configuration.APIClient.ParameterToString(noProgress, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo4", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Echo method receives a simple message and returns it. - * The message posted as the id parameter will also be returned. - * - * @param noNote - * @param id Id represents the message identifier. - * @param num - * @param lineNum - * @param lang - * @param statusProgress - * @param en - * @param noProgress - * @return *ExamplepbSimpleMessage - */ -func (a EchoServiceApi) Echo5(noNote string, id string, num string, lineNum string, lang string, statusProgress string, en string, noProgress string) (*ExamplepbSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo2/{no.note}" - localVarPath = strings.Replace(localVarPath, "{"+"no.note"+"}", fmt.Sprintf("%v", noNote), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("id", a.Configuration.APIClient.ParameterToString(id, "")) - localVarQueryParams.Add("num", a.Configuration.APIClient.ParameterToString(num, "")) - localVarQueryParams.Add("line_num", a.Configuration.APIClient.ParameterToString(lineNum, "")) - localVarQueryParams.Add("lang", a.Configuration.APIClient.ParameterToString(lang, "")) - localVarQueryParams.Add("status.progress", a.Configuration.APIClient.ParameterToString(statusProgress, "")) - localVarQueryParams.Add("en", a.Configuration.APIClient.ParameterToString(en, "")) - localVarQueryParams.Add("no.progress", a.Configuration.APIClient.ParameterToString(noProgress, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo5", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * EchoBody method receives a simple message and returns it. - * - * @param body - * @return *ExamplepbSimpleMessage - */ -func (a EchoServiceApi) EchoBody(body ExamplepbSimpleMessage) (*ExamplepbSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo_body" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(ExamplepbSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "EchoBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * EchoDelete method receives a simple message and returns it. - * - * @param id Id represents the message identifier. - * @param num - * @param lineNum - * @param lang - * @param statusProgress - * @param statusNote - * @param en - * @param noProgress - * @param noNote - * @return *ExamplepbSimpleMessage - */ -func (a EchoServiceApi) EchoDelete(id string, num string, lineNum string, lang string, statusProgress string, statusNote string, en string, noProgress string, noNote string) (*ExamplepbSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Delete") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo_delete" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("id", a.Configuration.APIClient.ParameterToString(id, "")) - localVarQueryParams.Add("num", a.Configuration.APIClient.ParameterToString(num, "")) - localVarQueryParams.Add("line_num", a.Configuration.APIClient.ParameterToString(lineNum, "")) - localVarQueryParams.Add("lang", a.Configuration.APIClient.ParameterToString(lang, "")) - localVarQueryParams.Add("status.progress", a.Configuration.APIClient.ParameterToString(statusProgress, "")) - localVarQueryParams.Add("status.note", a.Configuration.APIClient.ParameterToString(statusNote, "")) - localVarQueryParams.Add("en", a.Configuration.APIClient.ParameterToString(en, "")) - localVarQueryParams.Add("no.progress", a.Configuration.APIClient.ParameterToString(noProgress, "")) - localVarQueryParams.Add("no.note", a.Configuration.APIClient.ParameterToString(noNote, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "EchoDelete", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - diff --git a/examples/clients/echo/examplepb_embedded.go b/examples/clients/echo/model_examplepb_embedded.go similarity index 70% rename from examples/clients/echo/examplepb_embedded.go rename to examples/clients/echo/model_examplepb_embedded.go index 4b5fe265ac9..7f6ff8a7848 100644 --- a/examples/clients/echo/examplepb_embedded.go +++ b/examples/clients/echo/model_examplepb_embedded.go @@ -1,19 +1,16 @@ -/* +/* * Echo Service * * Echo Service API consists of a single service which returns a message. * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo // Embedded represents a message embedded in SimpleMessage. type ExamplepbEmbedded struct { - Progress string `json:"progress,omitempty"` - Note string `json:"note,omitempty"` } diff --git a/examples/clients/echo/examplepb_simple_message.go b/examples/clients/echo/model_examplepb_simple_message.go similarity index 67% rename from examples/clients/echo/examplepb_simple_message.go rename to examples/clients/echo/model_examplepb_simple_message.go index 366a6876665..d0c0d90e9eb 100644 --- a/examples/clients/echo/examplepb_simple_message.go +++ b/examples/clients/echo/model_examplepb_simple_message.go @@ -1,30 +1,22 @@ -/* +/* * Echo Service * * Echo Service API consists of a single service which returns a message. * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo // SimpleMessage represents a simple message sent to the Echo service. type ExamplepbSimpleMessage struct { - // Id represents the message identifier. Id string `json:"id,omitempty"` - Num string `json:"num,omitempty"` - LineNum string `json:"line_num,omitempty"` - Lang string `json:"lang,omitempty"` - - Status ExamplepbEmbedded `json:"status,omitempty"` - + Status *ExamplepbEmbedded `json:"status,omitempty"` En string `json:"en,omitempty"` - - No ExamplepbEmbedded `json:"no,omitempty"` + No *ExamplepbEmbedded `json:"no,omitempty"` } diff --git a/examples/clients/echo/api_response.go b/examples/clients/echo/response.go similarity index 75% rename from examples/clients/echo/api_response.go rename to examples/clients/echo/response.go index 8b0d07c4a13..a82295589de 100644 --- a/examples/clients/echo/api_response.go +++ b/examples/clients/echo/response.go @@ -1,11 +1,10 @@ -/* +/* * Echo Service * * Echo Service API consists of a single service which returns a message. * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package echo @@ -16,15 +15,15 @@ import ( type APIResponse struct { *http.Response `json:"-"` - Message string `json:"message,omitempty"` + Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. - Operation string `json:"operation,omitempty"` + Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. - RequestURL string `json:"url,omitempty"` + RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. - Method string `json:"method,omitempty"` + Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. diff --git a/examples/clients/responsebody/.swagger-codegen/VERSION b/examples/clients/responsebody/.swagger-codegen/VERSION new file mode 100644 index 00000000000..752a79ef362 --- /dev/null +++ b/examples/clients/responsebody/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.4.8 \ No newline at end of file diff --git a/examples/clients/responsebody/BUILD.bazel b/examples/clients/responsebody/BUILD.bazel index e621bea6960..f5fb6a134ad 100644 --- a/examples/clients/responsebody/BUILD.bazel +++ b/examples/clients/responsebody/BUILD.bazel @@ -3,21 +3,18 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = [ - "api_client.go", - "api_response.go", + "api_response_body_service.go", + "client.go", "configuration.go", - "examplepb_repeated_response_body_out.go", - "examplepb_repeated_response_body_out_response.go", - "examplepb_repeated_response_strings.go", - "examplepb_response_body_message.go", - "examplepb_response_body_message_response.go", - "examplepb_response_body_out.go", - "examplepb_response_body_out_response.go", - "examplepb_response_body_req.go", - "response_body_service_api.go", - "response_response_type.go", + "model_examplepb_repeated_response_body_out.go", + "model_examplepb_repeated_response_body_out_response.go", + "model_examplepb_repeated_response_strings.go", + "model_examplepb_response_body_out.go", + "model_examplepb_response_body_out_response.go", + "model_response_response_type.go", + "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/responsebody", visibility = ["//visibility:public"], - deps = ["@com_github_go_resty_resty//:go_default_library"], + deps = ["@org_golang_x_oauth2//:go_default_library"], ) diff --git a/examples/clients/responsebody/api/swagger.yaml b/examples/clients/responsebody/api/swagger.yaml new file mode 100644 index 00000000000..ca61b71ad42 --- /dev/null +++ b/examples/clients/responsebody/api/swagger.yaml @@ -0,0 +1,110 @@ +--- +swagger: "2.0" +info: + version: "version not set" + title: "examples/proto/examplepb/response_body_service.proto" +schemes: +- "http" +- "https" +consumes: +- "application/json" +produces: +- "application/json" +paths: + /responsebodies/{data}: + get: + tags: + - "ResponseBodyService" + operationId: "ListResponseBodies" + parameters: + - name: "data" + in: "path" + required: true + type: "string" + x-exportParamName: "Data" + responses: + 200: + description: "" + schema: + type: "array" + items: + $ref: "#/definitions/examplepbRepeatedResponseBodyOutResponse" + /responsebody/{data}: + get: + tags: + - "ResponseBodyService" + operationId: "GetResponseBody" + parameters: + - name: "data" + in: "path" + required: true + type: "string" + x-exportParamName: "Data" + responses: + 200: + description: "" + schema: + $ref: "#/definitions/examplepbResponseBodyOutResponse" + /responsestrings/{data}: + get: + tags: + - "ResponseBodyService" + operationId: "ListResponseStrings" + parameters: + - name: "data" + in: "path" + required: true + type: "string" + x-exportParamName: "Data" + responses: + 200: + description: "" + schema: + type: "array" + items: + type: "string" +definitions: + ResponseResponseType: + type: "string" + title: "- UNKNOWN: UNKNOWN\n - A: A is 1\n - B: B is 2" + enum: + - "UNKNOWN" + - "A" + - "B" + default: "UNKNOWN" + examplepbRepeatedResponseBodyOut: + type: "object" + properties: + response: + type: "array" + items: + $ref: "#/definitions/examplepbRepeatedResponseBodyOutResponse" + examplepbRepeatedResponseBodyOutResponse: + type: "object" + properties: + data: + type: "string" + type: + $ref: "#/definitions/ResponseResponseType" + example: + data: "data" + type: {} + examplepbRepeatedResponseStrings: + type: "object" + properties: + values: + type: "array" + items: + type: "string" + examplepbResponseBodyOut: + type: "object" + properties: + response: + $ref: "#/definitions/examplepbResponseBodyOutResponse" + examplepbResponseBodyOutResponse: + type: "object" + properties: + data: + type: "string" + example: + data: "data" diff --git a/examples/clients/responsebody/api_client.go b/examples/clients/responsebody/api_client.go deleted file mode 100644 index 1f7354b61dc..00000000000 --- a/examples/clients/responsebody/api_client.go +++ /dev/null @@ -1,164 +0,0 @@ -/* - * examples/proto/examplepb/response_body_service.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package responsebody - -import ( - "bytes" - "fmt" - "path/filepath" - "reflect" - "strings" - "net/url" - "io/ioutil" - "github.com/go-resty/resty" -) - -type APIClient struct { - config *Configuration -} - -func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { - - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -func (c *APIClient) SelectHeaderAccept(accepts []string) string { - - if len(accepts) == 0 { - return "" - } - if contains(accepts, "application/json") { - return "application/json" - } - return strings.Join(accepts, ",") -} - -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { - return true - } - } - return false -} - -func (c *APIClient) CallAPI(path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams map[string]string, - fileName string, - fileBytes []byte) (*resty.Response, error) { - - rClient := c.prepareClient() - request := c.prepareRequest(rClient, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - switch strings.ToUpper(method) { - case "GET": - response, err := request.Get(path) - return response, err - case "POST": - response, err := request.Post(path) - return response, err - case "PUT": - response, err := request.Put(path) - return response, err - case "PATCH": - response, err := request.Patch(path) - return response, err - case "DELETE": - response, err := request.Delete(path) - return response, err - } - - return nil, fmt.Errorf("invalid method %v", method) -} - -func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string { - delimiter := "" - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," - } - - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } - - return fmt.Sprintf("%v", obj) -} - -func (c *APIClient) prepareClient() *resty.Client { - - rClient := resty.New() - - rClient.SetDebug(c.config.Debug) - if c.config.Transport != nil { - rClient.SetTransport(c.config.Transport) - } - - if c.config.Timeout != nil { - rClient.SetTimeout(*c.config.Timeout) - } - rClient.SetLogger(ioutil.Discard) - return rClient -} - -func (c *APIClient) prepareRequest( - rClient *resty.Client, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams map[string]string, - fileName string, - fileBytes []byte) *resty.Request { - - - request := rClient.R() - request.SetBody(postBody) - - if c.config.UserAgent != "" { - request.SetHeader("User-Agent", c.config.UserAgent) - } - - // add header parameter, if any - if len(headerParams) > 0 { - request.SetHeaders(headerParams) - } - - // add query parameter, if any - if len(queryParams) > 0 { - request.SetMultiValueQueryParams(queryParams) - } - - // add form parameter, if any - if len(formParams) > 0 { - request.SetFormData(formParams) - } - - if len(fileBytes) > 0 && fileName != "" { - _, fileNm := filepath.Split(fileName) - request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) - } - return request -} diff --git a/examples/clients/responsebody/api_response_body_service.go b/examples/clients/responsebody/api_response_body_service.go new file mode 100644 index 00000000000..4d534a3867e --- /dev/null +++ b/examples/clients/responsebody/api_response_body_service.go @@ -0,0 +1,290 @@ +/* + * examples/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package responsebody + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type ResponseBodyServiceApiService service + +/* +ResponseBodyServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param data + +@return ExamplepbResponseBodyOutResponse +*/ +func (a *ResponseBodyServiceApiService) GetResponseBody(ctx context.Context, data string) (ExamplepbResponseBodyOutResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbResponseBodyOutResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/responsebody/{data}" + localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbResponseBodyOutResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ResponseBodyServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param data + +@return []ExamplepbRepeatedResponseBodyOutResponse +*/ +func (a *ResponseBodyServiceApiService) ListResponseBodies(ctx context.Context, data string) ([]ExamplepbRepeatedResponseBodyOutResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []ExamplepbRepeatedResponseBodyOutResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/responsebodies/{data}" + localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v []ExamplepbRepeatedResponseBodyOutResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ResponseBodyServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param data + +@return []string +*/ +func (a *ResponseBodyServiceApiService) ListResponseStrings(ctx context.Context, data string) ([]string, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []string + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/responsestrings/{data}" + localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v []string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/examples/clients/responsebody/client.go b/examples/clients/responsebody/client.go new file mode 100644 index 00000000000..e728fd1eecd --- /dev/null +++ b/examples/clients/responsebody/client.go @@ -0,0 +1,464 @@ +/* + * examples/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package responsebody + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") + xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") +) + +// APIClient manages communication with the examples/proto/examplepb/response_body_service.proto API vversion not set +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + ResponseBodyServiceApi *ResponseBodyServiceApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.ResponseBodyServiceApi = (*ResponseBodyServiceApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } + + return fmt.Sprintf("%v", obj) +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + return c.cfg.HTTPClient.Do(request) +} + +// Change base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile("file", filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + } + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Override request host, if applicable + if c.cfg.Host != "" { + localVarRequest.Host = c.cfg.Host + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } + expires = now.Add(lifetime) + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericSwaggerError Provides access to the body, error and model on returned errors. +type GenericSwaggerError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericSwaggerError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericSwaggerError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericSwaggerError) Model() interface{} { + return e.model +} \ No newline at end of file diff --git a/examples/clients/responsebody/configuration.go b/examples/clients/responsebody/configuration.go index 0ffa917b424..6a98b8dcfe0 100644 --- a/examples/clients/responsebody/configuration.go +++ b/examples/clients/responsebody/configuration.go @@ -1,67 +1,72 @@ -/* +/* * examples/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody import ( - "encoding/base64" "net/http" - "time" ) +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} type Configuration struct { - Username string `json:"userName,omitempty"` - Password string `json:"password,omitempty"` - APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` - APIKey map[string]string `json:"APIKey,omitempty"` - Debug bool `json:"debug,omitempty"` - DebugFile string `json:"debugFile,omitempty"` - OAuthToken string `json:"oAuthToken,omitempty"` BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` - AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` - APIClient *APIClient - Transport *http.Transport - Timeout *time.Duration `json:"timeout,omitempty"` + HTTPClient *http.Client } func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "http://localhost", DefaultHeader: make(map[string]string), - APIKey: make(map[string]string), - APIKeyPrefix: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", - APIClient: &APIClient{}, } - - cfg.APIClient.config = cfg return cfg } -func (c *Configuration) GetBasicAuthEncodedString() string { - return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password)) -} - func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } - -func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string { - if c.APIKeyPrefix[APIKeyIdentifier] != "" { - return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] - } - - return c.APIKey[APIKeyIdentifier] -} diff --git a/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md b/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md index 64153cb125c..f7169959b1b 100644 --- a/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md +++ b/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Data** | **string** | | [optional] [default to null] -**Type_** | [**ResponseResponseType**](ResponseResponseType.md) | | [optional] [default to null] +**Type_** | [***ResponseResponseType**](ResponseResponseType.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/examples/clients/responsebody/docs/ExamplepbResponseBodyOut.md b/examples/clients/responsebody/docs/ExamplepbResponseBodyOut.md index a26ce7530d0..5a7146581bf 100644 --- a/examples/clients/responsebody/docs/ExamplepbResponseBodyOut.md +++ b/examples/clients/responsebody/docs/ExamplepbResponseBodyOut.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Response** | [**ExamplepbResponseBodyOutResponse**](examplepbResponseBodyOutResponse.md) | | [optional] [default to null] +**Response** | [***ExamplepbResponseBodyOutResponse**](examplepbResponseBodyOutResponse.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/examples/clients/responsebody/docs/ResponseBodyServiceApi.md b/examples/clients/responsebody/docs/ResponseBodyServiceApi.md index 458725faa9b..7645bba50b5 100644 --- a/examples/clients/responsebody/docs/ResponseBodyServiceApi.md +++ b/examples/clients/responsebody/docs/ResponseBodyServiceApi.md @@ -10,16 +10,15 @@ Method | HTTP request | Description # **GetResponseBody** -> ExamplepbResponseBodyOutResponse GetResponseBody($data) +> ExamplepbResponseBodyOutResponse GetResponseBody(ctx, data) - - -### Parameters +### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **data** | **string**| | + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **data** | **string**| | ### Return type @@ -37,16 +36,15 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **ListResponseBodies** -> []ExamplepbRepeatedResponseBodyOutResponse ListResponseBodies($data) - +> []ExamplepbRepeatedResponseBodyOutResponse ListResponseBodies(ctx, data) - -### Parameters +### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **data** | **string**| | + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **data** | **string**| | ### Return type @@ -64,16 +62,15 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **ListResponseStrings** -> []string ListResponseStrings($data) - - +> []string ListResponseStrings(ctx, data) -### Parameters +### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **data** | **string**| | + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **data** | **string**| | ### Return type diff --git a/examples/clients/responsebody/examplepb_response_body_message.go b/examples/clients/responsebody/examplepb_response_body_message.go deleted file mode 100644 index 6dfcea3835c..00000000000 --- a/examples/clients/responsebody/examplepb_response_body_message.go +++ /dev/null @@ -1,18 +0,0 @@ -/* - * examples/proto/examplepb/response_body_service.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package responsebody - -type ExamplepbResponseBodyMessage struct { - - Request string `json:"request,omitempty"` - - Response ExamplepbResponseBodyMessageResponse `json:"response,omitempty"` -} diff --git a/examples/clients/responsebody/examplepb_response_body_message_response.go b/examples/clients/responsebody/examplepb_response_body_message_response.go deleted file mode 100644 index 436f1dff6cb..00000000000 --- a/examples/clients/responsebody/examplepb_response_body_message_response.go +++ /dev/null @@ -1,16 +0,0 @@ -/* - * examples/proto/examplepb/response_body_service.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package responsebody - -type ExamplepbResponseBodyMessageResponse struct { - - Data string `json:"data,omitempty"` -} diff --git a/examples/clients/responsebody/examplepb_response_body_req.go b/examples/clients/responsebody/examplepb_response_body_req.go deleted file mode 100644 index 5d9a56d9546..00000000000 --- a/examples/clients/responsebody/examplepb_response_body_req.go +++ /dev/null @@ -1,16 +0,0 @@ -/* - * examples/proto/examplepb/response_body_service.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package responsebody - -type ExamplepbResponseBodyReq struct { - - Data string `json:"data,omitempty"` -} diff --git a/examples/clients/responsebody/examplepb_repeated_response_body_out.go b/examples/clients/responsebody/model_examplepb_repeated_response_body_out.go similarity index 72% rename from examples/clients/responsebody/examplepb_repeated_response_body_out.go rename to examples/clients/responsebody/model_examplepb_repeated_response_body_out.go index 18977ab5732..8ca6f95e154 100644 --- a/examples/clients/responsebody/examplepb_repeated_response_body_out.go +++ b/examples/clients/responsebody/model_examplepb_repeated_response_body_out.go @@ -1,16 +1,14 @@ -/* +/* * examples/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ExamplepbRepeatedResponseBodyOut struct { - Response []ExamplepbRepeatedResponseBodyOutResponse `json:"response,omitempty"` } diff --git a/examples/clients/responsebody/examplepb_repeated_response_body_out_response.go b/examples/clients/responsebody/model_examplepb_repeated_response_body_out_response.go similarity index 62% rename from examples/clients/responsebody/examplepb_repeated_response_body_out_response.go rename to examples/clients/responsebody/model_examplepb_repeated_response_body_out_response.go index 8c5c20bac24..9b15a6a5b2c 100644 --- a/examples/clients/responsebody/examplepb_repeated_response_body_out_response.go +++ b/examples/clients/responsebody/model_examplepb_repeated_response_body_out_response.go @@ -1,18 +1,15 @@ -/* +/* * examples/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ExamplepbRepeatedResponseBodyOutResponse struct { - Data string `json:"data,omitempty"` - - Type_ ResponseResponseType `json:"type,omitempty"` + Type_ *ResponseResponseType `json:"type,omitempty"` } diff --git a/examples/clients/responsebody/examplepb_repeated_response_strings.go b/examples/clients/responsebody/model_examplepb_repeated_response_strings.go similarity index 70% rename from examples/clients/responsebody/examplepb_repeated_response_strings.go rename to examples/clients/responsebody/model_examplepb_repeated_response_strings.go index 94a35e877ab..f25b08479ba 100644 --- a/examples/clients/responsebody/examplepb_repeated_response_strings.go +++ b/examples/clients/responsebody/model_examplepb_repeated_response_strings.go @@ -1,16 +1,14 @@ -/* +/* * examples/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ExamplepbRepeatedResponseStrings struct { - Values []string `json:"values,omitempty"` } diff --git a/examples/clients/responsebody/examplepb_response_body_out.go b/examples/clients/responsebody/model_examplepb_response_body_out.go similarity index 54% rename from examples/clients/responsebody/examplepb_response_body_out.go rename to examples/clients/responsebody/model_examplepb_response_body_out.go index 72fae8bd52a..4775292258a 100644 --- a/examples/clients/responsebody/examplepb_response_body_out.go +++ b/examples/clients/responsebody/model_examplepb_response_body_out.go @@ -1,16 +1,14 @@ -/* +/* * examples/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ExamplepbResponseBodyOut struct { - - Response ExamplepbResponseBodyOutResponse `json:"response,omitempty"` + Response *ExamplepbResponseBodyOutResponse `json:"response,omitempty"` } diff --git a/examples/clients/responsebody/examplepb_response_body_out_response.go b/examples/clients/responsebody/model_examplepb_response_body_out_response.go similarity index 69% rename from examples/clients/responsebody/examplepb_response_body_out_response.go rename to examples/clients/responsebody/model_examplepb_response_body_out_response.go index ca14fa3e6a1..8ef1dd1469e 100644 --- a/examples/clients/responsebody/examplepb_response_body_out_response.go +++ b/examples/clients/responsebody/model_examplepb_response_body_out_response.go @@ -1,16 +1,14 @@ -/* +/* * examples/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody type ExamplepbResponseBodyOutResponse struct { - Data string `json:"data,omitempty"` } diff --git a/examples/clients/responsebody/model_response_response_type.go b/examples/clients/responsebody/model_response_response_type.go new file mode 100644 index 00000000000..4db9360c72f --- /dev/null +++ b/examples/clients/responsebody/model_response_response_type.go @@ -0,0 +1,19 @@ +/* + * examples/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package responsebody + +type ResponseResponseType string + +// List of ResponseResponseType +const ( + UNKNOWN_ResponseResponseType ResponseResponseType = "UNKNOWN" + A_ResponseResponseType ResponseResponseType = "A" + B_ResponseResponseType ResponseResponseType = "B" +) diff --git a/examples/clients/responsebody/api_response.go b/examples/clients/responsebody/response.go similarity index 76% rename from examples/clients/responsebody/api_response.go rename to examples/clients/responsebody/response.go index 225d12176b3..1fdaa337c51 100644 --- a/examples/clients/responsebody/api_response.go +++ b/examples/clients/responsebody/response.go @@ -1,11 +1,10 @@ -/* +/* * examples/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package responsebody @@ -16,15 +15,15 @@ import ( type APIResponse struct { *http.Response `json:"-"` - Message string `json:"message,omitempty"` + Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. - Operation string `json:"operation,omitempty"` + Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. - RequestURL string `json:"url,omitempty"` + RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. - Method string `json:"method,omitempty"` + Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. diff --git a/examples/clients/responsebody/response_body_service_api.go b/examples/clients/responsebody/response_body_service_api.go deleted file mode 100644 index 000cecd6ddd..00000000000 --- a/examples/clients/responsebody/response_body_service_api.go +++ /dev/null @@ -1,219 +0,0 @@ -/* - * examples/proto/examplepb/response_body_service.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package responsebody - -import ( - "net/url" - "strings" - "encoding/json" - "fmt" -) - -type ResponseBodyServiceApi struct { - Configuration *Configuration -} - -func NewResponseBodyServiceApi() *ResponseBodyServiceApi { - configuration := NewConfiguration() - return &ResponseBodyServiceApi{ - Configuration: configuration, - } -} - -func NewResponseBodyServiceApiWithBasePath(basePath string) *ResponseBodyServiceApi { - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &ResponseBodyServiceApi{ - Configuration: configuration, - } -} - -/** - * - * - * @param data - * @return *ExamplepbResponseBodyOutResponse - */ -func (a ResponseBodyServiceApi) GetResponseBody(data string) (*ExamplepbResponseBodyOutResponse, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/responsebody/{data}" - localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbResponseBodyOutResponse) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "GetResponseBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param data - * @return []ExamplepbRepeatedResponseBodyOutResponse - */ -func (a ResponseBodyServiceApi) ListResponseBodies(data string) ([]ExamplepbRepeatedResponseBodyOutResponse, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/responsebodies/{data}" - localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new([]ExamplepbRepeatedResponseBodyOutResponse) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "ListResponseBodies", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return *successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return *successPayload, localVarAPIResponse, err -} - -/** - * - * - * @param data - * @return []string - */ -func (a ResponseBodyServiceApi) ListResponseStrings(data string) ([]string, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/responsestrings/{data}" - localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new([]string) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "ListResponseStrings", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return *successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return *successPayload, localVarAPIResponse, err -} - diff --git a/examples/clients/responsebody/response_response_type.go b/examples/clients/responsebody/response_response_type.go deleted file mode 100644 index 1c986fb7f92..00000000000 --- a/examples/clients/responsebody/response_response_type.go +++ /dev/null @@ -1,14 +0,0 @@ -/* - * examples/proto/examplepb/response_body_service.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package responsebody - -type ResponseResponseType struct { -} diff --git a/examples/clients/unannotatedecho/.swagger-codegen/VERSION b/examples/clients/unannotatedecho/.swagger-codegen/VERSION new file mode 100644 index 00000000000..752a79ef362 --- /dev/null +++ b/examples/clients/unannotatedecho/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.4.8 \ No newline at end of file diff --git a/examples/clients/unannotatedecho/BUILD.bazel b/examples/clients/unannotatedecho/BUILD.bazel index 611c6c7052d..06348263dc7 100644 --- a/examples/clients/unannotatedecho/BUILD.bazel +++ b/examples/clients/unannotatedecho/BUILD.bazel @@ -5,12 +5,15 @@ package(default_visibility = ["//visibility:public"]) go_library( name = "go_default_library", srcs = [ - "api_client.go", - "api_response.go", + "api_unannotated_echo_service.go", + "client.go", "configuration.go", - "examplepb_unannotated_simple_message.go", - "unannotated_echo_service_api.go", + "model_examplepb_unannotated_simple_message.go", + "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/unannotatedecho", - deps = ["@com_github_go_resty_resty//:go_default_library"], + deps = [ + "@com_github_antihax_optional//:go_default_library", + "@org_golang_x_oauth2//:go_default_library", + ], ) diff --git a/examples/clients/unannotatedecho/api/swagger.yaml b/examples/clients/unannotatedecho/api/swagger.yaml new file mode 100644 index 00000000000..ca2d21a58b6 --- /dev/null +++ b/examples/clients/unannotatedecho/api/swagger.yaml @@ -0,0 +1,135 @@ +--- +swagger: "2.0" +info: + description: "Unannotated Echo Service\nSimilar to echo_service.proto but without\ + \ annotations. See\nunannotated_echo_service.yaml for the equivalent of the annotations\ + \ in\ngRPC API configuration format.\n\nEcho Service API consists of a single\ + \ service which returns\na message." + version: "version not set" + title: "examples/proto/examplepb/unannotated_echo_service.proto" +schemes: +- "http" +- "https" +consumes: +- "application/json" +produces: +- "application/json" +paths: + /v1/example/echo/{id}: + post: + tags: + - "UnannotatedEchoService" + summary: "Echo method receives a simple message and returns it." + description: "The message posted as the id parameter will also be\nreturned." + operationId: "Echo" + parameters: + - name: "id" + in: "path" + description: "Id represents the message identifier." + required: true + type: "string" + x-exportParamName: "Id" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbUnannotatedSimpleMessage" + /v1/example/echo/{id}/{num}: + get: + tags: + - "UnannotatedEchoService" + summary: "Echo method receives a simple message and returns it." + description: "The message posted as the id parameter will also be\nreturned." + operationId: "Echo2" + parameters: + - name: "id" + in: "path" + description: "Id represents the message identifier." + required: true + type: "string" + x-exportParamName: "Id" + - name: "num" + in: "path" + required: true + type: "string" + format: "int64" + x-exportParamName: "Num" + - name: "duration" + in: "query" + required: false + type: "string" + x-exportParamName: "Duration" + x-optionalDataType: "String" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbUnannotatedSimpleMessage" + /v1/example/echo_body: + post: + tags: + - "UnannotatedEchoService" + summary: "EchoBody method receives a simple message and returns it." + operationId: "EchoBody" + parameters: + - in: "body" + name: "body" + required: true + schema: + $ref: "#/definitions/examplepbUnannotatedSimpleMessage" + x-exportParamName: "Body" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbUnannotatedSimpleMessage" + /v1/example/echo_delete: + delete: + tags: + - "UnannotatedEchoService" + summary: "EchoDelete method receives a simple message and returns it." + operationId: "EchoDelete" + parameters: + - name: "id" + in: "query" + description: "Id represents the message identifier." + required: false + type: "string" + x-exportParamName: "Id" + x-optionalDataType: "String" + - name: "num" + in: "query" + required: false + type: "string" + format: "int64" + x-exportParamName: "Num" + x-optionalDataType: "String" + - name: "duration" + in: "query" + required: false + type: "string" + x-exportParamName: "Duration" + x-optionalDataType: "String" + responses: + 200: + description: "A successful response." + schema: + $ref: "#/definitions/examplepbUnannotatedSimpleMessage" +definitions: + examplepbUnannotatedSimpleMessage: + type: "object" + properties: + id: + type: "string" + description: "Id represents the message identifier." + num: + type: "string" + format: "int64" + duration: + type: "string" + description: "UnannotatedSimpleMessage represents a simple message sent to the\ + \ unannotated Echo service." + example: + duration: "duration" + num: "num" + id: "id" diff --git a/examples/clients/unannotatedecho/api_client.go b/examples/clients/unannotatedecho/api_client.go deleted file mode 100644 index aa4c1f14e42..00000000000 --- a/examples/clients/unannotatedecho/api_client.go +++ /dev/null @@ -1,164 +0,0 @@ -/* - * examples/proto/examplepb/unannotated_echo_service.proto - * - * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. - * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package unannotatedecho - -import ( - "bytes" - "fmt" - "path/filepath" - "reflect" - "strings" - "net/url" - "io/ioutil" - "github.com/go-resty/resty" -) - -type APIClient struct { - config *Configuration -} - -func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { - - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -func (c *APIClient) SelectHeaderAccept(accepts []string) string { - - if len(accepts) == 0 { - return "" - } - if contains(accepts, "application/json") { - return "application/json" - } - return strings.Join(accepts, ",") -} - -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { - return true - } - } - return false -} - -func (c *APIClient) CallAPI(path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams map[string]string, - fileName string, - fileBytes []byte) (*resty.Response, error) { - - rClient := c.prepareClient() - request := c.prepareRequest(rClient, postBody, headerParams, queryParams, formParams, fileName, fileBytes) - - switch strings.ToUpper(method) { - case "GET": - response, err := request.Get(path) - return response, err - case "POST": - response, err := request.Post(path) - return response, err - case "PUT": - response, err := request.Put(path) - return response, err - case "PATCH": - response, err := request.Patch(path) - return response, err - case "DELETE": - response, err := request.Delete(path) - return response, err - } - - return nil, fmt.Errorf("invalid method %v", method) -} - -func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string { - delimiter := "" - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," - } - - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } - - return fmt.Sprintf("%v", obj) -} - -func (c *APIClient) prepareClient() *resty.Client { - - rClient := resty.New() - - rClient.SetDebug(c.config.Debug) - if c.config.Transport != nil { - rClient.SetTransport(c.config.Transport) - } - - if c.config.Timeout != nil { - rClient.SetTimeout(*c.config.Timeout) - } - rClient.SetLogger(ioutil.Discard) - return rClient -} - -func (c *APIClient) prepareRequest( - rClient *resty.Client, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams map[string]string, - fileName string, - fileBytes []byte) *resty.Request { - - - request := rClient.R() - request.SetBody(postBody) - - if c.config.UserAgent != "" { - request.SetHeader("User-Agent", c.config.UserAgent) - } - - // add header parameter, if any - if len(headerParams) > 0 { - request.SetHeaders(headerParams) - } - - // add query parameter, if any - if len(queryParams) > 0 { - request.SetMultiValueQueryParams(queryParams) - } - - // add form parameter, if any - if len(formParams) > 0 { - request.SetFormData(formParams) - } - - if len(fileBytes) > 0 && fileName != "" { - _, fileNm := filepath.Split(fileName) - request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) - } - return request -} diff --git a/examples/clients/unannotatedecho/api_unannotated_echo_service.go b/examples/clients/unannotatedecho/api_unannotated_echo_service.go new file mode 100644 index 00000000000..7bbd4f9e92f --- /dev/null +++ b/examples/clients/unannotatedecho/api_unannotated_echo_service.go @@ -0,0 +1,412 @@ +/* + * examples/proto/examplepb/unannotated_echo_service.proto + * + * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package unannotatedecho + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type UnannotatedEchoServiceApiService service + +/* +UnannotatedEchoServiceApiService Echo method receives a simple message and returns it. +The message posted as the id parameter will also be returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id Id represents the message identifier. + +@return ExamplepbUnannotatedSimpleMessage +*/ +func (a *UnannotatedEchoServiceApiService) Echo(ctx context.Context, id string) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbUnannotatedSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbUnannotatedSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +UnannotatedEchoServiceApiService Echo method receives a simple message and returns it. +The message posted as the id parameter will also be returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id Id represents the message identifier. + * @param num + * @param optional nil or *Echo2Opts - Optional Parameters: + * @param "Duration" (optional.String) - + +@return ExamplepbUnannotatedSimpleMessage +*/ + +type Echo2Opts struct { + Duration optional.String +} + +func (a *UnannotatedEchoServiceApiService) Echo2(ctx context.Context, id string, num string, localVarOptionals *Echo2Opts) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbUnannotatedSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo/{id}/{num}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Duration.IsSet() { + localVarQueryParams.Add("duration", parameterToString(localVarOptionals.Duration.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbUnannotatedSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +UnannotatedEchoServiceApiService EchoBody method receives a simple message and returns it. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + +@return ExamplepbUnannotatedSimpleMessage +*/ +func (a *UnannotatedEchoServiceApiService) EchoBody(ctx context.Context, body ExamplepbUnannotatedSimpleMessage) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbUnannotatedSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo_body" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbUnannotatedSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +UnannotatedEchoServiceApiService EchoDelete method receives a simple message and returns it. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *EchoDeleteOpts - Optional Parameters: + * @param "Id" (optional.String) - Id represents the message identifier. + * @param "Num" (optional.String) - + * @param "Duration" (optional.String) - + +@return ExamplepbUnannotatedSimpleMessage +*/ + +type EchoDeleteOpts struct { + Id optional.String + Num optional.String + Duration optional.String +} + +func (a *UnannotatedEchoServiceApiService) EchoDelete(ctx context.Context, localVarOptionals *EchoDeleteOpts) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbUnannotatedSimpleMessage + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/echo_delete" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Id.IsSet() { + localVarQueryParams.Add("id", parameterToString(localVarOptionals.Id.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Num.IsSet() { + localVarQueryParams.Add("num", parameterToString(localVarOptionals.Num.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Duration.IsSet() { + localVarQueryParams.Add("duration", parameterToString(localVarOptionals.Duration.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbUnannotatedSimpleMessage + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/examples/clients/unannotatedecho/client.go b/examples/clients/unannotatedecho/client.go new file mode 100644 index 00000000000..a7cdc750e4e --- /dev/null +++ b/examples/clients/unannotatedecho/client.go @@ -0,0 +1,464 @@ +/* + * examples/proto/examplepb/unannotated_echo_service.proto + * + * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package unannotatedecho + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") + xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") +) + +// APIClient manages communication with the examples/proto/examplepb/unannotated_echo_service.proto API vversion not set +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + UnannotatedEchoServiceApi *UnannotatedEchoServiceApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.UnannotatedEchoServiceApi = (*UnannotatedEchoServiceApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } + + return fmt.Sprintf("%v", obj) +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + return c.cfg.HTTPClient.Do(request) +} + +// Change base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile("file", filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + } + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Override request host, if applicable + if c.cfg.Host != "" { + localVarRequest.Host = c.cfg.Host + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } + expires = now.Add(lifetime) + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericSwaggerError Provides access to the body, error and model on returned errors. +type GenericSwaggerError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericSwaggerError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericSwaggerError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericSwaggerError) Model() interface{} { + return e.model +} \ No newline at end of file diff --git a/examples/clients/unannotatedecho/configuration.go b/examples/clients/unannotatedecho/configuration.go index d8ed5f04501..1d0dadff96c 100644 --- a/examples/clients/unannotatedecho/configuration.go +++ b/examples/clients/unannotatedecho/configuration.go @@ -1,67 +1,72 @@ -/* +/* * examples/proto/examplepb/unannotated_echo_service.proto * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho import ( - "encoding/base64" "net/http" - "time" ) +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} type Configuration struct { - Username string `json:"userName,omitempty"` - Password string `json:"password,omitempty"` - APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` - APIKey map[string]string `json:"APIKey,omitempty"` - Debug bool `json:"debug,omitempty"` - DebugFile string `json:"debugFile,omitempty"` - OAuthToken string `json:"oAuthToken,omitempty"` BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` - AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` - APIClient *APIClient - Transport *http.Transport - Timeout *time.Duration `json:"timeout,omitempty"` + HTTPClient *http.Client } func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "http://localhost", DefaultHeader: make(map[string]string), - APIKey: make(map[string]string), - APIKeyPrefix: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", - APIClient: &APIClient{}, } - - cfg.APIClient.config = cfg return cfg } -func (c *Configuration) GetBasicAuthEncodedString() string { - return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password)) -} - func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } - -func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string { - if c.APIKeyPrefix[APIKeyIdentifier] != "" { - return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] - } - - return c.APIKey[APIKeyIdentifier] -} diff --git a/examples/clients/unannotatedecho/examplepb_unannotated_simple_message.go b/examples/clients/unannotatedecho/model_examplepb_unannotated_simple_message.go similarity index 84% rename from examples/clients/unannotatedecho/examplepb_unannotated_simple_message.go rename to examples/clients/unannotatedecho/model_examplepb_unannotated_simple_message.go index 7791baa682b..c400daa0b55 100644 --- a/examples/clients/unannotatedecho/examplepb_unannotated_simple_message.go +++ b/examples/clients/unannotatedecho/model_examplepb_unannotated_simple_message.go @@ -1,22 +1,18 @@ -/* +/* * examples/proto/examplepb/unannotated_echo_service.proto * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho // UnannotatedSimpleMessage represents a simple message sent to the unannotated Echo service. type ExamplepbUnannotatedSimpleMessage struct { - // Id represents the message identifier. Id string `json:"id,omitempty"` - Num string `json:"num,omitempty"` - Duration string `json:"duration,omitempty"` } diff --git a/examples/clients/unannotatedecho/api_response.go b/examples/clients/unannotatedecho/response.go similarity index 79% rename from examples/clients/unannotatedecho/api_response.go rename to examples/clients/unannotatedecho/response.go index 8d7af71022e..3121acc8950 100644 --- a/examples/clients/unannotatedecho/api_response.go +++ b/examples/clients/unannotatedecho/response.go @@ -1,11 +1,10 @@ -/* +/* * examples/proto/examplepb/unannotated_echo_service.proto * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package unannotatedecho @@ -16,15 +15,15 @@ import ( type APIResponse struct { *http.Response `json:"-"` - Message string `json:"message,omitempty"` + Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. - Operation string `json:"operation,omitempty"` + Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. - RequestURL string `json:"url,omitempty"` + RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. - Method string `json:"method,omitempty"` + Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. diff --git a/examples/clients/unannotatedecho/unannotated_echo_service_api.go b/examples/clients/unannotatedecho/unannotated_echo_service_api.go deleted file mode 100644 index cb3efdde4d4..00000000000 --- a/examples/clients/unannotatedecho/unannotated_echo_service_api.go +++ /dev/null @@ -1,290 +0,0 @@ -/* - * examples/proto/examplepb/unannotated_echo_service.proto - * - * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. - * - * OpenAPI spec version: version not set - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -package unannotatedecho - -import ( - "net/url" - "strings" - "encoding/json" - "fmt" -) - -type UnannotatedEchoServiceApi struct { - Configuration *Configuration -} - -func NewUnannotatedEchoServiceApi() *UnannotatedEchoServiceApi { - configuration := NewConfiguration() - return &UnannotatedEchoServiceApi{ - Configuration: configuration, - } -} - -func NewUnannotatedEchoServiceApiWithBasePath(basePath string) *UnannotatedEchoServiceApi { - configuration := NewConfiguration() - configuration.BasePath = basePath - - return &UnannotatedEchoServiceApi{ - Configuration: configuration, - } -} - -/** - * Echo method receives a simple message and returns it. - * The message posted as the id parameter will also be returned. - * - * @param id Id represents the message identifier. - * @return *ExamplepbUnannotatedSimpleMessage - */ -func (a UnannotatedEchoServiceApi) Echo(id string) (*ExamplepbUnannotatedSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbUnannotatedSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Echo method receives a simple message and returns it. - * The message posted as the id parameter will also be returned. - * - * @param id Id represents the message identifier. - * @param num - * @param duration - * @return *ExamplepbUnannotatedSimpleMessage - */ -func (a UnannotatedEchoServiceApi) Echo2(id string, num string, duration string) (*ExamplepbUnannotatedSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo/{id}/{num}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) - localVarPath = strings.Replace(localVarPath, "{"+"num"+"}", fmt.Sprintf("%v", num), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("duration", a.Configuration.APIClient.ParameterToString(duration, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbUnannotatedSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * EchoBody method receives a simple message and returns it. - * - * @param body - * @return *ExamplepbUnannotatedSimpleMessage - */ -func (a UnannotatedEchoServiceApi) EchoBody(body ExamplepbUnannotatedSimpleMessage) (*ExamplepbUnannotatedSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo_body" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(ExamplepbUnannotatedSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "EchoBody", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * EchoDelete method receives a simple message and returns it. - * - * @param id Id represents the message identifier. - * @param num - * @param duration - * @return *ExamplepbUnannotatedSimpleMessage - */ -func (a UnannotatedEchoServiceApi) EchoDelete(id string, num string, duration string) (*ExamplepbUnannotatedSimpleMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Delete") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/echo_delete" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("id", a.Configuration.APIClient.ParameterToString(id, "")) - localVarQueryParams.Add("num", a.Configuration.APIClient.ParameterToString(num, "")) - localVarQueryParams.Add("duration", a.Configuration.APIClient.ParameterToString(duration, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(ExamplepbUnannotatedSimpleMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "EchoDelete", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - diff --git a/examples/integration/client_test.go b/examples/integration/client_test.go index 90431625380..8ca2807d97b 100644 --- a/examples/integration/client_test.go +++ b/examples/integration/client_test.go @@ -1,7 +1,7 @@ package integration_test import ( - "reflect" + "context" "testing" "github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe" @@ -9,19 +9,19 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/examples/clients/unannotatedecho" ) -func TestClientIntegration(t *testing.T) { -} - func TestEchoClient(t *testing.T) { if testing.Short() { t.Skip() return } - cl := echo.NewEchoServiceApiWithBasePath("http://localhost:8080") - resp, _, err := cl.Echo("foo") + cfg := echo.NewConfiguration() + cfg.BasePath = "http://localhost:8080" + + cl := echo.NewAPIClient(cfg) + resp, _, err := cl.EchoServiceApi.Echo(context.Background(), "foo") if err != nil { - t.Errorf(`cl.Echo("foo") failed with %v; want success`, err) + t.Errorf(`cl.EchoServiceApi.Echo("foo") failed with %v; want success`, err) } if got, want := resp.Id, "foo"; got != want { t.Errorf("resp.Id = %q; want %q", got, want) @@ -34,9 +34,12 @@ func TestEchoBodyClient(t *testing.T) { return } - cl := echo.NewEchoServiceApiWithBasePath("http://localhost:8080") + cfg := echo.NewConfiguration() + cfg.BasePath = "http://localhost:8080" + + cl := echo.NewAPIClient(cfg) req := echo.ExamplepbSimpleMessage{Id: "foo"} - resp, _, err := cl.EchoBody(req) + resp, _, err := cl.EchoServiceApi.EchoBody(context.Background(), req) if err != nil { t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err) } @@ -51,12 +54,19 @@ func TestAbitOfEverythingClient(t *testing.T) { return } - cl := abe.NewABitOfEverythingServiceApiWithBasePath("http://localhost:8080") + cfg := abe.NewConfiguration() + cfg.BasePath = "http://localhost:8080" + + cl := abe.NewAPIClient(cfg) + testABEClientCreate(t, cl) - testABEClientCreateBody(t, cl) } -func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { +func testABEClientCreate(t *testing.T, cl *abe.APIClient) { + enumZero := abe.ZERO_ExamplepbNumericEnum + enumPath := abe.ABC_PathenumPathEnum + messagePath := abe.JKL_MessagePathEnumNestedPathEnum + want := &abe.ExamplepbABitOfEverything{ FloatValue: 1.5, DoubleValue: 2.5, @@ -73,12 +83,13 @@ func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { Sint32Value: 2147483647, Sint64Value: "4611686018427387903", NonConventionalNameValue: "camelCase", - EnumValue: abe.ExamplepbNumericEnum{}, - PathEnumValue: abe.PathenumPathEnum{}, - NestedPathEnumValue: abe.MessagePathEnumNestedPathEnum{}, - EnumValueAnnotation: abe.ExamplepbNumericEnum{}, + EnumValue: &enumZero, + PathEnumValue: &enumPath, + NestedPathEnumValue: &messagePath, + EnumValueAnnotation: &enumZero, } - resp, _, err := cl.Create( + resp, _, err := cl.ABitOfEverythingServiceApi.Create( + context.Background(), want.FloatValue, want.DoubleValue, want.Int64Value, @@ -106,70 +117,63 @@ func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { t.Errorf("resp.Uuid is empty; want not empty") } resp.Uuid = "" - if got := resp; !reflect.DeepEqual(got, want) { - t.Errorf("resp = %#v; want %#v", got, want) - } -} -func testABEClientCreateBody(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { - t.Log("TODO: support enum") - return - - want := abe.ExamplepbABitOfEverything{ - FloatValue: 1.5, - DoubleValue: 2.5, - Int64Value: "4294967296", - Uint64Value: "9223372036854775807", - Int32Value: -2147483648, - Fixed64Value: "9223372036854775807", - Fixed32Value: 4294967295, - BoolValue: true, - StringValue: "strprefix/foo", - Uint32Value: 4294967295, - Sfixed32Value: 2147483647, - Sfixed64Value: "-4611686018427387904", - Sint32Value: 2147483647, - Sint64Value: "4611686018427387903", - NonConventionalNameValue: "camelCase", - EnumValue: abe.ExamplepbNumericEnum{}, - PathEnumValue: abe.PathenumPathEnum{}, - NestedPathEnumValue: abe.MessagePathEnumNestedPathEnum{}, - - Nested: []abe.ABitOfEverythingNested{ - { - Name: "bar", - Amount: 10, - }, - { - Name: "baz", - Amount: 20, - }, - }, - RepeatedStringValue: []string{"a", "b", "c"}, - OneofString: "x", - MapValue: map[string]abe.ExamplepbNumericEnum{ - // "a": abe.ExamplepbNumericEnum_ONE, - // "b": abe.ExamplepbNumericEnum_ZERO, - }, - MappedStringValue: map[string]string{ - "a": "x", - "b": "y", - }, - MappedNestedValue: map[string]abe.ABitOfEverythingNested{ - "a": {Name: "x", Amount: 1}, - "b": {Name: "y", Amount: 2}, - }, - } - resp, _, err := cl.CreateBody(want) - if err != nil { - t.Errorf("cl.CreateBody(%#v) failed with %v; want success", want, err) + if resp.FloatValue != want.FloatValue { + t.Error("float") } - if resp.Uuid == "" { - t.Errorf("resp.Uuid is empty; want not empty") + if resp.DoubleValue != want.DoubleValue { + t.Error("double") } - resp.Uuid = "" - if got := resp; !reflect.DeepEqual(got, want) { - t.Errorf("resp = %#v; want %#v", got, want) + if resp.Int64Value != want.Int64Value { + t.Error("double") + } + if resp.Uint64Value != want.Uint64Value { + t.Error("double") + } + if resp.Int32Value != want.Int32Value { + t.Error("double") + } + if resp.Fixed32Value != want.Fixed32Value { + t.Error("bool") + } + if resp.Fixed64Value != want.Fixed64Value { + t.Error("bool") + } + if resp.BoolValue != want.BoolValue { + t.Error("bool") + } + if resp.StringValue != want.StringValue { + t.Error("bool") + } + if resp.Uint32Value != want.Uint32Value { + t.Error("bool") + } + if resp.Sfixed32Value != want.Sfixed32Value { + t.Error("bool") + } + if resp.Sfixed64Value != want.Sfixed64Value { + t.Error("bool") + } + if resp.Sint32Value != want.Sint32Value { + t.Error("bool") + } + if resp.Sint64Value != want.Sint64Value { + t.Error("enum") + } + if resp.NonConventionalNameValue != want.NonConventionalNameValue { + t.Error("enum") + } + if resp.EnumValue.String() != want.EnumValue.String() { + t.Error("enum") + } + if resp.PathEnumValue.String() != want.PathEnumValue.String() { + t.Error("path enum") + } + if resp.NestedPathEnumValue.String() != want.NestedPathEnumValue.String() { + t.Error("nested path enum") + } + if resp.NestedPathEnumValue.String() != want.NestedPathEnumValue.String() { + t.Error("nested path enum") } } @@ -179,8 +183,12 @@ func TestUnannotatedEchoClient(t *testing.T) { return } - cl := unannotatedecho.NewUnannotatedEchoServiceApiWithBasePath("http://localhost:8080") - resp, _, err := cl.Echo("foo") + cfg := unannotatedecho.NewConfiguration() + cfg.BasePath = "http://localhost:8080" + + cl := unannotatedecho.NewAPIClient(cfg) + + resp, _, err := cl.UnannotatedEchoServiceApi.Echo(context.Background(), "foo") if err != nil { t.Errorf(`cl.Echo("foo") failed with %v; want success`, err) } @@ -195,9 +203,13 @@ func TestUnannotatedEchoBodyClient(t *testing.T) { return } - cl := unannotatedecho.NewUnannotatedEchoServiceApiWithBasePath("http://localhost:8080") + cfg := unannotatedecho.NewConfiguration() + cfg.BasePath = "http://localhost:8080" + + cl := unannotatedecho.NewAPIClient(cfg) + req := unannotatedecho.ExamplepbUnannotatedSimpleMessage{Id: "foo"} - resp, _, err := cl.EchoBody(req) + resp, _, err := cl.UnannotatedEchoServiceApi.EchoBody(context.Background(), req) if err != nil { t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err) } diff --git a/examples/integration/fieldmask_test.go b/examples/integration/fieldmask_test.go index 2ebe44ff05c..94131079cea 100644 --- a/examples/integration/fieldmask_test.go +++ b/examples/integration/fieldmask_test.go @@ -50,6 +50,11 @@ func fieldMaskString(fm *field_mask.FieldMask) string { // to import examplepb for the descriptor, which would result in a circular // dependency since examplepb imports runtime from the pb.gw.go files func TestFieldMaskFromRequestBodyWithDescriptor(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + _, md := descriptor.ForMessage(new(examplepb.NonStandardMessage)) jsonInput := `{"id":"foo", "thing":{"subThing":{"sub_value":"bar"}}}` expected := newFieldMask("id", "thing.subThing.sub_value") @@ -64,6 +69,11 @@ func TestFieldMaskFromRequestBodyWithDescriptor(t *testing.T) { } func TestFieldMaskFromRequestBodyWithJsonNames(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + _, md := descriptor.ForMessage(new(examplepb.NonStandardMessageWithJSONNames)) jsonInput := `{"ID":"foo", "Thingy":{"SubThing":{"sub_Value":"bar"}}}` expected := newFieldMask("id", "thing.subThing.sub_value") @@ -81,6 +91,11 @@ func TestFieldMaskFromRequestBodyWithJsonNames(t *testing.T) { var result *field_mask.FieldMask func BenchmarkABEFieldMaskFromRequestBodyWithDescriptor(b *testing.B) { + if testing.Short() { + b.Skip() + return + } + _, md := descriptor.ForMessage(new(examplepb.ABitOfEverything)) input := `{` + `"single_nested": {"name": "bar",` + @@ -143,6 +158,11 @@ func BenchmarkABEFieldMaskFromRequestBodyWithDescriptor(b *testing.B) { } func BenchmarkNonStandardFieldMaskFromRequestBodyWithDescriptor(b *testing.B) { + if testing.Short() { + b.Skip() + return + } + _, md := descriptor.ForMessage(new(examplepb.NonStandardMessage)) input := `{` + `"id": "foo",` + diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index febbb75b023..bdc5fd23777 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -48,6 +48,11 @@ func TestEcho(t *testing.T) { } func TestForwardResponseOption(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -670,6 +675,11 @@ func testABELookup(t *testing.T, port int) { // Then, issue a PATCH request updating only the string_value // Then, GET the resource and verify that string_value is changed, but int32_value isn't func TestABEPatch(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + port := 8080 // create a record with a known string_value and int32_value @@ -709,6 +719,11 @@ func TestABEPatch(t *testing.T) { // TestABEPatchBody demonstrates the ability to specify an update mask within the request body. // This binding does not use an automatically generated update_mask. func TestABEPatchBody(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + port := 8080 for _, tc := range []struct { @@ -1264,6 +1279,11 @@ func testABERepeated(t *testing.T, port int) { } func TestTimeout(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + apiURL := "http://localhost:8080/v2/example/timeout" req, err := http.NewRequest("GET", apiURL, nil) if err != nil { @@ -1284,6 +1304,11 @@ func TestTimeout(t *testing.T) { } func TestErrorWithDetails(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + apiURL := "http://localhost:8080/v2/example/errorwithdetails" resp, err := http.Get(apiURL) if err != nil { @@ -1344,6 +1369,11 @@ func TestErrorWithDetails(t *testing.T) { } func TestPostWithEmptyBody(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + apiURL := "http://localhost:8080/v2/example/postwithemptybody/name" rep, err := http.Post(apiURL, "application/json", nil) @@ -1360,6 +1390,11 @@ func TestPostWithEmptyBody(t *testing.T) { } func TestUnknownPath(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + apiURL := "http://localhost:8080" resp, err := http.Post(apiURL, "application/json", strings.NewReader("{}")) if err != nil { @@ -1380,6 +1415,11 @@ func TestUnknownPath(t *testing.T) { } func TestMethodNotAllowed(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + apiURL := "http://localhost:8080/v1/example/echo/myid" resp, err := http.Get(apiURL) if err != nil { @@ -1400,6 +1440,11 @@ func TestMethodNotAllowed(t *testing.T) { } func TestInvalidArgument(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + apiURL := "http://localhost:8080/v1/example/echo/myid/not_int64" resp, err := http.Get(apiURL) if err != nil { @@ -1544,6 +1589,11 @@ func testResponseStrings(t *testing.T, port int) { } func TestRequestQueryParams(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + port := 8080 formValues := url.Values{} @@ -1629,6 +1679,11 @@ func TestRequestQueryParams(t *testing.T) { } func TestNonStandardNames(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() diff --git a/examples/integration/proto_error_test.go b/examples/integration/proto_error_test.go index 5aa263b3df4..80b92638199 100644 --- a/examples/integration/proto_error_test.go +++ b/examples/integration/proto_error_test.go @@ -23,6 +23,11 @@ func runServer(ctx context.Context, t *testing.T, port uint16) { } func TestWithProtoErrorHandler(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -114,6 +119,11 @@ func testABELookupNotFoundWithProtoError(t *testing.T, port uint16) { } func TestUnknownPathWithProtoError(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -160,6 +170,11 @@ func TestUnknownPathWithProtoError(t *testing.T) { } func TestMethodNotAllowedWithProtoError(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index e8df7423c79..bbfbc52d053 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -820,228 +820,228 @@ func init() { } var fileDescriptor_3978364c010e812a = []byte{ - // 3529 bytes of a gzipped FileDescriptorProto + // 3523 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4d, 0x6c, 0x1b, 0xc7, - 0x7e, 0xd7, 0x72, 0x25, 0x59, 0x1a, 0x7d, 0x8f, 0x2c, 0x5b, 0xa6, 0x95, 0x68, 0x4c, 0x3b, 0x2f, - 0x6b, 0x3e, 0x93, 0x2b, 0xad, 0x94, 0xc4, 0x66, 0xfa, 0x92, 0x90, 0x92, 0xec, 0xc8, 0x4e, 0x64, - 0x65, 0xed, 0xb8, 0xa9, 0x5f, 0xfc, 0xd4, 0x21, 0x39, 0x14, 0xd7, 0xe2, 0xee, 0xec, 0xdb, 0x9d, - 0x95, 0x45, 0xab, 0x6c, 0x1f, 0xda, 0xa2, 0x05, 0xfa, 0x6e, 0x7c, 0xfd, 0x7e, 0x68, 0x2f, 0x45, - 0x51, 0xa0, 0xe8, 0xa9, 0x40, 0x4f, 0x05, 0xda, 0x4b, 0x6f, 0x3d, 0xb4, 0x48, 0x81, 0xa2, 0x87, - 0xf6, 0xd4, 0x9e, 0x7b, 0x69, 0x11, 0xa0, 0x87, 0x7e, 0x60, 0x66, 0x77, 0xc9, 0xdd, 0x25, 0x69, - 0x99, 0x76, 0x91, 0xe4, 0x10, 0xef, 0xcc, 0xfc, 0x3f, 0x7e, 0xff, 0x99, 0xff, 0xfc, 0x3f, 0x86, - 0x02, 0x1a, 0x39, 0xc1, 0xa6, 0xdd, 0x20, 0xae, 0x6a, 0x3b, 0x94, 0x51, 0x35, 0x18, 0xda, 0x65, - 0x15, 0x1f, 0x94, 0x0d, 0x76, 0x40, 0x6b, 0x07, 0xe4, 0x98, 0x38, 0x4d, 0x56, 0x37, 0xac, 0xc3, - 0xbc, 0xa0, 0x81, 0xab, 0x87, 0x8e, 0x5d, 0xc9, 0x1f, 0x62, 0x46, 0x9e, 0xe1, 0x66, 0x3e, 0x14, - 0x90, 0xef, 0xb0, 0xa6, 0x57, 0x0e, 0x29, 0x3d, 0x6c, 0x10, 0x15, 0xdb, 0x86, 0x8a, 0x2d, 0x8b, - 0x32, 0xcc, 0x0c, 0x6a, 0xb9, 0x3e, 0x7b, 0x1a, 0x05, 0xab, 0x62, 0x54, 0xf6, 0x6a, 0x6a, 0xcd, - 0x20, 0x8d, 0xea, 0x81, 0x89, 0xdd, 0xa3, 0x80, 0xe2, 0x72, 0x92, 0x82, 0x98, 0x36, 0x6b, 0x06, - 0x8b, 0x6f, 0x26, 0x17, 0xab, 0x9e, 0x23, 0xe4, 0x07, 0xeb, 0x6f, 0x27, 0x2c, 0xb2, 0x31, 0xab, - 0x13, 0xcb, 0x33, 0xc5, 0xc7, 0x01, 0xff, 0x0a, 0x71, 0x24, 0x08, 0x5d, 0xaf, 0xac, 0x9a, 0xc4, - 0x75, 0xf1, 0x21, 0x09, 0x28, 0xae, 0xf4, 0x52, 0x68, 0x09, 0x92, 0xd5, 0x24, 0x1a, 0x66, 0x98, - 0xc4, 0x65, 0xd8, 0xb4, 0x03, 0x82, 0x1b, 0xe2, 0x9f, 0x4a, 0xee, 0x90, 0x58, 0x39, 0xf7, 0x19, - 0x3e, 0x3c, 0x24, 0x8e, 0x4a, 0x6d, 0xb1, 0x1f, 0xbd, 0x7b, 0x93, 0xf9, 0xfb, 0xcb, 0x60, 0xbe, - 0x58, 0x32, 0xd8, 0xfd, 0xda, 0x4e, 0x67, 0xd7, 0xe1, 0x13, 0x30, 0xe3, 0x1a, 0xd6, 0x61, 0x83, - 0x1c, 0x58, 0xc4, 0x65, 0xa4, 0xba, 0x7c, 0x09, 0x49, 0xca, 0x94, 0x76, 0x33, 0x7f, 0xc6, 0x39, - 0xe4, 0x93, 0x92, 0xf2, 0x7b, 0x82, 0x5f, 0x9f, 0xf6, 0xc5, 0xf9, 0x23, 0x58, 0x07, 0xa3, 0x9e, - 0x67, 0x54, 0x97, 0x25, 0x24, 0x29, 0x93, 0xa5, 0x87, 0xed, 0xe2, 0x67, 0x3f, 0x92, 0xa4, 0xdf, - 0x90, 0xee, 0x7d, 0x1f, 0xe7, 0x6a, 0xc5, 0xdc, 0xed, 0xb5, 0xdc, 0xad, 0x27, 0xa7, 0x37, 0x5b, - 0xb9, 0xe8, 0x70, 0x73, 0x98, 0xe1, 0xba, 0xd6, 0xd2, 0x85, 0x06, 0xb8, 0x0f, 0xc6, 0x03, 0x0b, - 0x52, 0x48, 0x7e, 0x2d, 0x0b, 0x02, 0x39, 0xf0, 0x2e, 0x98, 0xaa, 0x35, 0x28, 0x66, 0x07, 0xc7, - 0xb8, 0xe1, 0x91, 0x65, 0x19, 0x49, 0x4a, 0xaa, 0x74, 0xbd, 0x5d, 0xfc, 0x8e, 0xb6, 0x70, 0x9b, - 0xcf, 0x23, 0x31, 0x8f, 0x84, 0x87, 0x15, 0xe4, 0xb5, 0xbc, 0xf6, 0x95, 0x14, 0x65, 0xd0, 0x81, - 0x18, 0x3c, 0xe2, 0xdf, 0xf0, 0x0a, 0x98, 0xae, 0x52, 0xaf, 0xdc, 0x20, 0x81, 0xb0, 0x51, 0x24, - 0x29, 0x92, 0x3e, 0xe5, 0xcf, 0xf9, 0x24, 0xab, 0x60, 0xca, 0xb0, 0xd8, 0xbb, 0x9b, 0x01, 0xc5, - 0x18, 0x92, 0x14, 0x59, 0x07, 0x62, 0xaa, 0x23, 0xc3, 0x8b, 0x52, 0x8c, 0x23, 0x49, 0x19, 0xd5, - 0xa7, 0xbc, 0x08, 0x89, 0x2f, 0x63, 0x43, 0x0b, 0x28, 0xce, 0x21, 0x49, 0x19, 0x13, 0x32, 0x36, - 0x34, 0x9f, 0xe0, 0x2a, 0x98, 0xa9, 0x19, 0x27, 0xa4, 0xda, 0x11, 0x32, 0x81, 0x24, 0x65, 0x5c, - 0x9f, 0x0e, 0x26, 0xe3, 0x44, 0x1d, 0x39, 0x93, 0x48, 0x52, 0xce, 0x05, 0x44, 0xa1, 0xa4, 0x37, - 0x00, 0x28, 0x53, 0xda, 0x08, 0x28, 0x00, 0x92, 0x94, 0x09, 0x7d, 0x92, 0xcf, 0x74, 0xc0, 0xba, - 0xcc, 0x31, 0xac, 0xc3, 0x80, 0x60, 0x8a, 0x3b, 0x80, 0x3e, 0xe5, 0xcf, 0x75, 0xc0, 0x96, 0x9b, - 0x8c, 0xb8, 0x01, 0xc5, 0x1b, 0x48, 0x52, 0xa6, 0x75, 0x20, 0xa6, 0x62, 0x06, 0x77, 0x60, 0xcc, - 0x20, 0x49, 0x99, 0xf1, 0x0d, 0x0e, 0x51, 0xdc, 0x03, 0x80, 0xdf, 0xba, 0x80, 0x60, 0x16, 0x49, - 0xca, 0xac, 0x76, 0xe3, 0xcc, 0x93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db, 0x27, 0x6a, - 0xbb, 0xbb, 0x16, 0x0b, 0xd3, 0x47, 0x13, 0x55, 0xa8, 0x69, 0x37, 0x8c, 0x8a, 0xb8, 0x55, 0x41, - 0xf7, 0x84, 0xb8, 0xe3, 0x21, 0x46, 0x51, 0x85, 0xbb, 0x22, 0x32, 0xb1, 0xd5, 0x44, 0x35, 0x82, - 0x99, 0xe7, 0x10, 0x97, 0xcb, 0xda, 0x0f, 0xf3, 0xc8, 0x57, 0x92, 0x68, 0x1d, 0xbe, 0x92, 0xa2, - 0x85, 0xf7, 0x57, 0x52, 0xac, 0x52, 0xcf, 0x3e, 0x02, 0xd7, 0x6e, 0x1b, 0x56, 0x15, 0x51, 0x8f, - 0x21, 0x93, 0x3a, 0x04, 0xe1, 0x32, 0xff, 0xec, 0x69, 0xa4, 0xf2, 0x75, 0xc6, 0x6c, 0xb7, 0xa0, - 0xaa, 0x87, 0x06, 0xab, 0x7b, 0xe5, 0x7c, 0x85, 0x9a, 0x2a, 0xdf, 0x8c, 0x1c, 0xa9, 0x50, 0xb7, - 0xe9, 0x32, 0x12, 0x0c, 0x83, 0xbd, 0xd1, 0x36, 0xa1, 0x76, 0x8a, 0x32, 0x5c, 0x3f, 0x77, 0x96, - 0xb5, 0x4a, 0x6d, 0xe3, 0xdd, 0x75, 0xb2, 0x9e, 0xdb, 0x2c, 0x6f, 0x6e, 0xe6, 0x36, 0x6f, 0x6e, - 0x54, 0x73, 0x78, 0xfd, 0x9d, 0x5b, 0xb9, 0x77, 0x36, 0xab, 0xb8, 0x5c, 0xad, 0xbd, 0x47, 0x6e, - 0xae, 0x6f, 0x66, 0x50, 0xab, 0x34, 0x13, 0xd6, 0x44, 0x02, 0x5c, 0xe6, 0x7f, 0x26, 0xc0, 0x72, - 0x12, 0x49, 0x18, 0x64, 0xe0, 0x2d, 0x70, 0x49, 0x54, 0x9d, 0x9d, 0xa0, 0x17, 0xed, 0x66, 0x24, - 0x24, 0x2b, 0x29, 0xfd, 0x02, 0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, 0x39, 0xfd, 0x52, 0x6c, - 0x77, 0x62, 0xfd, 0xd1, 0x00, 0x01, 0x1d, 0xa7, 0x98, 0x45, 0xb2, 0x32, 0xdf, 0x4f, 0xc0, 0x40, - 0x67, 0x8e, 0xf5, 0x51, 0x73, 0x48, 0x56, 0x16, 0x12, 0xa7, 0x13, 0xd9, 0xa5, 0xbe, 0xcc, 0x91, - 0x4e, 0x4d, 0x56, 0x60, 0x2f, 0x73, 0xa0, 0xb9, 0x50, 0x6f, 0x17, 0x89, 0x56, 0x81, 0xf8, 0x14, - 0x65, 0x06, 0x39, 0x56, 0xa6, 0x80, 0xbe, 0xcf, 0x1c, 0x8f, 0xdc, 0x40, 0xfe, 0xff, 0x6b, 0xb8, - 0xe1, 0x06, 0x83, 0x27, 0x37, 0x92, 0x6c, 0x11, 0xdc, 0x9c, 0x6f, 0xfd, 0x06, 0xd2, 0x6e, 0xa0, - 0x8d, 0x27, 0xa8, 0x95, 0x49, 0x83, 0xd1, 0x12, 0xad, 0x36, 0xfb, 0x65, 0xee, 0xcc, 0x97, 0x60, - 0x2e, 0x68, 0x5f, 0x7f, 0xd6, 0x60, 0x75, 0x41, 0x36, 0x0b, 0x52, 0xe1, 0x63, 0x90, 0x9e, 0x32, - 0x78, 0x88, 0x1a, 0xad, 0x62, 0x86, 0x83, 0xec, 0xf1, 0xd6, 0x99, 0xe7, 0xce, 0x85, 0xe8, 0x82, - 0x25, 0xf3, 0x13, 0x09, 0xcc, 0x7d, 0x6e, 0x57, 0x31, 0x23, 0x8f, 0x34, 0x9d, 0xfc, 0xd0, 0x23, - 0x2e, 0x83, 0x5b, 0x40, 0xc6, 0x65, 0x1f, 0xc4, 0x94, 0xb6, 0x3e, 0x74, 0x2e, 0xd2, 0x39, 0x37, - 0x7c, 0x1f, 0x4c, 0x79, 0x42, 0xae, 0x78, 0x35, 0x0c, 0xa0, 0xf5, 0x36, 0x21, 0xb7, 0x0d, 0xd2, - 0xa8, 0x7e, 0x8a, 0xdd, 0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0x9b, 0xa9, 0x4d, 0x3e, 0x14, - 0xb6, 0xdd, 0xca, 0x6c, 0x9e, 0x19, 0xf9, 0x63, 0xbf, 0x5a, 0xe7, 0x79, 0xc3, 0x21, 0x52, 0x56, - 0x11, 0x80, 0x3d, 0x5a, 0x32, 0xac, 0xaa, 0x61, 0x1d, 0xba, 0xf0, 0x52, 0x4f, 0x60, 0xdf, 0x0e, - 0x7e, 0xd0, 0x1f, 0x18, 0xf3, 0x47, 0xe0, 0x23, 0x70, 0xee, 0xa1, 0x61, 0x12, 0xea, 0x31, 0x38, - 0x80, 0x68, 0x20, 0xf3, 0x65, 0x01, 0x7f, 0x09, 0x2e, 0x46, 0xf7, 0x93, 0x05, 0xc2, 0xea, 0x60, - 0x7e, 0xc7, 0x71, 0xa8, 0xc3, 0xbb, 0xa1, 0x6d, 0xc2, 0xb0, 0xd1, 0x70, 0x87, 0x56, 0x70, 0x4d, - 0x28, 0x78, 0x13, 0xae, 0xc4, 0x0e, 0x8c, 0x4b, 0x7d, 0x66, 0xb0, 0x7a, 0x35, 0x90, 0xfa, 0xeb, - 0x12, 0x80, 0x77, 0x08, 0x4b, 0x76, 0x5f, 0x67, 0x17, 0x2e, 0x09, 0x8e, 0x81, 0x30, 0xde, 0x16, - 0x30, 0xae, 0x64, 0x2e, 0x45, 0x61, 0x70, 0x04, 0x65, 0x5a, 0x6d, 0xaa, 0xa7, 0xbc, 0x7c, 0x10, - 0x5d, 0x1a, 0xfc, 0x15, 0x09, 0x2c, 0xec, 0x53, 0x97, 0x71, 0x89, 0x82, 0x55, 0x00, 0x79, 0xb9, - 0x46, 0x6f, 0xa0, 0x76, 0x55, 0x68, 0xbf, 0x9e, 0xb9, 0x16, 0xd5, 0x6e, 0x53, 0x97, 0x71, 0x04, - 0xe2, 0xc7, 0x42, 0x1f, 0x46, 0xc7, 0x29, 0xfe, 0x46, 0x02, 0x8b, 0x5b, 0x75, 0x52, 0x39, 0x0a, - 0x73, 0xf6, 0x3e, 0x76, 0x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 0x95, 0x8b, 0x0e, 0x37, 0x87, 0x19, 0xae, 0x6b, 0x2d, 0x5d, 0x68, 0x80, 0xfb, 0x60, 0x3c, + 0xb0, 0x20, 0x85, 0xe4, 0xd7, 0xb2, 0x20, 0x90, 0x03, 0xef, 0x82, 0xe9, 0x5a, 0x83, 0x62, 0x76, + 0x70, 0x8c, 0x1b, 0x1e, 0x59, 0x96, 0x91, 0xa4, 0xa4, 0x4a, 0xd7, 0xdb, 0xc5, 0xef, 0x68, 0x0b, + 0xb7, 0xf9, 0x3c, 0x12, 0xf3, 0x48, 0x78, 0x58, 0x41, 0x5e, 0xcb, 0x6b, 0x5f, 0x49, 0x51, 0x06, + 0x1d, 0x88, 0xc1, 0x23, 0xfe, 0x0d, 0xaf, 0x80, 0x73, 0x55, 0xea, 0x95, 0x1b, 0x24, 0x10, 0x36, + 0x8a, 0x24, 0x45, 0xd2, 0xa7, 0xfd, 0x39, 0x9f, 0x64, 0x15, 0x4c, 0x1b, 0x16, 0x7b, 0x77, 0x33, + 0xa0, 0x18, 0x43, 0x92, 0x22, 0xeb, 0x40, 0x4c, 0x75, 0x64, 0x78, 0x51, 0x8a, 0x71, 0x24, 0x29, + 0xa3, 0xfa, 0xb4, 0x17, 0x21, 0xf1, 0x65, 0x6c, 0x68, 0x01, 0xc5, 0x04, 0x92, 0x94, 0x31, 0x21, + 0x63, 0x43, 0xf3, 0x09, 0xae, 0x82, 0x99, 0x9a, 0x71, 0x42, 0xaa, 0x1d, 0x21, 0x93, 0x48, 0x52, + 0xc6, 0xf5, 0x73, 0xc1, 0x64, 0x9c, 0xa8, 0x23, 0x67, 0x0a, 0x49, 0xca, 0x44, 0x40, 0x14, 0x4a, + 0x7a, 0x03, 0x80, 0x32, 0xa5, 0x8d, 0x80, 0x02, 0x20, 0x49, 0x99, 0xd4, 0xa7, 0xf8, 0x4c, 0x07, + 0xac, 0xcb, 0x1c, 0xc3, 0x3a, 0x0c, 0x08, 0xa6, 0xb9, 0x03, 0xe8, 0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x32, + 0x38, 0xa3, 0x4d, 0x83, 0xb1, 0xb4, 0x4c, 0x2d, 0x02, 0x52, 0x48, 0x7a, 0x3c, 0xd5, 0x71, 0xc7, + 0xf2, 0xb8, 0x08, 0x63, 0x1b, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x12, 0xd7, 0x52, 0x3a, + 0x2b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 6a7a75c2447..e7328ca4804 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -441,7 +441,6 @@ service ABitOfEverythingService { option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { description: "Description Echo"; summary: "Summary: Echo rpc"; - tags: "echo service"; tags: "echo rpc"; external_docs: { url: "https://github.com/grpc-ecosystem/grpc-gateway"; diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 41a60607f7d..e357ff5ffd7 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -115,7 +115,6 @@ } ], "tags": [ - "echo service", "echo rpc" ], "externalDocs": { @@ -1865,7 +1864,6 @@ } ], "tags": [ - "echo service", "echo rpc" ], "externalDocs": { @@ -1918,7 +1916,6 @@ } ], "tags": [ - "echo service", "echo rpc" ], "externalDocs": { diff --git a/go.mod b/go.mod index 73fe8d8d48b..23003a8626f 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,13 @@ module github.com/grpc-ecosystem/grpc-gateway go 1.13 require ( + github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6 github.com/ghodss/yaml v1.0.0 - github.com/go-resty/resty v1.8.0 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/protobuf v1.3.2 github.com/rogpeppe/fastuuid v1.2.0 golang.org/x/net v0.0.0-20191002035440-2ec189313ef0 + golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c google.golang.org/grpc v1.24.0 gopkg.in/yaml.v2 v2.2.3 // indirect diff --git a/go.sum b/go.sum index 50fdb09d1b5..20a620a8700 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,10 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6 h1:uZuxRZCz65cG1o6K/xUqImNcYKtmk9ylqaH0itMSvzA= +github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-resty/resty v1.8.0 h1:vbNCxbHOWCototzwxf3L63PQCKx6xgT6v8SHfoqkp6U= -github.com/go-resty/resty v1.8.0/go.mod h1:n37daLLGIHq2FFYHxg+FYQiwA95FpfNI+A9uxoIYGRk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -19,13 +19,13 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0 h1:2mqDk8w/o6UmeUCu5Qiq2y7iMf6anbx+YA8d1JFoFrs= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -40,6 +40,7 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c h1:hrpEMCZ2O7DR5gC1n2AJGVhrwiEjOi35+jxtIuZpTMo= diff --git a/repositories.bzl b/repositories.bzl index 2d83853dfc7..477883cfad3 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -43,24 +43,7 @@ def go_repositories(): sum = "h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=", version = "v1.3.2", ) - go_repository( - name = "com_github_kr_pretty", - importpath = "github.com/kr/pretty", - sum = "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=", - version = "v0.1.0", - ) - go_repository( - name = "com_github_kr_pty", - importpath = "github.com/kr/pty", - sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=", - version = "v1.1.1", - ) - go_repository( - name = "com_github_kr_text", - importpath = "github.com/kr/text", - sum = "h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=", - version = "v0.1.0", - ) + go_repository( name = "com_github_rogpeppe_fastuuid", importpath = "github.com/rogpeppe/fastuuid", @@ -79,12 +62,7 @@ def go_repositories(): sum = "h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=", version = "v0.0.0-20161208181325-20d25e280405", ) - go_repository( - name = "in_gopkg_resty_v1", - importpath = "gopkg.in/resty.v1", - sum = "h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI=", - version = "v1.12.0", - ) + go_repository( name = "in_gopkg_yaml_v2", importpath = "gopkg.in/yaml.v2", @@ -151,12 +129,7 @@ def go_repositories(): sum = "h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A=", version = "v0.0.0-20190524140312-2c0ae7006135", ) - go_repository( - name = "com_github_go_resty_resty", - importpath = "github.com/go-resty/resty", - sum = "h1:vbNCxbHOWCototzwxf3L63PQCKx6xgT6v8SHfoqkp6U=", - version = "v1.8.0", - ) + go_repository( name = "com_github_google_go_cmp", importpath = "github.com/google/go-cmp", @@ -175,3 +148,9 @@ def go_repositories(): sum = "h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA=", version = "v0.0.0-20190121172915-509febef88a4", ) + go_repository( + name = "com_github_antihax_optional", + importpath = "github.com/antihax/optional", + sum = "h1:uZuxRZCz65cG1o6K/xUqImNcYKtmk9ylqaH0itMSvzA=", + version = "v0.0.0-20180407024304-ca021399b1a6", + ) From ddfc00d1275d2b4407adb47f6842cfd39313a176 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 9 Oct 2019 10:11:42 +0100 Subject: [PATCH 482/552] Add back bzip2 to image This is required by node_tests --- .circleci/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile index a6a2f688857..c6cf118fc18 100644 --- a/.circleci/Dockerfile +++ b/.circleci/Dockerfile @@ -1,6 +1,7 @@ FROM golang:1.13.1 -# Warm apt cache +# Warm apt cache and install dependencies +# bzip2 is required by the node_tests (to extract its dependencies). RUN apt-get update && \ apt-get install -y wget unzip \ openjdk-11-jre \ @@ -30,6 +31,5 @@ RUN wget -qO- https://raw.githubusercontent.com/creationix/nvm/${NVM_VERSION}/in # Clean up RUN apt-get autoremove -y && \ apt-get remove -y wget \ - unzip \ - bzip2 && \ + unzip && \ rm -rf /var/lib/apt/lists/* From 7d2dc5f422a5ff8700761d10f297760886cc2b45 Mon Sep 17 00:00:00 2001 From: Marcus Low Junxiang Date: Mon, 14 Oct 2019 15:43:21 +0800 Subject: [PATCH 483/552] Fix building for Go 1.11 (#1062) * adding build-scoping for builds on earlier go versions (<1.12) * updating `BUILD.bazel` --- protoc-gen-swagger/genswagger/BUILD.bazel | 2 ++ protoc-gen-swagger/genswagger/generator.go | 4 ---- protoc-gen-swagger/genswagger/helpers.go | 9 +++++++++ protoc-gen-swagger/genswagger/helpers_go111_old.go | 9 +++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 protoc-gen-swagger/genswagger/helpers.go create mode 100644 protoc-gen-swagger/genswagger/helpers_go111_old.go diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/genswagger/BUILD.bazel index 929d0cf11d5..c89eb04477d 100644 --- a/protoc-gen-swagger/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/genswagger/BUILD.bazel @@ -7,6 +7,8 @@ go_library( srcs = [ "doc.go", "generator.go", + "helpers.go", + "helpers_go111_old.go", "template.go", "types.go", ], diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go index 31409ac4c19..61c5a537661 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/genswagger/generator.go @@ -67,10 +67,6 @@ func mergeTargetFile(targets []*wrapper, mergeFileName string) *wrapper { return mergedTarget } -func fieldName(k string) string { - return strings.ReplaceAll(strings.Title(k), "-", "_") -} - // Q: What's up with the alias types here? // A: We don't want to completely override how these structs are marshaled into // JSON, we only want to add fields (see below, extensionMarshalJSON). diff --git a/protoc-gen-swagger/genswagger/helpers.go b/protoc-gen-swagger/genswagger/helpers.go new file mode 100644 index 00000000000..3615596f7c1 --- /dev/null +++ b/protoc-gen-swagger/genswagger/helpers.go @@ -0,0 +1,9 @@ +//+build go1.12 + +package genswagger + +import "strings" + +func fieldName(k string) string { + return strings.ReplaceAll(strings.Title(k), "-", "_") +} diff --git a/protoc-gen-swagger/genswagger/helpers_go111_old.go b/protoc-gen-swagger/genswagger/helpers_go111_old.go new file mode 100644 index 00000000000..8e9458dd8d6 --- /dev/null +++ b/protoc-gen-swagger/genswagger/helpers_go111_old.go @@ -0,0 +1,9 @@ +//+build !go1.12 + +package genswagger + +import "strings" + +func fieldName(k string) string { + return strings.Replace(strings.Title(k), "-", "_", -1) +} From 69e270c99886e383b59aa39a83d2a495dceff8f5 Mon Sep 17 00:00:00 2001 From: Jeremy <45685728+Jeremytjuh@users.noreply.github.com> Date: Mon, 21 Oct 2019 15:11:33 +0200 Subject: [PATCH 484/552] Use Go templates in protofile comments (#1056) * use GO templates in protofile comments * Added support for the other swagger documentation fields * Added feature for Go templates in imported files * Fixed typo in main.go Co-Authored-By: Johan Brandhorst * Added Go template example * Added Go template documentation * Generated examples using build image * Generated bazel files using build image * Added use_go_templates.pb.gw.go in build file * Enhanced documentation * Fixed indents * Edited Go template bazel test * Excluded use_go_template.pb.gw.go in buildfile --- Makefile | 4 +- docs/_docs/usegotemplates.md | 93 ++++ docs/_imgs/gotemplates/postman.png | Bin 0 -> 51699 bytes docs/_imgs/gotemplates/swaggerui.png | Bin 0 -> 30963 bytes examples/proto/examplepb/BUILD.bazel | 2 + .../proto/examplepb/use_go_template.pb.go | 440 ++++++++++++++++++ .../proto/examplepb/use_go_template.pb.gw.go | 241 ++++++++++ .../proto/examplepb/use_go_template.proto | 85 ++++ .../examplepb/use_go_template.swagger.json | 135 ++++++ .../descriptor/registry.go | 14 + protoc-gen-swagger/defs.bzl | 5 +- protoc-gen-swagger/genswagger/template.go | 84 +++- .../genswagger/template_test.go | 165 ++++++- protoc-gen-swagger/main.go | 2 + 14 files changed, 1247 insertions(+), 23 deletions(-) create mode 100644 docs/_docs/usegotemplates.md create mode 100644 docs/_imgs/gotemplates/postman.png create mode 100644 docs/_imgs/gotemplates/swaggerui.png create mode 100644 examples/proto/examplepb/use_go_template.pb.go create mode 100644 examples/proto/examplepb/use_go_template.pb.gw.go create mode 100644 examples/proto/examplepb/use_go_template.proto create mode 100644 examples/proto/examplepb/use_go_template.swagger.json diff --git a/Makefile b/Makefile index a591c77baaa..608d9028129 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,7 @@ SWAGGER_EXAMPLES=examples/proto/examplepb/echo_service.proto \ examples/proto/examplepb/wrappers.proto \ examples/proto/examplepb/stream.proto \ examples/proto/examplepb/unannotated_echo_service.proto \ + examples/proto/examplepb/use_go_template.proto \ examples/proto/examplepb/response_body_service.proto EXAMPLES=examples/proto/examplepb/echo_service.proto \ @@ -73,6 +74,7 @@ EXAMPLES=examples/proto/examplepb/echo_service.proto \ examples/proto/examplepb/non_standard_names.proto \ examples/proto/examplepb/wrappers.proto \ examples/proto/examplepb/unannotated_echo_service.proto \ + examples/proto/examplepb/use_go_template.proto \ examples/proto/examplepb/response_body_service.proto EXAMPLE_SVCSRCS=$(EXAMPLES:.proto=.pb.go) @@ -161,7 +163,7 @@ $(EXAMPLE_GWSRCS): $(GATEWAY_PLUGIN) $(EXAMPLES) $(EXAMPLE_SWAGGERSRCS): ADDITIONAL_SWG_FLAGS:=$(ADDITIONAL_SWG_FLAGS),grpc_api_configuration=examples/proto/examplepb/unannotated_echo_service.yaml $(EXAMPLE_SWAGGERSRCS): $(SWAGGER_PLUGIN) $(SWAGGER_EXAMPLES) - protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(SWAGGER_PLUGIN) --swagger_out=logtostderr=true,allow_repeated_fields_in_body=true,$(PKGMAP)$(ADDITIONAL_SWG_FLAGS):. $(SWAGGER_EXAMPLES) + protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(SWAGGER_PLUGIN) --swagger_out=logtostderr=true,allow_repeated_fields_in_body=true,use_go_templates=true,$(PKGMAP)$(ADDITIONAL_SWG_FLAGS):. $(SWAGGER_EXAMPLES) $(ECHO_EXAMPLE_SRCS): $(ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ECHO_EXAMPLE_SPEC) \ diff --git a/docs/_docs/usegotemplates.md b/docs/_docs/usegotemplates.md new file mode 100644 index 00000000000..69dfa9474a7 --- /dev/null +++ b/docs/_docs/usegotemplates.md @@ -0,0 +1,93 @@ +| Title | Category | +| -------------------------------------- | ------------- | +| Use go templates in protofile comments | Documentation | + +# Use go templates in protofile comments + +Use [Go templates](https://golang.org/pkg/text/template/ "Package template") in your protofile comments to allow more advanced documentation such as: +* Documentation about fields in the proto objects. +* Import the content of external files (such as [Markdown](https://en.wikipedia.org/wiki/Markdown "Markdown Github")). + +## How to use it + +By default this function is turned off, so if you want to use it you have to set the `use_go_templates` flag to true inside of the `swagger_out` flag. +```bash +--swagger_out=use_go_templates=true:. +``` + +### Example script + +Example of a bash script with the `use_go_templates` flag set to true: + +```bash +protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway \ + --go_out=plugins=grpc:. \ + --grpc-gateway_out=logtostderr=true:. \ + --swagger_out=logtostderr=true,use_go_templates=true:. \ + *.proto +``` + +### Example proto file + +Example of a protofile with Go templates. This proto file imports documentation from another file, `tables.md`: +```protobuf +service LoginService { + // Login + // + // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. + // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". + // + // {{import "tables.md"}} + rpc Login (LoginRequest) returns (LoginReply) { + option (google.api.http) = { + post: "/v1/example/login" + body: "*" + }; + } +} + +message LoginRequest { + // The entered username + string username = 1; + // The entered password + string password = 2; +} + +message LoginReply { + // Whether you have access or not + bool access = 1; +} +``` + +The content of `tables.md`: + +```markdown +## {{.RequestType.Name}} +| Field ID | Name | Type | Description | +| ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} +| {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + +## {{.ResponseType.Name}} +| Field ID | Name | Type | Description | +| ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} +| {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} +``` + +## Swagger output + +### SwaggerUI + +This is how the swagger file would be rendered in [SwaggerUI](https://swagger.io/tools/swagger-ui/ "SwaggerUI site") + +![Screenshot swaggerfile in SwaggerUI](../_imgs/gotemplates/swaggerui.png "SwaggerUI") + +### Postman + +This is how the swagger file would be rendered in [Postman](https://www.getpostman.com/ "Postman site") + +![Screenshot swaggerfile in Postman](../_imgs/gotemplates/postman.png "Postman") + +For a more detailed example of a protofile that has Go templates enabled, [click here](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/use_go_template.proto "Example protofile with Go template"). diff --git a/docs/_imgs/gotemplates/postman.png b/docs/_imgs/gotemplates/postman.png new file mode 100644 index 0000000000000000000000000000000000000000..4f6fb7fb9c6e289f01b568f6f9ba6a1a158561ff GIT binary patch literal 51699 zcmdqIbx>Ww^Ct=+!CiuTa0u>j(ctdEF9ZngZo!?4ySrNma*-SKCO~l4T-@Dt^V@H- zyRYiKKek?Ny{b1=r%uf|Q!_n%y8F{-x;siuMHT~<1QiYr4ntl}S_2O5wH6#4{1!6e zpC?P26%2oF@U9xNl5lmSWP5))udO7MCE(y1L1>S_H-GvlPI4bz;ova){_BE=I#zsw zgZmjNFD;?vWqi1TB#tk;hIksm98HcESyT`i9r=ZXmGSzmc^sX(xsMWORM`%R$6i`EmzYsnY?S?FSO4Yc%N zn|_6j^Pi?(`jPns_g{yOvp`b%KkXAeqE_VJHq!qE_3x0xOd>UEn*TJeDJf#L1;J|a z#c$bRxkEd`Ouk1fyYug{FN#xN{~ZH95y@fGnzn&KIxbpvNv^+{T4-W@t7by^yNugf zqna-MN4a~{IkP}*0Hd9LZ&43R!!j(|BuJA}Pi)Ho$;4>_aV_9-l8s%aN;-|G=k|AA-Z<1Umj{1^VV&=5&XT z6>P>&JI<_1IU(H&i@CIjuA$_Pz(POz{}5XApiE~_Q4u7R3|zP*(Bs?3K>H+_D@tBP zeo+W6`h;UqFWVCiU{qN{c6VmeoBm9T!MKX$em~5(cui7gMaYu*Mz>e3?Eqz2po6j@ z?LvRvI6}x#&|%XEf7Tq0aX2B|=38iHXp^4c!K4jO``F@w9!JJsR=ed_e?m(&F@<%b z%?P(6qexzpRg2GNH{2Ri^WfuxUAe z@a0!_g!e`FciXOd)0J2#$LCpcauWD`*bjud({I zNzdOJl4&Uic3K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Mj-QPgB&NY{cc;a>#WK6<@Z9cwrmEnT9$QhZZ>YAbv8X zz-BTts7c9YquB0beA@n%FRcUPOw)Q}@AKPH^BdSWsDhUA)lt|IUQu;KY;$etMNyzp zwbQvp`aZ2yRN=~;jORKwu4Oih+>u&+%A6EjQ(MpdOUP7U^@$P9mBKfsvHFHaTY3s) zaQ$0hghLE?KOL-5FcTWLikKnCe7&yOJS(mR{H9gpt`-^4Jb-bt`@d11f`YVd4u-N( ztvqgFLtxDhl05zbpH%OI0^>$oQn#D>(N70o?rRfxUCRy6yBx&l0)|j&r~dcNSpF;` k{11+L{-w*1n%UZUOiIe_QVFLCt5wjwV06Az+cE0@07IGN7XSbN literal 0 HcmV?d00001 diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index 62a3a147115..1077b5885e7 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -9,6 +9,7 @@ package(default_visibility = ["//visibility:public"]) # gazelle:exclude flow_combination.pb.gw.go # gazelle:exclude non_standard_names.pb.gw.go # gazelle:exclude stream.pb.gw.go +# gazelle:exclude use_go_template.pb.gw.go # gazelle:exclude wrappers.pb.gw.go # gazelle:exclude response_body_service.pb.gw.go @@ -22,6 +23,7 @@ proto_library( "response_body_service.proto", "stream.proto", "unannotated_echo_service.proto", + "use_go_template.proto", "wrappers.proto", ], deps = [ diff --git a/examples/proto/examplepb/use_go_template.pb.go b/examples/proto/examplepb/use_go_template.pb.go new file mode 100644 index 00000000000..46e939310ac --- /dev/null +++ b/examples/proto/examplepb/use_go_template.pb.go @@ -0,0 +1,440 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: examples/proto/examplepb/use_go_template.proto + +package examplepb + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type LoginRequest struct { + // The entered username + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + // The entered password + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LoginRequest) Reset() { *m = LoginRequest{} } +func (m *LoginRequest) String() string { return proto.CompactTextString(m) } +func (*LoginRequest) ProtoMessage() {} +func (*LoginRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_11d6ea622d77f66b, []int{0} +} + +func (m *LoginRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LoginRequest.Unmarshal(m, b) +} +func (m *LoginRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LoginRequest.Marshal(b, m, deterministic) +} +func (m *LoginRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoginRequest.Merge(m, src) +} +func (m *LoginRequest) XXX_Size() int { + return xxx_messageInfo_LoginRequest.Size(m) +} +func (m *LoginRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LoginRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_LoginRequest proto.InternalMessageInfo + +func (m *LoginRequest) GetUsername() string { + if m != nil { + return m.Username + } + return "" +} + +func (m *LoginRequest) GetPassword() string { + if m != nil { + return m.Password + } + return "" +} + +type LoginReply struct { + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + // Whether you have access or not + Access bool `protobuf:"varint,2,opt,name=access,proto3" json:"access,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LoginReply) Reset() { *m = LoginReply{} } +func (m *LoginReply) String() string { return proto.CompactTextString(m) } +func (*LoginReply) ProtoMessage() {} +func (*LoginReply) Descriptor() ([]byte, []int) { + return fileDescriptor_11d6ea622d77f66b, []int{1} +} + +func (m *LoginReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LoginReply.Unmarshal(m, b) +} +func (m *LoginReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LoginReply.Marshal(b, m, deterministic) +} +func (m *LoginReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoginReply.Merge(m, src) +} +func (m *LoginReply) XXX_Size() int { + return xxx_messageInfo_LoginReply.Size(m) +} +func (m *LoginReply) XXX_DiscardUnknown() { + xxx_messageInfo_LoginReply.DiscardUnknown(m) +} + +var xxx_messageInfo_LoginReply proto.InternalMessageInfo + +func (m *LoginReply) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func (m *LoginReply) GetAccess() bool { + if m != nil { + return m.Access + } + return false +} + +type LogoutRequest struct { + // The time the logout was registered + Timeoflogout string `protobuf:"bytes,1,opt,name=timeoflogout,proto3" json:"timeoflogout,omitempty"` + // This is the title + // + // This is the "Description" of field test + // you can use as many newlines as you want + // + // + // it will still format the same in the table + Test int32 `protobuf:"varint,2,opt,name=test,proto3" json:"test,omitempty"` + // This is an array + // + // It displays that using [] infront of the type + Stringarray []string `protobuf:"bytes,3,rep,name=stringarray,proto3" json:"stringarray,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogoutRequest) Reset() { *m = LogoutRequest{} } +func (m *LogoutRequest) String() string { return proto.CompactTextString(m) } +func (*LogoutRequest) ProtoMessage() {} +func (*LogoutRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_11d6ea622d77f66b, []int{2} +} + +func (m *LogoutRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogoutRequest.Unmarshal(m, b) +} +func (m *LogoutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogoutRequest.Marshal(b, m, deterministic) +} +func (m *LogoutRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogoutRequest.Merge(m, src) +} +func (m *LogoutRequest) XXX_Size() int { + return xxx_messageInfo_LogoutRequest.Size(m) +} +func (m *LogoutRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LogoutRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_LogoutRequest proto.InternalMessageInfo + +func (m *LogoutRequest) GetTimeoflogout() string { + if m != nil { + return m.Timeoflogout + } + return "" +} + +func (m *LogoutRequest) GetTest() int32 { + if m != nil { + return m.Test + } + return 0 +} + +func (m *LogoutRequest) GetStringarray() []string { + if m != nil { + return m.Stringarray + } + return nil +} + +type LogoutReply struct { + // Message that tells you whether your + // logout was succesful or not + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogoutReply) Reset() { *m = LogoutReply{} } +func (m *LogoutReply) String() string { return proto.CompactTextString(m) } +func (*LogoutReply) ProtoMessage() {} +func (*LogoutReply) Descriptor() ([]byte, []int) { + return fileDescriptor_11d6ea622d77f66b, []int{3} +} + +func (m *LogoutReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogoutReply.Unmarshal(m, b) +} +func (m *LogoutReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogoutReply.Marshal(b, m, deterministic) +} +func (m *LogoutReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogoutReply.Merge(m, src) +} +func (m *LogoutReply) XXX_Size() int { + return xxx_messageInfo_LogoutReply.Size(m) +} +func (m *LogoutReply) XXX_DiscardUnknown() { + xxx_messageInfo_LogoutReply.DiscardUnknown(m) +} + +var xxx_messageInfo_LogoutReply proto.InternalMessageInfo + +func (m *LogoutReply) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func init() { + proto.RegisterType((*LoginRequest)(nil), "grpc.gateway.examples.examplepb.LoginRequest") + proto.RegisterType((*LoginReply)(nil), "grpc.gateway.examples.examplepb.LoginReply") + proto.RegisterType((*LogoutRequest)(nil), "grpc.gateway.examples.examplepb.LogoutRequest") + proto.RegisterType((*LogoutReply)(nil), "grpc.gateway.examples.examplepb.LogoutReply") +} + +func init() { + proto.RegisterFile("examples/proto/examplepb/use_go_template.proto", fileDescriptor_11d6ea622d77f66b) +} + +var fileDescriptor_11d6ea622d77f66b = []byte{ + // 360 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x31, 0x4e, 0xeb, 0x40, + 0x14, 0x94, 0x93, 0x9f, 0xfc, 0xe4, 0x25, 0xbf, 0xf8, 0x5b, 0x04, 0xcb, 0x0a, 0x22, 0xda, 0x86, + 0x28, 0x80, 0x2d, 0xa0, 0x4b, 0x41, 0x41, 0x41, 0x95, 0xca, 0x74, 0x34, 0xd1, 0xc6, 0x3c, 0x56, + 0x96, 0x6c, 0xef, 0xb2, 0xbb, 0x4e, 0x70, 0x09, 0x12, 0x27, 0xa0, 0xe3, 0x5a, 0x5c, 0x81, 0x83, + 0xa0, 0x6c, 0x6c, 0x13, 0x28, 0x20, 0x9d, 0x67, 0xe6, 0xcd, 0x78, 0x34, 0x36, 0xf8, 0xf8, 0xc0, + 0x52, 0x99, 0xa0, 0x0e, 0xa4, 0x12, 0x46, 0x04, 0x25, 0x94, 0x8b, 0x20, 0xd7, 0x38, 0xe7, 0x62, + 0x6e, 0x30, 0x95, 0x09, 0x33, 0xe8, 0x5b, 0x9d, 0x1c, 0x70, 0x25, 0x23, 0x9f, 0x33, 0x83, 0x2b, + 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 0xfd, 0x1f, 0x2c, 0x4f, 0xab, 0xcf, 0x1f, 0x24, 0x6b, 0x7d, + 0xea, 0x4c, 0xc8, 0xb3, 0x03, 0xed, 0x4d, 0x7d, 0xe2, 0xef, 0x92, 0xfa, 0x39, 0xa9, 0x77, 0xbc, + 0xf3, 0xfd, 0xba, 0xc6, 0xbe, 0xad, 0xb1, 0x47, 0xc9, 0xb7, 0x1a, 0x22, 0x37, 0x53, 0x67, 0x72, + 0xd9, 0xbb, 0xe9, 0xd6, 0xbe, 0x45, 0xdb, 0xfe, 0x4c, 0xe7, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0xf3, 0xee, 0xed, 0x28, 0xbd, 0x02, 0x00, 0x00, +} + +// 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.SupportPackageIsVersion4 + +// LoginServiceClient is the client API for LoginService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type LoginServiceClient interface { + // Login + // + // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. + // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". + // + // ## {{.RequestType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + // + // ## {{.ResponseType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error) + // Logout + // + // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. + // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". + // + // ## {{.RequestType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + // + // ## {{.ResponseType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutReply, error) +} + +type loginServiceClient struct { + cc *grpc.ClientConn +} + +func NewLoginServiceClient(cc *grpc.ClientConn) LoginServiceClient { + return &loginServiceClient{cc} +} + +func (c *loginServiceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error) { + out := new(LoginReply) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.LoginService/Login", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *loginServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutReply, error) { + out := new(LogoutReply) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.LoginService/Logout", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LoginServiceServer is the server API for LoginService service. +type LoginServiceServer interface { + // Login + // + // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. + // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". + // + // ## {{.RequestType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + // + // ## {{.ResponseType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + Login(context.Context, *LoginRequest) (*LoginReply, error) + // Logout + // + // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. + // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". + // + // ## {{.RequestType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + // + // ## {{.ResponseType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + Logout(context.Context, *LogoutRequest) (*LogoutReply, error) +} + +// UnimplementedLoginServiceServer can be embedded to have forward compatible implementations. +type UnimplementedLoginServiceServer struct { +} + +func (*UnimplementedLoginServiceServer) Login(ctx context.Context, req *LoginRequest) (*LoginReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") +} +func (*UnimplementedLoginServiceServer) Logout(ctx context.Context, req *LogoutRequest) (*LogoutReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented") +} + +func RegisterLoginServiceServer(s *grpc.Server, srv LoginServiceServer) { + s.RegisterService(&_LoginService_serviceDesc, srv) +} + +func _LoginService_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LoginServiceServer).Login(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.LoginService/Login", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LoginServiceServer).Login(ctx, req.(*LoginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LoginService_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LogoutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LoginServiceServer).Logout(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.LoginService/Logout", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LoginServiceServer).Logout(ctx, req.(*LogoutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _LoginService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.LoginService", + HandlerType: (*LoginServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Login", + Handler: _LoginService_Login_Handler, + }, + { + MethodName: "Logout", + Handler: _LoginService_Logout_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/proto/examplepb/use_go_template.proto", +} diff --git a/examples/proto/examplepb/use_go_template.pb.gw.go b/examples/proto/examplepb/use_go_template.pb.gw.go new file mode 100644 index 00000000000..68236c143ee --- /dev/null +++ b/examples/proto/examplepb/use_go_template.pb.gw.go @@ -0,0 +1,241 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: examples/proto/examplepb/use_go_template.proto + +/* +Package examplepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package examplepb + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage + +func request_LoginService_Login_0(ctx context.Context, marshaler runtime.Marshaler, client LoginServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq LoginRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Login(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_LoginService_Login_0(ctx context.Context, marshaler runtime.Marshaler, server LoginServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq LoginRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Login(ctx, &protoReq) + return msg, metadata, err + +} + +func request_LoginService_Logout_0(ctx context.Context, marshaler runtime.Marshaler, client LoginServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq LogoutRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Logout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_LoginService_Logout_0(ctx context.Context, marshaler runtime.Marshaler, server LoginServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq LogoutRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Logout(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterLoginServiceHandlerServer registers the http handlers for service LoginService to "mux". +// UnaryRPC :call LoginServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +func RegisterLoginServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LoginServiceServer) error { + + mux.Handle("POST", pattern_LoginService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_LoginService_Login_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_LoginService_Login_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_LoginService_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_LoginService_Logout_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_LoginService_Logout_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterLoginServiceHandlerFromEndpoint is same as RegisterLoginServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterLoginServiceHandlerFromEndpoint(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.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterLoginServiceHandler(ctx, mux, conn) +} + +// RegisterLoginServiceHandler registers the http handlers for service LoginService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterLoginServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterLoginServiceHandlerClient(ctx, mux, NewLoginServiceClient(conn)) +} + +// RegisterLoginServiceHandlerClient registers the http handlers for service LoginService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LoginServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LoginServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "LoginServiceClient" to call the correct interceptors. +func RegisterLoginServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LoginServiceClient) error { + + mux.Handle("POST", pattern_LoginService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_LoginService_Login_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_LoginService_Login_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_LoginService_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_LoginService_Logout_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_LoginService_Logout_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_LoginService_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "login"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_LoginService_Logout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "logout"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_LoginService_Login_0 = runtime.ForwardResponseMessage + + forward_LoginService_Logout_0 = runtime.ForwardResponseMessage +) diff --git a/examples/proto/examplepb/use_go_template.proto b/examples/proto/examplepb/use_go_template.proto new file mode 100644 index 00000000000..5a1b3161630 --- /dev/null +++ b/examples/proto/examplepb/use_go_template.proto @@ -0,0 +1,85 @@ +syntax = "proto3"; +option go_package = "examplepb"; +package grpc.gateway.examples.examplepb; + +import "google/api/annotations.proto"; + +service LoginService { + // Login + // + // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. + // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". + // + // ## {{.RequestType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + // + // ## {{.ResponseType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + rpc Login (LoginRequest) returns (LoginReply) { + option (google.api.http) = { + post: "/v1/example/login" + body: "*" + }; + } + + // Logout + // + // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. + // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". + // + // ## {{.RequestType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + // + // ## {{.ResponseType.Name}} + // | Field ID | Name | Type | Description | + // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} + // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} + rpc Logout (LogoutRequest) returns (LogoutReply) { + option (google.api.http) = { + post: "/v1/example/logout" + body: "*" + }; + } +} + +message LoginRequest { + // The entered username + string username = 1; + // The entered password + string password = 2; +} + +message LoginReply { + string message = 1; + // Whether you have access or not + bool access = 2; +} + +message LogoutRequest { + // The time the logout was registered + string timeoflogout = 1; + // This is the title + // + // This is the "Description" of field test + // you can use as many newlines as you want + // + // + // it will still format the same in the table + int32 test = 2; + // This is an array + // + // It displays that using [] infront of the type + repeated string stringarray = 3; +} + +message LogoutReply { + // Message that tells you whether your + // logout was succesful or not + string message = 1; +} \ No newline at end of file diff --git a/examples/proto/examplepb/use_go_template.swagger.json b/examples/proto/examplepb/use_go_template.swagger.json new file mode 100644 index 00000000000..61ea6b83475 --- /dev/null +++ b/examples/proto/examplepb/use_go_template.swagger.json @@ -0,0 +1,135 @@ +{ + "swagger": "2.0", + "info": { + "title": "examples/proto/examplepb/use_go_template.proto", + "version": "version not set" + }, + "schemes": [ + "http", + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/example/login": { + "post": { + "summary": "Login", + "description": "Login is a call with the method(s) POST within the \"LoginService\" service.\nIt takes in \"LoginRequest\" and returns a \"LoginReply\".\n\n## LoginRequest\n| Field ID | Name | Type | Description |\n| ----------- | --------- | --------------------------------------------------------- | ---------------------------- | \n| 1 | username | TYPE_STRING | The entered username | \n| 2 | password | TYPE_STRING | The entered password | \n\n## LoginReply\n| Field ID | Name | Type | Description |\n| ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | \n| 1 | message | TYPE_STRING | | \n| 2 | access | TYPE_BOOL | Whether you have access or not |", + "operationId": "Login", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbLoginReply" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbLoginRequest" + } + } + ], + "tags": [ + "LoginService" + ] + } + }, + "/v1/example/logout": { + "post": { + "summary": "Logout", + "description": "Logout is a call with the method(s) POST within the \"LoginService\" service.\nIt takes in \"LogoutRequest\" and returns a \"LogoutReply\".\n\n## LogoutRequest\n| Field ID | Name | Type | Description |\n| ----------- | --------- | --------------------------------------------------------- | ---------------------------- | \n| 1 | timeoflogout | TYPE_STRING | The time the logout was registered | \n| 2 | test | TYPE_INT32 | This is the title\u003cbr\u003e\u003cbr\u003eThis is the \"Description\" of field test\u003cbr\u003eyou can use as many newlines as you want\u003cbr\u003e\u003cbr\u003e\u003cbr\u003eit will still format the same in the table | \n| 3 | stringarray | []TYPE_STRING | This is an array\u003cbr\u003e\u003cbr\u003eIt displays that using [] infront of the type | \n\n## LogoutReply\n| Field ID | Name | Type | Description |\n| ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | \n| 1 | message | TYPE_STRING | Message that tells you whether your\u003cbr\u003elogout was succesful or not |", + "operationId": "Logout", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/examplepbLogoutReply" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbLogoutRequest" + } + } + ], + "tags": [ + "LoginService" + ] + } + } + }, + "definitions": { + "examplepbLoginReply": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "access": { + "type": "boolean", + "format": "boolean", + "title": "Whether you have access or not" + } + } + }, + "examplepbLoginRequest": { + "type": "object", + "properties": { + "username": { + "type": "string", + "title": "The entered username" + }, + "password": { + "type": "string", + "title": "The entered password" + } + } + }, + "examplepbLogoutReply": { + "type": "object", + "properties": { + "message": { + "type": "string", + "title": "Message that tells you whether your\nlogout was succesful or not" + } + } + }, + "examplepbLogoutRequest": { + "type": "object", + "properties": { + "timeoflogout": { + "type": "string", + "title": "The time the logout was registered" + }, + "test": { + "type": "integer", + "format": "int32", + "description": "This is the \"Description\" of field test\nyou can use as many newlines as you want\n\n\nit will still format the same in the table", + "title": "This is the title" + }, + "stringarray": { + "type": "array", + "items": { + "type": "string" + }, + "description": "It displays that using [] infront of the type", + "title": "This is an array" + } + } + } + } +} diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index 2f056364b8f..b73c123c8f9 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -71,6 +71,10 @@ type Registry struct { // allowColonFinalSegments determines whether colons are permitted // in the final segment of a path. allowColonFinalSegments bool + + // useGoTemplate determines whether you want to use GO templates + // in your protofile comments + useGoTemplate bool } type repeatedFieldSeparator struct { @@ -446,6 +450,16 @@ func (r *Registry) GetMergeFileName() string { return r.mergeFileName } +// SetUseGoTemplate sets useGoTemplate +func (r *Registry) SetUseGoTemplate(use bool) { + r.useGoTemplate = use +} + +// GetUseGoTemplate returns useGoTemplate +func (r *Registry) GetUseGoTemplate() bool { + return r.useGoTemplate +} + // sanitizePackageName replaces unallowed character in package name // with allowed character. func sanitizePackageName(pkgName string) string { diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index 4f90807f0f5..26cd7ca9e51 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -53,7 +53,6 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action output_dir = "/".join([output_dir, direct_proto_srcs[0].owner.workspace_root]) output_dir = "/".join([output_dir, direct_proto_srcs[0].dirname]) - options.append("allow_merge=true") options.append("merge_file_name=%s" % ctx.attr.name) @@ -74,6 +73,9 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action swagger_files.append(swagger_file) else: for proto in direct_proto_srcs: + if proto.basename == "use_go_template.proto": + options.append("use_go_templates=true") + swagger_file = actions.declare_file( "%s.swagger.json" % proto.basename[:-len(".proto")], sibling = proto, @@ -96,7 +98,6 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action outputs = [swagger_file], arguments = [args], ) - swagger_files.append(swagger_file) return swagger_files diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 3d97207c7eb..114252d0865 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1,8 +1,10 @@ package genswagger import ( + "bytes" "encoding/json" "fmt" + "io/ioutil" "os" "reflect" "regexp" @@ -10,6 +12,7 @@ import ( "strconv" "strings" "sync" + "text/template" "github.com/golang/glog" "github.com/golang/protobuf/jsonpb" @@ -122,7 +125,7 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st fieldType := field.GetTypeName() if message.File != nil { comments := fieldProtoComments(reg, message, field) - if err := updateSwaggerDataFromComments(&schema, comments, false); err != nil { + if err := updateSwaggerDataFromComments(reg, &schema, message, comments, false); err != nil { return nil, err } } @@ -285,7 +288,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, }, } msgComments := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index)) - if err := updateSwaggerDataFromComments(&schema, msgComments, false); err != nil { + if err := updateSwaggerDataFromComments(reg, &schema, msg, msgComments, false); err != nil { panic(err) } opts, err := extractSchemaOptionFromMessageDescriptor(msg.DescriptorProto) @@ -293,7 +296,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, panic(err) } if opts != nil { - protoSchema := swaggerSchemaFromProtoSchema(opts, reg, customRefs) + protoSchema := swaggerSchemaFromProtoSchema(opts, reg, customRefs, msg) // Warning: Make sure not to overwrite any fields already set on the schema type. schema.ExternalDocs = protoSchema.ExternalDocs @@ -330,7 +333,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, for _, f := range msg.Fields { fieldValue := schemaOfField(f, reg, customRefs) comments := fieldProtoComments(reg, msg, f) - if err := updateSwaggerDataFromComments(&fieldValue, comments, false); err != nil { + if err := updateSwaggerDataFromComments(reg, &fieldValue, f, comments, false); err != nil { panic(err) } @@ -461,7 +464,7 @@ func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) s } if j, err := extractJSONSchemaFromFieldDescriptor(fd); err == nil { - updateSwaggerObjectFromJSONSchema(&ret, j) + updateSwaggerObjectFromJSONSchema(&ret, j, reg, f) } return ret @@ -535,7 +538,7 @@ func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, r Default: defaultValue, }, } - if err := updateSwaggerDataFromComments(&enumSchemaObject, enumComments, false); err != nil { + if err := updateSwaggerDataFromComments(reg, &enumSchemaObject, enum, enumComments, false); err != nil { panic(err) } @@ -908,7 +911,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } methComments := protoComments(reg, svc.File, nil, "Method", int32(svcIdx), methProtoPath, int32(methIdx)) - if err := updateSwaggerDataFromComments(operationObject, methComments, false); err != nil { + if err := updateSwaggerDataFromComments(reg, operationObject, meth, methComments, false); err != nil { panic(err) } @@ -917,7 +920,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re if err != nil { panic(err) } - operationObject.ExternalDocs = protoExternalDocumentationToSwaggerExternalDocumentation(opts.ExternalDocs) + operationObject.ExternalDocs = protoExternalDocumentationToSwaggerExternalDocumentation(opts.ExternalDocs, reg, meth) // TODO(ivucica): this would be better supported by looking whether the method is deprecated in the proto file operationObject.Deprecated = opts.Deprecated @@ -958,7 +961,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re for name, resp := range opts.Responses { respObj := swaggerResponseObject{ Description: resp.Description, - Schema: swaggerSchemaFromProtoSchema(resp.Schema, reg, customRefs), + Schema: swaggerSchemaFromProtoSchema(resp.Schema, reg, customRefs, meth), } if resp.Extensions != nil { exts, err := processExtensions(resp.Extensions) @@ -1048,7 +1051,7 @@ func applyTemplate(p param) (*swaggerObject, error) { // File itself might have some comments and metadata. packageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") packageComments := protoComments(p.reg, p.File, nil, "Package", packageProtoPath) - if err := updateSwaggerDataFromComments(&s, packageComments, true); err != nil { + if err := updateSwaggerDataFromComments(p.reg, &s, p, packageComments, true); err != nil { panic(err) } @@ -1216,7 +1219,7 @@ func applyTemplate(p param) (*swaggerObject, error) { } s.Security = newSecurity } - s.ExternalDocs = protoExternalDocumentationToSwaggerExternalDocumentation(spb.ExternalDocs) + s.ExternalDocs = protoExternalDocumentationToSwaggerExternalDocumentation(spb.ExternalDocs, p.reg, spb) // Populate all Paths with Responses set at top level, // preferring Responses already set over those at the top level. if spb.Responses != nil { @@ -1246,7 +1249,7 @@ func applyTemplate(p param) (*swaggerObject, error) { } respMap[k] = swaggerResponseObject{ Description: v.Description, - Schema: swaggerSchemaFromProtoSchema(v.Schema, p.reg, customRefs), + Schema: swaggerSchemaFromProtoSchema(v.Schema, p.reg, customRefs, nil), } } } @@ -1300,11 +1303,16 @@ func processExtensions(inputExts map[string]*structpb.Value) ([]extension, error // // If there is no 'Summary', the same behavior will be attempted on 'Title', // but only if the last character is not a period. -func updateSwaggerDataFromComments(swaggerObject interface{}, comment string, isPackageObject bool) error { +func updateSwaggerDataFromComments(reg *descriptor.Registry, swaggerObject interface{}, data interface{}, comment string, isPackageObject bool) error { if len(comment) == 0 { return nil } + // Checks whether the "use_go_templates" flag is set to true + if reg.GetUseGoTemplate() { + comment = goTemplateComments(comment, data, reg) + } + // Figure out what to apply changes to. swaggerObjectValue := reflect.ValueOf(swaggerObject) infoObjectValue := swaggerObjectValue.Elem().FieldByName("Info") @@ -1435,6 +1443,37 @@ func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []str return "" } +func goTemplateComments(comment string, data interface{}, reg *descriptor.Registry) string { + var temp bytes.Buffer + tpl, err := template.New("").Funcs(template.FuncMap{ + // Allows importing documentation from a file + "import": func(name string) string { + file, err := ioutil.ReadFile(name) + if err != nil { + return err.Error() + } + // Runs template over imported file + return goTemplateComments(string(file), data, reg) + }, + // Grabs title and description from a field + "fieldcomments": func(msg *descriptor.Message, field *descriptor.Field) string { + return strings.Replace(fieldProtoComments(reg, msg, field), "\n", "
", -1) + }, + }).Parse(comment) + if err != nil { + // If there is an error parsing the templating insert the error as string in the comment + // to make it easier to debug the template error + return err.Error() + } + err = tpl.Execute(&temp, data) + if err != nil { + // If there is an error executing the templating insert the error as string in the comment + // to make it easier to debug the error + return err.Error() + } + return temp.String() +} + var messageProtoPath = protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "MessageType") var nestedProtoPath = protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "NestedType") var packageProtoPath = protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") @@ -1638,9 +1677,14 @@ func protoJSONSchemaToSwaggerSchemaCore(j *swagger_options.JSONSchema, reg *desc return ret } -func updateSwaggerObjectFromJSONSchema(s *swaggerSchemaObject, j *swagger_options.JSONSchema) { +func updateSwaggerObjectFromJSONSchema(s *swaggerSchemaObject, j *swagger_options.JSONSchema, reg *descriptor.Registry, data interface{}) { s.Title = j.GetTitle() s.Description = j.GetDescription() + if reg.GetUseGoTemplate() { + s.Title = goTemplateComments(s.Title, data, reg) + s.Description = goTemplateComments(s.Description, data, reg) + } + s.ReadOnly = j.GetReadOnly() s.MultipleOf = j.GetMultipleOf() s.Maximum = j.GetMaximum() @@ -1662,13 +1706,13 @@ func updateSwaggerObjectFromJSONSchema(s *swaggerSchemaObject, j *swagger_option } } -func swaggerSchemaFromProtoSchema(s *swagger_options.Schema, reg *descriptor.Registry, refs refMap) swaggerSchemaObject { +func swaggerSchemaFromProtoSchema(s *swagger_options.Schema, reg *descriptor.Registry, refs refMap, data interface{}) swaggerSchemaObject { ret := swaggerSchemaObject{ - ExternalDocs: protoExternalDocumentationToSwaggerExternalDocumentation(s.GetExternalDocs()), + ExternalDocs: protoExternalDocumentationToSwaggerExternalDocumentation(s.GetExternalDocs(), reg, data), } ret.schemaCore = protoJSONSchemaToSwaggerSchemaCore(s.GetJsonSchema(), reg, refs) - updateSwaggerObjectFromJSONSchema(&ret, s.GetJsonSchema()) + updateSwaggerObjectFromJSONSchema(&ret, s.GetJsonSchema(), reg, data) if s != nil && s.Example != nil { ret.Example = json.RawMessage(s.Example.Value) @@ -1712,11 +1756,15 @@ func protoJSONSchemaTypeToFormat(in []swagger_options.JSONSchema_JSONSchemaSimpl } } -func protoExternalDocumentationToSwaggerExternalDocumentation(in *swagger_options.ExternalDocumentation) *swaggerExternalDocumentationObject { +func protoExternalDocumentationToSwaggerExternalDocumentation(in *swagger_options.ExternalDocumentation, reg *descriptor.Registry, data interface{}) *swaggerExternalDocumentationObject { if in == nil { return nil } + if reg.GetUseGoTemplate() { + in.Description = goTemplateComments(in.Description, data, reg) + } + return &swaggerExternalDocumentationObject{ Description: in.Description, URL: in.Url, diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 5f0adf4f26f..27031742f87 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -1674,6 +1674,7 @@ func TestUpdateSwaggerDataFromComments(t *testing.T) { comments string expectedError error expectedSwaggerObject interface{} + useGoTemplate bool }{ { descr: "empty comments", @@ -1769,12 +1770,47 @@ func TestUpdateSwaggerDataFromComments(t *testing.T) { comments: "Any comment", expectedError: errors.New("no description nor summary property"), }, + { + descr: "without use_go_template", + swaggerObject: &swaggerSchemaObject{}, + expectedSwaggerObject: &swaggerSchemaObject{ + Title: "First line", + Description: "{{import \"documentation.md\"}}", + }, + comments: "First line\n\n{{import \"documentation.md\"}}", + expectedError: nil, + }, + { + descr: "error with use_go_template", + swaggerObject: &swaggerSchemaObject{}, + expectedSwaggerObject: &swaggerSchemaObject{ + Title: "First line", + Description: "open noneexistingfile.txt: no such file or directory", + }, + comments: "First line\n\n{{import \"noneexistingfile.txt\"}}", + expectedError: nil, + useGoTemplate: true, + }, + { + descr: "template with use_go_template", + swaggerObject: &swaggerSchemaObject{}, + expectedSwaggerObject: &swaggerSchemaObject{ + Title: "Template", + Description: `Description "which means nothing"`, + }, + comments: "Template\n\nDescription {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", + expectedError: nil, + useGoTemplate: true, + }, } for _, test := range tests { t.Run(test.descr, func(t *testing.T) { - err := updateSwaggerDataFromComments(test.swaggerObject, test.comments, false) - + reg := descriptor.NewRegistry() + if test.useGoTemplate { + reg.SetUseGoTemplate(true) + } + err := updateSwaggerDataFromComments(reg, test.swaggerObject, nil, test.comments, false) if test.expectedError == nil { if err != nil { t.Errorf("unexpected error '%v'", err) @@ -1796,3 +1832,128 @@ func TestUpdateSwaggerDataFromComments(t *testing.T) { }) } } + +func TestMessageOptionsWithGoTemplate(t *testing.T) { + tests := []struct { + descr string + msgDescs []*protodescriptor.DescriptorProto + schema map[string]swagger_options.Schema // per-message schema to add + defs swaggerDefinitionsObject + useGoTemplate bool + }{ + { + descr: "external docs option", + msgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{Name: proto.String("Message")}, + }, + schema: map[string]swagger_options.Schema{ + "Message": swagger_options.Schema{ + JsonSchema: &swagger_options.JSONSchema{ + Title: "{{.Name}}", + Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", + }, + ExternalDocs: &swagger_options.ExternalDocumentation{ + Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", + }, + }, + }, + defs: map[string]swaggerSchemaObject{ + "Message": swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "object", + }, + Title: "Message", + Description: `Description "which means nothing"`, + ExternalDocs: &swaggerExternalDocumentationObject{ + Description: `Description "which means nothing"`, + }, + }, + }, + useGoTemplate: true, + }, + { + descr: "external docs option", + msgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{Name: proto.String("Message")}, + }, + schema: map[string]swagger_options.Schema{ + "Message": swagger_options.Schema{ + JsonSchema: &swagger_options.JSONSchema{ + Title: "{{.Name}}", + Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", + }, + ExternalDocs: &swagger_options.ExternalDocumentation{ + Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", + }, + }, + }, + defs: map[string]swaggerSchemaObject{ + "Message": swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "object", + }, + Title: "{{.Name}}", + Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", + ExternalDocs: &swaggerExternalDocumentationObject{ + Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}", + }, + }, + }, + useGoTemplate: false, + }, + } + + for _, test := range tests { + t.Run(test.descr, func(t *testing.T) { + + msgs := []*descriptor.Message{} + for _, msgdesc := range test.msgDescs { + msgdesc.Options = &protodescriptor.MessageOptions{} + msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) + } + + reg := descriptor.NewRegistry() + reg.SetUseGoTemplate(test.useGoTemplate) + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{}, + MessageType: test.msgDescs, + EnumType: []*protodescriptor.EnumDescriptorProto{}, + Service: []*protodescriptor.ServiceDescriptorProto{}, + }, + Messages: msgs, + } + reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}, + }) + + msgMap := map[string]*descriptor.Message{} + for _, d := range test.msgDescs { + name := d.GetName() + msg, err := reg.LookupMsg("example", name) + if err != nil { + t.Fatalf("lookup message %v: %v", name, err) + } + msgMap[msg.FQMN()] = msg + + if schema, ok := test.schema[name]; ok { + err := proto.SetExtension(d.Options, swagger_options.E_Openapiv2Schema, &schema) + if err != nil { + t.Fatalf("SetExtension(%s, ...) returned error: %v", msg, err) + } + } + } + + refs := make(refMap) + actual := make(swaggerDefinitionsObject) + renderMessagesAsDefinition(msgMap, actual, reg, refs) + + if !reflect.DeepEqual(actual, test.defs) { + t.Errorf("Expected renderMessagesAsDefinition() to add defs %+v, not %+v", test.defs, actual) + } + }) + } +} diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index 237e4604983..9befc2544f4 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -27,6 +27,7 @@ var ( allowRepeatedFieldsInBody = flag.Bool("allow_repeated_fields_in_body", false, "allows to use repeated field in `body` and `response_body` field of `google.api.http` annotation option") includePackageInTags = flag.Bool("include_package_in_tags", false, "if unset, the gRPC service name is added to the `Tags` field of each operation. if set and the `package` directive is shown in the proto file, the package name will be prepended to the service name") useFQNForSwaggerName = flag.Bool("fqn_for_swagger_name", false, "if set, the object's swagger names will use the fully qualify name from the proto definition (ie my.package.MyMessage.MyInnerMessage") + useGoTemplate = flag.Bool("use_go_templates", false, "if set, you can use Go templates in protofile comments") ) // Variables set by goreleaser at build time @@ -78,6 +79,7 @@ func main() { reg.SetAllowRepeatedFieldsInBody(*allowRepeatedFieldsInBody) reg.SetIncludePackageInTags(*includePackageInTags) reg.SetUseFQNForSwaggerName(*useFQNForSwaggerName) + reg.SetUseGoTemplate(*useGoTemplate) if err := reg.SetRepeatedPathParamSeparator(*repeatedPathParamSeparator); err != nil { emitError(err) return From 6beb696139f107415561382aa6bddee081a0e582 Mon Sep 17 00:00:00 2001 From: Dan Muller Date: Mon, 28 Oct 2019 14:36:38 -0600 Subject: [PATCH 485/552] fix(protoc-gen-swagger): Windows compatibility Inspired by protobuf.bzl from the main bazel repo: https://github.com/bazelbuild/bazel/blob/deeeba3fc8003cbbcc73e04f14fc5b5275e72e5d/third_party/protobuf/3.6.1/protobuf.bzl#L108 This PR introducing a windows mapping from protoc-gen-swagger to the binaries actual path. --- protoc-gen-swagger/defs.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index 26cd7ca9e51..4dfca37fdac 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -57,7 +57,7 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action options.append("merge_file_name=%s" % ctx.attr.name) args = actions.args() - args.add("--plugin=%s" % protoc_gen_swagger.path) + args.add("--plugin=protoc-gen-swagger=%s" % protoc_gen_swagger.path) args.add("--swagger_out=%s:%s" % (",".join(options), output_dir)) args.add_all(["-I%s" % include for include in includes]) args.add_all([src.path for src in direct_proto_srcs]) @@ -86,7 +86,7 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action output_dir = "/".join([output_dir, proto.owner.workspace_root]) args = actions.args() - args.add("--plugin=%s" % protoc_gen_swagger.path) + args.add("--plugin=protoc-gen-swagger=%s" % protoc_gen_swagger.path) args.add("--swagger_out=%s:%s" % (",".join(options), output_dir)) args.add_all(["-I%s" % include for include in includes]) args.add(proto.path) From 7429a4cbeb19be5c57f68f42fa729654dda85d84 Mon Sep 17 00:00:00 2001 From: ch3rub1m Date: Tue, 27 Aug 2019 16:53:50 +0800 Subject: [PATCH 486/552] Fix templateToSwaggerPath generates invalid path --- protoc-gen-swagger/genswagger/template.go | 35 +++++++++++++++++-- .../genswagger/template_test.go | 21 +++++------ 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 114252d0865..a5548f3e46e 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io/ioutil" + "net/url" "os" "reflect" "regexp" @@ -17,9 +18,9 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" - structpb "github.com/golang/protobuf/ptypes/struct" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" + structpb "github.com/golang/protobuf/ptypes/struct" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) @@ -678,13 +679,18 @@ func templateToSwaggerPath(path string, reg *descriptor.Registry) string { // Parts is now an array of segments of the path. Interestingly, since the // syntax for this subsection CAN be handled by a regexp since it has no // memory. + keyre := regexp.MustCompile("{(.*)}") for index, part := range parts { // If part is a resource name such as "parent", "name", "user.name", the format info must be retained. prefix := canRegexp.ReplaceAllString(part, "$1") if isResourceName(prefix) { - continue + sm := keyre.FindStringSubmatch(part) + key := sm[1] + esckey := url.PathEscape(key) + parts[index] = keyre.ReplaceAllString(part, fmt.Sprintf("{%s}", esckey)) + } else { + parts[index] = canRegexp.ReplaceAllString(part, "{$1}") } - parts[index] = canRegexp.ReplaceAllString(part, "{$1}") } return strings.Join(parts, "/") @@ -699,11 +705,31 @@ func isResourceName(prefix string) bool { return field == "parent" || field == "name" } +func extractResourceName(path string) map[string]string { + m := map[string]string{} + keyre := regexp.MustCompile("{(.*)}") + sm := keyre.FindStringSubmatch(path) + count := len(sm) + for i := 0; i < count; i++ { + key := sm[1] + parts := strings.Split(key, "=") + label := parts[0] + parts = strings.Split(label, ".") + l := len(parts) + field := parts[l-1] + if field == "parent" || field == "name" { + m[label] = key + } + } + return m +} + func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry, requestResponseRefs, customRefs refMap) error { // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. for svcIdx, svc := range services { for methIdx, meth := range svc.Methods { for bIdx, b := range meth.Bindings { + pathParamMap := extractResourceName(templateToSwaggerPath(b.PathTmpl.Template, reg)) // Iterate over all the swagger parameters parameters := swaggerParametersObject{} for _, parameter := range b.PathParams { @@ -771,6 +797,9 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re if reg.GetUseJSONNamesForFields() { parameterString = lowerCamelCase(parameterString) } + if esckey, ok := pathParamMap[parameterString]; ok { + parameterString = esckey + } parameters = append(parameters, swaggerParameterObject{ Name: parameterString, Description: desc, diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 27031742f87..8768830a8d0 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -1050,16 +1050,17 @@ func TestTemplateToSwaggerPath(t *testing.T) { {"/{test=prefix/that/has/multiple/parts/to/it/*}", "/{test}"}, {"/{test1}/{test2}", "/{test1}/{test2}"}, {"/{test1}/{test2}/", "/{test1}/{test2}/"}, - {"/{name=prefix/*}", "/{name=prefix/*}"}, - {"/{name=prefix1/*/prefix2/*}", "/{name=prefix1/*/prefix2/*}"}, - {"/{user.name=prefix/*}", "/{user.name=prefix/*}"}, - {"/{user.name=prefix1/*/prefix2/*}", "/{user.name=prefix1/*/prefix2/*}"}, - {"/{parent=prefix/*}/children", "/{parent=prefix/*}/children"}, - {"/{name=prefix/*}:customMethod", "/{name=prefix/*}:customMethod"}, - {"/{name=prefix1/*/prefix2/*}:customMethod", "/{name=prefix1/*/prefix2/*}:customMethod"}, - {"/{user.name=prefix/*}:customMethod", "/{user.name=prefix/*}:customMethod"}, - {"/{user.name=prefix1/*/prefix2/*}:customMethod", "/{user.name=prefix1/*/prefix2/*}:customMethod"}, - {"/{parent=prefix/*}/children:customMethod", "/{parent=prefix/*}/children:customMethod"}, + {"/{name=prefix/*}", "/{name=prefix%2F%2A}"}, + {"/{name=prefix1/*/prefix2/*}", "/{name=prefix1%2F%2A%2Fprefix2%2F%2A}"}, + {"/{parent=prefix1/*}/{name=prefix2/*}", "/{parent=prefix1%2F%2A}/{name=prefix2%2F%2A}"}, + {"/{user.name=prefix/*}", "/{user.name=prefix%2F%2A}"}, + {"/{user.name=prefix1/*/prefix2/*}", "/{user.name=prefix1%2F%2A%2Fprefix2%2F%2A}"}, + {"/{parent=prefix/*}/children", "/{parent=prefix%2F%2A}/children"}, + {"/{name=prefix/*}:customMethod", "/{name=prefix%2F%2A}:customMethod"}, + {"/{name=prefix1/*/prefix2/*}:customMethod", "/{name=prefix1%2F%2A%2Fprefix2%2F%2A}:customMethod"}, + {"/{user.name=prefix/*}:customMethod", "/{user.name=prefix%2F%2A}:customMethod"}, + {"/{user.name=prefix1/*/prefix2/*}:customMethod", "/{user.name=prefix1%2F%2A%2Fprefix2%2F%2A}:customMethod"}, + {"/{parent=prefix/*}/children:customMethod", "/{parent=prefix%2F%2A}/children:customMethod"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) From 94f3ea9af5a549affd741538558825e0cba037c5 Mon Sep 17 00:00:00 2001 From: Prateek Malhotra Date: Fri, 1 Nov 2019 10:32:09 -0400 Subject: [PATCH 487/552] annotations: Sort import order. --- protoc-gen-swagger/options/annotations.pb.go | 32 ++++++++++---------- protoc-gen-swagger/options/annotations.proto | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/protoc-gen-swagger/options/annotations.pb.go b/protoc-gen-swagger/options/annotations.pb.go index 851af51231a..651400277ef 100644 --- a/protoc-gen-swagger/options/annotations.pb.go +++ b/protoc-gen-swagger/options/annotations.pb.go @@ -84,22 +84,22 @@ var fileDescriptor_a6a34ca6badab664 = []byte{ 0x14, 0xc5, 0xc3, 0xe6, 0xe5, 0xa5, 0xef, 0xa9, 0x58, 0x37, 0x86, 0xf8, 0x87, 0x9d, 0xc6, 0xc0, 0x8c, 0x81, 0x5d, 0x77, 0x6a, 0xe2, 0xc2, 0x44, 0x49, 0x0a, 0x2b, 0x37, 0x64, 0x18, 0x2e, 0x97, 0x49, 0x4a, 0xef, 0x64, 0x66, 0x80, 0x90, 0xb0, 0xf4, 0x13, 0xf8, 0x89, 0x8d, 0xd3, 0xd2, 0x9a, - 0x8a, 0xa6, 0xbb, 0xde, 0xdb, 0x39, 0xe7, 0x77, 0x7a, 0x3a, 0x41, 0x47, 0x1b, 0x72, 0x24, 0xbb, + 0x8a, 0xa6, 0xbb, 0xce, 0xe9, 0xbd, 0xe7, 0x77, 0x7a, 0x3a, 0x41, 0x47, 0x1b, 0x72, 0x24, 0xbb, 0x08, 0x69, 0xd7, 0xae, 0x05, 0x22, 0x18, 0x4e, 0xda, 0x29, 0x4a, 0x2d, 0x17, 0x69, 0x4a, 0x4e, - 0xf8, 0x67, 0xe6, 0x8f, 0x85, 0x57, 0x68, 0xb4, 0x64, 0x28, 0x1c, 0xac, 0xc5, 0x26, 0xdb, 0xc9, - 0x31, 0x42, 0x3a, 0xce, 0xa5, 0x2c, 0x97, 0xb6, 0x6e, 0x7e, 0xb1, 0x25, 0x0d, 0xa9, 0xd0, 0x6a, - 0xd5, 0xcb, 0x0c, 0x5a, 0x6d, 0x24, 0xc2, 0x04, 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, 0x19, 0x09, 0x8c, + 0xb6, 0x41, 0x99, 0x63, 0x3c, 0x53, 0x90, 0x4c, 0xc3, 0xf3, 0x3d, 0x7f, 0x1d, 0x92, 0x6a, 0xe7, + 0xfd, 0xda, 0xd0, 0xa7, 0xe1, 0xe0, 0x25, 0xff, 0xe6, 0xc3, 0x82, 0xe5, 0x2d, 0xef, 0x1f, 0x5e, + 0xef, 0x50, 0xb9, 0xf9, 0x72, 0xc2, 0x24, 0x2d, 0xf8, 0xa7, 0x61, 0x17, 0x24, 0xd9, 0x8d, 0x75, + 0x90, 0x1f, 0x73, 0x7f, 0xfe, 0xf3, 0x55, 0x9e, 0xfc, 0xf1, 0xef, 0xfa, 0x1f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x59, 0x78, 0xb0, 0x03, 0x68, 0x03, 0x00, 0x00, } diff --git a/protoc-gen-swagger/options/annotations.proto b/protoc-gen-swagger/options/annotations.proto index 2c0f594470e..5151fd5a652 100644 --- a/protoc-gen-swagger/options/annotations.proto +++ b/protoc-gen-swagger/options/annotations.proto @@ -4,8 +4,8 @@ package grpc.gateway.protoc_gen_swagger.options; option go_package = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"; -import "protoc-gen-swagger/options/openapiv2.proto"; import "google/protobuf/descriptor.proto"; +import "protoc-gen-swagger/options/openapiv2.proto"; extend google.protobuf.FileOptions { // ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project. From 11a8abfcba64de0cde814facb40355b18949ef03 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Sun, 3 Nov 2019 21:08:40 +0000 Subject: [PATCH 488/552] Update dockerfile and regenerate files Fixes #1073 --- .circleci/Dockerfile | 4 ++-- .circleci/README.md | 2 +- CONTRIBUTING.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile index c6cf118fc18..c44eac5c23d 100644 --- a/.circleci/Dockerfile +++ b/.circleci/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.1 +FROM golang:1.13.4 # Warm apt cache and install dependencies # bzip2 is required by the node_tests (to extract its dependencies). @@ -17,7 +17,7 @@ RUN echo -e '#!/bin/bash\njava -jar /usr/local/bin/swagger-codegen-cli.jar "$@"' chmod +x /usr/local/bin/swagger-codegen # Install protoc -ENV PROTOC_VERSION=3.9.2 +ENV PROTOC_VERSION=3.10.1 RUN wget https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \ -O /protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ unzip /protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local/ && \ diff --git a/.circleci/README.md b/.circleci/README.md index aff8c5cf78c..c6ce14672fb 100644 --- a/.circleci/README.md +++ b/.circleci/README.md @@ -10,7 +10,7 @@ Great, it should be as simple as thus (run from the root of the directory): $ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.13 \ /bin/bash -c 'cd /go/src/github.com/grpc-ecosystem/grpc-gateway && \ make realclean && \ - make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' + make examples' ``` If this has resulted in some file changes in the repo, please ensure you check those in with your merge request. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 09951e3c4f9..8772fd3ad2a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ Great, it should be as simple as thus (run from the root of the directory): docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.13 \ /bin/bash -c 'cd /src/grpc-gateway && \ make realclean && \ - make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"' + make examples' docker run -itv $(pwd):/grpc-gateway -w /grpc-gateway --entrypoint /bin/bash --rm \ l.gcr.io/google/bazel -c 'bazel run :gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories; bazel run :buildifier' ``` From d642baa8bf4b868671bfdb5228da2e0350ed279f Mon Sep 17 00:00:00 2001 From: Gordon Schneider <1594377+ailurarctos@users.noreply.github.com> Date: Mon, 4 Nov 2019 08:41:47 +0900 Subject: [PATCH 489/552] Support creating a Swagger def with no schemes Make it so if you do not specify the schemes then no schemes will be present in the generated Swagger definition. The OpenAPIv2 spec says this means to use the same scheme that was used to access the Swagger definition itself. Fixes #1069 --- examples/clients/echo/api/swagger.yaml | 3 --- examples/clients/echo/configuration.go | 2 +- examples/clients/responsebody/api/swagger.yaml | 3 --- examples/clients/responsebody/configuration.go | 2 +- examples/clients/responsebody/docs/ResponseBodyServiceApi.md | 2 +- examples/clients/unannotatedecho/api/swagger.yaml | 3 --- examples/clients/unannotatedecho/configuration.go | 2 +- examples/proto/examplepb/echo_service.swagger.json | 4 ---- examples/proto/examplepb/response_body_service.swagger.json | 4 ---- examples/proto/examplepb/stream.swagger.json | 4 ---- .../proto/examplepb/unannotated_echo_service.swagger.json | 4 ---- examples/proto/examplepb/use_go_template.swagger.json | 4 ---- examples/proto/examplepb/wrappers.swagger.json | 4 ---- protoc-gen-swagger/genswagger/template.go | 1 - protoc-gen-swagger/genswagger/template_test.go | 4 ++-- protoc-gen-swagger/genswagger/types.go | 2 +- 16 files changed, 7 insertions(+), 41 deletions(-) diff --git a/examples/clients/echo/api/swagger.yaml b/examples/clients/echo/api/swagger.yaml index 884e7ad6bfb..9d28a1ab99b 100644 --- a/examples/clients/echo/api/swagger.yaml +++ b/examples/clients/echo/api/swagger.yaml @@ -4,9 +4,6 @@ info: description: "Echo Service API consists of a single service which returns\na message." version: "version not set" title: "Echo Service" -schemes: -- "http" -- "https" consumes: - "application/json" produces: diff --git a/examples/clients/echo/configuration.go b/examples/clients/echo/configuration.go index 5f730c12ab7..6a44e4c9cf6 100644 --- a/examples/clients/echo/configuration.go +++ b/examples/clients/echo/configuration.go @@ -60,7 +60,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ - BasePath: "http://localhost", + BasePath: "https://localhost", DefaultHeader: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", } diff --git a/examples/clients/responsebody/api/swagger.yaml b/examples/clients/responsebody/api/swagger.yaml index ca61b71ad42..b94a7273d45 100644 --- a/examples/clients/responsebody/api/swagger.yaml +++ b/examples/clients/responsebody/api/swagger.yaml @@ -3,9 +3,6 @@ swagger: "2.0" info: version: "version not set" title: "examples/proto/examplepb/response_body_service.proto" -schemes: -- "http" -- "https" consumes: - "application/json" produces: diff --git a/examples/clients/responsebody/configuration.go b/examples/clients/responsebody/configuration.go index 6a98b8dcfe0..cae2bff96f6 100644 --- a/examples/clients/responsebody/configuration.go +++ b/examples/clients/responsebody/configuration.go @@ -60,7 +60,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ - BasePath: "http://localhost", + BasePath: "https://localhost", DefaultHeader: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", } diff --git a/examples/clients/responsebody/docs/ResponseBodyServiceApi.md b/examples/clients/responsebody/docs/ResponseBodyServiceApi.md index 7645bba50b5..914a90f0113 100644 --- a/examples/clients/responsebody/docs/ResponseBodyServiceApi.md +++ b/examples/clients/responsebody/docs/ResponseBodyServiceApi.md @@ -1,6 +1,6 @@ # \ResponseBodyServiceApi -All URIs are relative to *http://localhost* +All URIs are relative to *https://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/examples/clients/unannotatedecho/api/swagger.yaml b/examples/clients/unannotatedecho/api/swagger.yaml index ca2d21a58b6..3a439d45a10 100644 --- a/examples/clients/unannotatedecho/api/swagger.yaml +++ b/examples/clients/unannotatedecho/api/swagger.yaml @@ -7,9 +7,6 @@ info: \ service which returns\na message." version: "version not set" title: "examples/proto/examplepb/unannotated_echo_service.proto" -schemes: -- "http" -- "https" consumes: - "application/json" produces: diff --git a/examples/clients/unannotatedecho/configuration.go b/examples/clients/unannotatedecho/configuration.go index 1d0dadff96c..fe53e0374ad 100644 --- a/examples/clients/unannotatedecho/configuration.go +++ b/examples/clients/unannotatedecho/configuration.go @@ -60,7 +60,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ - BasePath: "http://localhost", + BasePath: "https://localhost", DefaultHeader: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", } diff --git a/examples/proto/examplepb/echo_service.swagger.json b/examples/proto/examplepb/echo_service.swagger.json index f1687bccf64..45187c3e463 100644 --- a/examples/proto/examplepb/echo_service.swagger.json +++ b/examples/proto/examplepb/echo_service.swagger.json @@ -5,10 +5,6 @@ "description": "Echo Service API consists of a single service which returns\na message.", "version": "version not set" }, - "schemes": [ - "http", - "https" - ], "consumes": [ "application/json" ], diff --git a/examples/proto/examplepb/response_body_service.swagger.json b/examples/proto/examplepb/response_body_service.swagger.json index 820129e93eb..ea0ced6dcdb 100644 --- a/examples/proto/examplepb/response_body_service.swagger.json +++ b/examples/proto/examplepb/response_body_service.swagger.json @@ -4,10 +4,6 @@ "title": "examples/proto/examplepb/response_body_service.proto", "version": "version not set" }, - "schemes": [ - "http", - "https" - ], "consumes": [ "application/json" ], diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index e9fcd5ed5ee..69be3d81225 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -4,10 +4,6 @@ "title": "examples/proto/examplepb/stream.proto", "version": "version not set" }, - "schemes": [ - "http", - "https" - ], "consumes": [ "application/json" ], diff --git a/examples/proto/examplepb/unannotated_echo_service.swagger.json b/examples/proto/examplepb/unannotated_echo_service.swagger.json index 48825985057..26dc292cc17 100644 --- a/examples/proto/examplepb/unannotated_echo_service.swagger.json +++ b/examples/proto/examplepb/unannotated_echo_service.swagger.json @@ -5,10 +5,6 @@ "description": "Unannotated Echo Service\nSimilar to echo_service.proto but without annotations. See\nunannotated_echo_service.yaml for the equivalent of the annotations in\ngRPC API configuration format.\n\nEcho Service API consists of a single service which returns\na message.", "version": "version not set" }, - "schemes": [ - "http", - "https" - ], "consumes": [ "application/json" ], diff --git a/examples/proto/examplepb/use_go_template.swagger.json b/examples/proto/examplepb/use_go_template.swagger.json index 61ea6b83475..011b33aeaf7 100644 --- a/examples/proto/examplepb/use_go_template.swagger.json +++ b/examples/proto/examplepb/use_go_template.swagger.json @@ -4,10 +4,6 @@ "title": "examples/proto/examplepb/use_go_template.proto", "version": "version not set" }, - "schemes": [ - "http", - "https" - ], "consumes": [ "application/json" ], diff --git a/examples/proto/examplepb/wrappers.swagger.json b/examples/proto/examplepb/wrappers.swagger.json index f45b512e1c6..7c7c8566bd6 100644 --- a/examples/proto/examplepb/wrappers.swagger.json +++ b/examples/proto/examplepb/wrappers.swagger.json @@ -4,10 +4,6 @@ "title": "examples/proto/examplepb/wrappers.proto", "version": "version not set" }, - "schemes": [ - "http", - "https" - ], "consumes": [ "application/json" ], diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index a5548f3e46e..b92b6937af4 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -1047,7 +1047,6 @@ func applyTemplate(p param) (*swaggerObject, error) { s := swaggerObject{ // Swagger 2.0 is the version of this document Swagger: "2.0", - Schemes: []string{"http", "https"}, Consumes: []string{"application/json"}, Produces: []string{"application/json"}, Paths: make(swaggerPathsObject), diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 8768830a8d0..69e5b070638 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -355,7 +355,7 @@ func TestApplyTemplateSimple(t *testing.T) { if want, is, name := "", result.BasePath, "BasePath"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } - if want, is, name := []string{"http", "https"}, result.Schemes, "Schemes"; !reflect.DeepEqual(is, want) { + if want, is, name := ([]string)(nil), result.Schemes, "Schemes"; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) } if want, is, name := []string{"application/json"}, result.Consumes, "Consumes"; !reflect.DeepEqual(is, want) { @@ -657,7 +657,7 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { if want, got := "", result.BasePath; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).BasePath = %s want to be %s", file, got, want) } - if want, got := []string{"http", "https"}, result.Schemes; !reflect.DeepEqual(got, want) { + if want, got := ([]string)(nil), result.Schemes; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).Schemes = %s want to be %s", file, got, want) } if want, got := []string{"application/json"}, result.Consumes; !reflect.DeepEqual(got, want) { diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 77db96d877b..0b16d195514 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -59,7 +59,7 @@ type swaggerObject struct { Info swaggerInfoObject `json:"info"` Host string `json:"host,omitempty"` BasePath string `json:"basePath,omitempty"` - Schemes []string `json:"schemes"` + Schemes []string `json:"schemes,omitempty"` Consumes []string `json:"consumes"` Produces []string `json:"produces"` Paths swaggerPathsObject `json:"paths"` From 7d009d4713e6d3d4c68034c86b9dd9af2ea10dbb Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 4 Nov 2019 16:13:38 +0000 Subject: [PATCH 490/552] Generate changelog for 1.12.0 --- CHANGELOG.md | 47 +++++++++++++++++++++++++++++++++++++++++++---- Makefile | 2 +- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 492ee9f74d4..65797402f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,41 @@ # Change Log +## [v1.12.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.12.0) (2019-11-04) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.11.3...v1.12.0) + +**Implemented enhancements:** + +- protoc-gen-swagger: support generating a Swagger definition with no schemes [\#1069](https://github.com/grpc-ecosystem/grpc-gateway/issues/1069) + +**Fixed bugs:** + +- "make test" fails with go mod error [\#895](https://github.com/grpc-ecosystem/grpc-gateway/issues/895) + +**Closed issues:** + +- jfbrandhorst/grpc-gateway-build-env image can't run on Windows [\#1073](https://github.com/grpc-ecosystem/grpc-gateway/issues/1073) +- EOF is received after one request [\#1071](https://github.com/grpc-ecosystem/grpc-gateway/issues/1071) +- grpc-ecosystem/grpc-gateway/third\_party/googleapis: warning: directory does not exist. [\#1068](https://github.com/grpc-ecosystem/grpc-gateway/issues/1068) +- third\_party/googleapis is missing from package [\#1065](https://github.com/grpc-ecosystem/grpc-gateway/issues/1065) +- handleForwardResponseOptions not called by DefaultHTTPError [\#1064](https://github.com/grpc-ecosystem/grpc-gateway/issues/1064) +- why marshal enum to json using string but received it with int . [\#1063](https://github.com/grpc-ecosystem/grpc-gateway/issues/1063) +- protoc-gen-swagger/genswagger does not build on go1.11 and earlier versions [\#1061](https://github.com/grpc-ecosystem/grpc-gateway/issues/1061) +- How to support custom output, implementation [\#1055](https://github.com/grpc-ecosystem/grpc-gateway/issues/1055) + +**Merged pull requests:** + +- Support creating a Swagger def with no schemes [\#1075](https://github.com/grpc-ecosystem/grpc-gateway/pull/1075) ([ailurarctos](https://github.com/ailurarctos)) +- Update dockerfile and regenerate files [\#1074](https://github.com/grpc-ecosystem/grpc-gateway/pull/1074) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- annotations: Sort import order. [\#1072](https://github.com/grpc-ecosystem/grpc-gateway/pull/1072) ([someone1](https://github.com/someone1)) +- fix\(protoc-gen-swagger\): Windows compatibility [\#1070](https://github.com/grpc-ecosystem/grpc-gateway/pull/1070) ([mrmeku](https://github.com/mrmeku)) +- adding build-scoping for builds on earlier go versions \(\<1.12\) [\#1062](https://github.com/grpc-ecosystem/grpc-gateway/pull/1062) ([marcusljx](https://github.com/marcusljx)) +- Add back bzip2 to image [\#1060](https://github.com/grpc-ecosystem/grpc-gateway/pull/1060) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Swagger 2.4.8 [\#1058](https://github.com/grpc-ecosystem/grpc-gateway/pull/1058) ([zachgersh](https://github.com/zachgersh)) +- get bazel deps back in right spot [\#1057](https://github.com/grpc-ecosystem/grpc-gateway/pull/1057) ([zachgersh](https://github.com/zachgersh)) +- use Go templates in protofile comments [\#1056](https://github.com/grpc-ecosystem/grpc-gateway/pull/1056) ([Jeremytjuh](https://github.com/Jeremytjuh)) +- Bump generators Dockerfile to 1.13.1 [\#1054](https://github.com/grpc-ecosystem/grpc-gateway/pull/1054) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Updates grpc proto deps [\#1053](https://github.com/grpc-ecosystem/grpc-gateway/pull/1053) ([zachgersh](https://github.com/zachgersh)) + ## [v1.11.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.11.3) (2019-09-30) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.11.2...v1.11.3) @@ -11,6 +47,7 @@ **Merged pull requests:** +- Generate changelog for 1.11.3 [\#1052](https://github.com/grpc-ecosystem/grpc-gateway/pull/1052) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Support json names in field mask generation [\#1050](https://github.com/grpc-ecosystem/grpc-gateway/pull/1050) ([william-plano-oxb](https://github.com/william-plano-oxb)) - Fix auto generated fieldmask case in patch requests [\#1049](https://github.com/grpc-ecosystem/grpc-gateway/pull/1049) ([william-plano-oxb](https://github.com/william-plano-oxb)) - Pass nested enum values through properly when used as url parameters [\#1048](https://github.com/grpc-ecosystem/grpc-gateway/pull/1048) ([mnito](https://github.com/mnito)) @@ -37,6 +74,7 @@ **Merged pull requests:** - Generate changelog for 1.11.2 [\#1045](https://github.com/grpc-ecosystem/grpc-gateway/pull/1045) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Remove "make test" recommendation from CONTRIBUTING.md [\#1040](https://github.com/grpc-ecosystem/grpc-gateway/pull/1040) ([johanbrandhorst](https://github.com/johanbrandhorst)) - examples/integration: wait for secondary gateway [\#1039](https://github.com/grpc-ecosystem/grpc-gateway/pull/1039) ([srenatus](https://github.com/srenatus)) - Update README.md [\#1038](https://github.com/grpc-ecosystem/grpc-gateway/pull/1038) ([piengeng](https://github.com/piengeng)) - Configure stale\[bot\] [\#1036](https://github.com/grpc-ecosystem/grpc-gateway/pull/1036) ([achew22](https://github.com/achew22)) @@ -110,6 +148,7 @@ **Merged pull requests:** - Generate changelog for 1.10.0 [\#1011](https://github.com/grpc-ecosystem/grpc-gateway/pull/1011) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Fix templateToSwaggerPath generates invalid path [\#1006](https://github.com/grpc-ecosystem/grpc-gateway/pull/1006) ([ch3rub1m](https://github.com/ch3rub1m)) - Allow overriding the primitive type of fields [\#1003](https://github.com/grpc-ecosystem/grpc-gateway/pull/1003) ([snowzach](https://github.com/snowzach)) - Add Continuous Fuzzing Integration via fuzzit.dev [\#1001](https://github.com/grpc-ecosystem/grpc-gateway/pull/1001) ([yevgenypats](https://github.com/yevgenypats)) @@ -1038,7 +1077,7 @@ - Method parameter in query string [\#6](https://github.com/grpc-ecosystem/grpc-gateway/issues/6) - Integrate authentication [\#4](https://github.com/grpc-ecosystem/grpc-gateway/issues/4) - Add swagger support [\#68](https://github.com/grpc-ecosystem/grpc-gateway/pull/68) ([achew22](https://github.com/achew22)) -- Add runtime.WithForwardResponseOption [\#53](https://github.com/grpc-ecosystem/grpc-gateway/pull/53) ([pedgeio](https://github.com/pedgeio)) +- Add runtime.WithForwardResponseOption [\#53](https://github.com/grpc-ecosystem/grpc-gateway/pull/53) ([bufdev](https://github.com/bufdev)) **Fixed bugs:** @@ -1148,15 +1187,15 @@ - Fix broken test [\#76](https://github.com/grpc-ecosystem/grpc-gateway/pull/76) ([yugui](https://github.com/yugui)) - Added missing instruction line in README [\#75](https://github.com/grpc-ecosystem/grpc-gateway/pull/75) ([betrcode](https://github.com/betrcode)) - Fix a complie error in generated go files [\#71](https://github.com/grpc-ecosystem/grpc-gateway/pull/71) ([yugui](https://github.com/yugui)) -- Update generated .pb.go files in third\_party [\#69](https://github.com/grpc-ecosystem/grpc-gateway/pull/69) ([pedgeio](https://github.com/pedgeio)) +- Update generated .pb.go files in third\_party [\#69](https://github.com/grpc-ecosystem/grpc-gateway/pull/69) ([bufdev](https://github.com/bufdev)) - Bugfix/handling headers for `Authorization` and `Host` [\#65](https://github.com/grpc-ecosystem/grpc-gateway/pull/65) ([mwitkow](https://github.com/mwitkow)) - Fix `error` field always in chunk response [\#64](https://github.com/grpc-ecosystem/grpc-gateway/pull/64) ([mwitkow](https://github.com/mwitkow)) - Update .pb.go to latest version. [\#63](https://github.com/grpc-ecosystem/grpc-gateway/pull/63) ([johansja](https://github.com/johansja)) - Run more tests in Travis CI [\#60](https://github.com/grpc-ecosystem/grpc-gateway/pull/60) ([yugui](https://github.com/yugui)) - Added http error code and error status for responseStreamChunk error [\#59](https://github.com/grpc-ecosystem/grpc-gateway/pull/59) ([kdima](https://github.com/kdima)) - Fix parsing of verb and final path component. [\#55](https://github.com/grpc-ecosystem/grpc-gateway/pull/55) ([hbchai](https://github.com/hbchai)) -- add grpc.WithInsecure\(\) as option for grpc.Dial call in template [\#52](https://github.com/grpc-ecosystem/grpc-gateway/pull/52) ([pedgeio](https://github.com/pedgeio)) -- update .pb.go files for latest golang proto generation [\#51](https://github.com/grpc-ecosystem/grpc-gateway/pull/51) ([pedgeio](https://github.com/pedgeio)) +- add grpc.WithInsecure\(\) as option for grpc.Dial call in template [\#52](https://github.com/grpc-ecosystem/grpc-gateway/pull/52) ([bufdev](https://github.com/bufdev)) +- update .pb.go files for latest golang proto generation [\#51](https://github.com/grpc-ecosystem/grpc-gateway/pull/51) ([bufdev](https://github.com/bufdev)) - Fix a build error with the latest protoc-gen-go [\#50](https://github.com/grpc-ecosystem/grpc-gateway/pull/50) ([yugui](https://github.com/yugui)) - Configure Travis CI [\#49](https://github.com/grpc-ecosystem/grpc-gateway/pull/49) ([yugui](https://github.com/yugui)) - Follow a change of go package name convention in protoc-gen-go [\#48](https://github.com/grpc-ecosystem/grpc-gateway/pull/48) ([yugui](https://github.com/yugui)) diff --git a/Makefile b/Makefile index 608d9028129..4bd474ac71b 100644 --- a/Makefile +++ b/Makefile @@ -203,7 +203,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.11.3 + --future-release=v1.12.0 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 13ea93424825a6b5b9f7667585a16dcf7f352472 Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Mon, 4 Nov 2019 14:12:00 -0800 Subject: [PATCH 491/552] support json_names_for_fields --- protoc-gen-swagger/defs.bzl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index 4dfca37fdac..02f412399fa 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -30,7 +30,7 @@ def _collect_includes(gen_dir, srcs): return includes -def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, actions, protoc, protoc_gen_swagger, grpc_api_configuration, single_output): +def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, actions, protoc, protoc_gen_swagger, grpc_api_configuration, single_output, json_names_for_fields): swagger_files = [] inputs = direct_proto_srcs + transitive_proto_srcs @@ -41,6 +41,9 @@ def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, action options.append("grpc_api_configuration=%s" % grpc_api_configuration.path) inputs.append(grpc_api_configuration) + if json_names_for_fields: + options.append("json_names_for_fields=true") + includes = _collect_includes(ctx.genfiles_dir.path, direct_proto_srcs + transitive_proto_srcs) if single_output: @@ -117,6 +120,7 @@ def _proto_gen_swagger_impl(ctx): protoc_gen_swagger = ctx.executable._protoc_gen_swagger, grpc_api_configuration = grpc_api_configuration, single_output = ctx.attr.single_output, + json_names_for_fields = ctx.attr.json_names_for_fields, ), ), )] @@ -136,6 +140,10 @@ protoc_gen_swagger = rule( default = False, mandatory = False, ), + "json_names_for_fields": attr.bool( + default = False, + mandatory = False, + ), "_protoc": attr.label( default = "@com_google_protobuf//:protoc", executable = True, From db7583b7bfb5eed19d55b106d965be4e27c92a06 Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Mon, 4 Nov 2019 16:19:31 -0800 Subject: [PATCH 492/552] buildifier --- protoc-gen-swagger/defs.bzl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index 02f412399fa..652e4a20b1a 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -140,10 +140,10 @@ protoc_gen_swagger = rule( default = False, mandatory = False, ), - "json_names_for_fields": attr.bool( - default = False, - mandatory = False, - ), + "json_names_for_fields": attr.bool( + default = False, + mandatory = False, + ), "_protoc": attr.label( default = "@com_google_protobuf//:protoc", executable = True, From ddf9f2dc5e69bf1eb41d24181939491a765e3e89 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 6 Nov 2019 14:22:23 +0000 Subject: [PATCH 493/552] Revert "Fix templateToSwaggerPath generates invalid path" This reverts commit 69669120b0e010b88291cd9d24761297c2a17582. This commit was causing panics for some valid paths. --- protoc-gen-swagger/genswagger/template.go | 35 ++----------------- .../genswagger/template_test.go | 21 ++++++----- 2 files changed, 13 insertions(+), 43 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index b92b6937af4..f6db8c8c5c7 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io/ioutil" - "net/url" "os" "reflect" "regexp" @@ -18,9 +17,9 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + structpb "github.com/golang/protobuf/ptypes/struct" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" - structpb "github.com/golang/protobuf/ptypes/struct" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) @@ -679,18 +678,13 @@ func templateToSwaggerPath(path string, reg *descriptor.Registry) string { // Parts is now an array of segments of the path. Interestingly, since the // syntax for this subsection CAN be handled by a regexp since it has no // memory. - keyre := regexp.MustCompile("{(.*)}") for index, part := range parts { // If part is a resource name such as "parent", "name", "user.name", the format info must be retained. prefix := canRegexp.ReplaceAllString(part, "$1") if isResourceName(prefix) { - sm := keyre.FindStringSubmatch(part) - key := sm[1] - esckey := url.PathEscape(key) - parts[index] = keyre.ReplaceAllString(part, fmt.Sprintf("{%s}", esckey)) - } else { - parts[index] = canRegexp.ReplaceAllString(part, "{$1}") + continue } + parts[index] = canRegexp.ReplaceAllString(part, "{$1}") } return strings.Join(parts, "/") @@ -705,31 +699,11 @@ func isResourceName(prefix string) bool { return field == "parent" || field == "name" } -func extractResourceName(path string) map[string]string { - m := map[string]string{} - keyre := regexp.MustCompile("{(.*)}") - sm := keyre.FindStringSubmatch(path) - count := len(sm) - for i := 0; i < count; i++ { - key := sm[1] - parts := strings.Split(key, "=") - label := parts[0] - parts = strings.Split(label, ".") - l := len(parts) - field := parts[l-1] - if field == "parent" || field == "name" { - m[label] = key - } - } - return m -} - func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry, requestResponseRefs, customRefs refMap) error { // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. for svcIdx, svc := range services { for methIdx, meth := range svc.Methods { for bIdx, b := range meth.Bindings { - pathParamMap := extractResourceName(templateToSwaggerPath(b.PathTmpl.Template, reg)) // Iterate over all the swagger parameters parameters := swaggerParametersObject{} for _, parameter := range b.PathParams { @@ -797,9 +771,6 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re if reg.GetUseJSONNamesForFields() { parameterString = lowerCamelCase(parameterString) } - if esckey, ok := pathParamMap[parameterString]; ok { - parameterString = esckey - } parameters = append(parameters, swaggerParameterObject{ Name: parameterString, Description: desc, diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 69e5b070638..7a2859782a3 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -1050,17 +1050,16 @@ func TestTemplateToSwaggerPath(t *testing.T) { {"/{test=prefix/that/has/multiple/parts/to/it/*}", "/{test}"}, {"/{test1}/{test2}", "/{test1}/{test2}"}, {"/{test1}/{test2}/", "/{test1}/{test2}/"}, - {"/{name=prefix/*}", "/{name=prefix%2F%2A}"}, - {"/{name=prefix1/*/prefix2/*}", "/{name=prefix1%2F%2A%2Fprefix2%2F%2A}"}, - {"/{parent=prefix1/*}/{name=prefix2/*}", "/{parent=prefix1%2F%2A}/{name=prefix2%2F%2A}"}, - {"/{user.name=prefix/*}", "/{user.name=prefix%2F%2A}"}, - {"/{user.name=prefix1/*/prefix2/*}", "/{user.name=prefix1%2F%2A%2Fprefix2%2F%2A}"}, - {"/{parent=prefix/*}/children", "/{parent=prefix%2F%2A}/children"}, - {"/{name=prefix/*}:customMethod", "/{name=prefix%2F%2A}:customMethod"}, - {"/{name=prefix1/*/prefix2/*}:customMethod", "/{name=prefix1%2F%2A%2Fprefix2%2F%2A}:customMethod"}, - {"/{user.name=prefix/*}:customMethod", "/{user.name=prefix%2F%2A}:customMethod"}, - {"/{user.name=prefix1/*/prefix2/*}:customMethod", "/{user.name=prefix1%2F%2A%2Fprefix2%2F%2A}:customMethod"}, - {"/{parent=prefix/*}/children:customMethod", "/{parent=prefix%2F%2A}/children:customMethod"}, + {"/{name=prefix/*}", "/{name=prefix/*}"}, + {"/{name=prefix1/*/prefix2/*}", "/{name=prefix1/*/prefix2/*}"}, + {"/{user.name=prefix/*}", "/{user.name=prefix/*}"}, + {"/{user.name=prefix1/*/prefix2/*}", "/{user.name=prefix1/*/prefix2/*}"}, + {"/{parent=prefix/*}/children", "/{parent=prefix/*}/children"}, + {"/{name=prefix/*}:customMethod", "/{name=prefix/*}:customMethod"}, + {"/{name=prefix1/*/prefix2/*}:customMethod", "/{name=prefix1/*/prefix2/*}:customMethod"}, + {"/{user.name=prefix/*}:customMethod", "/{user.name=prefix/*}:customMethod"}, + {"/{user.name=prefix1/*/prefix2/*}:customMethod", "/{user.name=prefix1/*/prefix2/*}:customMethod"}, + {"/{parent=prefix/*}/children:customMethod", "/{parent=prefix/*}/children:customMethod"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) From deaf9557ef538beda26f01e13d016855f7490dcb Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 6 Nov 2019 14:22:23 +0000 Subject: [PATCH 494/552] Revert "Fix templateToSwaggerPath generates invalid path" This reverts commit 69669120b0e010b88291cd9d24761297c2a17582. This commit was causing panics for some valid paths. --- protoc-gen-swagger/genswagger/template.go | 35 ++----------------- .../genswagger/template_test.go | 21 ++++++----- 2 files changed, 13 insertions(+), 43 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index b92b6937af4..f6db8c8c5c7 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io/ioutil" - "net/url" "os" "reflect" "regexp" @@ -18,9 +17,9 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + structpb "github.com/golang/protobuf/ptypes/struct" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" - structpb "github.com/golang/protobuf/ptypes/struct" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) @@ -679,18 +678,13 @@ func templateToSwaggerPath(path string, reg *descriptor.Registry) string { // Parts is now an array of segments of the path. Interestingly, since the // syntax for this subsection CAN be handled by a regexp since it has no // memory. - keyre := regexp.MustCompile("{(.*)}") for index, part := range parts { // If part is a resource name such as "parent", "name", "user.name", the format info must be retained. prefix := canRegexp.ReplaceAllString(part, "$1") if isResourceName(prefix) { - sm := keyre.FindStringSubmatch(part) - key := sm[1] - esckey := url.PathEscape(key) - parts[index] = keyre.ReplaceAllString(part, fmt.Sprintf("{%s}", esckey)) - } else { - parts[index] = canRegexp.ReplaceAllString(part, "{$1}") + continue } + parts[index] = canRegexp.ReplaceAllString(part, "{$1}") } return strings.Join(parts, "/") @@ -705,31 +699,11 @@ func isResourceName(prefix string) bool { return field == "parent" || field == "name" } -func extractResourceName(path string) map[string]string { - m := map[string]string{} - keyre := regexp.MustCompile("{(.*)}") - sm := keyre.FindStringSubmatch(path) - count := len(sm) - for i := 0; i < count; i++ { - key := sm[1] - parts := strings.Split(key, "=") - label := parts[0] - parts = strings.Split(label, ".") - l := len(parts) - field := parts[l-1] - if field == "parent" || field == "name" { - m[label] = key - } - } - return m -} - func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry, requestResponseRefs, customRefs refMap) error { // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. for svcIdx, svc := range services { for methIdx, meth := range svc.Methods { for bIdx, b := range meth.Bindings { - pathParamMap := extractResourceName(templateToSwaggerPath(b.PathTmpl.Template, reg)) // Iterate over all the swagger parameters parameters := swaggerParametersObject{} for _, parameter := range b.PathParams { @@ -797,9 +771,6 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re if reg.GetUseJSONNamesForFields() { parameterString = lowerCamelCase(parameterString) } - if esckey, ok := pathParamMap[parameterString]; ok { - parameterString = esckey - } parameters = append(parameters, swaggerParameterObject{ Name: parameterString, Description: desc, diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 69e5b070638..7a2859782a3 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -1050,17 +1050,16 @@ func TestTemplateToSwaggerPath(t *testing.T) { {"/{test=prefix/that/has/multiple/parts/to/it/*}", "/{test}"}, {"/{test1}/{test2}", "/{test1}/{test2}"}, {"/{test1}/{test2}/", "/{test1}/{test2}/"}, - {"/{name=prefix/*}", "/{name=prefix%2F%2A}"}, - {"/{name=prefix1/*/prefix2/*}", "/{name=prefix1%2F%2A%2Fprefix2%2F%2A}"}, - {"/{parent=prefix1/*}/{name=prefix2/*}", "/{parent=prefix1%2F%2A}/{name=prefix2%2F%2A}"}, - {"/{user.name=prefix/*}", "/{user.name=prefix%2F%2A}"}, - {"/{user.name=prefix1/*/prefix2/*}", "/{user.name=prefix1%2F%2A%2Fprefix2%2F%2A}"}, - {"/{parent=prefix/*}/children", "/{parent=prefix%2F%2A}/children"}, - {"/{name=prefix/*}:customMethod", "/{name=prefix%2F%2A}:customMethod"}, - {"/{name=prefix1/*/prefix2/*}:customMethod", "/{name=prefix1%2F%2A%2Fprefix2%2F%2A}:customMethod"}, - {"/{user.name=prefix/*}:customMethod", "/{user.name=prefix%2F%2A}:customMethod"}, - {"/{user.name=prefix1/*/prefix2/*}:customMethod", "/{user.name=prefix1%2F%2A%2Fprefix2%2F%2A}:customMethod"}, - {"/{parent=prefix/*}/children:customMethod", "/{parent=prefix%2F%2A}/children:customMethod"}, + {"/{name=prefix/*}", "/{name=prefix/*}"}, + {"/{name=prefix1/*/prefix2/*}", "/{name=prefix1/*/prefix2/*}"}, + {"/{user.name=prefix/*}", "/{user.name=prefix/*}"}, + {"/{user.name=prefix1/*/prefix2/*}", "/{user.name=prefix1/*/prefix2/*}"}, + {"/{parent=prefix/*}/children", "/{parent=prefix/*}/children"}, + {"/{name=prefix/*}:customMethod", "/{name=prefix/*}:customMethod"}, + {"/{name=prefix1/*/prefix2/*}:customMethod", "/{name=prefix1/*/prefix2/*}:customMethod"}, + {"/{user.name=prefix/*}:customMethod", "/{user.name=prefix/*}:customMethod"}, + {"/{user.name=prefix1/*/prefix2/*}:customMethod", "/{user.name=prefix1/*/prefix2/*}:customMethod"}, + {"/{parent=prefix/*}/children:customMethod", "/{parent=prefix/*}/children:customMethod"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) From 81095a5d4ffad9c16b52a8cb63445265bd184d50 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 6 Nov 2019 14:43:01 +0000 Subject: [PATCH 495/552] Generate changelog for 1.12.1 --- CHANGELOG.md | 13 +++++++++++++ Makefile | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65797402f09..89356537f24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## [v1.12.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.12.1) (2019-11-06) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.12.0...v1.12.1) + +**Closed issues:** + +- Unable to create HTTP mapping with "/parent" [\#1079](https://github.com/grpc-ecosystem/grpc-gateway/issues/1079) + +**Merged pull requests:** + +- Revert "Fix templateToSwaggerPath generates invalid path" [\#1078](https://github.com/grpc-ecosystem/grpc-gateway/pull/1078) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Support json\_names\_for\_fields in starlark rule protoc\_gen\_swagger [\#1077](https://github.com/grpc-ecosystem/grpc-gateway/pull/1077) ([prestonvanloon](https://github.com/prestonvanloon)) + ## [v1.12.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.12.0) (2019-11-04) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.11.3...v1.12.0) @@ -24,6 +36,7 @@ **Merged pull requests:** +- Generate changelog for 1.12.0 [\#1076](https://github.com/grpc-ecosystem/grpc-gateway/pull/1076) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Support creating a Swagger def with no schemes [\#1075](https://github.com/grpc-ecosystem/grpc-gateway/pull/1075) ([ailurarctos](https://github.com/ailurarctos)) - Update dockerfile and regenerate files [\#1074](https://github.com/grpc-ecosystem/grpc-gateway/pull/1074) ([johanbrandhorst](https://github.com/johanbrandhorst)) - annotations: Sort import order. [\#1072](https://github.com/grpc-ecosystem/grpc-gateway/pull/1072) ([someone1](https://github.com/someone1)) diff --git a/Makefile b/Makefile index 4bd474ac71b..b9aa868f90c 100644 --- a/Makefile +++ b/Makefile @@ -203,7 +203,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.12.0 + --future-release=v1.12.1 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From e3dcbe74554818cddb2f67d4e353e06ff1397982 Mon Sep 17 00:00:00 2001 From: xin-au Date: Thu, 14 Nov 2019 01:40:31 -0800 Subject: [PATCH 496/552] Support reserved json name and add tests (#1085) * Support reserved json name and add tests * Correct some variable names * Optimize a logic for assigning a reserved json name to jsonCamelCaseName * Put a logic for checking if there is a reseved json name in the method of lowerCamelCase Fixes #1084 --- protoc-gen-swagger/genswagger/template.go | 21 +++++++++------ .../genswagger/template_test.go | 27 +++++++++++++------ 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index f6db8c8c5c7..4dd5f04656d 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -17,9 +17,9 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" - structpb "github.com/golang/protobuf/ptypes/struct" pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" + structpb "github.com/golang/protobuf/ptypes/struct" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) @@ -621,7 +621,7 @@ func resolveFullyQualifiedNameToSwaggerNames(messages []string, useFQNForSwagger var canRegexp = regexp.MustCompile("{([a-zA-Z][a-zA-Z0-9_.]*).*}") // Swagger expects paths of the form /path/{string_value} but grpc-gateway paths are expected to be of the form /path/{string_value=strprefix/*}. This should reformat it correctly. -func templateToSwaggerPath(path string, reg *descriptor.Registry) string { +func templateToSwaggerPath(path string, reg *descriptor.Registry, fields []*descriptor.Field) string { // It seems like the right thing to do here is to just use // strings.Split(path, "/") but that breaks badly when you hit a url like // /{my_field=prefix/*}/ and end up with 2 sections representing my_field. @@ -650,7 +650,7 @@ func templateToSwaggerPath(path string, reg *descriptor.Registry) string { if reg.GetUseJSONNamesForFields() && len(jsonBuffer) > 1 { jsonSnakeCaseName := string(jsonBuffer[1:]) - jsonCamelCaseName := string(lowerCamelCase(jsonSnakeCaseName)) + jsonCamelCaseName := string(lowerCamelCase(jsonSnakeCaseName, fields)) prev := string(buffer[:len(buffer)-len(jsonSnakeCaseName)-2]) buffer = strings.Join([]string{prev, "{", jsonCamelCaseName, "}"}, "") jsonBuffer = "" @@ -769,7 +769,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } parameterString := parameter.String() if reg.GetUseJSONNamesForFields() { - parameterString = lowerCamelCase(parameterString) + parameterString = lowerCamelCase(parameterString, meth.RequestType.Fields) } parameters = append(parameters, swaggerParameterObject{ Name: parameterString, @@ -836,7 +836,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re parameters = append(parameters, queryParams...) } - pathItemObject, ok := paths[templateToSwaggerPath(b.PathTmpl.Template, reg)] + pathItemObject, ok := paths[templateToSwaggerPath(b.PathTmpl.Template, reg, meth.RequestType.Fields)] if !ok { pathItemObject = swaggerPathItemObject{} } @@ -1002,7 +1002,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re pathItemObject.Patch = operationObject break } - paths[templateToSwaggerPath(b.PathTmpl.Template, reg)] = pathItemObject + paths[templateToSwaggerPath(b.PathTmpl.Template, reg, meth.RequestType.Fields)] = pathItemObject } } } @@ -1802,8 +1802,13 @@ func addCustomRefs(d swaggerDefinitionsObject, reg *descriptor.Registry, refs re addCustomRefs(d, reg, refs) } -func lowerCamelCase(parameter string) string { - parameterString := gogen.CamelCase(parameter) +func lowerCamelCase(fieldName string, fields []*descriptor.Field) string { + for _, oneField := range fields { + if oneField.GetName() == fieldName { + return oneField.GetJsonName() + } + } + parameterString := gogen.CamelCase(fieldName) builder := &strings.Builder{} builder.WriteString(strings.ToLower(string(parameterString[0]))) builder.WriteString(parameterString[1:]) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 7a2859782a3..dbcb238e290 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -986,6 +986,15 @@ func TestApplyTemplateRequestWithUnusedReferences(t *testing.T) { } } +func generateFieldsForJSONReservedName() []*descriptor.Field { + fields := make([]*descriptor.Field, 0) + fieldName := string("json_name") + fieldJSONName := string("jsonNAME") + fieldDescriptor := protodescriptor.FieldDescriptorProto{Name: &fieldName, JsonName: &fieldJSONName} + field := &descriptor.Field{FieldDescriptorProto: &fieldDescriptor} + return append(fields, field) +} + func TestTemplateWithJsonCamelCase(t *testing.T) { var tests = []struct { input string @@ -1002,11 +1011,12 @@ func TestTemplateWithJsonCamelCase(t *testing.T) { {"test/{ab}", "test/{ab}"}, {"test/{a_a}", "test/{aA}"}, {"test/{ab_c}", "test/{abC}"}, + {"test/{json_name}", "test/{jsonNAME}"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } @@ -1028,11 +1038,12 @@ func TestTemplateWithoutJsonCamelCase(t *testing.T) { {"test/{a}", "test/{a}"}, {"test/{ab}", "test/{ab}"}, {"test/{a_a}", "test/{a_a}"}, + {"test/{json_name}", "test/{json_name}"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } @@ -1064,14 +1075,14 @@ func TestTemplateToSwaggerPath(t *testing.T) { reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } } reg.SetUseJSONNamesForFields(true) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } @@ -1086,7 +1097,7 @@ func BenchmarkTemplateToSwaggerPath(b *testing.B) { reg.SetUseJSONNamesForFields(false) for i := 0; i < b.N; i++ { - _ = templateToSwaggerPath(input, reg) + _ = templateToSwaggerPath(input, reg, generateFieldsForJSONReservedName()) } }) @@ -1095,7 +1106,7 @@ func BenchmarkTemplateToSwaggerPath(b *testing.B) { reg.SetUseJSONNamesForFields(true) for i := 0; i < b.N; i++ { - _ = templateToSwaggerPath(input, reg) + _ = templateToSwaggerPath(input, reg, generateFieldsForJSONReservedName()) } }) } @@ -1171,14 +1182,14 @@ func TestFQMNtoSwaggerName(t *testing.T) { reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } } reg.SetUseJSONNamesForFields(true) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } From 00c798a579a984f102e0b32fde4bde3e5846416f Mon Sep 17 00:00:00 2001 From: Guilherme Santos Date: Tue, 3 Dec 2019 18:02:09 +0100 Subject: [PATCH 497/552] Override operation_id when available --- protoc-gen-swagger/genswagger/template.go | 3 + .../genswagger/template_test.go | 78 +++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 4dd5f04656d..dc3cf6a3130 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -934,6 +934,9 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re operationObject.Tags = make([]string, len(opts.Tags)) copy(operationObject.Tags, opts.Tags) } + if opts.OperationId != "" { + operationObject.OperationID = opts.OperationId + } if opts.Security != nil { newSecurity := []swaggerSecurityRequirementObject{} if operationObject.Security != nil { diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index dbcb238e290..c61a3346acc 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -372,6 +372,84 @@ func TestApplyTemplateSimple(t *testing.T) { } } +func TestApplyTemplateOverrideOperationID(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Example"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + Options: &protodescriptor.MethodOptions{}, + } + swaggerOperation := swagger_options.Operation{ + OperationId: "MyExample", + } + if err := proto.SetExtension(proto.Message(meth.Options), swagger_options.E_Openapiv2Operation, &swaggerOperation); err != nil { + t.Fatalf("proto.SetExtension(MethodDescriptorProto.Options) failed: %v", err) + } + + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, + MessageType: []*protodescriptor.DescriptorProto{msgdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + Body: &descriptor.Body{FieldPath: nil}, + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: "/v1/echo", // TODO(achew22): Figure out what this should really be + }, + }, + }, + }, + }, + }, + }, + } + result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: descriptor.NewRegistry()}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + if want, is := "MyExample", result.Paths["/v1/echo"].Get.OperationID; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).Paths[0].Get.OperationID = %s want to be %s", file, is, want) + } + + // If there was a failure, print out the input and the json result for debugging. + if t.Failed() { + t.Errorf("had: %s", file) + t.Errorf("got: %s", fmt.Sprint(result)) + } +} + func TestApplyTemplateExtensions(t *testing.T) { msgdesc := &protodescriptor.DescriptorProto{ Name: proto.String("ExampleMessage"), From 14aeab45f5419d90c2d0f7d28bda563fd1f1ddd5 Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Sat, 7 Dec 2019 16:57:04 -0800 Subject: [PATCH 498/552] Add example where generated proto does not work --- examples/proto/examplepb/BUILD.bazel | 8 +++++++ .../proto/examplepb/generated_input.proto | 21 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 examples/proto/examplepb/generated_input.proto diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index 1077b5885e7..9928fa47e8e 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -13,12 +13,20 @@ package(default_visibility = ["//visibility:public"]) # gazelle:exclude wrappers.pb.gw.go # gazelle:exclude response_body_service.pb.gw.go +genrule( + name = "generated_proto", + srcs = ["generated_input.proto"], + outs = ["generated_output.proto"], + cmd = "cp $< $@", # A simple copy simulates a generated proto file. +) + proto_library( name = "examplepb_proto", srcs = [ "a_bit_of_everything.proto", "echo_service.proto", "flow_combination.proto", + "generated_output.proto", "non_standard_names.proto", "response_body_service.proto", "stream.proto", diff --git a/examples/proto/examplepb/generated_input.proto b/examples/proto/examplepb/generated_input.proto new file mode 100644 index 00000000000..8a1b7af3498 --- /dev/null +++ b/examples/proto/examplepb/generated_input.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +option go_package = "examplepb"; +package grpc.gateway.examples.examplepb; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "examples/proto/examplepb/a_bit_of_everything.proto"; +import "examples/proto/sub/message.proto"; + +// This file is run through a genrule. + +// Defines some more operations to be added to ABitOfEverythingService +service GeneratedService { + rpc Create(ABitOfEverything) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything/generated_create" + body: "*" + }; + } + +} From 2fe7ead86310590d1d3e4da34c61981a5f0b70ad Mon Sep 17 00:00:00 2001 From: Yannic Bonenberger Date: Mon, 9 Dec 2019 20:50:12 +0100 Subject: [PATCH 499/552] [bazel] Correctly handle proto files under `_virtual_imports` This can happen if: 1. `proto_library` contains at least one of `import_prefix/strip_import_prefix`, or 2. (for Bazel >= 1.0) at least one of `proto_library`'s `srcs` is generated. Fixes #1094 --- examples/proto/examplepb/BUILD.bazel | 7 +- protoc-gen-swagger/defs.bzl | 218 +++++++++++++++------------ 2 files changed, 129 insertions(+), 96 deletions(-) diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index 9928fa47e8e..b483934a865 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -4,20 +4,23 @@ load("@grpc_ecosystem_grpc_gateway//protoc-gen-swagger:defs.bzl", "protoc_gen_sw package(default_visibility = ["//visibility:public"]) +# TODO(yannic): Add examples/tests that use import_prefix/strip_import_prefix. + # gazelle:exclude a_bit_of_everything.pb.gw.go # gazelle:exclude echo_service.pb.gw.go # gazelle:exclude flow_combination.pb.gw.go +# gazelle:exclude generated_input.proto # gazelle:exclude non_standard_names.pb.gw.go +# gazelle:exclude response_body_service.pb.gw.go # gazelle:exclude stream.pb.gw.go # gazelle:exclude use_go_template.pb.gw.go # gazelle:exclude wrappers.pb.gw.go -# gazelle:exclude response_body_service.pb.gw.go genrule( name = "generated_proto", srcs = ["generated_input.proto"], outs = ["generated_output.proto"], - cmd = "cp $< $@", # A simple copy simulates a generated proto file. + cmd = "cp $< $@", # A simple copy simulates a generated proto file. ) proto_library( diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index 652e4a20b1a..fac06f3b9b7 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -4,133 +4,163 @@ Reads the the api spec in protobuf format and generate an open-api spec. Optionally applies settings from the grpc-service configuration. """ -def _collect_includes(gen_dir, srcs): - """Build an include path mapping. - - It is important to not just collect unique dirnames, to also support - proto files of the same name from different packages. - - The implementation below is similar to what bazel does in its - ProtoCompileActionBuilder.java +# TODO(yannic): Replace with |proto_common.direct_source_infos| when +# https://github.com/bazelbuild/rules_proto/pull/22 lands. +def _direct_source_infos(proto_info, provided_sources = []): + """Returns sequence of `ProtoFileInfo` for `proto_info`'s direct sources. + + Files that are both in `proto_info`'s direct sources and in + `provided_sources` are skipped. This is useful, e.g., for well-known + protos that are already provided by the Protobuf runtime. + + Args: + proto_info: An instance of `ProtoInfo`. + provided_sources: Optional. A sequence of files to ignore. + Usually, these files are already provided by the + Protocol Buffer runtime (e.g. Well-Known protos). + + Returns: A sequence of `ProtoFileInfo` containing information about + `proto_info`'s direct sources. """ - includes = [] - for src in srcs: - ref_path = src.path - if ref_path.startswith(gen_dir): - ref_path = ref_path[len(gen_dir):].lstrip("/") + source_root = proto_info.proto_source_root + if "." == source_root: + return [struct(file = src, import_path = src.path) for src in proto_info.direct_sources] + + offset = len(source_root) + 1 # + '/'. + + infos = [] + for src in proto_info.direct_sources: + # TODO(yannic): Remove this hack when we drop support for Bazel < 1.0. + local_offset = offset + if src.root.path and not source_root.startswith(src.root.path): + # Before Bazel 1.0, `proto_source_root` wasn't guaranteed to be a + # prefix of `src.path`. This could happend, e.g., if `file` was + # generated (https://github.com/bazelbuild/bazel/issues/9215). + local_offset += len(src.root.path) + 1 # + '/'. + infos.append(struct(file = src, import_path = src.path[local_offset:])) + + return infos + +def _run_proto_gen_swagger( + actions, + proto_info, + target_name, + transitive_proto_srcs, + protoc, + protoc_gen_swagger, + grpc_api_configuration, + single_output, + json_names_for_fields): + args = actions.args() + + args.add("--plugin", "protoc-gen-swagger=%s" % protoc_gen_swagger.path) + + args.add("--swagger_opt", "logtostderr=true") + args.add("--swagger_opt", "allow_repeated_fields_in_body=true") + + extra_inputs = [] + if grpc_api_configuration: + extra_inputs.append(grpc_api_configuration) + args.add("--swagger_opt", "grpc_api_configuration=%s" % grpc_api_configuration.path) - if src.owner.workspace_root: - workspace_root = src.owner.workspace_root - ref_path = ref_path[len(workspace_root):].lstrip("/") + if json_names_for_fields: + args.add("--swagger_opt", "json_names_for_fields=true") - include = ref_path + "=" + src.path - if include not in includes: - includes.append(include) + proto_file_infos = _direct_source_infos(proto_info) - return includes + # TODO(yannic): Use |proto_info.transitive_descriptor_sets| when + # https://github.com/bazelbuild/bazel/issues/9337 is fixed. + args.add_all(proto_info.transitive_proto_path, format_each = "--proto_path=%s") -def _run_proto_gen_swagger(ctx, direct_proto_srcs, transitive_proto_srcs, actions, protoc, protoc_gen_swagger, grpc_api_configuration, single_output, json_names_for_fields): - swagger_files = [] + if single_output: + args.add("--swagger_opt", "allow_merge=true") + args.add("--swagger_opt", "merge_file_name=%s" % target_name) - inputs = direct_proto_srcs + transitive_proto_srcs - tools = [protoc_gen_swagger] + swagger_file = actions.declare_file("%s.swagger.json" % target_name) + args.add("--swagger_out", swagger_file.dirname) - options = ["logtostderr=true", "allow_repeated_fields_in_body=true"] - if grpc_api_configuration: - options.append("grpc_api_configuration=%s" % grpc_api_configuration.path) - inputs.append(grpc_api_configuration) + args.add_all([f.import_path for f in proto_file_infos]) - if json_names_for_fields: - options.append("json_names_for_fields=true") + actions.run( + executable = protoc, + tools = [protoc_gen_swagger], + inputs = depset( + direct = extra_inputs, + transitive = [transitive_proto_srcs], + ), + outputs = [swagger_file], + arguments = [args], + ) - includes = _collect_includes(ctx.genfiles_dir.path, direct_proto_srcs + transitive_proto_srcs) + return [swagger_file] - if single_output: + # TODO(yannic): We may be able to generate all files in a single action, + # but that will change at least the semantics of `use_go_template.proto`. + swagger_files = [] + for proto_file_info in proto_file_infos: + # TODO(yannic): This probably doesn't work as expected: we only add this + # option after we have seen it, so `.proto` sources that happen to be + # in the list of `.proto` files before `use_go_template.proto` will be + # compiled without this option, and all sources that get compiled after + # `use_go_template.proto` will have this option on. + if proto_file_info.file.basename == "use_go_template.proto": + args.add("--swagger_opt", "use_go_templates=true") + + file_name = "%s.swagger.json" % proto_file_info.import_path[:-len(".proto")] swagger_file = actions.declare_file( - "%s.swagger.json" % ctx.attr.name, - sibling = direct_proto_srcs[0], + "_virtual_imports/%s/%s" % (target_name, file_name), ) - output_dir = ctx.bin_dir.path - if direct_proto_srcs[0].owner.workspace_root: - output_dir = "/".join([output_dir, direct_proto_srcs[0].owner.workspace_root]) - output_dir = "/".join([output_dir, direct_proto_srcs[0].dirname]) - options.append("allow_merge=true") - options.append("merge_file_name=%s" % ctx.attr.name) + file_args = actions.args() + + offset = len(file_name) + 1 # + '/'. + file_args.add("--swagger_out", swagger_file.path[:-offset]) - args = actions.args() - args.add("--plugin=protoc-gen-swagger=%s" % protoc_gen_swagger.path) - args.add("--swagger_out=%s:%s" % (",".join(options), output_dir)) - args.add_all(["-I%s" % include for include in includes]) - args.add_all([src.path for src in direct_proto_srcs]) + file_args.add(proto_file_info.import_path) actions.run( executable = protoc, - inputs = inputs, - tools = tools, + tools = [protoc_gen_swagger], + inputs = depset( + direct = extra_inputs, + transitive = [transitive_proto_srcs], + ), outputs = [swagger_file], - arguments = [args], + arguments = [args, file_args], ) - swagger_files.append(swagger_file) - else: - for proto in direct_proto_srcs: - if proto.basename == "use_go_template.proto": - options.append("use_go_templates=true") - - swagger_file = actions.declare_file( - "%s.swagger.json" % proto.basename[:-len(".proto")], - sibling = proto, - ) - - output_dir = ctx.bin_dir.path - if proto.owner.workspace_root: - output_dir = "/".join([output_dir, proto.owner.workspace_root]) - - args = actions.args() - args.add("--plugin=protoc-gen-swagger=%s" % protoc_gen_swagger.path) - args.add("--swagger_out=%s:%s" % (",".join(options), output_dir)) - args.add_all(["-I%s" % include for include in includes]) - args.add(proto.path) - - actions.run( - executable = protoc, - inputs = inputs, - tools = tools, - outputs = [swagger_file], - arguments = [args], - ) - swagger_files.append(swagger_file) return swagger_files def _proto_gen_swagger_impl(ctx): proto = ctx.attr.proto[ProtoInfo] - grpc_api_configuration = ctx.file.grpc_api_configuration - - return [DefaultInfo( - files = depset( - _run_proto_gen_swagger( - ctx, - direct_proto_srcs = proto.direct_sources, - transitive_proto_srcs = ctx.files._well_known_protos + proto.transitive_sources.to_list(), - actions = ctx.actions, - protoc = ctx.executable._protoc, - protoc_gen_swagger = ctx.executable._protoc_gen_swagger, - grpc_api_configuration = grpc_api_configuration, - single_output = ctx.attr.single_output, - json_names_for_fields = ctx.attr.json_names_for_fields, + return [ + DefaultInfo( + files = depset( + _run_proto_gen_swagger( + actions = ctx.actions, + proto_info = proto, + target_name = ctx.attr.name, + transitive_proto_srcs = depset( + direct = ctx.files._well_known_protos, + transitive = [proto.transitive_sources], + ), + protoc = ctx.executable._protoc, + protoc_gen_swagger = ctx.executable._protoc_gen_swagger, + grpc_api_configuration = ctx.file.grpc_api_configuration, + single_output = ctx.attr.single_output, + json_names_for_fields = ctx.attr.json_names_for_fields, + ), ), ), - )] + ] protoc_gen_swagger = rule( attrs = { "proto": attr.label( - allow_rules = ["proto_library"], mandatory = True, - providers = ["proto"], + providers = [ProtoInfo], ), "grpc_api_configuration": attr.label( allow_single_file = True, From 10414215ba6ab0468787acd4765a1863bdc9d9ac Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Fri, 20 Dec 2019 09:26:49 -0700 Subject: [PATCH 500/552] Update dependencies --- WORKSPACE | 51 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 7430c6bc260..8515bd549ad 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -3,29 +3,60 @@ workspace(name = "grpc_ecosystem_grpc_gateway") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( - name = "io_bazel_rules_go", - sha256 = "513c12397db1bc9aa46dd62f02dd94b49a9b5d17444d49b5a04c5a89f3053c1c", + name = "bazel_skylib", + sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", urls = [ - "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/v0.19.5/rules_go-v0.19.5.tar.gz", - "https://github.com/bazelbuild/rules_go/releases/download/v0.19.5/rules_go-v0.19.5.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", ], ) -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") -go_rules_dependencies() +bazel_skylib_workspace() -go_register_toolchains() +http_archive( + name = "rules_proto", + sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208", + strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz", + "https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz", + ], +) + +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") + +rules_proto_dependencies() + +rules_proto_toolchains() + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "io_bazel_rules_go", + sha256 = "e88471aea3a3a4f19ec1310a55ba94772d087e9ce46e41ae38ecebe17935de7b", + urls = [ + "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/v0.20.3/rules_go-v0.20.3.tar.gz", + "https://github.com/bazelbuild/rules_go/releases/download/v0.20.3/rules_go-v0.20.3.tar.gz", + ], +) http_archive( name = "bazel_gazelle", - sha256 = "7fc87f4170011201b1690326e8c16c5d802836e3a0d617d8f75c3af2b23180c4", + sha256 = "86c6d481b3f7aedc1d60c1c211c6f76da282ae197c3b3160f54bd3a8f847896f", urls = [ - "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/0.18.2/bazel-gazelle-0.18.2.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.18.2/bazel-gazelle-0.18.2.tar.gz", + "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/v0.19.1/bazel-gazelle-v0.19.1.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.19.1/bazel-gazelle-v0.19.1.tar.gz", ], ) +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") + +go_rules_dependencies() + +go_register_toolchains() + load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") gazelle_dependencies() From 5f69cd200af1d8b87f7f1d824830b6ded352b92f Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Fri, 20 Dec 2019 09:30:44 -0700 Subject: [PATCH 501/552] Fix BUILD files to load from rules_proto --- examples/pbwrappers/helloworld/BUILD.bazel | 1 + examples/proto/examplepb/BUILD.bazel | 1 + examples/proto/pathenum/BUILD.bazel | 1 + examples/proto/sub/BUILD.bazel | 1 + examples/proto/sub2/BUILD.bazel | 1 + internal/BUILD.bazel | 1 + protoc-gen-swagger/defs.bzl | 2 ++ protoc-gen-swagger/options/BUILD.bazel | 1 + 8 files changed, 9 insertions(+) diff --git a/examples/pbwrappers/helloworld/BUILD.bazel b/examples/pbwrappers/helloworld/BUILD.bazel index 0b6c67f8074..01949ef7e9d 100644 --- a/examples/pbwrappers/helloworld/BUILD.bazel +++ b/examples/pbwrappers/helloworld/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index b483934a865..ac90b28a4ba 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@grpc_ecosystem_grpc_gateway//protoc-gen-swagger:defs.bzl", "protoc_gen_swagger") diff --git a/examples/proto/pathenum/BUILD.bazel b/examples/proto/pathenum/BUILD.bazel index 26b3efc1921..06d17fc4483 100644 --- a/examples/proto/pathenum/BUILD.bazel +++ b/examples/proto/pathenum/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") diff --git a/examples/proto/sub/BUILD.bazel b/examples/proto/sub/BUILD.bazel index bc5874bba55..4500b5689d9 100644 --- a/examples/proto/sub/BUILD.bazel +++ b/examples/proto/sub/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") diff --git a/examples/proto/sub2/BUILD.bazel b/examples/proto/sub2/BUILD.bazel index 539f5b6e450..780d550ccbb 100644 --- a/examples/proto/sub2/BUILD.bazel +++ b/examples/proto/sub2/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") diff --git a/internal/BUILD.bazel b/internal/BUILD.bazel index 76cafe6ec7f..5f73042d6f6 100644 --- a/internal/BUILD.bazel +++ b/internal/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") diff --git a/protoc-gen-swagger/defs.bzl b/protoc-gen-swagger/defs.bzl index fac06f3b9b7..2cb1f22fdda 100644 --- a/protoc-gen-swagger/defs.bzl +++ b/protoc-gen-swagger/defs.bzl @@ -4,6 +4,8 @@ Reads the the api spec in protobuf format and generate an open-api spec. Optionally applies settings from the grpc-service configuration. """ +load("@rules_proto//proto:defs.bzl", "ProtoInfo") + # TODO(yannic): Replace with |proto_common.direct_source_infos| when # https://github.com/bazelbuild/rules_proto/pull/22 lands. def _direct_source_infos(proto_info, provided_sources = []): diff --git a/protoc-gen-swagger/options/BUILD.bazel b/protoc-gen-swagger/options/BUILD.bazel index 8dea43d297d..464a56d4539 100644 --- a/protoc-gen-swagger/options/BUILD.bazel +++ b/protoc-gen-swagger/options/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") From 3275ea65199b813325dedeb5fa67854e584d97ea Mon Sep 17 00:00:00 2001 From: Sean Lafferty Date: Sat, 18 Jan 2020 06:33:53 -0500 Subject: [PATCH 502/552] #1109 Inline streamingDefinitions in generated swagger to better support codegen tools (#1112) * #1109 Inline streamingDefinitions in generated swagger * Updated generated swagger streaming examples --- examples/proto/examplepb/stream.swagger.json | 48 ++++++------- protoc-gen-swagger/genswagger/generator.go | 3 - protoc-gen-swagger/genswagger/template.go | 70 +++++++------------ .../genswagger/template_test.go | 24 +++---- protoc-gen-swagger/genswagger/types.go | 1 - 5 files changed, 53 insertions(+), 93 deletions(-) diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index 69be3d81225..84215a088c1 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -18,7 +18,16 @@ "200": { "description": "A successful response.(streaming responses)", "schema": { - "$ref": "#/x-stream-definitions/examplepbABitOfEverything" + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/examplepbABitOfEverything" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of examplepbABitOfEverything" } } }, @@ -61,7 +70,16 @@ "200": { "description": "A successful response.(streaming responses)", "schema": { - "$ref": "#/x-stream-definitions/subStringMessage" + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/subStringMessage" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of subStringMessage" } } }, @@ -374,31 +392,5 @@ } } } - }, - "x-stream-definitions": { - "examplepbABitOfEverything": { - "type": "object", - "properties": { - "result": { - "$ref": "#/definitions/examplepbABitOfEverything" - }, - "error": { - "$ref": "#/definitions/runtimeStreamError" - } - }, - "title": "Stream result of examplepbABitOfEverything" - }, - "subStringMessage": { - "type": "object", - "properties": { - "result": { - "$ref": "#/definitions/subStringMessage" - }, - "error": { - "$ref": "#/definitions/runtimeStreamError" - } - }, - "title": "Stream result of subStringMessage" - } } } diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go index 61c5a537661..ecf1135fde7 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/genswagger/generator.go @@ -52,9 +52,6 @@ func mergeTargetFile(targets []*wrapper, mergeFileName string) *wrapper { for k, v := range f.swagger.Definitions { mergedTarget.swagger.Definitions[k] = v } - for k, v := range f.swagger.StreamDefinitions { - mergedTarget.swagger.StreamDefinitions[k] = v - } for k, v := range f.swagger.Paths { mergedTarget.swagger.Paths[k] = v } diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index dc3cf6a3130..1f43af3bf08 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -352,42 +352,6 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, } } -func renderMessagesAsStreamDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { - for name, msg := range messages { - if skipRenderingRef(name) { - continue - } - - if opt := msg.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { - continue - } - d[fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)] = swaggerSchemaObject{ - schemaCore: schemaCore{ - Type: "object", - }, - Title: fmt.Sprintf("Stream result of %s", fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)), - Properties: &swaggerSchemaObjectProperties{ - keyVal{ - Key: "result", - Value: swaggerSchemaObject{ - schemaCore: schemaCore{ - Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)), - }, - }, - }, - keyVal{ - Key: "error", - Value: swaggerSchemaObject{ - schemaCore: schemaCore{ - Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.StreamError", reg)), - }, - }, - }, - }, - } - } -} - // schemaOfField returns a swagger Schema Object for a protobuf field. func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) swaggerSchemaObject { const ( @@ -877,8 +841,26 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } if meth.GetServerStreaming() { desc += "(streaming responses)" - // Use the streamdefinition which wraps the message in a "result" - responseSchema.Ref = strings.Replace(responseSchema.Ref, `#/definitions/`, `#/x-stream-definitions/`, 1) + responseSchema.Type = "object" + responseSchema.Title = fmt.Sprintf("Stream result of %s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)) + responseSchema.Properties = &swaggerSchemaObjectProperties{ + keyVal{ + Key: "result", + Value: swaggerSchemaObject{ + schemaCore: schemaCore{ + Ref: responseSchema.Ref, + }, + }, + }, + keyVal{ + Key: "error", + Value: swaggerSchemaObject{ + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.StreamError", reg))}, + }, + }, + } + responseSchema.Ref = "" } tag := svc.GetName() @@ -1020,12 +1002,11 @@ func applyTemplate(p param) (*swaggerObject, error) { // defined off of. s := swaggerObject{ // Swagger 2.0 is the version of this document - Swagger: "2.0", - Consumes: []string{"application/json"}, - Produces: []string{"application/json"}, - Paths: make(swaggerPathsObject), - Definitions: make(swaggerDefinitionsObject), - StreamDefinitions: make(swaggerDefinitionsObject), + Swagger: "2.0", + Consumes: []string{"application/json"}, + Produces: []string{"application/json"}, + Paths: make(swaggerPathsObject), + Definitions: make(swaggerDefinitionsObject), Info: swaggerInfoObject{ Title: *p.File.Name, Version: "version not set", @@ -1047,7 +1028,6 @@ func applyTemplate(p param) (*swaggerObject, error) { e := enumMap{} findServicesMessagesAndEnumerations(p.Services, p.reg, m, ms, e, requestResponseRefs) renderMessagesAsDefinition(m, s.Definitions, p.reg, customRefs) - renderMessagesAsStreamDefinition(ms, s.StreamDefinitions, p.reg) renderEnumerationsAsDefinition(e, s.Definitions, p.reg) // File itself might have some comments and metadata. diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index c61a3346acc..3abaa6b3a5f 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -892,15 +892,17 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { if want, got, name := 3, len(result.Definitions), "len(Definitions)"; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) } - // stream ExampleMessage must be present - if want, got, name := 1, len(result.StreamDefinitions), "len(StreamDefinitions)"; !reflect.DeepEqual(got, want) { - t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) + if _, ok := result.Paths["/v1/echo"].Post.Responses["200"]; !ok { + t.Errorf("applyTemplate(%#v).%s = expected 200 response to be defined", file, `result.Paths["/v1/echo"].Post.Responses["200"]`) } else { - streamExampleExampleMessage := result.StreamDefinitions["exampleExampleMessage"] - if want, got, name := "object", streamExampleExampleMessage.Type, `StreamDefinitions["exampleExampleMessage"].Type`; !reflect.DeepEqual(got, want) { + if want, got, name := "A successful response.(streaming responses)", result.Paths["/v1/echo"].Post.Responses["200"].Description, `result.Paths["/v1/echo"].Post.Responses["200"].Description`; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) + } + streamExampleExampleMessage := result.Paths["/v1/echo"].Post.Responses["200"].Schema + if want, got, name := "object", streamExampleExampleMessage.Type, `result.Paths["/v1/echo"].Post.Responses["200"].Schema.Type`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } - if want, got, name := "Stream result of exampleExampleMessage", streamExampleExampleMessage.Title, `StreamDefinitions["exampleExampleMessage"].Title`; !reflect.DeepEqual(got, want) { + if want, got, name := "Stream result of exampleExampleMessage", streamExampleExampleMessage.Title, `result.Paths["/v1/echo"].Post.Responses["200"].Schema.Title`; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) } streamExampleExampleMessageProperties := *(streamExampleExampleMessage.Properties) @@ -925,16 +927,6 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { } } } - if want, got, name := 1, len(result.Paths["/v1/echo"].Post.Responses), "len(Paths[/v1/echo].Post.Responses)"; !reflect.DeepEqual(got, want) { - t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) - } else { - if want, got, name := "A successful response.(streaming responses)", result.Paths["/v1/echo"].Post.Responses["200"].Description, `result.Paths["/v1/echo"].Post.Responses["200"].Description`; !reflect.DeepEqual(got, want) { - t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) - } - if want, got, name := "#/x-stream-definitions/exampleExampleMessage", result.Paths["/v1/echo"].Post.Responses["200"].Schema.Ref, `result.Paths["/v1/echo"].Post.Responses["200"].Description`; !reflect.DeepEqual(got, want) { - t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) - } - } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 0b16d195514..5765706b34b 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -64,7 +64,6 @@ type swaggerObject struct { Produces []string `json:"produces"` Paths swaggerPathsObject `json:"paths"` Definitions swaggerDefinitionsObject `json:"definitions"` - StreamDefinitions swaggerDefinitionsObject `json:"x-stream-definitions,omitempty"` SecurityDefinitions swaggerSecurityDefinitionsObject `json:"securityDefinitions,omitempty"` Security []swaggerSecurityRequirementObject `json:"security,omitempty"` ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` From f9b73e0e7ccd7dbaed0874894c6306552761fa99 Mon Sep 17 00:00:00 2001 From: Sean Lafferty Date: Sat, 18 Jan 2020 13:31:57 -0500 Subject: [PATCH 503/552] #1113 Fix broken parsing of camelCase oneof --- runtime/query.go | 16 +++++++++------- runtime/query_test.go | 9 +++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/runtime/query.go b/runtime/query.go index ee0207e461e..80ff21c3a4c 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -117,14 +117,16 @@ func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Prope props := proto.GetProperties(m.Type()) // look up field name in oneof map - if op, ok := props.OneofTypes[name]; ok { - v := reflect.New(op.Type.Elem()) - field := m.Field(op.Field) - if !field.IsNil() { - return reflect.Value{}, nil, fmt.Errorf("field already set for %s oneof", props.Prop[op.Field].OrigName) + for _, op := range props.OneofTypes { + if name == op.Prop.OrigName || name == op.Prop.JSONName { + v := reflect.New(op.Type.Elem()) + field := m.Field(op.Field) + if !field.IsNil() { + return reflect.Value{}, nil, fmt.Errorf("field already set for %s oneof", props.Prop[op.Field].OrigName) + } + field.Set(v) + return v.Elem().Field(0), op.Prop, nil } - field.Set(v) - return v.Elem().Field(0), op.Prop, nil } for _, p := range props.Prop { diff --git a/runtime/query_test.go b/runtime/query_test.go index fb8d27ad769..e35904df2a7 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -371,6 +371,15 @@ func TestPopulateParameters(t *testing.T) { OneofValue: &proto3Message_OneofStringValue{"foobar"}, }, }, + { + values: url.Values{ + "oneofStringValue": {"foobar"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + OneofValue: &proto3Message_OneofStringValue{"foobar"}, + }, + }, { values: url.Values{ "oneof_bool_value": {"true"}, From f466fde78123b7cc8faaf25c22ea525d31c16a5a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 19 Jan 2020 01:26:54 +0000 Subject: [PATCH 504/552] Bump rubyzip from 1.2.3 to 2.0.0 in /docs Bumps [rubyzip](https://github.com/rubyzip/rubyzip) from 1.2.3 to 2.0.0. - [Release notes](https://github.com/rubyzip/rubyzip/releases) - [Changelog](https://github.com/rubyzip/rubyzip/blob/master/Changelog.md) - [Commits](https://github.com/rubyzip/rubyzip/compare/v1.2.3...v2.0.0) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 9bf6baf5847..9a6ac6f8c32 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -223,7 +223,7 @@ GEM ruby-enum (0.7.2) i18n ruby_dep (1.5.0) - rubyzip (1.2.3) + rubyzip (2.0.0) safe_yaml (1.0.4) sass (3.5.6) sass-listen (~> 4.0.0) From b3237cc42f6fef4be5f0bceb2f0de04bb7fb5658 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 20 Jan 2020 10:50:18 +0000 Subject: [PATCH 505/552] docs: require Jekyll Github Token to be set This didn't run successfully without this for me --- docs/run.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/run.sh b/docs/run.sh index b9b5a2c031b..2071f85b1f7 100755 --- a/docs/run.sh +++ b/docs/run.sh @@ -18,11 +18,17 @@ if [ ! -d "${BUNDLE_DIR}" ]; then bundle update fi +if [[ ${JEKYLL_GITHUB_TOKEN} == "" ]]; then + echo "Please set \$JEKYLL_GITHUB_TOKEN before running" + exit 1 +fi + docker run --rm \ --volume="${PWD}:/srv/jekyll" \ -p 35729:35729 -p 4000:4000 \ -e "JEKYLL_UID=$(id -u)" \ -e "JEKYLL_GID=$(id -g)" \ + -e "JEKYLL_GITHUB_TOKEN=${JEKYLL_GITHUB_TOKEN}" \ --volume="/tmp/grpc-gateway-bundle:/usr/local/bundle" \ -it "jekyll/builder:${JEKYLL_VERSION}" \ jekyll serve From 2a1ce6a2978b2d4e344f98e115cf2b67d8909353 Mon Sep 17 00:00:00 2001 From: Alan Wang Date: Sun, 19 Jan 2020 10:25:15 +0800 Subject: [PATCH 506/552] fix: get wrong second services method comments, then the swagger.jsons summary not right --- protoc-gen-swagger/genswagger/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 1f43af3bf08..1b9e14d545f 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -892,7 +892,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } } - methComments := protoComments(reg, svc.File, nil, "Method", int32(svcIdx), methProtoPath, int32(methIdx)) + methComments := protoComments(reg, svc.File, nil, "Service", int32(svcIdx), methProtoPath, int32(methIdx)) if err := updateSwaggerDataFromComments(reg, operationObject, meth, methComments, false); err != nil { panic(err) } From d43d92cb1f87e37c239416e8b9873eaf96b98ad1 Mon Sep 17 00:00:00 2001 From: Alan Wang Date: Wed, 22 Jan 2020 19:44:48 +0800 Subject: [PATCH 507/552] chore: regenerate the files after making changes --- examples/clients/abe/api/swagger.yaml | 2 -- examples/clients/abe/api_camel_case_service_name.go | 3 +-- examples/proto/examplepb/a_bit_of_everything.swagger.json | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/examples/clients/abe/api/swagger.yaml b/examples/clients/abe/api/swagger.yaml index bcb92338096..ab5f7a80719 100644 --- a/examples/clients/abe/api/swagger.yaml +++ b/examples/clients/abe/api/swagger.yaml @@ -1624,8 +1624,6 @@ paths: get: tags: - "camelCaseServiceName" - summary: "Create a new ABitOfEverything" - description: "This API creates a new ABitOfEverything" operationId: "Empty" parameters: [] responses: diff --git a/examples/clients/abe/api_camel_case_service_name.go b/examples/clients/abe/api_camel_case_service_name.go index f5835bbe031..80d867e660c 100644 --- a/examples/clients/abe/api_camel_case_service_name.go +++ b/examples/clients/abe/api_camel_case_service_name.go @@ -26,8 +26,7 @@ var ( type CamelCaseServiceNameApiService service /* -CamelCaseServiceNameApiService Create a new ABitOfEverything -This API creates a new ABitOfEverything +CamelCaseServiceNameApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return interface{} diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index e357ff5ffd7..14e86590d21 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -1926,8 +1926,6 @@ }, "/v2/example/empty": { "get": { - "summary": "Create a new ABitOfEverything", - "description": "This API creates a new ABitOfEverything", "operationId": "Empty", "responses": { "200": { From f6612d15b547afc383bf1ef70a9a6b05449bdd9c Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 22 Jan 2020 13:31:53 +0000 Subject: [PATCH 508/552] Generate changelog for 1.12.2 --- CHANGELOG.md | 42 +++++++++++++++++++++++++++++++++++++++++- Makefile | 2 +- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89356537f24..283628989cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,44 @@ # Change Log +## [v1.12.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.12.2) (2020-01-22) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.12.1...v1.12.2) + +**Fixed bugs:** + +- Gateway does not parse oneof types correctly when using camelCase [\#1113](https://github.com/grpc-ecosystem/grpc-gateway/issues/1113) + +**Closed issues:** + +- all SubConns are in TransientFailure, latest connection error: connection error: desc = \"transport: Error while dialing dial tcp \[::1\]:50051: connect: connection refused\" [\#1111](https://github.com/grpc-ecosystem/grpc-gateway/issues/1111) +- Streaming responses are put in `x-stream-definitions` rather than `/components/schema`, which tools do not support [\#1109](https://github.com/grpc-ecosystem/grpc-gateway/issues/1109) +- Why is metadataAnnotators not \[\]func\(metadata.MD, \*http.Request\) [\#1107](https://github.com/grpc-ecosystem/grpc-gateway/issues/1107) +- protoc\_gen\_swagger: Why `protobufListValue` type is represented as object? [\#1106](https://github.com/grpc-ecosystem/grpc-gateway/issues/1106) +- The metadata of local\_request function's return is always nil [\#1105](https://github.com/grpc-ecosystem/grpc-gateway/issues/1105) +- protoc-gen-swagger: support multiple files [\#1104](https://github.com/grpc-ecosystem/grpc-gateway/issues/1104) +- grpc-gateway is incompatible with --incompatible\_load\_proto\_rules\_from\_bzl [\#1101](https://github.com/grpc-ecosystem/grpc-gateway/issues/1101) +- Any example or doc of sending large data from Postman \(json\) to the server using client side streaming? [\#1100](https://github.com/grpc-ecosystem/grpc-gateway/issues/1100) +- Why errors have both "error" and "message" field that contains same \(redundant\) data? [\#1098](https://github.com/grpc-ecosystem/grpc-gateway/issues/1098) +- Generate java grpc gateway code. [\#1097](https://github.com/grpc-ecosystem/grpc-gateway/issues/1097) +- protoc-gen-swagger gen unsupport http post in query, only support http get in query? [\#1096](https://github.com/grpc-ecosystem/grpc-gateway/issues/1096) +- Cannot generate swagger with generated protobuf [\#1094](https://github.com/grpc-ecosystem/grpc-gateway/issues/1094) +- genswagger fails on Ubuntu on Windows \(WSL\): value of type genswagger.alias is not assignable to type genswagger.alias [\#1092](https://github.com/grpc-ecosystem/grpc-gateway/issues/1092) +- protoc-gen-swagger: should use json\_name values for generating properties in swagger doc [\#1090](https://github.com/grpc-ecosystem/grpc-gateway/issues/1090) +- protoc-gen-swagger: json\_names\_for\_fields=true does not respect json\_name for path parameters [\#1084](https://github.com/grpc-ecosystem/grpc-gateway/issues/1084) +- extract protoc-gen-swagger to separate repo [\#1083](https://github.com/grpc-ecosystem/grpc-gateway/issues/1083) +- How do I load balance call grpc service? [\#1081](https://github.com/grpc-ecosystem/grpc-gateway/issues/1081) + +**Merged pull requests:** + +- docs: require Jekyll Github Token to be set [\#1118](https://github.com/grpc-ecosystem/grpc-gateway/pull/1118) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- fix: protoc-gen-swagger: get wrong second services method comments [\#1116](https://github.com/grpc-ecosystem/grpc-gateway/pull/1116) ([chinaran](https://github.com/chinaran)) +- Bump rubyzip from 1.2.3 to 2.0.0 in /docs [\#1115](https://github.com/grpc-ecosystem/grpc-gateway/pull/1115) ([dependabot[bot]](https://github.com/apps/dependabot)) +- \#1113 Fix broken parsing of camelCase oneof [\#1114](https://github.com/grpc-ecosystem/grpc-gateway/pull/1114) ([seanlaff](https://github.com/seanlaff)) +- \#1109 Inline streamingDefinitions in generated swagger to better support codegen tools [\#1112](https://github.com/grpc-ecosystem/grpc-gateway/pull/1112) ([seanlaff](https://github.com/seanlaff)) +- Explicitly load rules\_proto rules [\#1102](https://github.com/grpc-ecosystem/grpc-gateway/pull/1102) ([achew22](https://github.com/achew22)) +- \[bazel\] Correctly handle proto files under \_virtual\_imports [\#1095](https://github.com/grpc-ecosystem/grpc-gateway/pull/1095) ([Yannic](https://github.com/Yannic)) +- Override operation\_id when available [\#1091](https://github.com/grpc-ecosystem/grpc-gateway/pull/1091) ([guilherme-santos](https://github.com/guilherme-santos)) +- Support reserved json name and add tests [\#1085](https://github.com/grpc-ecosystem/grpc-gateway/pull/1085) ([xin-au](https://github.com/xin-au)) + ## [v1.12.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.12.1) (2019-11-06) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.12.0...v1.12.1) @@ -9,6 +48,7 @@ **Merged pull requests:** +- Generate changelog for 1.12.1 [\#1080](https://github.com/grpc-ecosystem/grpc-gateway/pull/1080) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Revert "Fix templateToSwaggerPath generates invalid path" [\#1078](https://github.com/grpc-ecosystem/grpc-gateway/pull/1078) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Support json\_names\_for\_fields in starlark rule protoc\_gen\_swagger [\#1077](https://github.com/grpc-ecosystem/grpc-gateway/pull/1077) ([prestonvanloon](https://github.com/prestonvanloon)) @@ -724,7 +764,7 @@ - Fixes file integrity errors on TravisCI [\#619](https://github.com/grpc-ecosystem/grpc-gateway/pull/619) ([yugui](https://github.com/yugui)) - Reorganize examples [\#618](https://github.com/grpc-ecosystem/grpc-gateway/pull/618) ([yugui](https://github.com/yugui)) - Update dependency declarations in the Makefile [\#617](https://github.com/grpc-ecosystem/grpc-gateway/pull/617) ([yugui](https://github.com/yugui)) -- Support delete method in swagger generator [\#616](https://github.com/grpc-ecosystem/grpc-gateway/pull/616) ([blackdahila](https://github.com/blackdahila)) +- Support delete method in swagger generator [\#616](https://github.com/grpc-ecosystem/grpc-gateway/pull/616) ([beerose](https://github.com/beerose)) - feat\(bazel\): Add rule for generating .swagger.json files [\#613](https://github.com/grpc-ecosystem/grpc-gateway/pull/613) ([mrmeku](https://github.com/mrmeku)) - Support UNIX domain socket in the example servers [\#609](https://github.com/grpc-ecosystem/grpc-gateway/pull/609) ([yugui](https://github.com/yugui)) - misspelling [\#601](https://github.com/grpc-ecosystem/grpc-gateway/pull/601) ([chemidy](https://github.com/chemidy)) diff --git a/Makefile b/Makefile index b9aa868f90c..eb31aa6d714 100644 --- a/Makefile +++ b/Makefile @@ -203,7 +203,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.12.1 + --future-release=v1.12.2 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 0ef14fe5d5a3f9afc8c19d5fa4386bd9c18c0bcc Mon Sep 17 00:00:00 2001 From: Josh Giles Date: Sun, 2 Feb 2020 10:56:03 -0500 Subject: [PATCH 509/552] Fix #1125: JSON-prefix nested-field params. (#1126) * Fix #1125: JSON-prefix nested-field params. * Add test case. --- protoc-gen-swagger/genswagger/template.go | 8 ++++- .../genswagger/template_test.go | 36 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 1b9e14d545f..f54c7e3ed8b 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -201,7 +201,13 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st return nil, fmt.Errorf("unknown message type %s", fieldType) } for _, nestedField := range msg.Fields { - p, err := queryParams(msg, nestedField, prefix+field.GetName()+".", reg, pathParams) + var fieldName string + if reg.GetUseJSONNamesForFields() { + fieldName = field.GetJsonName() + } else { + fieldName = field.GetName() + } + p, err := queryParams(msg, nestedField, prefix+fieldName+".", reg, pathParams) if err != nil { return nil, err } diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 3abaa6b3a5f..9c1f0b74c70 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -248,6 +248,42 @@ func TestMessageToQueryParametersWithJsonName(t *testing.T) { }, }, }, + { + MsgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{ + Name: proto.String("SubMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("test_field_a"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + JsonName: proto.String("testFieldA"), + }, + }, + }, + &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("sub_message"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String(".example.SubMessage"), + Number: proto.Int32(1), + JsonName: proto.String("subMessage"), + }, + }, + }, + }, + Message: "ExampleMessage", + Params: []swaggerParameterObject{ + swaggerParameterObject{ + Name: "subMessage.testFieldA", + In: "query", + Required: false, + Type: "string", + }, + }, + }, } for _, test := range tests { From b21d75a9d46968927ee66acd64fdd1b948408d03 Mon Sep 17 00:00:00 2001 From: Josh Giles Date: Mon, 3 Feb 2020 02:39:15 -0500 Subject: [PATCH 510/552] Fix #1117: Support response examples. (#1124) * Fix #1117: Support response examples. Add support for examples in operation annotation responses. Merge custom response data into the default 200 response. * Regenerate files. * Documentation improvements. --- README.md | 23 + docs/_docs/usage.md | 23 + examples/clients/abe/api/swagger.yaml | 11 +- .../proto/examplepb/a_bit_of_everything.pb.go | 445 +++++++++--------- .../proto/examplepb/a_bit_of_everything.proto | 9 + .../a_bit_of_everything.swagger.json | 15 + protoc-gen-swagger/genswagger/template.go | 32 +- protoc-gen-swagger/genswagger/types.go | 5 +- protoc-gen-swagger/options/openapiv2.pb.go | 253 +++++----- protoc-gen-swagger/options/openapiv2.proto | 5 +- 10 files changed, 470 insertions(+), 351 deletions(-) diff --git a/README.md b/README.md index 9f7493d9bf2..85aaa7b6b0f 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,10 @@ annotation to your .proto file } ``` + See [a_bit_of_everything.proto](examples/proto/examplepb/a_bit_of_everything.proto) + for examples of more annotations you can add to customize gateway behavior + and generated Swagger output. + If you do not want to modify the proto file for use with grpc-gateway you can alternatively use an external [gRPC Service Configuration](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config) file. @@ -210,6 +214,16 @@ annotation to your .proto file ``` ## Parameters and flags + +During code generation with `protoc`, flags to grpc-gateway tools must be passed +through protoc using the `--_out=:` pattern, for +example: + +```sh +--grpc-gateway_out=logtostderr=true,repeated_path_param_separator=ssv:. +--swagger_out=logtostderr=true,repeated_path_param_separator=ssv:. +``` + `protoc-gen-grpc-gateway` supports custom mapping from Protobuf `import` to Golang import paths. They are compatible to [the parameters with same names in `protoc-gen-go`](https://github.com/golang/protobuf#parameters) @@ -223,6 +237,15 @@ useful to pass request scoped context between the gateway and the gRPC service. logging. You can give these flags together with parameters above. Run `protoc-gen-grpc-gateway --help` for more details about the flags. +Similarly, `protoc-gen-swagger` supports command-line flags to control Swagger +output (for example, `json_names_for_fields` to output JSON names for fields +instead of protobuf names). Run `protoc-gen-swagger --help` for more flag +details. Further Swagger customization is possible by annotating your `.proto` +files with options from +[openapiv2.proto](protoc-gen-swagger/options/openapiv2.proto) - see +[a_bit_of_everything.proto](examples/proto/examplepb/a_bit_of_everything.proto) +for examples. + ## More Examples More examples are available under `examples` directory. * `proto/examplepb/echo_service.proto`, `proto/examplepb/a_bit_of_everything.proto`, `proto/examplepb/unannotated_echo_service.proto`: service definition diff --git a/docs/_docs/usage.md b/docs/_docs/usage.md index 2bb0f22cb3b..7ccf52e0abd 100644 --- a/docs/_docs/usage.md +++ b/docs/_docs/usage.md @@ -68,6 +68,10 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. } ``` + See [a_bit_of_everything.proto](examples/proto/examplepb/a_bit_of_everything.proto) + for examples of more annotations you can add to customize gateway behavior + and generated Swagger output. + If you do not want to modify the proto file for use with grpc-gateway you can alternatively use an external [gRPC API Configuration](https://cloud.google.com/endpoints/docs/grpc/grpc-service-config) file. [Check our documentation](grpcapiconfiguration.html) for more information. 3. Generate gRPC stub @@ -174,6 +178,16 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. ``` ## Parameters and flags + +During code generation with `protoc`, flags to grpc-gateway tools must be passed +through protoc using the `--_out=:` pattern, for +example: + +```sh +--grpc-gateway_out=logtostderr=true,repeated_path_param_separator=ssv:. +--swagger_out=logtostderr=true,repeated_path_param_separator=ssv:. +``` + `protoc-gen-grpc-gateway` supports custom mapping from Protobuf `import` to Golang import path. They are compatible to [the parameters with same names in `protoc-gen-go`](https://github.com/golang/protobuf#parameters). @@ -182,6 +196,15 @@ This parameter can be useful to pass request scoped context between the gateway `protoc-gen-grpc-gateway` also supports some more command line flags to control logging. You can give these flags together with parameters above. Run `protoc-gen-grpc-gateway --help` for more details about the flags. +Similarly, `protoc-gen-swagger` supports command-line flags to control Swagger +output (for example, `json_names_for_fields` to output JSON names for fields +instead of protobuf names). Run `protoc-gen-swagger --help` for more flag +details. Further Swagger customization is possible by annotating your `.proto` +files with options from +[openapiv2.proto](protoc-gen-swagger/options/openapiv2.proto) - see +[a_bit_of_everything.proto](examples/proto/examplepb/a_bit_of_everything.proto) +for examples. + # Mapping gRPC to HTTP * [How gRPC error codes map to HTTP status codes in the response](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15) diff --git a/examples/clients/abe/api/swagger.yaml b/examples/clients/abe/api/swagger.yaml index ab5f7a80719..91859be58e5 100644 --- a/examples/clients/abe/api/swagger.yaml +++ b/examples/clients/abe/api/swagger.yaml @@ -75,6 +75,9 @@ paths: responses: 200: description: "A successful response." + examples: + application/json: + value: "the input value" schema: $ref: "#/definitions/subStringMessage" 403: @@ -1560,6 +1563,9 @@ paths: responses: 200: description: "A successful response." + examples: + application/json: + value: "the input value" schema: $ref: "#/definitions/subStringMessage" 403: @@ -1598,6 +1604,9 @@ paths: responses: 200: description: "A successful response." + examples: + application/json: + value: "the input value" schema: $ref: "#/definitions/subStringMessage" 403: @@ -2189,8 +2198,6 @@ definitions: properties: value: type: "string" - example: - value: "value" externalDocs: description: "More about gRPC-Gateway" url: "https://github.com/grpc-ecosystem/grpc-gateway" diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index bbfbc52d053..78a653b0adb 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -820,228 +820,229 @@ func init() { } var fileDescriptor_3978364c010e812a = []byte{ - // 3523 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4d, 0x6c, 0x1b, 0xc7, - 0x7e, 0xd7, 0x72, 0xf5, 0x39, 0xb2, 0xbe, 0x46, 0x96, 0x2d, 0xd3, 0x4a, 0x34, 0xa6, 0x9d, 0x97, - 0x35, 0x9f, 0xc9, 0x95, 0x56, 0x4a, 0x62, 0x33, 0x7d, 0x49, 0x48, 0x49, 0x76, 0x64, 0x27, 0xb2, - 0xb2, 0x76, 0xdc, 0xd4, 0x2f, 0x7e, 0xea, 0x90, 0x1c, 0x8a, 0x6b, 0x71, 0x77, 0xf6, 0xed, 0xce, - 0xca, 0xa2, 0x55, 0xb6, 0x0f, 0x6d, 0xd1, 0x02, 0xef, 0xdd, 0xf8, 0xfa, 0x81, 0xd7, 0x87, 0xf6, - 0x52, 0xf4, 0x52, 0xf4, 0x54, 0xa0, 0xa7, 0x02, 0xed, 0xa5, 0xb7, 0x02, 0x6d, 0x91, 0x02, 0x45, - 0x2f, 0x3d, 0xb5, 0xe7, 0x02,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x45, 0xd2, 0xa7, 0xfd, 0x39, 0x9f, 0x64, 0x15, 0x4c, 0x1b, 0x16, 0x7b, 0x77, 0x33, - 0xa0, 0x18, 0x43, 0x92, 0x22, 0xeb, 0x40, 0x4c, 0x75, 0x64, 0x78, 0x51, 0x8a, 0x71, 0x24, 0x29, - 0xa3, 0xfa, 0xb4, 0x17, 0x21, 0xf1, 0x65, 0x6c, 0x68, 0x01, 0xc5, 0x04, 0x92, 0x94, 0x31, 0x21, - 0x63, 0x43, 0xf3, 0x09, 0xae, 0x82, 0x99, 0x9a, 0x71, 0x42, 0xaa, 0x1d, 0x21, 0x93, 0x48, 0x52, - 0xc6, 0xf5, 0x73, 0xc1, 0x64, 0x9c, 0xa8, 0x23, 0x67, 0x0a, 0x49, 0xca, 0x44, 0x40, 0x14, 0x4a, - 0x7a, 0x03, 0x80, 0x32, 0xa5, 0x8d, 0x80, 0x02, 0x20, 0x49, 0x99, 0xd4, 0xa7, 0xf8, 0x4c, 0x07, - 0xac, 0xcb, 0x1c, 0xc3, 0x3a, 0x0c, 0x08, 0xa6, 0xb9, 0x03, 0xe8, 0xd3, 0xfe, 0x5c, 0x07, 0x6c, - 0xb9, 0xc9, 0x88, 0x1b, 0x50, 0xbc, 0x81, 0x24, 0xe5, 0x9c, 0x0e, 0xc4, 0x54, 0xcc, 0xe0, 0x0e, - 0x8c, 0x19, 0x24, 0x29, 0x33, 0xbe, 0xc1, 0x21, 0x8a, 0x7b, 0x00, 0xf0, 0x5b, 0x17, 0x10, 0xcc, - 0x22, 0x49, 0x99, 0xd5, 0x6e, 0x9c, 0x79, 0xf2, 0x7b, 0x9e, 0x49, 0x1c, 0xa3, 0xb2, 0x63, 0x79, - 0xa6, 0x3e, 0xc5, 0xf9, 0x7d, 0x61, 0xfb, 0x60, 0xae, 0x73, 0x8f, 0x03, 0x89, 0x6f, 0x0a, 0x89, - 0xca, 0x00, 0x89, 0xe1, 0xf5, 0xcf, 0xef, 0x63, 0x56, 0x17, 0xd2, 0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, 0x3d, 0xb8, 0x3b, 0x84, 0x41, 0x41, 0x2f, 0x24, 0xfe, - 0x3c, 0x26, 0x61, 0x1c, 0x3d, 0x6a, 0xc1, 0xbf, 0x97, 0xc0, 0x79, 0x61, 0x1a, 0x77, 0x96, 0x6f, - 0xcd, 0xa2, 0x4c, 0xe1, 0x25, 0x2d, 0xe2, 0xce, 0x16, 0xef, 0x41, 0x5b, 0x85, 0xf8, 0x5f, 0xce, - 0xa4, 0xff, 0x5a, 0x6a, 0x17, 0xff, 0x52, 0x82, 0xb5, 0x01, 0xdd, 0x7d, 0xf4, 0x37, 0x05, 0x94, - 0xcb, 0xa1, 0x67, 0x75, 0xa3, 0x52, 0x47, 0x6e, 0x9d, 0x7a, 0x8d, 0xaa, 0x08, 0xf9, 0x65, 0x82, - 0x3c, 0x97, 0x54, 0x91, 0x61, 0x21, 0xbb, 0x81, 0x2b, 0x04, 0xd1, 0x9a, 0x48, 0x0e, 0x55, 0x5a, - 0xf1, 0x4c, 0x62, 0xf9, 0x3d, 0x23, 0xaa, 0x50, 0x93, 0x0f, 0xae, 0xa4, 0x3f, 0x03, 0xab, 0xfd, - 0xca, 0x52, 0x1e, 0xba, 0xc3, 0xf7, 0x84, 0x61, 0xdf, 0xa4, 0x9f, 0x82, 0xf3, 0x15, 0x6c, 0x92, - 0xc6, 0x16, 0x76, 0x49, 0x20, 0x83, 0x37, 0xbf, 0x50, 0x07, 0x63, 0xfe, 0xef, 0xea, 0xc3, 0x06, - 0xaf, 0x4b, 0x62, 0x97, 0x17, 0xe1, 0x42, 0x2c, 0x78, 0xf1, 0x25, 0xed, 0x07, 0x60, 0xa5, 0x68, - 0x51, 0x56, 0x27, 0x4e, 0xa0, 0x89, 0x07, 0x8c, 0x48, 0x20, 0xff, 0x20, 0x16, 0xd6, 0x87, 0x55, - 0x3c, 0x52, 0xfa, 0xf3, 0xa9, 0x76, 0xf1, 0x8f, 0xa7, 0xe0, 0xd7, 0x12, 0x58, 0x2c, 0xa2, 0x92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0x8b, 0xb9, 0x88, 0x0f, 0x82, 0xb3, 0x04, 0x2b, - 0x41, 0x27, 0x0f, 0x17, 0x83, 0x45, 0x31, 0x0a, 0x57, 0xb7, 0xc0, 0x18, 0xae, 0x9a, 0x86, 0x05, - 0x0b, 0x31, 0x56, 0xab, 0x1a, 0x23, 0x13, 0xae, 0xc1, 0xc9, 0x0c, 0x97, 0xf1, 0x6a, 0xed, 0x98, - 0x20, 0xc3, 0xaa, 0x51, 0xc7, 0x14, 0xde, 0x57, 0x5e, 0x05, 0x33, 0xd1, 0x83, 0x19, 0x49, 0xbe, - 0x2e, 0x94, 0xaf, 0x0f, 0x7c, 0x5f, 0x48, 0x92, 0x3a, 0xbb, 0xe0, 0xe2, 0xa7, 0xdd, 0x68, 0x19, - 0x8d, 0x01, 0xc3, 0xde, 0xfd, 0xe7, 0x97, 0x01, 0x3c, 0xc9, 0x45, 0x67, 0xf8, 0x25, 0x81, 0x63, - 0x69, 0xb9, 0x8c, 0x9d, 0xe7, 0x0a, 0xb8, 0x98, 0x58, 0x2c, 0xe3, 0xe7, 0xb9, 0x86, 0xe1, 0x32, - 0x38, 0xa3, 0x4d, 0x83, 0xb1, 0xb4, 0x4c, 0x2d, 0x02, 0x52, 0x48, 0x7a, 0x3c, 0xd5, 0x71, 0xc7, - 0xf2, 0xb8, 0x08, 0x63, 0x1b, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x12, 0xd7, 0x52, 0x3a, - 0x2b, 0x00, 0x00, + // 3552 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4d, 0x70, 0x1b, 0xc9, + 0x5e, 0xf7, 0x68, 0xfc, 0xd9, 0x8e, 0xbf, 0xda, 0x71, 0xe2, 0x28, 0xde, 0x75, 0x47, 0xc9, 0xbe, + 0x9d, 0xe8, 0x45, 0x1a, 0x7b, 0xec, 0xdd, 0x4d, 0x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 0x90, 0x03, 0xef, 0x82, 0xe9, 0x5a, 0x83, 0x62, 0x76, 0x70, + 0x8c, 0x1b, 0x1e, 0x59, 0x96, 0x91, 0xa4, 0xa4, 0x4a, 0xd7, 0xdb, 0xc5, 0xef, 0x68, 0x0b, 0xb7, + 0xf9, 0x3c, 0x12, 0xf3, 0x48, 0x78, 0x58, 0x41, 0x5e, 0xcb, 0x6b, 0x5f, 0x49, 0x51, 0x06, 0x1d, + 0x88, 0xc1, 0x23, 0xfe, 0x0d, 0xaf, 0x80, 0x73, 0x55, 0xea, 0x95, 0x1b, 0x24, 0x10, 0x36, 0x8a, + 0x24, 0x45, 0xd2, 0xa7, 0xfd, 0x39, 0x9f, 0x64, 0x15, 0x4c, 0x1b, 0x16, 0x7b, 0x77, 0x33, 0xa0, + 0x18, 0x43, 0x92, 0x22, 0xeb, 0x40, 0x4c, 0x75, 0x64, 0x78, 0x51, 0x8a, 0x71, 0x24, 0x29, 0xa3, + 0xfa, 0xb4, 0x17, 0x21, 0xf1, 0x65, 0x6c, 0x68, 0x01, 0xc5, 0x04, 0x92, 0x94, 0x31, 0x21, 0x63, + 0x43, 0xf3, 0x09, 0xae, 0x82, 0x99, 0x9a, 0x71, 0x42, 0xaa, 0x1d, 0x21, 0x93, 0x48, 0x52, 0xc6, + 0xf5, 0x73, 0xc1, 0x64, 0x9c, 0xa8, 0x23, 0x67, 0x0a, 0x49, 0xca, 0x44, 0x40, 0x14, 0x4a, 0x7a, + 0x03, 0x80, 0x32, 0xa5, 0x8d, 0x80, 0x02, 0x20, 0x49, 0x99, 0xd4, 0xa7, 0xf8, 0x4c, 0x07, 0xac, + 0xcb, 0x1c, 0xc3, 0x3a, 0x0c, 0x08, 0xa6, 0xb9, 0x03, 0xe8, 0xd3, 0xfe, 0x5c, 0x07, 0x6c, 0xb9, + 0xc9, 0x88, 0x1b, 0x50, 0xbc, 0x81, 0x24, 0xe5, 0x9c, 0x0e, 0xc4, 0x54, 0xcc, 0xe0, 0x0e, 0x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4, 0x56, 0x29, 0x71, 0x91, 0x45, 0x19, 0x22, 0x27, 0x86, 0xcb, 0xf2, 0x70, 0x1c, 0x88, + 0x27, 0x37, 0x71, 0x51, 0x9f, 0x9c, 0x1d, 0x6a, 0xf8, 0x56, 0xab, 0xa7, 0xfe, 0xe1, 0x3e, 0xbe, + 0x94, 0x99, 0x8f, 0x66, 0x17, 0xbe, 0x56, 0xf0, 0x5f, 0x68, 0x1e, 0x43, 0xd8, 0xb3, 0x04, 0xff, + 0x42, 0x02, 0xe7, 0xb6, 0x09, 0xb1, 0xc5, 0xef, 0x50, 0x7c, 0xe2, 0x9b, 0x29, 0x64, 0x3e, 0x14, + 0xb6, 0xdd, 0xca, 0x6c, 0x9e, 0x99, 0x26, 0x62, 0x3f, 0x71, 0xe7, 0x79, 0x77, 0x22, 0xf2, 0x5b, + 0x11, 0x80, 0x3d, 0x5a, 0x32, 0xac, 0xaa, 0x61, 0x1d, 0xba, 0xf0, 0x52, 0x4f, 0x16, 0xd8, 0x0e, + 0x7e, 0xfd, 0x1f, 0x98, 0x20, 0x46, 0xe0, 0x23, 0x30, 0xf1, 0xd0, 0x30, 0x09, 0xf5, 0x18, 0x1c, + 0x40, 0x34, 0x90, 0xf9, 0xb2, 0x80, 0xbf, 0x04, 0x17, 0xa3, 0xfb, 0xc9, 0x02, 0x61, 0x75, 0x30, + 0xbf, 0xe3, 0x38, 0xd4, 0xe1, 0xad, 0xd3, 0x36, 0x61, 0xd8, 0x68, 0xb8, 0x43, 0x2b, 0xb8, 0x26, + 0x14, 0xbc, 0x09, 0x57, 0x62, 0x07, 0xc6, 0xa5, 0x3e, 0x33, 0x58, 0xbd, 0x1a, 0x48, 0xfd, 0x4d, + 0x09, 0xc0, 0x3b, 0x84, 0x25, 0x5b, 0xb5, 0xb3, 0xab, 0x9c, 0x04, 0xc7, 0x40, 0x18, 0x6f, 0x0b, + 0x18, 0x57, 0x32, 0x97, 0xa2, 0x30, 0x38, 0x82, 0x32, 0xad, 0x36, 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0xc5, 0xc4, 0x62, 0x19, 0x3f, 0xcf, 0x35, 0x0c, 0x97, 0xc1, 0x19, 0x6d, 0x1a, + 0x8c, 0xa5, 0x65, 0x6a, 0x11, 0x90, 0x42, 0xd2, 0xe3, 0xa9, 0x8e, 0x3b, 0x96, 0xc7, 0x45, 0x18, + 0xdb, 0xf8, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xb2, 0xb5, 0x0c, 0x75, 0x2b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index e7328ca4804..79d9363fe0d 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -446,6 +446,15 @@ service ABitOfEverythingService { url: "https://github.com/grpc-ecosystem/grpc-gateway"; description: "Find out more Echo"; } + responses: { + key: "200" + value: { + examples: { + key: "application/json" + value: '{"value": "the input value"}' + } + } + } responses: { key: "503"; value: { diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 14e86590d21..033eb3e2f2c 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -81,6 +81,11 @@ "description": "A successful response.", "schema": { "$ref": "#/definitions/subStringMessage" + }, + "examples": { + "application/json": { + "value": "the input value" + } } }, "403": { @@ -1830,6 +1835,11 @@ "description": "A successful response.", "schema": { "$ref": "#/definitions/subStringMessage" + }, + "examples": { + "application/json": { + "value": "the input value" + } } }, "403": { @@ -1880,6 +1890,11 @@ "description": "A successful response.", "schema": { "$ref": "#/definitions/subStringMessage" + }, + "examples": { + "application/json": { + "value": "the input value" + } } }, "403": { diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index f54c7e3ed8b..6b2b62eb38f 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -950,9 +950,16 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } if opts.Responses != nil { for name, resp := range opts.Responses { - respObj := swaggerResponseObject{ - Description: resp.Description, - Schema: swaggerSchemaFromProtoSchema(resp.Schema, reg, customRefs, meth), + // Merge response data into default response if available. + respObj := operationObject.Responses[name] + if resp.Description != "" { + respObj.Description = resp.Description + } + if resp.Schema != nil { + respObj.Schema = swaggerSchemaFromProtoSchema(resp.Schema, reg, customRefs, meth) + } + if resp.Examples != nil { + respObj.Examples = swaggerExamplesFromProtoExamples(resp.Examples) } if resp.Extensions != nil { exts, err := processExtensions(resp.Extensions) @@ -1238,6 +1245,7 @@ func applyTemplate(p param) (*swaggerObject, error) { respMap[k] = swaggerResponseObject{ Description: v.Description, Schema: swaggerSchemaFromProtoSchema(v.Schema, p.reg, customRefs, nil), + Examples: swaggerExamplesFromProtoExamples(v.Examples), } } } @@ -1709,6 +1717,24 @@ func swaggerSchemaFromProtoSchema(s *swagger_options.Schema, reg *descriptor.Reg return ret } +func swaggerExamplesFromProtoExamples(in map[string]string) map[string]interface{} { + if len(in) == 0 { + return nil + } + out := make(map[string]interface{}) + for mimeType, exampleStr := range in { + switch mimeType { + case "application/json": + // JSON example objects are rendered raw. + out[mimeType] = json.RawMessage(exampleStr) + default: + // All other mimetype examples are rendered as strings. + out[mimeType] = exampleStr + } + } + return out +} + func protoJSONSchemaTypeToFormat(in []swagger_options.JSONSchema_JSONSchemaSimpleTypes) (string, string) { if len(in) == 0 { return "", "" diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 5765706b34b..47d099806f4 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -167,8 +167,9 @@ type swaggerResponsesObject map[string]swaggerResponseObject // http://swagger.io/specification/#responseObject type swaggerResponseObject struct { - Description string `json:"description"` - Schema swaggerSchemaObject `json:"schema"` + Description string `json:"description"` + Schema swaggerSchemaObject `json:"schema"` + Examples map[string]interface{} `json:"examples,omitempty"` extensions []extension } diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index 727ca52783c..8ea807582e2 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -477,7 +477,10 @@ type Response struct { Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` // `Schema` optionally defines the structure of the response. // If `Schema` is not provided, it means there is no content to the response. - Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + // `Examples` gives per-mimetype response examples. + // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#example-object + Examples map[string]string `protobuf:"bytes,4,rep,name=examples,proto3" json:"examples,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Extensions map[string]*_struct.Value `protobuf:"bytes,5,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -523,6 +526,13 @@ func (m *Response) GetSchema() *Schema { return nil } +func (m *Response) GetExamples() map[string]string { + if m != nil { + return m.Examples + } + return nil +} + func (m *Response) GetExtensions() map[string]*_struct.Value { if m != nil { return m.Extensions @@ -1478,6 +1488,7 @@ func init() { proto.RegisterMapType((map[string]*_struct.Value)(nil), "grpc.gateway.protoc_gen_swagger.options.Operation.ExtensionsEntry") proto.RegisterMapType((map[string]*Response)(nil), "grpc.gateway.protoc_gen_swagger.options.Operation.ResponsesEntry") proto.RegisterType((*Response)(nil), "grpc.gateway.protoc_gen_swagger.options.Response") + proto.RegisterMapType((map[string]string)(nil), "grpc.gateway.protoc_gen_swagger.options.Response.ExamplesEntry") proto.RegisterMapType((map[string]*_struct.Value)(nil), "grpc.gateway.protoc_gen_swagger.options.Response.ExtensionsEntry") proto.RegisterType((*Info)(nil), "grpc.gateway.protoc_gen_swagger.options.Info") proto.RegisterMapType((map[string]*_struct.Value)(nil), "grpc.gateway.protoc_gen_swagger.options.Info.ExtensionsEntry") @@ -1503,123 +1514,125 @@ func init() { } var fileDescriptor_ba35ad8af024fb48 = []byte{ - // 1884 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0x5b, 0x73, 0xdb, 0xc6, - 0xf5, 0x0f, 0x48, 0x90, 0x04, 0x0f, 0x45, 0x7a, 0xbd, 0x96, 0xf3, 0x47, 0x18, 0xdb, 0x7f, 0x85, - 0x4d, 0xa7, 0x1a, 0xbb, 0xa6, 0x12, 0xe5, 0xa1, 0x99, 0x4c, 0x6f, 0x94, 0xc4, 0xc8, 0x80, 0x65, - 0x92, 0x05, 0xa9, 0x28, 0xee, 0x8c, 0x07, 0x85, 0xc0, 0x25, 0x85, 0x18, 0x17, 0x06, 0x17, 0x49, - 0xec, 0x27, 0xe8, 0x73, 0xa7, 0xaf, 0xf9, 0x1e, 0x9d, 0x69, 0x9f, 0xfa, 0x09, 0xfa, 0x59, 0xda, - 0xe9, 0x7b, 0x67, 0x2f, 0x20, 0x41, 0x91, 0xf1, 0x90, 0x72, 0x3c, 0x79, 0xe8, 0x13, 0xf7, 0xdc, - 0x7e, 0xbb, 0x7b, 0xce, 0x9e, 0x0b, 0x08, 0x8f, 0x27, 0x61, 0x10, 0x07, 0xf6, 0xd3, 0x31, 0xf1, - 0x9f, 0x46, 0x57, 0xd6, 0x78, 0x4c, 0xc2, 0xbd, 0x60, 0x12, 0x3b, 0x81, 0x1f, 0xed, 0x05, 0x13, - 0xe2, 0x5b, 0x13, 0xe7, 0x72, 0xbf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e, 0xfc, 0x5d, 0xc3, 0x89, 0xfa, 0x77, 0xd2, 0x4a, 0x93, 0xef, 0x7b, 0x21, 0xaf, - 0x17, 0x5f, 0xc8, 0x0f, 0x7e, 0xb7, 0xa5, 0x07, 0xf6, 0x17, 0x89, 0x8e, 0xd5, 0x2c, 0x57, 0x7a, - 0xd9, 0x0b, 0x54, 0x36, 0xa9, 0x2f, 0xcc, 0x9e, 0xff, 0x70, 0xe7, 0x89, 0xcb, 0x7f, 0x0e, 0x30, - 0x67, 0xae, 0xb8, 0xed, 0x76, 0xf6, 0xb6, 0xe5, 0xcc, 0xb1, 0x0e, 0x0e, 0x7f, 0xdf, 0x1a, 0x3b, - 0xf1, 0x45, 0x72, 0xde, 0xb4, 0x03, 0x6f, 0x8f, 0x1e, 0xe4, 0x29, 0xb1, 0x83, 0x68, 0x1a, 0xc5, - 0x44, 0x90, 0xe2, 0x5c, 0x7b, 0xdf, 0xff, 0xd7, 0xff, 0x79, 0x91, 0xc9, 0x3e, 0xfb, 0x6f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x29, 0x5a, 0xd3, 0x93, 0x1f, 0x18, 0x00, 0x00, + // 1910 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0x5b, 0x73, 0x1a, 0xd7, + 0x1d, 0xcf, 0xc2, 0x02, 0xcb, 0x1f, 0x81, 0x8f, 0x8f, 0xe5, 0x74, 0x43, 0x6c, 0x57, 0xa1, 0xe9, + 0x54, 0x63, 0xd7, 0x28, 0x51, 0x1e, 0x9a, 0x49, 0xaf, 0x48, 0x22, 0xf2, 0xae, 0x65, 0xa0, 0x0b, + 0x8a, 0xe2, 0x76, 0x3c, 0xdb, 0xd5, 0x72, 0x40, 0x1b, 0xef, 0x85, 0xec, 0x45, 0x12, 0xfd, 0x04, + 0x7d, 0xee, 0xf4, 0x35, 0xdf, 0xa3, 0x0f, 0x7d, 0x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x82, 0x74, 0x07, 0xa6, 0x33, + 0x54, 0x0b, 0x7c, 0x1d, 0x33, 0x9e, 0x36, 0xbc, 0x71, 0xb1, 0x30, 0xb3, 0xc5, 0xa2, 0xcc, 0x82, + 0xb3, 0xb5, 0xf2, 0xda, 0x67, 0xc7, 0xfa, 0x9a, 0x72, 0xa1, 0xce, 0xeb, 0x23, 0xb0, 0xb9, 0x67, + 0xf5, 0xed, 0x01, 0xc0, 0x90, 0x4c, 0x42, 0x62, 0x5b, 0x31, 0x19, 0xb2, 0xf2, 0xa1, 0x18, 0x19, + 0xce, 0x3b, 0xcc, 0xfb, 0xd3, 0x85, 0x94, 0xac, 0x32, 0xec, 0xbd, 0x1b, 0xec, 0xfa, 0x7b, 0x90, + 0x94, 0x3c, 0xa1, 0x1a, 0xff, 0xc8, 0x83, 0x92, 0x4e, 0x7a, 0x35, 0x2b, 0xa4, 0xeb, 0x59, 0x71, + 0x08, 0x45, 0xe6, 0x65, 0x4b, 0xcc, 0xb3, 0xb3, 0xba, 0xe3, 0x98, 0x99, 0x21, 0xcc, 0xf1, 0xef, + 0x41, 0x21, 0x97, 0x96, 0x37, 0x71, 0x09, 0xcd, 0xac, 0xf5, 0x5a, 0x59, 0xba, 0xde, 0x66, 0x5b, + 0x20, 0x70, 0x27, 0xcd, 0x00, 0xb1, 0xb5, 0x10, 0x06, 0x85, 0x35, 0x83, 0x3f, 0x03, 0xff, 0xea, + 0x28, 0xf8, 0x39, 0x54, 0x17, 0x66, 0x5f, 0xe2, 0x92, 0xcd, 0xac, 0x4b, 0xca, 0xff, 0x13, 0x8f, + 0xe6, 0x91, 0xdc, 0xf8, 0x67, 0x1e, 0x64, 0x7a, 0xef, 0xa1, 0xf3, 0xc7, 0x4e, 0xec, 0x12, 0x01, + 0xca, 0x89, 0xab, 0x3e, 0xce, 0x5d, 0xf7, 0xf1, 0x36, 0xa0, 0x98, 0x84, 0x5e, 0x64, 0x06, 0x23, + 0x33, 0x22, 0xe1, 0xb9, 0x63,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0x85, 0x32, 0xba, 0xbe, + 0xbb, 0xe4, 0xde, 0x58, 0x78, 0x07, 0x4d, 0xbf, 0x09, 0x25, 0x51, 0xa9, 0x58, 0x74, 0x56, 0x76, + 0x37, 0xaf, 0x45, 0x40, 0xcb, 0x9f, 0x1a, 0xa9, 0x92, 0x2e, 0x2b, 0x32, 0x2a, 0x34, 0xbe, 0x2b, + 0x01, 0xcc, 0x37, 0x4e, 0xcf, 0x37, 0x24, 0x23, 0xe1, 0x5f, 0x3a, 0x9c, 0xa7, 0x7b, 0xe1, 0x35, + 0xe9, 0x5e, 0xbc, 0xee, 0x29, 0x15, 0x4a, 0x43, 0x32, 0xb2, 0x12, 0x37, 0x56, 0x4b, 0x3c, 0x59, + 0x04, 0xb9, 0x78, 0x54, 0xca, 0x95, 0xa3, 0xfa, 0x21, 0x54, 0xbc, 0xc4, 0x8d, 0x9d, 0x89, 0x4b, + 0xcc, 0x60, 0xa4, 0xc2, 0x96, 0xb4, 0x2d, 0x19, 0x90, 0xb2, 0xba, 0x23, 0x8a, 0xeb, 0x59, 0x97, + 0x8e, 0x97, 0x78, 0xec, 0x0a, 0x20, 0x19, 0x29, 0x89, 0x1f, 0xc1, 0x6d, 0x72, 0x69, 0xbb, 0x49, + 0xe4, 0x9c, 0x13, 0x33, 0xd5, 0xd9, 0x60, 0xf8, 0x68, 0x26, 0x78, 0x26, 0x94, 0x29, 0x8c, 0xe3, + 0x33, 0x95, 0xaa, 0x80, 0xe1, 0xe4, 0x15, 0x18, 0xa1, 0x53, 0xbb, 0x0a, 0x23, 0x94, 0xef, 0x03, + 0x78, 0xd6, 0xa5, 0xe9, 0x12, 0x7f, 0x1c, 0x9f, 0xa9, 0xb7, 0xb6, 0xa4, 0x6d, 0xd9, 0x28, 0x7b, + 0xd6, 0xe5, 0x11, 0x63, 0x30, 0xb1, 0xe3, 0xa7, 0x62, 0x24, 0xc4, 0x8e, 0x2f, 0xc4, 0x2a, 0x94, + 0x26, 0x56, 0x4c, 0x7d,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ff, 0xff, 0xe3, 0xbc, + 0xdd, 0xdd, 0xb3, 0x18, 0x00, 0x00, } diff --git a/protoc-gen-swagger/options/openapiv2.proto b/protoc-gen-swagger/options/openapiv2.proto index 83cb564fa58..3dcac4d99ff 100644 --- a/protoc-gen-swagger/options/openapiv2.proto +++ b/protoc-gen-swagger/options/openapiv2.proto @@ -84,8 +84,9 @@ message Response { Schema schema = 2; // field 3 is reserved for 'headers'. reserved 3; - // field 3 is reserved for 'example'. - reserved 4; + // `Examples` gives per-mimetype response examples. + // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#example-object + map examples = 4; map extensions = 5; } From 7242afcf3bd0f105f43b81ecf584bd77ad4a22d0 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 10 Feb 2020 12:38:22 +0000 Subject: [PATCH 511/552] protoc-gen-swagger: add default error response Adds a "default" error entry to all responses in the swagger definitions. Fixes #1122 --- Makefile | 2 +- examples/clients/abe/BUILD.bazel | 2 + examples/clients/abe/api/swagger.yaml | 160 ++++++++++++++ .../abe/api_a_bit_of_everything_service.go | 198 ++++++++++++++++++ .../abe/api_camel_case_service_name.go | 11 + examples/clients/abe/api_echo_rpc.go | 33 +++ examples/clients/abe/model_protobuf_any.go | 19 ++ examples/clients/abe/model_runtime_error.go | 18 ++ examples/clients/echo/BUILD.bazel | 2 + examples/clients/echo/api/swagger.yaml | 100 +++++++++ examples/clients/echo/api_echo_service.go | 77 +++++++ examples/clients/echo/model_protobuf_any.go | 18 ++ examples/clients/echo/model_runtime_error.go | 17 ++ examples/clients/responsebody/BUILD.bazel | 2 + .../clients/responsebody/api/swagger.yaml | 84 ++++++++ .../responsebody/api_response_body_service.go | 33 +++ .../clients/responsebody/docs/ProtobufAny.md | 11 + .../clients/responsebody/docs/RuntimeError.md | 13 ++ .../responsebody/model_protobuf_any.go | 18 ++ .../responsebody/model_runtime_error.go | 17 ++ examples/clients/unannotatedecho/BUILD.bazel | 2 + .../clients/unannotatedecho/api/swagger.yaml | 88 ++++++++ .../api_unannotated_echo_service.go | 44 ++++ .../unannotatedecho/model_protobuf_any.go | 18 ++ .../unannotatedecho/model_runtime_error.go | 17 ++ .../a_bit_of_everything.swagger.json | 168 +++++++++++++++ .../proto/examplepb/echo_service.swagger.json | 78 +++++++ .../response_body_service.swagger.json | 54 +++++ examples/proto/examplepb/stream.swagger.json | 39 ++++ .../unannotated_echo_service.swagger.json | 60 ++++++ .../examplepb/use_go_template.swagger.json | 48 +++++ .../proto/examplepb/wrappers.swagger.json | 102 +++++++++ internal/BUILD.bazel | 2 +- internal/errors.pb.go | 189 +++++++++++++++++ internal/errors.proto | 26 +++ internal/stream_chunk.pb.go | 119 ----------- internal/stream_chunk.proto | 15 -- protoc-gen-swagger/genswagger/template.go | 31 ++- .../genswagger/template_test.go | 2 +- runtime/errors.go | 20 +- 40 files changed, 1796 insertions(+), 161 deletions(-) create mode 100644 examples/clients/abe/model_protobuf_any.go create mode 100644 examples/clients/abe/model_runtime_error.go create mode 100644 examples/clients/echo/model_protobuf_any.go create mode 100644 examples/clients/echo/model_runtime_error.go create mode 100644 examples/clients/responsebody/docs/ProtobufAny.md create mode 100644 examples/clients/responsebody/docs/RuntimeError.md create mode 100644 examples/clients/responsebody/model_protobuf_any.go create mode 100644 examples/clients/responsebody/model_runtime_error.go create mode 100644 examples/clients/unannotatedecho/model_protobuf_any.go create mode 100644 examples/clients/unannotatedecho/model_runtime_error.go create mode 100644 internal/errors.pb.go create mode 100644 internal/errors.proto delete mode 100644 internal/stream_chunk.pb.go delete mode 100644 internal/stream_chunk.proto diff --git a/Makefile b/Makefile index eb31aa6d714..bd641d17240 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ SWAGGER_PLUGIN_FLAGS?= GOOGLEAPIS_DIR=third_party/googleapis OUTPUT_DIR=_output -RUNTIME_PROTO=internal/stream_chunk.proto +RUNTIME_PROTO=internal/errors.proto RUNTIME_GO=$(RUNTIME_PROTO:.proto=.pb.go) OPENAPIV2_PROTO=protoc-gen-swagger/options/openapiv2.proto protoc-gen-swagger/options/annotations.proto diff --git a/examples/clients/abe/BUILD.bazel b/examples/clients/abe/BUILD.bazel index d64c856782d..a54d462444e 100644 --- a/examples/clients/abe/BUILD.bazel +++ b/examples/clients/abe/BUILD.bazel @@ -20,7 +20,9 @@ go_library( "model_message_path_enum_nested_path_enum.go", "model_nested_deep_enum.go", "model_pathenum_path_enum.go", + "model_protobuf_any.go", "model_protobuf_field_mask.go", + "model_runtime_error.go", "model_sub_string_message.go", "response.go", ], diff --git a/examples/clients/abe/api/swagger.yaml b/examples/clients/abe/api/swagger.yaml index 91859be58e5..8c234914da2 100644 --- a/examples/clients/abe/api/swagger.yaml +++ b/examples/clients/abe/api/swagger.yaml @@ -59,6 +59,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/a_bit_of_everything/echo/{value}: get: tags: @@ -97,6 +101,10 @@ paths: description: "Returned when the resource is temporarily unavailable." schema: {} x-number: 100 + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" externalDocs: description: "Find out more Echo" url: "https://github.com/grpc-ecosystem/grpc-gateway" @@ -384,6 +392,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/a_bit_of_everything/params/get/{single_nested.name}: get: tags: @@ -675,6 +687,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/a_bit_of_everything/params/post/{string_value}: post: tags: @@ -710,6 +726,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/a_bit_of_everything/query/{uuid}: get: tags: @@ -1007,6 +1027,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" security: [] externalDocs: description: "Find out more about GetQuery" @@ -1161,6 +1185,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/a_bit_of_everything/{single_nested.name}: post: tags: @@ -1197,6 +1225,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/a_bit_of_everything/{uuid}: get: tags: @@ -1226,6 +1258,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" put: tags: - "ABitOfEverythingService" @@ -1259,6 +1295,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" delete: tags: - "ABitOfEverythingService" @@ -1286,6 +1326,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" security: - ApiKeyAuth: [] OAuth2: @@ -1479,6 +1523,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v2/example/a_bit_of_everything/{abe.uuid}: put: tags: @@ -1513,6 +1561,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" patch: tags: - "ABitOfEverythingService" @@ -1546,6 +1598,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v2/example/echo: get: tags: @@ -1585,6 +1641,10 @@ paths: description: "Returned when the resource is temporarily unavailable." schema: {} x-number: 100 + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" externalDocs: description: "Find out more Echo" url: "https://github.com/grpc-ecosystem/grpc-gateway" @@ -1626,6 +1686,10 @@ paths: description: "Returned when the resource is temporarily unavailable." schema: {} x-number: 100 + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" externalDocs: description: "Find out more Echo" url: "https://github.com/grpc-ecosystem/grpc-gateway" @@ -1652,6 +1716,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v2/example/errorwithdetails: get: tags: @@ -1675,6 +1743,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v2/example/postwithemptybody/{name}: post: tags: @@ -1709,6 +1781,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v2/example/timeout: get: tags: @@ -1732,6 +1808,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v2/example/withbody/{id}: post: tags: @@ -1766,6 +1846,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v2a/example/a_bit_of_everything/{abe.uuid}: patch: tags: @@ -1800,6 +1884,10 @@ paths: description: "I'm a teapot." schema: $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" securityDefinitions: ApiKeyAuth: type: "apiKey" @@ -2110,6 +2198,64 @@ definitions: - "ABC" - "DEF" default: "ABC" + protobufAny: + type: "object" + properties: + type_url: + type: "string" + description: "A URL/resource name that uniquely identifies the type of the\ + \ serialized\nprotocol buffer message. This string must contain at least\n\ + one \"/\" character. The last segment of the URL's path must represent\n\ + the fully qualified name of the type (as in\n`path/google.protobuf.Duration`).\ + \ The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\ + \nIn practice, teams usually precompile into the binary all types that they\n\ + expect it to use in the context of Any. However, for URLs which use the\n\ + scheme `http`, `https`, or no scheme, one can optionally set up a type\n\ + server that maps type URLs to message definitions as follows:\n\n* If no\ + \ scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must\ + \ yield a [google.protobuf.Type][]\n value in binary format, or produce\ + \ an error.\n* Applications are allowed to cache lookup results based on\ + \ the\n URL, or have them precompiled into a binary to avoid any\n lookup.\ + \ Therefore, binary compatibility needs to be preserved\n on changes to\ + \ types. (Use versioned type names to manage\n breaking changes.)\n\nNote:\ + \ this functionality is not currently available in the official\nprotobuf\ + \ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\ + \nSchemes other than `http`, `https` (or the empty scheme) might be\nused\ + \ with implementation specific semantics." + value: + type: "string" + format: "byte" + description: "Must be a valid serialized protocol buffer of the above specified\ + \ type." + pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" + description: "`Any` contains an arbitrary serialized protocol buffer message along\ + \ with a\nURL that describes the type of the serialized message.\n\nProtobuf\ + \ library provides support to pack/unpack Any values in the form\nof utility\ + \ functions or additional generated methods of the Any type.\n\nExample 1: Pack\ + \ and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n\ + \ ...\n if (any.UnpackTo(&foo)) {\n ...\n }\n\nExample 2: Pack\ + \ and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n\ + \ ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n\ + \ }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\ + \ any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n\ + \ any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in\ + \ Go\n\n foo := &pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n\ + \ ...\n foo := &pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo);\ + \ err != nil {\n ...\n }\n\nThe pack methods provided by protobuf\ + \ library will by default use\n'type.googleapis.com/full.type.name' as the type\ + \ URL and the unpack\nmethods only use the fully qualified type name after the\ + \ last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\n\ + name \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses\ + \ the regular\nrepresentation of the deserialized, embedded message, with an\n\ + additional field `@type` which contains the type URL. Example:\n\n package\ + \ google.profile;\n message Person {\n string first_name = 1;\n \ + \ string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\"\ + ,\n \"firstName\": ,\n \"lastName\": \n }\n\nIf\ + \ the embedded message type is well-known and has a custom JSON\nrepresentation,\ + \ that representation will be embedded adding a field\n`value` which holds the\ + \ custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\ + \n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n\ + \ \"value\": \"1.212s\"\n }" protobufFieldMask: type: "object" properties: @@ -2193,6 +2339,20 @@ definitions: \ API method which has a FieldMask type field in the\nrequest should verify\ \ the included field paths, and return an\n`INVALID_ARGUMENT` error if any path\ \ is duplicated or unmappable." + runtimeError: + type: "object" + properties: + error: + type: "string" + code: + type: "integer" + format: "int32" + message: + type: "string" + details: + type: "array" + items: + $ref: "#/definitions/protobufAny" subStringMessage: type: "object" properties: diff --git a/examples/clients/abe/api_a_bit_of_everything_service.go b/examples/clients/abe/api_a_bit_of_everything_service.go index 2bd1d972c20..f5d1759381e 100644 --- a/examples/clients/abe/api_a_bit_of_everything_service.go +++ b/examples/clients/abe/api_a_bit_of_everything_service.go @@ -317,6 +317,17 @@ func (a *ABitOfEverythingServiceApiService) CheckGetQueryParams(ctx context.Cont return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -613,6 +624,17 @@ func (a *ABitOfEverythingServiceApiService) CheckNestedEnumGetQueryParams(ctx co return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -750,6 +772,17 @@ func (a *ABitOfEverythingServiceApiService) CheckPostQueryParams(ctx context.Con return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -921,6 +954,17 @@ func (a *ABitOfEverythingServiceApiService) Create(ctx context.Context, floatVal return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -1056,6 +1100,17 @@ func (a *ABitOfEverythingServiceApiService) CreateBody(ctx context.Context, body return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -1193,6 +1248,17 @@ func (a *ABitOfEverythingServiceApiService) DeepPathEcho(ctx context.Context, si return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -1327,6 +1393,17 @@ func (a *ABitOfEverythingServiceApiService) Delete(ctx context.Context, uuid str return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -1459,6 +1536,17 @@ func (a *ABitOfEverythingServiceApiService) ErrorWithDetails(ctx context.Context return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -1596,6 +1684,17 @@ func (a *ABitOfEverythingServiceApiService) GetMessageWithBody(ctx context.Conte return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -1884,6 +1983,17 @@ func (a *ABitOfEverythingServiceApiService) GetQuery(ctx context.Context, uuid s return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -2096,6 +2206,17 @@ func (a *ABitOfEverythingServiceApiService) GetRepeatedQuery(ctx context.Context return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -2230,6 +2351,17 @@ func (a *ABitOfEverythingServiceApiService) Lookup(ctx context.Context, uuid str return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -2367,6 +2499,17 @@ func (a *ABitOfEverythingServiceApiService) PostWithEmptyBody(ctx context.Contex return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -2499,6 +2642,17 @@ func (a *ABitOfEverythingServiceApiService) Timeout(ctx context.Context) (interf return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -2636,6 +2790,17 @@ func (a *ABitOfEverythingServiceApiService) Update(ctx context.Context, uuid str return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -2773,6 +2938,17 @@ func (a *ABitOfEverythingServiceApiService) UpdateV2(ctx context.Context, abeUui return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -2910,6 +3086,17 @@ func (a *ABitOfEverythingServiceApiService) UpdateV22(ctx context.Context, abeUu return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -3047,6 +3234,17 @@ func (a *ABitOfEverythingServiceApiService) UpdateV23(ctx context.Context, abeUu return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } diff --git a/examples/clients/abe/api_camel_case_service_name.go b/examples/clients/abe/api_camel_case_service_name.go index 80d867e660c..8a12b878ef7 100644 --- a/examples/clients/abe/api_camel_case_service_name.go +++ b/examples/clients/abe/api_camel_case_service_name.go @@ -151,6 +151,17 @@ func (a *CamelCaseServiceNameApiService) Empty(ctx context.Context) (interface{} return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } diff --git a/examples/clients/abe/api_echo_rpc.go b/examples/clients/abe/api_echo_rpc.go index 1dab0dc55f0..e8979f37579 100644 --- a/examples/clients/abe/api_echo_rpc.go +++ b/examples/clients/abe/api_echo_rpc.go @@ -167,6 +167,17 @@ func (a *EchoRpcApiService) Echo(ctx context.Context, value string) (SubStringMe return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -314,6 +325,17 @@ func (a *EchoRpcApiService) Echo2(ctx context.Context, body string) (SubStringMe return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -468,6 +490,17 @@ func (a *EchoRpcApiService) Echo3(ctx context.Context, localVarOptionals *Echo3O return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } diff --git a/examples/clients/abe/model_protobuf_any.go b/examples/clients/abe/model_protobuf_any.go new file mode 100644 index 00000000000..f3e536a4ab5 --- /dev/null +++ b/examples/clients/abe/model_protobuf_any.go @@ -0,0 +1,19 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +// `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := ptypes.MarshalAny(foo) ... foo := &pb.Foo{} if err := ptypes.UnmarshalAny(any, foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": , \"lastName\": } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" } +type ProtobufAny struct { + // A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. + TypeUrl string `json:"type_url,omitempty"` + // Must be a valid serialized protocol buffer of the above specified type. + Value string `json:"value,omitempty"` +} diff --git a/examples/clients/abe/model_runtime_error.go b/examples/clients/abe/model_runtime_error.go new file mode 100644 index 00000000000..9674e976dc7 --- /dev/null +++ b/examples/clients/abe/model_runtime_error.go @@ -0,0 +1,18 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +type RuntimeError struct { + Error_ string `json:"error,omitempty"` + Code int32 `json:"code,omitempty"` + Message string `json:"message,omitempty"` + Details []ProtobufAny `json:"details,omitempty"` +} diff --git a/examples/clients/echo/BUILD.bazel b/examples/clients/echo/BUILD.bazel index 31ac6d56986..5700dd477c1 100644 --- a/examples/clients/echo/BUILD.bazel +++ b/examples/clients/echo/BUILD.bazel @@ -10,6 +10,8 @@ go_library( "configuration.go", "model_examplepb_embedded.go", "model_examplepb_simple_message.go", + "model_protobuf_any.go", + "model_runtime_error.go", "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo", diff --git a/examples/clients/echo/api/swagger.yaml b/examples/clients/echo/api/swagger.yaml index 9d28a1ab99b..7df1b8731c5 100644 --- a/examples/clients/echo/api/swagger.yaml +++ b/examples/clients/echo/api/swagger.yaml @@ -28,6 +28,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/echo/{id}/{num}: get: tags: @@ -99,6 +103,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/echo/{id}/{num}/{lang}: get: tags: @@ -169,6 +177,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/echo1/{id}/{line_num}/{status.note}: get: tags: @@ -233,6 +245,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/echo2/{no.note}: get: tags: @@ -299,6 +315,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/echo_body: post: tags: @@ -317,6 +337,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/echo_delete: delete: tags: @@ -389,6 +413,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" definitions: examplepbEmbedded: type: "object" @@ -436,3 +464,75 @@ definitions: status: note: "note" progress: "progress" + protobufAny: + type: "object" + properties: + type_url: + type: "string" + description: "A URL/resource name that uniquely identifies the type of the\ + \ serialized\nprotocol buffer message. This string must contain at least\n\ + one \"/\" character. The last segment of the URL's path must represent\n\ + the fully qualified name of the type (as in\n`path/google.protobuf.Duration`).\ + \ The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\ + \nIn practice, teams usually precompile into the binary all types that they\n\ + expect it to use in the context of Any. However, for URLs which use the\n\ + scheme `http`, `https`, or no scheme, one can optionally set up a type\n\ + server that maps type URLs to message definitions as follows:\n\n* If no\ + \ scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must\ + \ yield a [google.protobuf.Type][]\n value in binary format, or produce\ + \ an error.\n* Applications are allowed to cache lookup results based on\ + \ the\n URL, or have them precompiled into a binary to avoid any\n lookup.\ + \ Therefore, binary compatibility needs to be preserved\n on changes to\ + \ types. (Use versioned type names to manage\n breaking changes.)\n\nNote:\ + \ this functionality is not currently available in the official\nprotobuf\ + \ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\ + \nSchemes other than `http`, `https` (or the empty scheme) might be\nused\ + \ with implementation specific semantics." + value: + type: "string" + format: "byte" + description: "Must be a valid serialized protocol buffer of the above specified\ + \ type." + pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" + description: "`Any` contains an arbitrary serialized protocol buffer message along\ + \ with a\nURL that describes the type of the serialized message.\n\nProtobuf\ + \ library provides support to pack/unpack Any values in the form\nof utility\ + \ functions or additional generated methods of the Any type.\n\nExample 1: Pack\ + \ and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n\ + \ ...\n if (any.UnpackTo(&foo)) {\n ...\n }\n\nExample 2: Pack\ + \ and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n\ + \ ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n\ + \ }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\ + \ any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n\ + \ any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in\ + \ Go\n\n foo := &pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n\ + \ ...\n foo := &pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo);\ + \ err != nil {\n ...\n }\n\nThe pack methods provided by protobuf\ + \ library will by default use\n'type.googleapis.com/full.type.name' as the type\ + \ URL and the unpack\nmethods only use the fully qualified type name after the\ + \ last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\n\ + name \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses\ + \ the regular\nrepresentation of the deserialized, embedded message, with an\n\ + additional field `@type` which contains the type URL. Example:\n\n package\ + \ google.profile;\n message Person {\n string first_name = 1;\n \ + \ string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\"\ + ,\n \"firstName\": ,\n \"lastName\": \n }\n\nIf\ + \ the embedded message type is well-known and has a custom JSON\nrepresentation,\ + \ that representation will be embedded adding a field\n`value` which holds the\ + \ custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\ + \n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n\ + \ \"value\": \"1.212s\"\n }" + runtimeError: + type: "object" + properties: + error: + type: "string" + code: + type: "integer" + format: "int32" + message: + type: "string" + details: + type: "array" + items: + $ref: "#/definitions/protobufAny" diff --git a/examples/clients/echo/api_echo_service.go b/examples/clients/echo/api_echo_service.go index 5e5b44b450d..40524345aa6 100644 --- a/examples/clients/echo/api_echo_service.go +++ b/examples/clients/echo/api_echo_service.go @@ -109,6 +109,17 @@ func (a *EchoServiceApiService) Echo(ctx context.Context, id string) (ExamplepbS return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -240,6 +251,17 @@ func (a *EchoServiceApiService) Echo2(ctx context.Context, id string, num string return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -368,6 +390,17 @@ func (a *EchoServiceApiService) Echo3(ctx context.Context, id string, num string return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -491,6 +524,17 @@ func (a *EchoServiceApiService) Echo4(ctx context.Context, id string, lineNum st return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -620,6 +664,17 @@ func (a *EchoServiceApiService) Echo5(ctx context.Context, noNote string, localV return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -709,6 +764,17 @@ func (a *EchoServiceApiService) EchoBody(ctx context.Context, body ExamplepbSimp return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -845,6 +911,17 @@ func (a *EchoServiceApiService) EchoDelete(ctx context.Context, localVarOptional return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } diff --git a/examples/clients/echo/model_protobuf_any.go b/examples/clients/echo/model_protobuf_any.go new file mode 100644 index 00000000000..198cda747f2 --- /dev/null +++ b/examples/clients/echo/model_protobuf_any.go @@ -0,0 +1,18 @@ +/* + * Echo Service + * + * Echo Service API consists of a single service which returns a message. + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package echo + +// `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := ptypes.MarshalAny(foo) ... foo := &pb.Foo{} if err := ptypes.UnmarshalAny(any, foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": , \"lastName\": } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" } +type ProtobufAny struct { + // A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. + TypeUrl string `json:"type_url,omitempty"` + // Must be a valid serialized protocol buffer of the above specified type. + Value string `json:"value,omitempty"` +} diff --git a/examples/clients/echo/model_runtime_error.go b/examples/clients/echo/model_runtime_error.go new file mode 100644 index 00000000000..836afd7ac6b --- /dev/null +++ b/examples/clients/echo/model_runtime_error.go @@ -0,0 +1,17 @@ +/* + * Echo Service + * + * Echo Service API consists of a single service which returns a message. + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package echo + +type RuntimeError struct { + Error_ string `json:"error,omitempty"` + Code int32 `json:"code,omitempty"` + Message string `json:"message,omitempty"` + Details []ProtobufAny `json:"details,omitempty"` +} diff --git a/examples/clients/responsebody/BUILD.bazel b/examples/clients/responsebody/BUILD.bazel index f5fb6a134ad..cf94bfa564a 100644 --- a/examples/clients/responsebody/BUILD.bazel +++ b/examples/clients/responsebody/BUILD.bazel @@ -11,7 +11,9 @@ go_library( "model_examplepb_repeated_response_strings.go", "model_examplepb_response_body_out.go", "model_examplepb_response_body_out_response.go", + "model_protobuf_any.go", "model_response_response_type.go", + "model_runtime_error.go", "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/responsebody", diff --git a/examples/clients/responsebody/api/swagger.yaml b/examples/clients/responsebody/api/swagger.yaml index b94a7273d45..30d7604c7ff 100644 --- a/examples/clients/responsebody/api/swagger.yaml +++ b/examples/clients/responsebody/api/swagger.yaml @@ -26,6 +26,10 @@ paths: type: "array" items: $ref: "#/definitions/examplepbRepeatedResponseBodyOutResponse" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /responsebody/{data}: get: tags: @@ -42,6 +46,10 @@ paths: description: "" schema: $ref: "#/definitions/examplepbResponseBodyOutResponse" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /responsestrings/{data}: get: tags: @@ -60,6 +68,10 @@ paths: type: "array" items: type: "string" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" definitions: ResponseResponseType: type: "string" @@ -105,3 +117,75 @@ definitions: type: "string" example: data: "data" + protobufAny: + type: "object" + properties: + type_url: + type: "string" + description: "A URL/resource name that uniquely identifies the type of the\ + \ serialized\nprotocol buffer message. This string must contain at least\n\ + one \"/\" character. The last segment of the URL's path must represent\n\ + the fully qualified name of the type (as in\n`path/google.protobuf.Duration`).\ + \ The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\ + \nIn practice, teams usually precompile into the binary all types that they\n\ + expect it to use in the context of Any. However, for URLs which use the\n\ + scheme `http`, `https`, or no scheme, one can optionally set up a type\n\ + server that maps type URLs to message definitions as follows:\n\n* If no\ + \ scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must\ + \ yield a [google.protobuf.Type][]\n value in binary format, or produce\ + \ an error.\n* Applications are allowed to cache lookup results based on\ + \ the\n URL, or have them precompiled into a binary to avoid any\n lookup.\ + \ Therefore, binary compatibility needs to be preserved\n on changes to\ + \ types. (Use versioned type names to manage\n breaking changes.)\n\nNote:\ + \ this functionality is not currently available in the official\nprotobuf\ + \ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\ + \nSchemes other than `http`, `https` (or the empty scheme) might be\nused\ + \ with implementation specific semantics." + value: + type: "string" + format: "byte" + description: "Must be a valid serialized protocol buffer of the above specified\ + \ type." + pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" + description: "`Any` contains an arbitrary serialized protocol buffer message along\ + \ with a\nURL that describes the type of the serialized message.\n\nProtobuf\ + \ library provides support to pack/unpack Any values in the form\nof utility\ + \ functions or additional generated methods of the Any type.\n\nExample 1: Pack\ + \ and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n\ + \ ...\n if (any.UnpackTo(&foo)) {\n ...\n }\n\nExample 2: Pack\ + \ and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n\ + \ ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n\ + \ }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\ + \ any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n\ + \ any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in\ + \ Go\n\n foo := &pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n\ + \ ...\n foo := &pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo);\ + \ err != nil {\n ...\n }\n\nThe pack methods provided by protobuf\ + \ library will by default use\n'type.googleapis.com/full.type.name' as the type\ + \ URL and the unpack\nmethods only use the fully qualified type name after the\ + \ last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\n\ + name \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses\ + \ the regular\nrepresentation of the deserialized, embedded message, with an\n\ + additional field `@type` which contains the type URL. Example:\n\n package\ + \ google.profile;\n message Person {\n string first_name = 1;\n \ + \ string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\"\ + ,\n \"firstName\": ,\n \"lastName\": \n }\n\nIf\ + \ the embedded message type is well-known and has a custom JSON\nrepresentation,\ + \ that representation will be embedded adding a field\n`value` which holds the\ + \ custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\ + \n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n\ + \ \"value\": \"1.212s\"\n }" + runtimeError: + type: "object" + properties: + error: + type: "string" + code: + type: "integer" + format: "int32" + message: + type: "string" + details: + type: "array" + items: + $ref: "#/definitions/protobufAny" diff --git a/examples/clients/responsebody/api_response_body_service.go b/examples/clients/responsebody/api_response_body_service.go index 4d534a3867e..575d8b40eb4 100644 --- a/examples/clients/responsebody/api_response_body_service.go +++ b/examples/clients/responsebody/api_response_body_service.go @@ -107,6 +107,17 @@ func (a *ResponseBodyServiceApiService) GetResponseBody(ctx context.Context, dat return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -195,6 +206,17 @@ func (a *ResponseBodyServiceApiService) ListResponseBodies(ctx context.Context, return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -283,6 +305,17 @@ func (a *ResponseBodyServiceApiService) ListResponseStrings(ctx context.Context, return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } diff --git a/examples/clients/responsebody/docs/ProtobufAny.md b/examples/clients/responsebody/docs/ProtobufAny.md new file mode 100644 index 00000000000..50aaf9e772b --- /dev/null +++ b/examples/clients/responsebody/docs/ProtobufAny.md @@ -0,0 +1,11 @@ +# ProtobufAny + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TypeUrl** | **string** | A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. | [optional] [default to null] +**Value** | **string** | Must be a valid serialized protocol buffer of the above specified type. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/clients/responsebody/docs/RuntimeError.md b/examples/clients/responsebody/docs/RuntimeError.md new file mode 100644 index 00000000000..664dd90b514 --- /dev/null +++ b/examples/clients/responsebody/docs/RuntimeError.md @@ -0,0 +1,13 @@ +# RuntimeError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Error_** | **string** | | [optional] [default to null] +**Code** | **int32** | | [optional] [default to null] +**Message** | **string** | | [optional] [default to null] +**Details** | [**[]ProtobufAny**](protobufAny.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/clients/responsebody/model_protobuf_any.go b/examples/clients/responsebody/model_protobuf_any.go new file mode 100644 index 00000000000..902926206f8 --- /dev/null +++ b/examples/clients/responsebody/model_protobuf_any.go @@ -0,0 +1,18 @@ +/* + * examples/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package responsebody + +// `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := ptypes.MarshalAny(foo) ... foo := &pb.Foo{} if err := ptypes.UnmarshalAny(any, foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": , \"lastName\": } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" } +type ProtobufAny struct { + // A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. + TypeUrl string `json:"type_url,omitempty"` + // Must be a valid serialized protocol buffer of the above specified type. + Value string `json:"value,omitempty"` +} diff --git a/examples/clients/responsebody/model_runtime_error.go b/examples/clients/responsebody/model_runtime_error.go new file mode 100644 index 00000000000..a7f7a1d0569 --- /dev/null +++ b/examples/clients/responsebody/model_runtime_error.go @@ -0,0 +1,17 @@ +/* + * examples/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package responsebody + +type RuntimeError struct { + Error_ string `json:"error,omitempty"` + Code int32 `json:"code,omitempty"` + Message string `json:"message,omitempty"` + Details []ProtobufAny `json:"details,omitempty"` +} diff --git a/examples/clients/unannotatedecho/BUILD.bazel b/examples/clients/unannotatedecho/BUILD.bazel index 06348263dc7..f34a3fac4e0 100644 --- a/examples/clients/unannotatedecho/BUILD.bazel +++ b/examples/clients/unannotatedecho/BUILD.bazel @@ -9,6 +9,8 @@ go_library( "client.go", "configuration.go", "model_examplepb_unannotated_simple_message.go", + "model_protobuf_any.go", + "model_runtime_error.go", "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/unannotatedecho", diff --git a/examples/clients/unannotatedecho/api/swagger.yaml b/examples/clients/unannotatedecho/api/swagger.yaml index 3a439d45a10..da2fb50e598 100644 --- a/examples/clients/unannotatedecho/api/swagger.yaml +++ b/examples/clients/unannotatedecho/api/swagger.yaml @@ -31,6 +31,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbUnannotatedSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/echo/{id}/{num}: get: tags: @@ -62,6 +66,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbUnannotatedSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/echo_body: post: tags: @@ -80,6 +88,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbUnannotatedSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v1/example/echo_delete: delete: tags: @@ -112,6 +124,10 @@ paths: description: "A successful response." schema: $ref: "#/definitions/examplepbUnannotatedSimpleMessage" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" definitions: examplepbUnannotatedSimpleMessage: type: "object" @@ -130,3 +146,75 @@ definitions: duration: "duration" num: "num" id: "id" + protobufAny: + type: "object" + properties: + type_url: + type: "string" + description: "A URL/resource name that uniquely identifies the type of the\ + \ serialized\nprotocol buffer message. This string must contain at least\n\ + one \"/\" character. The last segment of the URL's path must represent\n\ + the fully qualified name of the type (as in\n`path/google.protobuf.Duration`).\ + \ The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\ + \nIn practice, teams usually precompile into the binary all types that they\n\ + expect it to use in the context of Any. However, for URLs which use the\n\ + scheme `http`, `https`, or no scheme, one can optionally set up a type\n\ + server that maps type URLs to message definitions as follows:\n\n* If no\ + \ scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must\ + \ yield a [google.protobuf.Type][]\n value in binary format, or produce\ + \ an error.\n* Applications are allowed to cache lookup results based on\ + \ the\n URL, or have them precompiled into a binary to avoid any\n lookup.\ + \ Therefore, binary compatibility needs to be preserved\n on changes to\ + \ types. (Use versioned type names to manage\n breaking changes.)\n\nNote:\ + \ this functionality is not currently available in the official\nprotobuf\ + \ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\ + \nSchemes other than `http`, `https` (or the empty scheme) might be\nused\ + \ with implementation specific semantics." + value: + type: "string" + format: "byte" + description: "Must be a valid serialized protocol buffer of the above specified\ + \ type." + pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" + description: "`Any` contains an arbitrary serialized protocol buffer message along\ + \ with a\nURL that describes the type of the serialized message.\n\nProtobuf\ + \ library provides support to pack/unpack Any values in the form\nof utility\ + \ functions or additional generated methods of the Any type.\n\nExample 1: Pack\ + \ and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n\ + \ ...\n if (any.UnpackTo(&foo)) {\n ...\n }\n\nExample 2: Pack\ + \ and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n\ + \ ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n\ + \ }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\ + \ any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n\ + \ any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in\ + \ Go\n\n foo := &pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n\ + \ ...\n foo := &pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo);\ + \ err != nil {\n ...\n }\n\nThe pack methods provided by protobuf\ + \ library will by default use\n'type.googleapis.com/full.type.name' as the type\ + \ URL and the unpack\nmethods only use the fully qualified type name after the\ + \ last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\n\ + name \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses\ + \ the regular\nrepresentation of the deserialized, embedded message, with an\n\ + additional field `@type` which contains the type URL. Example:\n\n package\ + \ google.profile;\n message Person {\n string first_name = 1;\n \ + \ string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\"\ + ,\n \"firstName\": ,\n \"lastName\": \n }\n\nIf\ + \ the embedded message type is well-known and has a custom JSON\nrepresentation,\ + \ that representation will be embedded adding a field\n`value` which holds the\ + \ custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\ + \n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n\ + \ \"value\": \"1.212s\"\n }" + runtimeError: + type: "object" + properties: + error: + type: "string" + code: + type: "integer" + format: "int32" + message: + type: "string" + details: + type: "array" + items: + $ref: "#/definitions/protobufAny" diff --git a/examples/clients/unannotatedecho/api_unannotated_echo_service.go b/examples/clients/unannotatedecho/api_unannotated_echo_service.go index 7bbd4f9e92f..d864a7411e7 100644 --- a/examples/clients/unannotatedecho/api_unannotated_echo_service.go +++ b/examples/clients/unannotatedecho/api_unannotated_echo_service.go @@ -109,6 +109,17 @@ func (a *UnannotatedEchoServiceApiService) Echo(ctx context.Context, id string) return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -210,6 +221,17 @@ func (a *UnannotatedEchoServiceApiService) Echo2(ctx context.Context, id string, return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -299,6 +321,17 @@ func (a *UnannotatedEchoServiceApiService) EchoBody(ctx context.Context, body Ex return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } @@ -405,6 +438,17 @@ func (a *UnannotatedEchoServiceApiService) EchoDelete(ctx context.Context, local return localVarReturnValue, localVarHttpResponse, newErr } + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr } diff --git a/examples/clients/unannotatedecho/model_protobuf_any.go b/examples/clients/unannotatedecho/model_protobuf_any.go new file mode 100644 index 00000000000..6959023a2ac --- /dev/null +++ b/examples/clients/unannotatedecho/model_protobuf_any.go @@ -0,0 +1,18 @@ +/* + * examples/proto/examplepb/unannotated_echo_service.proto + * + * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package unannotatedecho + +// `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := ptypes.MarshalAny(foo) ... foo := &pb.Foo{} if err := ptypes.UnmarshalAny(any, foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": , \"lastName\": } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" } +type ProtobufAny struct { + // A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. + TypeUrl string `json:"type_url,omitempty"` + // Must be a valid serialized protocol buffer of the above specified type. + Value string `json:"value,omitempty"` +} diff --git a/examples/clients/unannotatedecho/model_runtime_error.go b/examples/clients/unannotatedecho/model_runtime_error.go new file mode 100644 index 00000000000..30f7572025d --- /dev/null +++ b/examples/clients/unannotatedecho/model_runtime_error.go @@ -0,0 +1,17 @@ +/* + * examples/proto/examplepb/unannotated_echo_service.proto + * + * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package unannotatedecho + +type RuntimeError struct { + Error_ string `json:"error,omitempty"` + Code int32 `json:"code,omitempty"` + Message string `json:"message,omitempty"` + Details []ProtobufAny `json:"details,omitempty"` +} diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 033eb3e2f2c..61f298f170a 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -54,6 +54,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -109,6 +115,12 @@ "description": "Returned when the resource is temporarily unavailable.", "schema": {}, "x-number": 100 + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -154,6 +166,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -463,6 +481,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -778,6 +802,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -827,6 +857,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1157,6 +1193,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1338,6 +1380,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1388,6 +1436,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1427,6 +1481,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1476,6 +1536,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1525,6 +1591,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1755,6 +1827,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1802,6 +1880,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1863,6 +1947,12 @@ "description": "Returned when the resource is temporarily unavailable.", "schema": {}, "x-number": 100 + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1918,6 +2008,12 @@ "description": "Returned when the resource is temporarily unavailable.", "schema": {}, "x-number": 100 + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -1965,6 +2061,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "tags": [ @@ -1998,6 +2100,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "tags": [ @@ -2031,6 +2139,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -2080,6 +2194,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "tags": [ @@ -2113,6 +2233,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -2162,6 +2288,12 @@ "schema": { "$ref": "#/definitions/examplepbNumericEnum" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -2580,6 +2712,21 @@ ], "default": "ABC" }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string", + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + }, + "value": { + "type": "string", + "format": "byte", + "description": "Must be a valid serialized protocol buffer of the above specified type." + } + }, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n ...\n foo := \u0026pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, "protobufFieldMask": { "type": "object", "properties": { @@ -2594,6 +2741,27 @@ "description": "paths: \"f.a\"\n paths: \"f.b.d\"\n\nHere `f` represents a field in some root message, `a` and `b`\nfields in the message found in `f`, and `d` a field found in the\nmessage in `f.b`.\n\nField masks are used to specify a subset of fields that should be\nreturned by a get operation or modified by an update operation.\nField masks also have a custom JSON encoding (see below).\n\n# Field Masks in Projections\n\nWhen used in the context of a projection, a response message or\nsub-message is filtered by the API to only contain those fields as\nspecified in the mask. For example, if the mask in the previous\nexample is applied to a response message as follows:\n\n f {\n a : 22\n b {\n d : 1\n x : 2\n }\n y : 13\n }\n z: 8\n\nThe result will not contain specific values for fields x,y and z\n(their value will be set to the default, and omitted in proto text\noutput):\n\n\n f {\n a : 22\n b {\n d : 1\n }\n }\n\nA repeated field is not allowed except at the last position of a\npaths string.\n\nIf a FieldMask object is not present in a get operation, the\noperation applies to all fields (as if a FieldMask of all fields\nhad been specified).\n\nNote that a field mask does not necessarily apply to the\ntop-level response message. In case of a REST get operation, the\nfield mask applies directly to the response, but in case of a REST\nlist operation, the mask instead applies to each individual message\nin the returned resource list. In case of a REST custom method,\nother definitions may be used. Where the mask applies will be\nclearly documented together with its declaration in the API. In\nany case, the effect on the returned resource/resources is required\nbehavior for APIs.\n\n# Field Masks in Update Operations\n\nA field mask in update operations specifies which fields of the\ntargeted resource are going to be updated. The API is required\nto only change the values of the fields as specified in the mask\nand leave the others untouched. If a resource is passed in to\ndescribe the updated values, the API ignores the values of all\nfields not covered by the mask.\n\nIf a repeated field is specified for an update operation, new values will\nbe appended to the existing repeated field in the target resource. Note that\na repeated field is only allowed in the last position of a `paths` string.\n\nIf a sub-message is specified in the last position of the field mask for an\nupdate operation, then new value will be merged into the existing sub-message\nin the target resource.\n\nFor example, given the target message:\n\n f {\n b {\n d: 1\n x: 2\n }\n c: [1]\n }\n\nAnd an update message:\n\n f {\n b {\n d: 10\n }\n c: [2]\n }\n\nthen if the field mask is:\n\n paths: [\"f.b\", \"f.c\"]\n\nthen the result will be:\n\n f {\n b {\n d: 10\n x: 2\n }\n c: [1, 2]\n }\n\nAn implementation may provide options to override this default behavior for\nrepeated and message fields.\n\nIn order to reset a field's value to the default, the field must\nbe in the mask and set to the default value in the provided resource.\nHence, in order to reset all fields of a resource, provide a default\ninstance of the resource and set all fields in the mask, or do\nnot provide a mask as described below.\n\nIf a field mask is not present on update, the operation applies to\nall fields (as if a field mask of all fields has been specified).\nNote that in the presence of schema evolution, this may mean that\nfields the client does not know and has therefore not filled into\nthe request will be reset to their default. If this is unwanted\nbehavior, a specific service may require a client to always specify\na field mask, producing an error if not.\n\nAs with get operations, the location of the resource which\ndescribes the updated values in the request message depends on the\noperation kind. In any case, the effect of the field mask is\nrequired to be honored by the API.\n\n## Considerations for HTTP REST\n\nThe HTTP kind of an update operation which uses a field mask must\nbe set to PATCH instead of PUT in order to satisfy HTTP semantics\n(PUT must only be used for full updates).\n\n# JSON Encoding of Field Masks\n\nIn JSON, a field mask is encoded as a single string where paths are\nseparated by a comma. Fields name in each path are converted\nto/from lower-camel naming conventions.\n\nAs an example, consider the following message declarations:\n\n message Profile {\n User user = 1;\n Photo photo = 2;\n }\n message User {\n string display_name = 1;\n string address = 2;\n }\n\nIn proto a field mask for `Profile` may look as such:\n\n mask {\n paths: \"user.display_name\"\n paths: \"photo\"\n }\n\nIn JSON, the same mask is represented as below:\n\n {\n mask: \"user.displayName,photo\"\n }\n\n# Field Masks and Oneof Fields\n\nField masks treat fields in oneofs just as regular fields. Consider the\nfollowing message:\n\n message SampleMessage {\n oneof test_oneof {\n string name = 4;\n SubMessage sub_message = 9;\n }\n }\n\nThe field mask can be:\n\n mask {\n paths: \"name\"\n }\n\nOr:\n\n mask {\n paths: \"sub_message\"\n }\n\nNote that oneof type names (\"test_oneof\" in this case) cannot be used in\npaths.\n\n## Field Mask Verification\n\nThe implementation of any API method which has a FieldMask type field in the\nrequest should verify the included field paths, and return an\n`INVALID_ARGUMENT` error if any path is duplicated or unmappable.", "title": "`FieldMask` represents a set of symbolic field paths, for example:" }, + "runtimeError": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, "subStringMessage": { "type": "object", "properties": { diff --git a/examples/proto/examplepb/echo_service.swagger.json b/examples/proto/examplepb/echo_service.swagger.json index 45187c3e463..f7b35c2ddee 100644 --- a/examples/proto/examplepb/echo_service.swagger.json +++ b/examples/proto/examplepb/echo_service.swagger.json @@ -23,6 +23,12 @@ "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -50,6 +56,12 @@ "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -130,6 +142,12 @@ "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -210,6 +228,12 @@ "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -284,6 +308,12 @@ "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -357,6 +387,12 @@ "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -384,6 +420,12 @@ "schema": { "$ref": "#/definitions/examplepbSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -498,6 +540,42 @@ } }, "description": "SimpleMessage represents a simple message sent to the Echo service." + }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string", + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + }, + "value": { + "type": "string", + "format": "byte", + "description": "Must be a valid serialized protocol buffer of the above specified type." + } + }, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n ...\n foo := \u0026pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "runtimeError": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } } } } diff --git a/examples/proto/examplepb/response_body_service.swagger.json b/examples/proto/examplepb/response_body_service.swagger.json index ea0ced6dcdb..50fa2d025c4 100644 --- a/examples/proto/examplepb/response_body_service.swagger.json +++ b/examples/proto/examplepb/response_body_service.swagger.json @@ -23,6 +23,12 @@ "$ref": "#/definitions/examplepbRepeatedResponseBodyOutResponse" } } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -47,6 +53,12 @@ "schema": { "$ref": "#/definitions/examplepbResponseBodyOutResponse" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -74,6 +86,12 @@ "type": "string" } } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -149,6 +167,42 @@ "type": "string" } } + }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string", + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + }, + "value": { + "type": "string", + "format": "byte", + "description": "Must be a valid serialized protocol buffer of the above specified type." + } + }, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n ...\n foo := \u0026pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "runtimeError": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } } } } diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/proto/examplepb/stream.swagger.json index 84215a088c1..c4c696989a6 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/proto/examplepb/stream.swagger.json @@ -29,6 +29,12 @@ }, "title": "Stream result of examplepbABitOfEverything" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "tags": [ @@ -45,6 +51,12 @@ "schema": { "properties": {} } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -81,6 +93,12 @@ }, "title": "Stream result of subStringMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -359,6 +377,27 @@ }, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n ...\n foo := \u0026pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, + "runtimeError": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, "runtimeStreamError": { "type": "object", "properties": { diff --git a/examples/proto/examplepb/unannotated_echo_service.swagger.json b/examples/proto/examplepb/unannotated_echo_service.swagger.json index 26dc292cc17..c33a67d98f6 100644 --- a/examples/proto/examplepb/unannotated_echo_service.swagger.json +++ b/examples/proto/examplepb/unannotated_echo_service.swagger.json @@ -23,6 +23,12 @@ "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -50,6 +56,12 @@ "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -89,6 +101,12 @@ "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -116,6 +134,12 @@ "schema": { "$ref": "#/definitions/examplepbUnannotatedSimpleMessage" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -163,6 +187,42 @@ } }, "description": "UnannotatedSimpleMessage represents a simple message sent to the unannotated Echo service." + }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string", + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + }, + "value": { + "type": "string", + "format": "byte", + "description": "Must be a valid serialized protocol buffer of the above specified type." + } + }, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n ...\n foo := \u0026pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "runtimeError": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } } } } diff --git a/examples/proto/examplepb/use_go_template.swagger.json b/examples/proto/examplepb/use_go_template.swagger.json index 011b33aeaf7..c85ad10e119 100644 --- a/examples/proto/examplepb/use_go_template.swagger.json +++ b/examples/proto/examplepb/use_go_template.swagger.json @@ -22,6 +22,12 @@ "schema": { "$ref": "#/definitions/examplepbLoginReply" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -50,6 +56,12 @@ "schema": { "$ref": "#/definitions/examplepbLogoutReply" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -126,6 +138,42 @@ "title": "This is an array" } } + }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string", + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + }, + "value": { + "type": "string", + "format": "byte", + "description": "Must be a valid serialized protocol buffer of the above specified type." + } + }, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n ...\n foo := \u0026pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "runtimeError": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } } } } diff --git a/examples/proto/examplepb/wrappers.swagger.json b/examples/proto/examplepb/wrappers.swagger.json index 7c7c8566bd6..b6a93601d36 100644 --- a/examples/proto/examplepb/wrappers.swagger.json +++ b/examples/proto/examplepb/wrappers.swagger.json @@ -20,6 +20,12 @@ "schema": { "$ref": "#/definitions/examplepbWrappers" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -47,6 +53,12 @@ "type": "boolean", "format": "boolean" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -75,6 +87,12 @@ "type": "string", "format": "byte" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -103,6 +121,12 @@ "type": "number", "format": "double" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -130,6 +154,12 @@ "schema": { "properties": {} } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -157,6 +187,12 @@ "type": "number", "format": "float" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -185,6 +221,12 @@ "type": "integer", "format": "int32" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -213,6 +255,12 @@ "type": "string", "format": "int64" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -240,6 +288,12 @@ "schema": { "type": "string" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -267,6 +321,12 @@ "type": "integer", "format": "int64" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -295,6 +355,12 @@ "type": "string", "format": "uint64" } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } } }, "parameters": [ @@ -354,6 +420,42 @@ "format": "byte" } } + }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string", + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + }, + "value": { + "type": "string", + "format": "byte", + "description": "Must be a valid serialized protocol buffer of the above specified type." + } + }, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n ...\n foo := \u0026pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "runtimeError": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } } } } diff --git a/internal/BUILD.bazel b/internal/BUILD.bazel index 5f73042d6f6..5242751fb2d 100644 --- a/internal/BUILD.bazel +++ b/internal/BUILD.bazel @@ -6,7 +6,7 @@ package(default_visibility = ["//visibility:public"]) proto_library( name = "internal_proto", - srcs = ["stream_chunk.proto"], + srcs = ["errors.proto"], deps = ["@com_google_protobuf//:any_proto"], ) diff --git a/internal/errors.pb.go b/internal/errors.pb.go new file mode 100644 index 00000000000..61101d7177f --- /dev/null +++ b/internal/errors.pb.go @@ -0,0 +1,189 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: internal/errors.proto + +package internal + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + any "github.com/golang/protobuf/ptypes/any" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Error is the generic error returned from unary RPCs. +type Error struct { + Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + // This is to make the error more compatible with users that expect errors to be Status objects: + // https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto + // It should be the exact same message as the Error field. + Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Details []*any.Any `protobuf:"bytes,4,rep,name=details,proto3" json:"details,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Error) Reset() { *m = Error{} } +func (m *Error) String() string { return proto.CompactTextString(m) } +func (*Error) ProtoMessage() {} +func (*Error) Descriptor() ([]byte, []int) { + return fileDescriptor_9b093362ca6d1e03, []int{0} +} + +func (m *Error) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Error.Unmarshal(m, b) +} +func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Error.Marshal(b, m, deterministic) +} +func (m *Error) XXX_Merge(src proto.Message) { + xxx_messageInfo_Error.Merge(m, src) +} +func (m *Error) XXX_Size() int { + return xxx_messageInfo_Error.Size(m) +} +func (m *Error) XXX_DiscardUnknown() { + xxx_messageInfo_Error.DiscardUnknown(m) +} + +var xxx_messageInfo_Error proto.InternalMessageInfo + +func (m *Error) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +func (m *Error) GetCode() int32 { + if m != nil { + return m.Code + } + return 0 +} + +func (m *Error) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func (m *Error) GetDetails() []*any.Any { + if m != nil { + return m.Details + } + return nil +} + +// StreamError is a response type which is returned when +// streaming rpc returns an error. +type StreamError struct { + GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode,proto3" json:"grpc_code,omitempty"` + HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode,proto3" json:"http_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus,proto3" json:"http_status,omitempty"` + Details []*any.Any `protobuf:"bytes,5,rep,name=details,proto3" json:"details,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamError) Reset() { *m = StreamError{} } +func (m *StreamError) String() string { return proto.CompactTextString(m) } +func (*StreamError) ProtoMessage() {} +func (*StreamError) Descriptor() ([]byte, []int) { + return fileDescriptor_9b093362ca6d1e03, []int{1} +} + +func (m *StreamError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamError.Unmarshal(m, b) +} +func (m *StreamError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamError.Marshal(b, m, deterministic) +} +func (m *StreamError) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamError.Merge(m, src) +} +func (m *StreamError) XXX_Size() int { + return xxx_messageInfo_StreamError.Size(m) +} +func (m *StreamError) XXX_DiscardUnknown() { + xxx_messageInfo_StreamError.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamError proto.InternalMessageInfo + +func (m *StreamError) GetGrpcCode() int32 { + if m != nil { + return m.GrpcCode + } + return 0 +} + +func (m *StreamError) GetHttpCode() int32 { + if m != nil { + return m.HttpCode + } + return 0 +} + +func (m *StreamError) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func (m *StreamError) GetHttpStatus() string { + if m != nil { + return m.HttpStatus + } + return "" +} + +func (m *StreamError) GetDetails() []*any.Any { + if m != nil { + return m.Details + } + return nil +} + +func init() { + proto.RegisterType((*Error)(nil), "grpc.gateway.runtime.Error") + proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError") +} + +func init() { proto.RegisterFile("internal/errors.proto", fileDescriptor_9b093362ca6d1e03) } + +var fileDescriptor_9b093362ca6d1e03 = []byte{ + // 252 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0xc1, 0x4a, 0xc4, 0x30, + 0x10, 0x86, 0x89, 0xbb, 0x75, 0xdb, 0xe9, 0x2d, 0x54, 0x88, 0xee, 0xc1, 0xb2, 0xa7, 0x9e, 0x52, + 0xd0, 0x27, 0xd0, 0xc5, 0x17, 0xe8, 0xde, 0xbc, 0x2c, 0xd9, 0xdd, 0x31, 0x16, 0xda, 0xa4, 0x24, + 0x53, 0xa4, 0xf8, 0x56, 0x3e, 0xa1, 0x24, 0xa5, 0xb0, 0x27, 0xf1, 0xd6, 0xf9, 0xfb, 0xcf, 0x7c, + 0x1f, 0x81, 0xbb, 0xd6, 0x10, 0x3a, 0xa3, 0xba, 0x1a, 0x9d, 0xb3, 0xce, 0xcb, 0xc1, 0x59, 0xb2, + 0xbc, 0xd0, 0x6e, 0x38, 0x4b, 0xad, 0x08, 0xbf, 0xd4, 0x24, 0xdd, 0x68, 0xa8, 0xed, 0xf1, 0xe1, + 0x5e, 0x5b, 0xab, 0x3b, 0xac, 0x63, 0xe7, 0x34, 0x7e, 0xd4, 0xca, 0x4c, 0xf3, 0xc2, 0xee, 0x1b, + 0x92, 0xb7, 0x70, 0x80, 0x17, 0x90, 0xc4, 0x4b, 0x82, 0x95, 0xac, 0xca, 0x9a, 0x79, 0xe0, 0x1c, + 0xd6, 0x67, 0x7b, 0x41, 0x71, 0x53, 0xb2, 0x2a, 0x69, 0xe2, 0x37, 0x17, 0xb0, 0xe9, 0xd1, 0x7b, + 0xa5, 0x51, 0xac, 0x62, 0x77, 0x19, 0xb9, 0x84, 0xcd, 0x05, 0x49, 0xb5, 0x9d, 0x17, 0xeb, 0x72, + 0x55, 0xe5, 0x4f, 0x85, 0x9c, 0xc9, 0x72, 0x21, 0xcb, 0x17, 0x33, 0x35, 0x4b, 0x69, 0xf7, 0xc3, + 0x20, 0x3f, 0x90, 0x43, 0xd5, 0xcf, 0x0e, 0x5b, 0xc8, 0x82, 0xff, 0x31, 0x22, 0x59, 0x44, 0xa6, + 0x21, 0xd8, 0x07, 0xec, 0x16, 0xb2, 0x4f, 0xa2, 0xe1, 0x78, 0xe5, 0x93, 0x86, 0x60, 0xff, 0xb7, + 0xd3, 0x23, 0xe4, 0x71, 0xcd, 0x93, 0xa2, 0x31, 0x78, 0x85, 0xbf, 0x10, 0xa2, 0x43, 0x4c, 0xae, + 0xa5, 0x93, 0x7f, 0x48, 0xbf, 0xc2, 0x7b, 0xba, 0xbc, 0xfd, 0xe9, 0x36, 0x56, 0x9e, 0x7f, 0x03, + 0x00, 0x00, 0xff, 0xff, 0xde, 0x72, 0x6b, 0x83, 0x8e, 0x01, 0x00, 0x00, +} diff --git a/internal/errors.proto b/internal/errors.proto new file mode 100644 index 00000000000..4fb212c6b69 --- /dev/null +++ b/internal/errors.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package grpc.gateway.runtime; +option go_package = "internal"; + +import "google/protobuf/any.proto"; + +// Error is the generic error returned from unary RPCs. +message Error { + string error = 1; + // This is to make the error more compatible with users that expect errors to be Status objects: + // https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto + // It should be the exact same message as the Error field. + int32 code = 2; + string message = 3; + repeated google.protobuf.Any details = 4; +} + +// StreamError is a response type which is returned when +// streaming rpc returns an error. +message StreamError { + int32 grpc_code = 1; + int32 http_code = 2; + string message = 3; + string http_status = 4; + repeated google.protobuf.Any details = 5; +} diff --git a/internal/stream_chunk.pb.go b/internal/stream_chunk.pb.go deleted file mode 100644 index 1eca68e3350..00000000000 --- a/internal/stream_chunk.pb.go +++ /dev/null @@ -1,119 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: internal/stream_chunk.proto - -package internal - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// StreamError is a response type which is returned when -// streaming rpc returns an error. -type StreamError struct { - GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode,proto3" json:"grpc_code,omitempty"` - HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode,proto3" json:"http_code,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` - HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus,proto3" json:"http_status,omitempty"` - Details []*any.Any `protobuf:"bytes,5,rep,name=details,proto3" json:"details,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StreamError) Reset() { *m = StreamError{} } -func (m *StreamError) String() string { return proto.CompactTextString(m) } -func (*StreamError) ProtoMessage() {} -func (*StreamError) Descriptor() ([]byte, []int) { - return fileDescriptor_9d15b670e96bbb5a, []int{0} -} - -func (m *StreamError) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamError.Unmarshal(m, b) -} -func (m *StreamError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamError.Marshal(b, m, deterministic) -} -func (m *StreamError) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamError.Merge(m, src) -} -func (m *StreamError) XXX_Size() int { - return xxx_messageInfo_StreamError.Size(m) -} -func (m *StreamError) XXX_DiscardUnknown() { - xxx_messageInfo_StreamError.DiscardUnknown(m) -} - -var xxx_messageInfo_StreamError proto.InternalMessageInfo - -func (m *StreamError) GetGrpcCode() int32 { - if m != nil { - return m.GrpcCode - } - return 0 -} - -func (m *StreamError) GetHttpCode() int32 { - if m != nil { - return m.HttpCode - } - return 0 -} - -func (m *StreamError) GetMessage() string { - if m != nil { - return m.Message - } - return "" -} - -func (m *StreamError) GetHttpStatus() string { - if m != nil { - return m.HttpStatus - } - return "" -} - -func (m *StreamError) GetDetails() []*any.Any { - if m != nil { - return m.Details - } - return nil -} - -func init() { - proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError") -} - -func init() { proto.RegisterFile("internal/stream_chunk.proto", fileDescriptor_9d15b670e96bbb5a) } - -var fileDescriptor_9d15b670e96bbb5a = []byte{ - // 223 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x41, 0x4e, 0xc3, 0x30, - 0x10, 0x45, 0x15, 0x4a, 0x69, 0x3b, 0xd9, 0x45, 0x5d, 0x18, 0xba, 0x20, 0x62, 0x95, 0x95, 0x23, - 0xc1, 0x09, 0x00, 0x71, 0x81, 0x74, 0xc7, 0xa6, 0x9a, 0x26, 0x83, 0x13, 0x91, 0xd8, 0xd1, 0x78, - 0x22, 0x94, 0x6b, 0x71, 0xc2, 0xca, 0x8e, 0xb2, 0xf4, 0x7b, 0x7f, 0xbe, 0xbe, 0x0c, 0xa7, 0xce, - 0x0a, 0xb1, 0xc5, 0xbe, 0xf4, 0xc2, 0x84, 0xc3, 0xa5, 0x6e, 0x27, 0xfb, 0xab, 0x47, 0x76, 0xe2, - 0xb2, 0xa3, 0xe1, 0xb1, 0xd6, 0x06, 0x85, 0xfe, 0x70, 0xd6, 0x3c, 0x59, 0xe9, 0x06, 0x7a, 0x7a, - 0x34, 0xce, 0x99, 0x9e, 0xca, 0x98, 0xb9, 0x4e, 0x3f, 0x25, 0xda, 0x79, 0x39, 0x78, 0xf9, 0x4f, - 0x20, 0x3d, 0xc7, 0x9e, 0x2f, 0x66, 0xc7, 0xd9, 0x09, 0x0e, 0xa1, 0xe2, 0x52, 0xbb, 0x86, 0x54, - 0x92, 0x27, 0xc5, 0xb6, 0xda, 0x07, 0xf0, 0xe9, 0x1a, 0x0a, 0xb2, 0x15, 0x19, 0x17, 0x79, 0xb7, - 0xc8, 0x00, 0xa2, 0x54, 0xb0, 0x1b, 0xc8, 0x7b, 0x34, 0xa4, 0x36, 0x79, 0x52, 0x1c, 0xaa, 0xf5, - 0x99, 0x3d, 0x43, 0x1a, 0xcf, 0xbc, 0xa0, 0x4c, 0x5e, 0xdd, 0x47, 0x0b, 0x01, 0x9d, 0x23, 0xc9, - 0x34, 0xec, 0x1a, 0x12, 0xec, 0x7a, 0xaf, 0xb6, 0xf9, 0xa6, 0x48, 0x5f, 0x8f, 0x7a, 0x59, 0xac, - 0xd7, 0xc5, 0xfa, 0xdd, 0xce, 0xd5, 0x1a, 0xfa, 0x80, 0xef, 0xfd, 0xfa, 0x09, 0xd7, 0x87, 0x18, - 0x79, 0xbb, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x7d, 0xa5, 0x18, 0x17, 0x01, 0x00, 0x00, -} diff --git a/internal/stream_chunk.proto b/internal/stream_chunk.proto deleted file mode 100644 index 55f42ce63ec..00000000000 --- a/internal/stream_chunk.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -package grpc.gateway.runtime; -option go_package = "internal"; - -import "google/protobuf/any.proto"; - -// StreamError is a response type which is returned when -// streaming rpc returns an error. -message StreamError { - int32 grpc_code = 1; - int32 http_code = 2; - string message = 3; - string http_status = 4; - repeated google.protobuf.Any details = 5; -} diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 6b2b62eb38f..f7715c8a3ff 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -882,6 +882,15 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re Description: desc, Schema: responseSchema, }, + // https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responses-object + "default": swaggerResponseObject{ + Description: "An unexpected error response", + Schema: swaggerSchemaObject{ + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.Error", reg)), + }, + }, + }, }, } if bIdx == 0 { @@ -1034,14 +1043,24 @@ func applyTemplate(p param) (*swaggerObject, error) { panic(err) } + messages := messageMap{} + streamingMessages := messageMap{} + enums := enumMap{} + + // Add the error type to the message map + runtimeError, err := p.reg.LookupMsg(".grpc.gateway.runtime", "Error") + if err == nil { + messages[fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.Error", p.reg)] = runtimeError + } else { + // just in case there is an error looking up runtimeError + glog.Error(err) + } + // Find all the service's messages and enumerations that are defined (recursively) // and write request, response and other custom (but referenced) types out as definition objects. - m := messageMap{} - ms := messageMap{} - e := enumMap{} - findServicesMessagesAndEnumerations(p.Services, p.reg, m, ms, e, requestResponseRefs) - renderMessagesAsDefinition(m, s.Definitions, p.reg, customRefs) - renderEnumerationsAsDefinition(e, s.Definitions, p.reg) + findServicesMessagesAndEnumerations(p.Services, p.reg, messages, streamingMessages, enums, requestResponseRefs) + renderMessagesAsDefinition(messages, s.Definitions, p.reg, customRefs) + renderEnumerationsAsDefinition(enums, s.Definitions, p.reg) // File itself might have some comments and metadata. packageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 9c1f0b74c70..cda39688835 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -925,7 +925,7 @@ func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { } // Only ExampleMessage must be present, not NestedMessage - if want, got, name := 3, len(result.Definitions), "len(Definitions)"; !reflect.DeepEqual(got, want) { + if want, got, name := 4, len(result.Definitions), "len(Definitions)"; !reflect.DeepEqual(got, want) { t.Errorf("applyTemplate(%#v).%s = %d want to be %d", file, name, got, want) } if _, ok := result.Paths["/v1/echo"].Post.Responses["200"]; !ok { diff --git a/runtime/errors.go b/runtime/errors.go index a36080713ce..0118ca0479d 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -5,11 +5,10 @@ import ( "io" "net/http" - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/any" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" + "github.com/grpc-ecosystem/grpc-gateway/internal" ) // HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. @@ -65,21 +64,6 @@ var ( OtherErrorHandler = DefaultOtherErrorHandler ) -type errorBody struct { - Error string `protobuf:"bytes,100,name=error" json:"error"` - // This is to make the error more compatible with users that expect errors to be Status objects: - // https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto - // It should be the exact same message as the Error field. - Code int32 `protobuf:"varint,1,name=code" json:"code"` - Message string `protobuf:"bytes,2,name=message" json:"message"` - Details []*any.Any `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"` -} - -// Make this also conform to proto.Message for builtin JSONPb Marshaler -func (e *errorBody) Reset() { *e = errorBody{} } -func (e *errorBody) String() string { return proto.CompactTextString(e) } -func (*errorBody) ProtoMessage() {} - // DefaultHTTPError is the default implementation of HTTPError. // If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode. // If otherwise, it replies with http.StatusInternalServerError. @@ -106,7 +90,7 @@ func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w } w.Header().Set("Content-Type", contentType) - body := &errorBody{ + body := &internal.Error{ Error: s.Message(), Message: s.Message(), Code: int32(s.Code()), From 2ce327fdb1e3e9bd1789395a266780add78f4b6f Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 11 Feb 2020 11:09:19 +0000 Subject: [PATCH 512/552] Generate changelog for 1.13.0 --- CHANGELOG.md | 21 +++++++++++++++++++++ Makefile | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 283628989cc..614f938ea25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Change Log +## [v1.13.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.13.0) (2020-02-11) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.12.2...v1.13.0) + +**Implemented enhancements:** + +- \[Feature Request\] Custom Type conversion [\#754](https://github.com/grpc-ecosystem/grpc-gateway/issues/754) +- protoc-gen-swagger: add default error response [\#1127](https://github.com/grpc-ecosystem/grpc-gateway/pull/1127) ([johanbrandhorst](https://github.com/johanbrandhorst)) + +**Closed issues:** + +- swagger: Prefix used in nested-field GET params does not respect json\_names\_for\_fields [\#1125](https://github.com/grpc-ecosystem/grpc-gateway/issues/1125) +- Generated spec missing grpc errors [\#1122](https://github.com/grpc-ecosystem/grpc-gateway/issues/1122) +- protoc-gen-swagger: Support for repeated custom message in url params [\#1119](https://github.com/grpc-ecosystem/grpc-gateway/issues/1119) +- protoc-gen-swagger: Support Response-specific examples [\#1117](https://github.com/grpc-ecosystem/grpc-gateway/issues/1117) + +**Merged pull requests:** + +- Fix \#1125: JSON-prefix nested-field params. [\#1126](https://github.com/grpc-ecosystem/grpc-gateway/pull/1126) ([jgiles](https://github.com/jgiles)) +- Fix \#1117: Support response examples. [\#1124](https://github.com/grpc-ecosystem/grpc-gateway/pull/1124) ([jgiles](https://github.com/jgiles)) + ## [v1.12.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.12.2) (2020-01-22) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.12.1...v1.12.2) @@ -29,6 +49,7 @@ **Merged pull requests:** +- Generate changelog for 1.12.2 [\#1120](https://github.com/grpc-ecosystem/grpc-gateway/pull/1120) ([johanbrandhorst](https://github.com/johanbrandhorst)) - docs: require Jekyll Github Token to be set [\#1118](https://github.com/grpc-ecosystem/grpc-gateway/pull/1118) ([johanbrandhorst](https://github.com/johanbrandhorst)) - fix: protoc-gen-swagger: get wrong second services method comments [\#1116](https://github.com/grpc-ecosystem/grpc-gateway/pull/1116) ([chinaran](https://github.com/chinaran)) - Bump rubyzip from 1.2.3 to 2.0.0 in /docs [\#1115](https://github.com/grpc-ecosystem/grpc-gateway/pull/1115) ([dependabot[bot]](https://github.com/apps/dependabot)) diff --git a/Makefile b/Makefile index bd641d17240..03766b669ee 100644 --- a/Makefile +++ b/Makefile @@ -203,7 +203,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.12.2 + --future-release=v1.13.0 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 74fa02802dc4bca2968bb846b5f3b10d63433aa1 Mon Sep 17 00:00:00 2001 From: Nadir Boukeffa Date: Fri, 14 Feb 2020 10:59:16 +0100 Subject: [PATCH 513/552] Configure response content type at the method level (#1130) * Configure response content type at the method level This PR will add the possibility to configure the response content type at the method level. To do such the developer will have to set the `produces` property like in the following example. ``` rpc OverwriteResponseContentType(google.protobuf.Empty) returns (google.protobuf.StringValue) { option (google.api.http) = { get: "/v2/example/overwriteresponsecontenttype" }; option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { produces: "application/text" }; } ``` * Fix build --- examples/clients/abe/api/swagger.yaml | 30 ++ .../abe/api_a_bit_of_everything_service.go | 143 +++++ .../proto/examplepb/a_bit_of_everything.pb.go | 488 ++++++++++-------- .../examplepb/a_bit_of_everything.pb.gw.go | 62 +++ .../proto/examplepb/a_bit_of_everything.proto | 9 + .../a_bit_of_everything.swagger.json | 42 ++ examples/server/BUILD.bazel | 1 + examples/server/a_bit_of_everything.go | 5 + protoc-gen-swagger/genswagger/template.go | 5 + protoc-gen-swagger/genswagger/types.go | 1 + 10 files changed, 563 insertions(+), 223 deletions(-) diff --git a/examples/clients/abe/api/swagger.yaml b/examples/clients/abe/api/swagger.yaml index 8c234914da2..52ccf956d97 100644 --- a/examples/clients/abe/api/swagger.yaml +++ b/examples/clients/abe/api/swagger.yaml @@ -1747,6 +1747,36 @@ paths: description: "An unexpected error response" schema: $ref: "#/definitions/runtimeError" + /v2/example/overwriteresponsecontenttype: + get: + tags: + - "ABitOfEverythingService" + operationId: "OverwriteResponseContentType" + produces: + - "application/text" + parameters: [] + responses: + 200: + description: "A successful response." + schema: + type: "string" + 403: + description: "Returned when the user does not have permission to access\ + \ the resource." + schema: {} + 404: + description: "Returned when the resource does not exist." + schema: + type: "string" + format: "string" + 418: + description: "I'm a teapot." + schema: + $ref: "#/definitions/examplepbNumericEnum" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /v2/example/postwithemptybody/{name}: post: tags: diff --git a/examples/clients/abe/api_a_bit_of_everything_service.go b/examples/clients/abe/api_a_bit_of_everything_service.go index f5d1759381e..326be923b33 100644 --- a/examples/clients/abe/api_a_bit_of_everything_service.go +++ b/examples/clients/abe/api_a_bit_of_everything_service.go @@ -2368,6 +2368,149 @@ func (a *ABitOfEverythingServiceApiService) Lookup(ctx context.Context, uuid str return localVarReturnValue, localVarHttpResponse, nil } +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return string +*/ +func (a *ABitOfEverythingServiceApiService) OverwriteResponseContentType(ctx context.Context) (string, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/overwriteresponsecontenttype" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/text"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 78a653b0adb..a1320ed9b51 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -10,6 +10,7 @@ import ( duration "github.com/golang/protobuf/ptypes/duration" empty "github.com/golang/protobuf/ptypes/empty" timestamp "github.com/golang/protobuf/ptypes/timestamp" + wrappers "github.com/golang/protobuf/ptypes/wrappers" pathenum "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" sub "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" @@ -820,229 +821,234 @@ func init() { } var fileDescriptor_3978364c010e812a = []byte{ - // 3552 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4d, 0x70, 0x1b, 0xc9, - 0x5e, 0xf7, 0x68, 0xfc, 0xd9, 0x8e, 0xbf, 0xda, 0x71, 0xe2, 0x28, 0xde, 0x75, 0x47, 0xc9, 0xbe, - 0x9d, 0xe8, 0x45, 0x1a, 0x7b, 0xec, 0xdd, 0x4d, 0xb4, 0xbc, 0xdd, 0x95, 0x6c, 0x27, 0xeb, 0x64, - 0xd7, 0xf1, 0x4e, 0xb2, 0x61, 0xc9, 0xdb, 0x3c, 0xd3, 0x92, 0x5a, 0xd6, 0xc4, 0x9a, 0xe9, 0x79, - 0x33, 0x3d, 0x8e, 0x15, 0x23, 0x78, 0x05, 0x14, 0x14, 0xbc, 0x9b, 0x1e, 0x1f, 0x05, 0xaf, 0xe0, - 0x42, 0x71, 0xa1, 0xde, 0x89, 0x2a, 0x4e, 0x54, 0xc1, 0x05, 0x4e, 0x1c, 0xa0, 0x16, 0x8a, 0xe2, - 0xc2, 0x09, 0xce, 0x5c, 0xa0, 0xb6, 0x8a, 0x03, 0x14, 0xd5, 0x3d, 0x33, 0xd2, 0xcc, 0x48, 0x8a, - 0xa3, 0x84, 0xda, 0xdd, 0xc3, 0x66, 0xba, 0xfb, 0xff, 0xf1, 0xfb, 0x77, 0xff, 0xfb, 0xff, 0xd1, - 0x32, 0xd0, 0xc8, 0x09, 0x36, 0xed, 0x06, 0x71, 0x55, 0xdb, 0xa1, 0x8c, 0xaa, 0xc1, 0xd0, 0x2e, - 0xab, 0xf8, 0xa0, 0x6c, 0xb0, 0x03, 0x5a, 0x3b, 0x20, 0xc7, 0xc4, 0x69, 0xb2, 0xba, 0x61, 0x1d, - 0xe6, 0x05, 0x0d, 0x5c, 0x3d, 0x74, 0xec, 0x4a, 0xfe, 0x10, 0x33, 0xf2, 0x0c, 0x37, 0xf3, 0xa1, - 0x80, 0x7c, 0x87, 0x35, 0xbd, 0x72, 0x48, 0xe9, 0x61, 0x83, 0xa8, 0xd8, 0x36, 0x54, 0x6c, 0x59, - 0x94, 0x61, 0x66, 0x50, 0xcb, 0xf5, 0xd9, 0xd3, 0x28, 0x58, 0x15, 0xa3, 0xb2, 0x57, 0x53, 0x6b, - 0x06, 0x69, 0x54, 0x0f, 0x4c, 0xec, 0x1e, 0x05, 0x14, 0x97, 0x93, 0x14, 0xc4, 0xb4, 0x59, 0x33, - 0x58, 0x7c, 0x33, 0xb9, 0x58, 0xf5, 0x1c, 0x21, 0x3f, 0x58, 0x7f, 0x3b, 0x61, 0x91, 0x8d, 0x59, - 0x9d, 0x58, 0x9e, 0x29, 0x3e, 0x0e, 0xf8, 0x57, 0x88, 0x23, 0x41, 0xe8, 0x7a, 0x65, 0xd5, 0x24, - 0xae, 0x8b, 0x0f, 0x49, 0x40, 0x71, 0xa5, 0x97, 0x42, 0x4b, 0x90, 0xac, 0x26, 0xd1, 0x30, 0xc3, - 0x24, 0x2e, 0xc3, 0xa6, 0x1d, 0x10, 0xdc, 0x10, 0xff, 0x54, 0x72, 0x87, 0xc4, 0xca, 0xb9, 0xcf, - 0xf0, 0xe1, 0x21, 0x71, 0x54, 0x6a, 0x8b, 0xfd, 0xe8, 0xdd, 0x9b, 0x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 0x22, 0xeb, 0x40, 0x4c, 0x75, 0x64, 0x78, 0x51, 0x8a, 0x71, 0x24, 0x29, 0xa3, - 0xfa, 0xb4, 0x17, 0x21, 0xf1, 0x65, 0x6c, 0x68, 0x01, 0xc5, 0x04, 0x92, 0x94, 0x31, 0x21, 0x63, - 0x43, 0xf3, 0x09, 0xae, 0x82, 0x99, 0x9a, 0x71, 0x42, 0xaa, 0x1d, 0x21, 0x93, 0x48, 0x52, 0xc6, - 0xf5, 0x73, 0xc1, 0x64, 0x9c, 0xa8, 0x23, 0x67, 0x0a, 0x49, 0xca, 0x44, 0x40, 0x14, 0x4a, 0x7a, - 0x03, 0x80, 0x32, 0xa5, 0x8d, 0x80, 0x02, 0x20, 0x49, 0x99, 0xd4, 0xa7, 0xf8, 0x4c, 0x07, 0xac, - 0xcb, 0x1c, 0xc3, 0x3a, 0x0c, 0x08, 0xa6, 0xb9, 0x03, 0xe8, 0xd3, 0xfe, 0x5c, 0x07, 0x6c, 0xb9, - 0xc9, 0x88, 0x1b, 0x50, 0xbc, 0x81, 0x24, 0xe5, 0x9c, 0x0e, 0xc4, 0x54, 0xcc, 0xe0, 0x0e, 0x8c, - 0x19, 0x24, 0x29, 0x33, 0xbe, 0xc1, 0x21, 0x8a, 0x7b, 0x00, 0xf0, 0x5b, 0x17, 0x10, 0xcc, 0x22, - 0x49, 0x99, 0xd5, 0x6e, 0x9c, 0x79, 0xf2, 0x7b, 0x9e, 0x49, 0x1c, 0xa3, 0xb2, 0x63, 0x79, 0xa6, - 0x3e, 0xc5, 0xf9, 0x7d, 0x61, 0xfb, 0x60, 0xae, 0x73, 0x8f, 0x03, 0x89, 0x6f, 0x0a, 0x89, 0xca, - 0x00, 0x89, 0xe1, 0xf5, 0xcf, 0xef, 0x63, 0x56, 0x17, 0xd2, 0x66, 0xec, 0xe0, 0xcb, 0x97, 0xe8, - 0x82, 0x0b, 0xbe, 0x33, 0x1d, 0x24, 0x05, 0xaf, 0x0a, 0xc1, 0x1f, 0x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 0x94, 0x7e, 0x05, 0xa4, 0xfd, 0x76, - 0x1f, 0xc2, 0x3b, 0x0e, 0xb6, 0x98, 0x8b, 0xf8, 0x20, 0x38, 0x4b, 0xb0, 0x12, 0x3c, 0x02, 0xc0, - 0xc5, 0x60, 0x51, 0x8c, 0xc2, 0xd5, 0x2d, 0x30, 0x86, 0xab, 0xa6, 0x61, 0xc1, 0x42, 0x8c, 0xd5, - 0xaa, 0xc6, 0xc8, 0x84, 0x6b, 0x70, 0x32, 0xc3, 0x65, 0xbc, 0x5a, 0x3b, 0xe6, 0x45, 0x79, 0x8d, - 0x3a, 0xa6, 0xf0, 0xbe, 0xf2, 0x2a, 0x98, 0x89, 0x1e, 0xcc, 0x48, 0xf2, 0x61, 0xa2, 0x7c, 0x7d, - 0xe0, 0xd3, 0x44, 0x92, 0xd4, 0xd9, 0x05, 0x17, 0x3f, 0xed, 0x46, 0xcb, 0x68, 0x0c, 0x18, 0xf6, - 0xee, 0x3f, 0xbf, 0x0c, 0xe0, 0x49, 0x2e, 0x3a, 0xc3, 0x2f, 0x09, 0x1c, 0x4b, 0xcb, 0x65, 0xec, - 0x3c, 0x57, 0xc0, 0xc5, 0xc4, 0x62, 0x19, 0x3f, 0xcf, 0x35, 0x0c, 0x97, 0xc1, 0x19, 0x6d, 0x1a, - 0x8c, 0xa5, 0x65, 0x6a, 0x11, 0x90, 0x42, 0xd2, 0xe3, 0xa9, 0x8e, 0x3b, 0x96, 0xc7, 0x45, 0x18, - 0xdb, 0xf8, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xb2, 0xb5, 0x0c, 0x75, 0x2b, 0x00, 0x00, + // 3621 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4f, 0x70, 0x1c, 0xc7, + 0x5a, 0xd7, 0xec, 0x48, 0xb2, 0xd4, 0xb2, 0x2c, 0xa9, 0x65, 0xd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, 0xe4, 0xe4, 0x66, 0x2b, 0x1f, 0x1f, 0xae, 0x0f, + 0x33, 0x5c, 0xd5, 0x5b, 0x86, 0x40, 0x80, 0xbb, 0x60, 0x3c, 0xb4, 0x20, 0x83, 0xe4, 0xd7, 0xb2, + 0x20, 0x94, 0x03, 0xef, 0x82, 0xa9, 0xfd, 0x06, 0xc5, 0x6c, 0xef, 0x08, 0x37, 0x7c, 0xb2, 0x28, + 0x23, 0x49, 0xcd, 0x94, 0xaf, 0xb7, 0x4b, 0xdf, 0xd1, 0xe7, 0x6e, 0xf3, 0x79, 0x24, 0xe6, 0x91, + 0xf0, 0xc0, 0xa2, 0xbc, 0x52, 0xd0, 0xbf, 0x96, 0xe2, 0x0c, 0x06, 0x10, 0x83, 0x47, 0xfc, 0x1b, + 0x5e, 0x01, 0x67, 0x6b, 0xd4, 0xaf, 0x34, 0x48, 0x28, 0x6c, 0x14, 0x49, 0xaa, 0x64, 0x4c, 0x05, + 0x73, 0x01, 0xc9, 0x32, 0x98, 0x32, 0x6d, 0xf6, 0xee, 0x7a, 0x48, 0x31, 0x86, 0x24, 0x55, 0x36, + 0x80, 0x98, 0xea, 0xc8, 0xf0, 0xe3, 0x14, 0xe3, 0x48, 0x52, 0x47, 0x8d, 0x29, 0x3f, 0x46, 0x12, + 0xc8, 0x58, 0xd3, 0x43, 0x8a, 0x33, 0x48, 0x52, 0xc7, 0x84, 0x8c, 0x35, 0x3d, 0x20, 0xb8, 0x0a, + 0xa6, 0xf7, 0xcd, 0x63, 0x52, 0xeb, 0x08, 0x99, 0x40, 0x92, 0x3a, 0x6e, 0x9c, 0x0d, 0x27, 0x93, + 0x44, 0x1d, 0x39, 0x93, 0x48, 0x52, 0xcf, 0x84, 0x44, 0x91, 0xa4, 0x37, 0x00, 0xa8, 0x50, 0xda, + 0x08, 0x29, 0x00, 0x92, 0xd4, 0x09, 0x63, 0x92, 0xcf, 0x74, 0x94, 0xf5, 0x98, 0x6b, 0xda, 0x07, + 0x21, 0xc1, 0x14, 0x77, 0x00, 0x63, 0x2a, 0x98, 0xeb, 0x28, 0x5b, 0x69, 0x32, 0xe2, 0x85, 0x14, + 0x6f, 0x20, 0x49, 0x3d, 0x6b, 0x00, 0x31, 0x95, 0x30, 0xb8, 0xa3, 0xc6, 0x34, 0x92, 0xd4, 0xe9, + 0xc0, 0xe0, 0x48, 0x8b, 0x7b, 0x00, 0xf0, 0x5b, 0x17, 0x12, 0x9c, 0x43, 0x92, 0x7a, 0x4e, 0xbf, + 0x71, 0xea, 0xc9, 0xef, 0xf8, 0x16, 0x71, 0xcd, 0xea, 0x96, 0xed, 0x5b, 0xc6, 0x24, 0xe7, 0x0f, + 0x84, 0xed, 0x82, 0x99, 0xce, 0x3d, 0x0e, 0x25, 0xbe, 0x29, 0x24, 0xaa, 0x03, 0x24, 0x46, 0xd7, + 0xbf, 0xb0, 0x8b, 0x59, 0x5d, 0x48, 0x9b, 0x76, 0xc2, 0xaf, 0x40, 0xa2, 0x07, 0x2e, 0x04, 0xce, + 0xb4, 0x97, 0x16, 0xbc, 0x2c, 0x04, 0x7f, 0x70, 0x9a, 0xe0, 0x4f, 0x83, 0x80, 0x10, 0xc9, 0x0f, + 0x5d, 0xb4, 0x03, 0x37, 0x6f, 0x27, 0xc6, 0x01, 0xe8, 0x5b, 0xe0, 0x9c, 0x97, 0x3c, 0xbf, 0x19, + 0x24, 0xa9, 0x33, 0xc6, 0xb4, 0x97, 0x38, 0xc0, 0x0e, 0x59, 0xc7, 0x17, 0x66, 0x91, 0xa4, 0xce, + 0x46, 0x64, 0x31, 0xaf, 0xf3, 0xe2, 0x87, 0x30, 0x87, 0x24, 0x75, 0xce, 0x98, 0xf2, 0x62, 0x87, + 0x10, 0x92, 0x74, 0xe4, 0x40, 0x24, 0xa9, 0x30, 0x20, 0x89, 0xa4, 0xe8, 0x60, 0xc1, 0x25, 0x0e, + 0xc1, 0x7c, 0x2b, 0x12, 0x7e, 0x31, 0x8f, 0x64, 0x75, 0xd2, 0x98, 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41, 0xdd, 0x8b, 0xf5, 0x53, 0x09, 0x2c, 0x26, 0xc5, 0x77, 0x93, 0xec, 0x22, 0x1a, + 0x1e, 0xa3, 0xbc, 0xd9, 0x2e, 0x95, 0x72, 0x97, 0x8d, 0x50, 0x24, 0xb2, 0x83, 0x25, 0xc4, 0x45, + 0x23, 0x66, 0xb2, 0x06, 0xd1, 0x95, 0xfe, 0x8b, 0x35, 0xe2, 0x55, 0x5d, 0x53, 0x64, 0xfa, 0x82, + 0x71, 0x21, 0xae, 0x69, 0xa9, 0xa3, 0x11, 0xfc, 0x1d, 0x09, 0x2c, 0x74, 0x37, 0x21, 0xae, 0xeb, + 0x95, 0xe1, 0xe3, 0x64, 0x59, 0x6f, 0x97, 0xb4, 0x1c, 0xdc, 0xe9, 0x55, 0xf1, 0xd2, 0xce, 0x40, + 0xcd, 0xe6, 0x3b, 0xb1, 0x35, 0xa6, 0xd6, 0x11, 0xc8, 0xa6, 0x43, 0x41, 0x4c, 0x35, 0x85, 0xc7, + 0x83, 0xf2, 0xcd, 0x76, 0xe9, 0x9d, 0xdc, 0x42, 0xc7, 0xf6, 0x80, 0x2c, 0xc4, 0x5b, 0x4a, 0x4f, + 0x27, 0x20, 0x17, 0x93, 0x91, 0x24, 0x86, 0xfb, 0x57, 0x52, 0x0c, 0x38, 0xbc, 0x19, 0x31, 0xe0, + 0xab, 0xaf, 0x57, 0x35, 0x94, 0x6f, 0xb7, 0x4b, 0x1b, 0xb9, 0xae, 0x6e, 0x01, 0x00, 0xa2, 0x95, + 0xa7, 0xa4, 0xca, 0x42, 0xcd, 0xaf, 0x0e, 0x58, 0xed, 0x6f, 0x40, 0x20, 0x37, 0x66, 0xc0, 0x57, + 0x12, 0x98, 0xeb, 0xd5, 0xfb, 0xda, 0xeb, 0xd5, 0x6b, 0xe5, 0xf5, 0x76, 0x69, 0x35, 0x37, 0xbf, + 0xd3, 0x47, 0xdd, 0xec, 0xce, 0x60, 0x2d, 0x67, 0xed, 0xb4, 0x76, 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 0x28, 0x5a, 0xdd, 0x00, 0x63, 0xb8, 0x66, + 0x99, 0x36, 0x2c, 0x26, 0x58, 0xed, 0x5a, 0x82, 0x4c, 0xb8, 0x06, 0x27, 0x33, 0x3d, 0xc6, 0x6b, + 0xc9, 0x23, 0xde, 0x32, 0xec, 0x53, 0xd7, 0x12, 0xde, 0x57, 0x59, 0x06, 0xd3, 0xf1, 0x83, 0x19, + 0x49, 0x3f, 0x9b, 0x54, 0xae, 0x0f, 0x7c, 0x38, 0x49, 0x93, 0xba, 0xdb, 0xe0, 0xe2, 0xa7, 0xdd, + 0x68, 0x19, 0x8f, 0x01, 0xc3, 0xde, 0xfd, 0xe7, 0x97, 0x01, 0x3c, 0xce, 0xc7, 0x67, 0xf8, 0x25, + 0x81, 0x63, 0x59, 0xb9, 0x82, 0xdd, 0xe7, 0x2a, 0xb8, 0x98, 0x5a, 0xac, 0xe0, 0xe7, 0xf9, 0x86, + 0xe9, 0x31, 0x38, 0xad, 0x4f, 0x81, 0xb1, 0xac, 0x4c, 0x6d, 0x02, 0x32, 0x48, 0x7a, 0x3c, 0xd9, + 0x71, 0xc7, 0xca, 0xb8, 0x08, 0x63, 0x6b, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xe8, 0xcf, 0x9c, + 0x94, 0x33, 0x2c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1085,6 +1091,7 @@ type ABitOfEverythingServiceClient interface { CheckGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) CheckNestedEnumGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) CheckPostQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) + OverwriteResponseContentType(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*wrappers.StringValue, error) } type aBitOfEverythingServiceClient struct { @@ -1257,6 +1264,15 @@ func (c *aBitOfEverythingServiceClient) CheckPostQueryParams(ctx context.Context return out, nil } +func (c *aBitOfEverythingServiceClient) OverwriteResponseContentType(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*wrappers.StringValue, error) { + out := new(wrappers.StringValue) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/OverwriteResponseContentType", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ABitOfEverythingServiceServer is the server API for ABitOfEverythingService service. type ABitOfEverythingServiceServer interface { // Create a new ABitOfEverything @@ -1287,6 +1303,7 @@ type ABitOfEverythingServiceServer interface { CheckGetQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) CheckNestedEnumGetQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) CheckPostQueryParams(context.Context, *ABitOfEverything) (*ABitOfEverything, error) + OverwriteResponseContentType(context.Context, *empty.Empty) (*wrappers.StringValue, error) } // UnimplementedABitOfEverythingServiceServer can be embedded to have forward compatible implementations. @@ -1347,6 +1364,9 @@ func (*UnimplementedABitOfEverythingServiceServer) CheckNestedEnumGetQueryParams func (*UnimplementedABitOfEverythingServiceServer) CheckPostQueryParams(ctx context.Context, req *ABitOfEverything) (*ABitOfEverything, error) { return nil, status.Errorf(codes.Unimplemented, "method CheckPostQueryParams not implemented") } +func (*UnimplementedABitOfEverythingServiceServer) OverwriteResponseContentType(ctx context.Context, req *empty.Empty) (*wrappers.StringValue, error) { + return nil, status.Errorf(codes.Unimplemented, "method OverwriteResponseContentType not implemented") +} func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingServiceServer) { s.RegisterService(&_ABitOfEverythingService_serviceDesc, srv) @@ -1676,6 +1696,24 @@ func _ABitOfEverythingService_CheckPostQueryParams_Handler(srv interface{}, ctx return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_OverwriteResponseContentType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(empty.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).OverwriteResponseContentType(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/OverwriteResponseContentType", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).OverwriteResponseContentType(ctx, req.(*empty.Empty)) + } + return interceptor(ctx, in, info, handler) +} + var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.examplepb.ABitOfEverythingService", HandlerType: (*ABitOfEverythingServiceServer)(nil), @@ -1752,6 +1790,10 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "CheckPostQueryParams", Handler: _ABitOfEverythingService_CheckPostQueryParams_Handler, }, + { + MethodName: "OverwriteResponseContentType", + Handler: _ABitOfEverythingService_OverwriteResponseContentType_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/proto/examplepb/a_bit_of_everything.proto", diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go index eaa39346919..2135d7f8a54 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -2053,6 +2053,24 @@ func local_request_ABitOfEverythingService_CheckPostQueryParams_0(ctx context.Co } +func request_ABitOfEverythingService_OverwriteResponseContentType_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + msg, err := client.OverwriteResponseContentType(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ABitOfEverythingService_OverwriteResponseContentType_0(ctx context.Context, marshaler runtime.Marshaler, server ABitOfEverythingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + msg, err := server.OverwriteResponseContentType(ctx, &protoReq) + return msg, metadata, err + +} + func request_CamelCaseServiceName_Empty_0(ctx context.Context, marshaler runtime.Marshaler, client CamelCaseServiceNameClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq empty.Empty var metadata runtime.ServerMetadata @@ -2496,6 +2514,26 @@ func RegisterABitOfEverythingServiceHandlerServer(ctx context.Context, mux *runt }) + mux.Handle("GET", pattern_ABitOfEverythingService_OverwriteResponseContentType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ABitOfEverythingService_OverwriteResponseContentType_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_OverwriteResponseContentType_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -2985,6 +3023,26 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) + mux.Handle("GET", pattern_ABitOfEverythingService_OverwriteResponseContentType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_OverwriteResponseContentType_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_OverwriteResponseContentType_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -3030,6 +3088,8 @@ var ( pattern_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"v1", "example", "a_bit_of_everything", "params", "get", "nested_enum", "single_nested.ok"}, "", runtime.AssumeColonVerbOpt(true))) pattern_ABitOfEverythingService_CheckPostQueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "a_bit_of_everything", "params", "post", "string_value"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_ABitOfEverythingService_OverwriteResponseContentType_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "overwriteresponsecontenttype"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -3074,6 +3134,8 @@ var ( forward_ABitOfEverythingService_CheckNestedEnumGetQueryParams_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_CheckPostQueryParams_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_OverwriteResponseContentType_0 = runtime.ForwardResponseMessage ) // RegisterCamelCaseServiceNameHandlerFromEndpoint is same as RegisterCamelCaseServiceNameHandler but diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/proto/examplepb/a_bit_of_everything.proto index 79d9363fe0d..b5e394b2970 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -6,6 +6,7 @@ import "google/api/annotations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/duration.proto"; +import "google/protobuf/wrappers.proto"; import "examples/proto/pathenum/path_enum.proto"; import "examples/proto/sub/message.proto"; import "examples/proto/sub2/message.proto"; @@ -526,6 +527,14 @@ service ABitOfEverythingService { body: "single_nested" }; } + rpc OverwriteResponseContentType(google.protobuf.Empty) returns (google.protobuf.StringValue) { + option (google.api.http) = { + get: "/v2/example/overwriteresponsecontenttype" + }; + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { + produces: "application/text" + }; + } } // camelCase and lowercase service names are valid but not recommended (use TitleCase instead) diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/proto/examplepb/a_bit_of_everything.swagger.json index 61f298f170a..5dc22410e8d 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -2113,6 +2113,48 @@ ] } }, + "/v2/example/overwriteresponsecontenttype": { + "get": { + "operationId": "OverwriteResponseContentType", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "string" + } + }, + "403": { + "description": "Returned when the user does not have permission to access the resource.", + "schema": {} + }, + "404": { + "description": "Returned when the resource does not exist.", + "schema": { + "type": "string", + "format": "string" + } + }, + "418": { + "description": "I'm a teapot.", + "schema": { + "$ref": "#/definitions/examplepbNumericEnum" + } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "tags": [ + "ABitOfEverythingService" + ], + "produces": [ + "application/text" + ] + } + }, "/v2/example/postwithemptybody/{name}": { "post": { "operationId": "PostWithEmptyBody", diff --git a/examples/server/BUILD.bazel b/examples/server/BUILD.bazel index 61d14a2fde6..e5b6721790a 100644 --- a/examples/server/BUILD.bazel +++ b/examples/server/BUILD.bazel @@ -27,6 +27,7 @@ go_library( "@io_bazel_rules_go//proto/wkt:duration_go_proto", "@io_bazel_rules_go//proto/wkt:empty_go_proto", "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", + "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 892802fe3fc..0b87ce02639 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -10,6 +10,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/empty" + "github.com/golang/protobuf/ptypes/wrappers" examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" @@ -314,3 +315,7 @@ func (s *_ABitOfEverythingServer) CheckNestedEnumGetQueryParams(ctx context.Cont func (s *_ABitOfEverythingServer) CheckPostQueryParams(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { return msg, nil } + +func (s *_ABitOfEverythingServer) OverwriteResponseContentType(ctx context.Context, msg *empty.Empty) (*wrappers.StringValue, error) { + return &wrappers.StringValue{}, nil +} diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index f7715c8a3ff..5a668783c8e 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -989,6 +989,11 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re operationObject.extensions = exts } + if len(opts.Produces) > 0 { + operationObject.Produces = make([]string, len(opts.Produces)) + copy(operationObject.Produces, opts.Produces) + } + // TODO(ivucica): add remaining fields of operation object } diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 47d099806f4..255f53c77ca 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -115,6 +115,7 @@ type swaggerOperationObject struct { Parameters swaggerParametersObject `json:"parameters,omitempty"` Tags []string `json:"tags,omitempty"` Deprecated bool `json:"deprecated,omitempty"` + Produces []string `json:"produces,omitempty"` Security *[]swaggerSecurityRequirementObject `json:"security,omitempty"` ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` From 77ab597c75099fefe37650adf702048cf3c2126c Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 14 Feb 2020 10:29:26 +0000 Subject: [PATCH 514/552] Add bazel gazell to CONTRIBUTING This is the second time I've seen the previous command in isolation not entirely resolving the new files used. This should fix it. --- CONTRIBUTING.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8772fd3ad2a..e2ff6602e2e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,8 +7,8 @@ Here's the recommended process of contribution. 2. `cd $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway` 3. hack, hack, hack... 4. Make sure that your change follows best practices in Go - * [Effective Go](https://golang.org/doc/effective_go.html) - * [Go Code Review Comments](https://golang.org/wiki/CodeReviewComments) + - [Effective Go](https://golang.org/doc/effective_go.html) + - [Go Code Review Comments](https://golang.org/wiki/CodeReviewComments) 5. Make sure that `go test ./...` passes. 6. Sign [a Contributor License Agreement](https://cla.developers.google.com/clas) 7. Open a pull request in Github @@ -17,6 +17,7 @@ When you work on a larger contribution, it is also recommended that you get in t with us through the issue tracker. ### Code reviews + All submissions, including submissions by project members, require review. ### I want to regenerate the files after making changes! @@ -30,6 +31,8 @@ docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env: make examples' docker run -itv $(pwd):/grpc-gateway -w /grpc-gateway --entrypoint /bin/bash --rm \ l.gcr.io/google/bazel -c 'bazel run :gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories; bazel run :buildifier' +docker run -itv $(pwd):/grpc-gateway -w /grpc-gateway --entrypoint /bin/bash --rm \ + l.gcr.io/google/bazel -c 'bazel run :gazelle' ``` If this has resulted in some file changes in the repo, please ensure you check those in with your merge request. From 4f2718b05329ae472e9e3dd8c4ffeffc818c2cd2 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 14 Feb 2020 10:44:27 +0000 Subject: [PATCH 515/552] Improve installation instructions --- README.md | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 85aaa7b6b0f..4b9aa56b23b 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,31 @@ manager or by downloading one of the releases from the official repository: https://github.com/protocolbuffers/protobuf/releases +The following instructions assume you are using +[Go Modules](https://github.com/golang/go/wiki/Modules) for dependency +management. Use a +[tool dependency](https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module) +to track the versions of the following executable packages: + +```go +// +build tools + +package tools + +import ( + _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" + _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" + _ "github.com/golang/protobuf/protoc-gen-go" +) +``` -Then use `go get -u` to download the following packages: +Run `go mod tidy` to resolve the versions. Install by running ```sh -go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway -go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger -go get -u github.com/golang/protobuf/protoc-gen-go +$ go install \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \ + github.com/golang/protobuf/protoc-gen-go ``` This will place three binaries in your `$GOBIN`; From 46c6eb0b15f590f57247edcc6636371bd10ed45d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2020 11:48:09 +0000 Subject: [PATCH 516/552] Bump nokogiri from 1.10.4 to 1.10.8 in /docs (#1140) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.4 to 1.10.8. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.4...v1.10.8) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 9a6ac6f8c32..74d3327d9ad 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -209,7 +209,7 @@ GEM minitest (5.11.3) multipart-post (2.0.0) net-dns (0.8.0) - nokogiri (1.10.4) + nokogiri (1.10.8) mini_portile2 (~> 2.4.0) octokit (4.8.0) sawyer (~> 0.8.0, >= 0.5.3) From b7037788b3d4ff3bf22237dd3db78ff895276544 Mon Sep 17 00:00:00 2001 From: wp0pw Date: Tue, 25 Feb 2020 15:47:52 +0000 Subject: [PATCH 517/552] Configurable query parameters parser (#1138) * #1128 make it possible to configure query param parser implementation * Apply suggestions from code review Makes names more consistent and improves docs Co-Authored-By: Johan Brandhorst * #1128 make configured parser a global parser * update docs for configuring query parser Co-Authored-By: Johan Brandhorst * #1128 unexport default query parameter parser and rename mux option Co-authored-by: Johan Brandhorst Fixes #1128 --- runtime/mux.go | 9 +++++++++ runtime/query.go | 19 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/runtime/mux.go b/runtime/mux.go index 1da3a58854d..6cf5b1d6fb6 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -55,6 +55,15 @@ func WithForwardResponseOption(forwardResponseOption func(context.Context, http. } } +// SetQueryParameterParser sets the query parameter parser, used to populate message from query parameters. +// Configuring this will mean the generated swagger output is no longer correct, and it should be +// done with careful consideration. +func SetQueryParameterParser(queryParameterParser QueryParameterParser) ServeMuxOption { + return func(serveMux *ServeMux) { + currentQueryParser = queryParameterParser + } +} + // HeaderMatcherFunc checks whether a header key should be forwarded to/from gRPC context. type HeaderMatcherFunc func(string) (string, bool) diff --git a/runtime/query.go b/runtime/query.go index 80ff21c3a4c..ba66842c330 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -17,9 +17,24 @@ import ( var valuesKeyRegexp = regexp.MustCompile("^(.*)\\[(.*)\\]$") -// PopulateQueryParameters populates "values" into "msg". -// A value is ignored if its key starts with one of the elements in "filter". +var currentQueryParser QueryParameterParser = &defaultQueryParser{} + +// QueryParameterParser defines interface for all query parameter parsers +type QueryParameterParser interface { + Parse(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error +} + +// PopulateQueryParameters parses query parameters +// into "msg" using current query parser func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { + return currentQueryParser.Parse(msg, values, filter) +} + +type defaultQueryParser struct{} + +// Parse populates "values" into "msg". +// A value is ignored if its key starts with one of the elements in "filter". +func (*defaultQueryParser) Parse(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { for key, values := range values { match := valuesKeyRegexp.FindStringSubmatch(key) if len(match) == 3 { From 514757d850ccc69172c43a86bfcf019decc8479c Mon Sep 17 00:00:00 2001 From: Wiliam Souza Date: Sat, 29 Feb 2020 05:09:18 -0300 Subject: [PATCH 518/552] Fix customizing your gateway documentation CustomMatcher example (#1142) * Fix customizing your gateway documentation CustomMatcher example * Add more documentation about mapping from HTTP request headers to gRPC client metadata --- docs/_docs/customizingyourgateway.md | 37 +++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/docs/_docs/customizingyourgateway.md b/docs/_docs/customizingyourgateway.md index 49dcb1660c4..a461747fb1a 100644 --- a/docs/_docs/customizingyourgateway.md +++ b/docs/_docs/customizingyourgateway.md @@ -87,9 +87,9 @@ You might not like [the default mapping rule](http://godoc.org/github.com/grpc-e ```go func CustomMatcher(key string) (string, bool) { switch key { - case "x-custom-header1": + case "X-Custom-Header1": return key, true - case "x-custom-header2": + case "X-Custom-Header2": return "custom-header2", true default: return key, false @@ -98,8 +98,39 @@ You might not like [the default mapping rule](http://godoc.org/github.com/grpc-e ... mux := runtime.NewServeMux(runtime.WithIncomingHeaderMatcher(CustomMatcher)) - ``` +To keep the [the default mapping rule](http://godoc.org/github.com/grpc-ecosystem/grpc-gateway/runtime#DefaultHeaderMatcher) alongside with your own rules write: + +```go +func CustomMatcher(key string) (string, bool) { + switch key { + case "X-User-Id": + return key, true + default: + return runtime.DefaultHeaderMatcher(key) + } +} +``` +It will work with both: + +```bash +curl --header "x-user-id: 100d9f38-2777-4ee2-ac3b-b3a108f81a30" ... +``` +and: +```bash +curl --header "X-USER-ID: 100d9f38-2777-4ee2-ac3b-b3a108f81a30" ... +``` +To access this header on gRPC server side use: +```go +... +userID := "" +if md, ok := metadata.FromIncomingContext(ctx); ok { + if uID, ok := md["x-user-id"]; ok { + userID = strings.Join(uID, ",") + } +} +... +``` ## Mapping from gRPC server metadata to HTTP response headers ditto. Use [`WithOutgoingHeaderMatcher`](http://godoc.org/github.com/grpc-ecosystem/grpc-gateway/runtime#WithOutgoingHeaderMatcher). From 6b63116989e769747df490d90c895671ee04c0bc Mon Sep 17 00:00:00 2001 From: Josh Giles Date: Sun, 1 Mar 2020 16:49:45 -0500 Subject: [PATCH 519/552] Fix #1143: Support multiple error handlers. (#1144) * Fix #1143: Support multiple error handlers. Support specifying different custom error handlers on different muxes, or specifying custom error handlers on some muxes and using the default handlers on others. Make the runtime.HTTPError use the mux-configured error handler if present, and allow overriding the global default behavior by setting GlobalHTTPErrorHandler. Add commentary explaining the use of the different options for controlling error handling. * Stop overwriting HTTPError. * Fix WithProtoErrorHandler comment. * Document error customization options. --- docs/_docs/customizingyourgateway.md | 19 ++++++++++- runtime/errors.go | 47 +++++++++++++++++++++++++--- runtime/mux.go | 18 ++--------- 3 files changed, 64 insertions(+), 20 deletions(-) diff --git a/docs/_docs/customizingyourgateway.md b/docs/_docs/customizingyourgateway.md index a461747fb1a..6009bff9d7f 100644 --- a/docs/_docs/customizingyourgateway.md +++ b/docs/_docs/customizingyourgateway.md @@ -234,7 +234,24 @@ if err := pb.RegisterMyServiceHandlerFromEndpoint(ctx, mux, serviceEndpoint, opt ``` ## Error handler -http://mycodesmells.com/post/grpc-gateway-error-handler +The gateway uses two different error handlers for non-streaming requests: + + * `runtime.HTTPError` is called for errors from backend calls + * `runtime.OtherErrorHandler` is called for errors from parsing and routing client requests + +To override all error handling for a `*runtime.ServeMux`, use the +`runtime.WithProtoErrorHandler` serve option. + +Alternatively, you can override the global default `HTTPError` handling by +setting `runtime.GlobalHTTPErrorHandler` to a custom function, and override +the global default `OtherErrorHandler` by setting `runtime.OtherErrorHandler` +to a custom function. + +You should not set `runtime.HTTPError` directly, because that might break +any `ServeMux` set up with the `WithProtoErrorHandler` option. + +See https://mycodesmells.com/post/grpc-gateway-error-handler for an example +of writing a custom error handler function. ## Stream Error Handler The error handler described in the previous section applies only diff --git a/runtime/errors.go b/runtime/errors.go index 0118ca0479d..8ec2fc0f1c7 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -5,10 +5,10 @@ import ( "io" "net/http" + "github.com/grpc-ecosystem/grpc-gateway/internal" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" - "github.com/grpc-ecosystem/grpc-gateway/internal" ) // HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. @@ -57,13 +57,52 @@ func HTTPStatusFromCode(code codes.Code) int { } var ( - // HTTPError replies to the request with the error. + // HTTPError replies to the request with an error. + // + // HTTPError is called: + // - From generated per-endpoint gateway handler code, when calling the backend results in an error. + // - From gateway runtime code, when forwarding the response message results in an error. + // + // The default value for HTTPError calls the custom error handler configured on the ServeMux via the + // WithProtoErrorHandler serve option if that option was used, calling GlobalHTTPErrorHandler otherwise. + // + // To customize the error handling of a particular ServeMux instance, use the WithProtoErrorHandler + // serve option. + // + // To customize the error format for all ServeMux instances not using the WithProtoErrorHandler serve + // option, set GlobalHTTPErrorHandler to a custom function. + // + // Setting this variable directly to customize error format is deprecated. + HTTPError = MuxOrGlobalHTTPError + + // GlobalHTTPErrorHandler is the HTTPError handler for all ServeMux instances not using the + // WithProtoErrorHandler serve option. + // // You can set a custom function to this variable to customize error format. - HTTPError = DefaultHTTPError - // OtherErrorHandler handles the following error used by the gateway: StatusMethodNotAllowed StatusNotFound and StatusBadRequest + GlobalHTTPErrorHandler = DefaultHTTPError + + // OtherErrorHandler handles gateway errors from parsing and routing client requests for all + // ServeMux instances not using the WithProtoErrorHandler serve option. + // + // It returns the following error codes: StatusMethodNotAllowed StatusNotFound StatusBadRequest + // + // To customize parsing and routing error handling of a particular ServeMux instance, use the + // WithProtoErrorHandler serve option. + // + // To customize parsing and routing error handling of all ServeMux instances not using the + // WithProtoErrorHandler serve option, set a custom function to this variable. OtherErrorHandler = DefaultOtherErrorHandler ) +// MuxOrGlobalHTTPError uses the mux-configured error handler, falling back to GlobalErrorHandler. +func MuxOrGlobalHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, r *http.Request, err error) { + if mux.protoErrorHandler != nil { + mux.protoErrorHandler(ctx, mux, marshaler, w, r, err) + } else { + GlobalHTTPErrorHandler(ctx, mux, marshaler, w, r, err) + } +} + // DefaultHTTPError is the default implementation of HTTPError. // If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode. // If otherwise, it replies with http.StatusInternalServerError. diff --git a/runtime/mux.go b/runtime/mux.go index 6cf5b1d6fb6..523a9cb43c9 100644 --- a/runtime/mux.go +++ b/runtime/mux.go @@ -111,11 +111,11 @@ func WithMetadata(annotator func(context.Context, *http.Request) metadata.MD) Se } } -// WithProtoErrorHandler returns a ServeMuxOption for passing metadata to a gRPC context. +// WithProtoErrorHandler returns a ServeMuxOption for configuring a custom error handler. // // This can be used to handle an error as general proto message defined by gRPC. -// The response including body and status is not backward compatible with the default error handler. -// When this option is used, HTTPError and OtherErrorHandler are overwritten on initialization. +// When this option is used, the mux uses the configured error handler instead of HTTPError and +// OtherErrorHandler. func WithProtoErrorHandler(fn ProtoErrorHandlerFunc) ServeMuxOption { return func(serveMux *ServeMux) { serveMux.protoErrorHandler = fn @@ -165,18 +165,6 @@ func NewServeMux(opts ...ServeMuxOption) *ServeMux { opt(serveMux) } - if serveMux.protoErrorHandler != nil { - HTTPError = serveMux.protoErrorHandler - // OtherErrorHandler is no longer used when protoErrorHandler is set. - // Overwritten by a special error handler to return Unknown. - OtherErrorHandler = func(w http.ResponseWriter, r *http.Request, _ string, _ int) { - ctx := context.Background() - _, outboundMarshaler := MarshalerForRequest(serveMux, r) - sterr := status.Error(codes.Unknown, "unexpected use of OtherErrorHandler") - serveMux.protoErrorHandler(ctx, serveMux, outboundMarshaler, w, r, sterr) - } - } - if serveMux.incomingHeaderMatcher == nil { serveMux.incomingHeaderMatcher = DefaultHeaderMatcher } From 212c3bffb230ebda5a17b3afb2130afc264e7269 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 26 Feb 2020 17:38:13 +0000 Subject: [PATCH 520/552] protoc-gen-swagger: add flag to disable default errors The new flag disable_default_errors can be used to disable the generation of the default error types. This is suitable for users that define their own error formatting. --- .../descriptor/registry.go | 14 ++++++++ protoc-gen-swagger/genswagger/template.go | 34 +++++++++++-------- protoc-gen-swagger/main.go | 2 ++ 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index b73c123c8f9..e68a9aa233b 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -75,6 +75,10 @@ type Registry struct { // useGoTemplate determines whether you want to use GO templates // in your protofile comments useGoTemplate bool + + // disableDefaultErrors disables the generation of the default error types. + // This is useful for users who have defined custom error handling. + disableDefaultErrors bool } type repeatedFieldSeparator struct { @@ -460,6 +464,16 @@ func (r *Registry) GetUseGoTemplate() bool { return r.useGoTemplate } +// SetDisableDefaultErrors sets disableDefaultErrors +func (r *Registry) SetDisableDefaultErrors(use bool) { + r.disableDefaultErrors = use +} + +// GetDisableDefaultErrors returns disableDefaultErrors +func (r *Registry) GetDisableDefaultErrors() bool { + return r.disableDefaultErrors +} + // sanitizePackageName replaces unallowed character in package name // with allowed character. func sanitizePackageName(pkgName string) string { diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 5a668783c8e..9e0b5ce58af 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -882,16 +882,18 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re Description: desc, Schema: responseSchema, }, - // https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responses-object - "default": swaggerResponseObject{ - Description: "An unexpected error response", - Schema: swaggerSchemaObject{ - schemaCore: schemaCore{ - Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.Error", reg)), - }, + }, + } + if !reg.GetDisableDefaultErrors() { + // https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responses-object + operationObject.Responses["default"] = swaggerResponseObject{ + Description: "An unexpected error response", + Schema: swaggerSchemaObject{ + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.Error", reg)), }, }, - }, + } } if bIdx == 0 { operationObject.OperationID = fmt.Sprintf("%s", meth.GetName()) @@ -1052,13 +1054,15 @@ func applyTemplate(p param) (*swaggerObject, error) { streamingMessages := messageMap{} enums := enumMap{} - // Add the error type to the message map - runtimeError, err := p.reg.LookupMsg(".grpc.gateway.runtime", "Error") - if err == nil { - messages[fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.Error", p.reg)] = runtimeError - } else { - // just in case there is an error looking up runtimeError - glog.Error(err) + if !p.reg.GetDisableDefaultErrors() { + // Add the error type to the message map + runtimeError, err := p.reg.LookupMsg(".grpc.gateway.runtime", "Error") + if err == nil { + messages[fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.Error", p.reg)] = runtimeError + } else { + // just in case there is an error looking up runtimeError + glog.Error(err) + } } // Find all the service's messages and enumerations that are defined (recursively) diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index 9befc2544f4..f25e431b553 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -28,6 +28,7 @@ var ( includePackageInTags = flag.Bool("include_package_in_tags", false, "if unset, the gRPC service name is added to the `Tags` field of each operation. if set and the `package` directive is shown in the proto file, the package name will be prepended to the service name") useFQNForSwaggerName = flag.Bool("fqn_for_swagger_name", false, "if set, the object's swagger names will use the fully qualify name from the proto definition (ie my.package.MyMessage.MyInnerMessage") useGoTemplate = flag.Bool("use_go_templates", false, "if set, you can use Go templates in protofile comments") + disableDefaultErrors = flag.Bool("disable_default_errors", false, "if set, disables generation of default errors. This is useful if you have defined custom error handling") ) // Variables set by goreleaser at build time @@ -80,6 +81,7 @@ func main() { reg.SetIncludePackageInTags(*includePackageInTags) reg.SetUseFQNForSwaggerName(*useFQNForSwaggerName) reg.SetUseGoTemplate(*useGoTemplate) + reg.SetDisableDefaultErrors(*disableDefaultErrors) if err := reg.SetRepeatedPathParamSeparator(*repeatedPathParamSeparator); err != nil { emitError(err) return From b1847d32892ceb18243cb32ff23cfc4cd16d7293 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 4 Mar 2020 19:28:01 +0000 Subject: [PATCH 521/552] Minimize API surface in anticipation of gorelease (#1146) * Move examples under internal to avoid importing This is necessary as part of adding gorelease to our CI. These packages could otherwise be considered part of our public API. This will break users who are importing these examples in their own projects. * Rename imports and regenerate files * Make generator internals private This helps remove public API surface * Move codegenerator package to internal This reduces our API surface --- .circleci/config.yml | 2 +- Makefile | 108 +-- README.md | 4 +- docs/_docs/examples.md | 2 +- docs/_docs/faq.md | 2 +- docs/_docs/patch.md | 4 +- docs/_docs/usage.md | 4 +- docs/_docs/usegotemplates.md | 2 +- examples/{ => internal}/README.md | 2 +- examples/{ => internal}/browser/.gitignore | 0 examples/{ => internal}/browser/README.md | 0 .../a_bit_of_everything_service.spec.js | 0 .../{ => internal}/browser/bin/.gitignore | 0 examples/{ => internal}/browser/bower.json | 0 .../browser/echo_service.spec.js | 0 examples/{ => internal}/browser/gulpfile.js | 24 +- examples/{ => internal}/browser/index.html | 0 examples/{ => internal}/browser/package.json | 0 .../{ => internal}/clients/abe/.gitignore | 0 .../clients/abe/.swagger-codegen-ignore | 0 .../clients/abe/.swagger-codegen/VERSION | 0 .../{ => internal}/clients/abe/BUILD.bazel | 6 +- .../clients/abe/api/swagger.yaml | 0 .../abe/api_a_bit_of_everything_service.go | 0 .../abe/api_camel_case_service_name.go | 0 .../clients/abe/api_echo_rpc.go | 0 examples/{ => internal}/clients/abe/client.go | 0 .../clients/abe/configuration.go | 0 .../{ => internal}/clients/abe/enum_helper.go | 4 +- .../abe/model_a_bit_of_everything_nested.go | 0 .../model_examplepb_a_bit_of_everything.go | 0 ..._examplepb_a_bit_of_everything_repeated.go | 0 .../clients/abe/model_examplepb_body.go | 0 .../abe/model_examplepb_numeric_enum.go | 0 .../abe/model_examplepb_update_v2_request.go | 0 ...odel_message_path_enum_nested_path_enum.go | 0 .../clients/abe/model_nested_deep_enum.go | 0 .../clients/abe/model_pathenum_path_enum.go | 0 .../clients/abe/model_protobuf_any.go | 0 .../clients/abe/model_protobuf_field_mask.go | 0 .../clients/abe/model_runtime_error.go | 0 .../clients/abe/model_sub_string_message.go | 0 .../{ => internal}/clients/abe/response.go | 0 .../{ => internal}/clients/echo/.gitignore | 0 .../clients/echo/.swagger-codegen-ignore | 0 .../clients/echo/.swagger-codegen/VERSION | 0 .../{ => internal}/clients/echo/BUILD.bazel | 2 +- .../clients/echo/api/swagger.yaml | 0 .../clients/echo/api_echo_service.go | 0 .../{ => internal}/clients/echo/client.go | 0 .../clients/echo/configuration.go | 0 .../clients/echo/model_examplepb_embedded.go | 0 .../echo/model_examplepb_simple_message.go | 0 .../clients/echo/model_protobuf_any.go | 0 .../clients/echo/model_runtime_error.go | 0 .../{ => internal}/clients/echo/response.go | 0 .../clients/responsebody/.gitignore | 0 .../responsebody/.swagger-codegen-ignore | 0 .../responsebody/.swagger-codegen/VERSION | 0 .../clients/responsebody/BUILD.bazel | 2 +- .../clients/responsebody/api/swagger.yaml | 2 +- .../responsebody/api_response_body_service.go | 2 +- .../clients/responsebody/client.go | 4 +- .../clients/responsebody/configuration.go | 2 +- .../docs/ExamplepbRepeatedResponseBodyOut.md | 0 ...xamplepbRepeatedResponseBodyOutResponse.md | 0 .../docs/ExamplepbRepeatedResponseStrings.md | 0 .../docs/ExamplepbResponseBodyMessage.md | 0 .../ExamplepbResponseBodyMessageResponse.md | 0 .../docs/ExamplepbResponseBodyOut.md | 0 .../docs/ExamplepbResponseBodyOutResponse.md | 0 .../docs/ExamplepbResponseBodyReq.md | 0 .../clients/responsebody/docs/ProtobufAny.md | 0 .../docs/ResponseBodyServiceApi.md | 0 .../responsebody/docs/ResponseResponseType.md | 0 .../clients/responsebody/docs/RuntimeError.md | 0 ...el_examplepb_repeated_response_body_out.go | 2 +- ...epb_repeated_response_body_out_response.go | 2 +- ...del_examplepb_repeated_response_strings.go | 2 +- .../model_examplepb_response_body_out.go | 2 +- ...el_examplepb_response_body_out_response.go | 2 +- .../responsebody/model_protobuf_any.go | 2 +- .../model_response_response_type.go | 2 +- .../responsebody/model_runtime_error.go | 2 +- .../clients/responsebody/response.go | 2 +- .../clients/unannotatedecho/.gitignore | 0 .../unannotatedecho/.swagger-codegen-ignore | 0 .../unannotatedecho/.swagger-codegen/VERSION | 0 .../clients/unannotatedecho/BUILD.bazel | 2 +- .../clients/unannotatedecho/api/swagger.yaml | 2 +- .../api_unannotated_echo_service.go | 2 +- .../clients/unannotatedecho/client.go | 4 +- .../clients/unannotatedecho/configuration.go | 2 +- ...el_examplepb_unannotated_simple_message.go | 2 +- .../unannotatedecho/model_protobuf_any.go | 2 +- .../unannotatedecho/model_runtime_error.go | 2 +- .../clients/unannotatedecho/response.go | 2 +- .../cmd/example-gateway-server/BUILD.bazel | 4 +- .../cmd/example-gateway-server/main.go | 4 +- .../cmd/example-grpc-server/BUILD.bazel | 4 +- .../cmd/example-grpc-server/main.go | 2 +- examples/{ => internal}/gateway/BUILD.bazel | 4 +- examples/{ => internal}/gateway/doc.go | 0 examples/{ => internal}/gateway/gateway.go | 2 +- examples/{ => internal}/gateway/handlers.go | 0 examples/{ => internal}/gateway/main.go | 0 .../helloworld/BUILD.bazel | 4 +- .../helloworld/helloworld.pb.go | 0 .../helloworld/helloworld.pb.gw.go | 0 .../helloworld/helloworld.proto | 0 .../{ => internal}/integration/BUILD.bazel | 16 +- .../{ => internal}/integration/client_test.go | 6 +- .../integration/fieldmask_test.go | 2 +- .../integration/integration_test.go | 6 +- .../{ => internal}/integration/main_test.go | 6 +- .../integration/proto_error_test.go | 0 .../proto/examplepb/BUILD.bazel | 16 +- .../proto/examplepb/a_bit_of_everything.pb.go | 625 +++++++------- .../examplepb/a_bit_of_everything.pb.gw.go | 8 +- .../proto/examplepb/a_bit_of_everything.proto | 12 +- .../a_bit_of_everything.swagger.json | 0 .../proto/examplepb/echo_service.pb.go | 96 +-- .../proto/examplepb/echo_service.pb.gw.go | 2 +- .../proto/examplepb/echo_service.proto | 2 +- .../proto/examplepb/echo_service.swagger.json | 0 .../proto/examplepb/flow_combination.pb.go | 148 ++-- .../proto/examplepb/flow_combination.pb.gw.go | 2 +- .../proto/examplepb/flow_combination.proto | 2 +- .../proto/examplepb/generated_input.proto | 5 +- .../proto/examplepb/non_standard_names.pb.go | 136 +-- .../examplepb/non_standard_names.pb.gw.go | 2 +- .../proto/examplepb/non_standard_names.proto | 2 +- .../examplepb/response_body_service.pb.go | 115 +-- .../examplepb/response_body_service.pb.gw.go | 2 +- .../examplepb/response_body_service.proto | 2 +- .../response_body_service.swagger.json | 2 +- .../proto/examplepb/stream.pb.go | 65 +- .../proto/examplepb/stream.pb.gw.go | 4 +- .../proto/examplepb/stream.proto | 8 +- .../proto/examplepb/stream.swagger.json | 2 +- .../examplepb/unannotated_echo_service.pb.go | 63 +- .../unannotated_echo_service.pb.gw.go | 2 +- .../examplepb/unannotated_echo_service.proto | 2 +- .../unannotated_echo_service.swagger.json | 2 +- .../examplepb/unannotated_echo_service.yaml | 15 + .../proto/examplepb/use_go_template.pb.go | 87 +- .../proto/examplepb/use_go_template.pb.gw.go | 2 +- .../proto/examplepb/use_go_template.proto | 4 +- .../examplepb/use_go_template.swagger.json | 2 +- .../proto/examplepb/wrappers.pb.go | 138 +-- .../proto/examplepb/wrappers.pb.gw.go | 2 +- .../proto/examplepb/wrappers.proto | 2 +- .../proto/examplepb/wrappers.swagger.json | 2 +- .../{ => internal}/proto/pathenum/BUILD.bazel | 4 +- .../proto/pathenum/path_enum.pb.go | 47 +- .../proto/pathenum/path_enum.proto | 4 +- examples/{ => internal}/proto/sub/BUILD.bazel | 4 +- .../{ => internal}/proto/sub/message.pb.go | 30 +- .../{ => internal}/proto/sub/message.proto | 2 +- .../{ => internal}/proto/sub2/BUILD.bazel | 4 +- .../{ => internal}/proto/sub2/message.pb.go | 30 +- .../{ => internal}/proto/sub2/message.proto | 2 +- examples/{ => internal}/server/BUILD.bazel | 8 +- .../server/a_bit_of_everything.go | 6 +- examples/{ => internal}/server/echo.go | 2 +- .../{ => internal}/server/fieldmask_helper.go | 0 .../server/fieldmask_helper_test.go | 0 .../{ => internal}/server/flow_combination.go | 2 +- examples/{ => internal}/server/main.go | 2 +- .../server/non_standard_names.go | 2 +- .../{ => internal}/server/responsebody.go | 2 +- .../{ => internal}/server/unannotatedecho.go | 3 +- .../examplepb/unannotated_echo_service.yaml | 15 - fuzzit.sh | 4 +- .../codegenerator}/BUILD.bazel | 4 +- .../codegenerator}/doc.go | 0 .../codegenerator}/parse_req.go | 0 .../codegenerator}/parse_req_test.go | 2 +- .../descriptor/BUILD.bazel | 8 +- .../descriptor/grpc_api_configuration.go | 0 .../descriptor/grpc_api_configuration_test.go | 0 .../descriptor/grpc_api_service.go | 0 .../descriptor/registry.go | 0 .../descriptor/registry_test.go | 0 .../descriptor/services.go | 4 +- .../descriptor/services_test.go | 2 +- .../descriptor/types.go | 2 +- .../descriptor/types_test.go | 0 .../generator/BUILD.bazel | 6 +- .../generator/generator.go | 2 +- .../httprule/BUILD.bazel | 4 +- .../httprule/compile.go | 0 .../httprule/compile_test.go | 0 .../httprule/fuzz.go | 0 .../httprule/parse.go | 0 .../httprule/parse_test.go | 0 .../httprule/types.go | 0 .../httprule/types_test.go | 0 protoc-gen-grpc-gateway/BUILD.bazel | 6 +- .../{ => internal}/gengateway/BUILD.bazel | 10 +- .../{ => internal}/gengateway/doc.go | 0 .../{ => internal}/gengateway/generator.go | 4 +- .../gengateway/generator_test.go | 2 +- .../{ => internal}/gengateway/template.go | 2 +- .../gengateway/template_test.go | 4 +- protoc-gen-grpc-gateway/main.go | 6 +- protoc-gen-swagger/BUILD.bazel | 6 +- .../{ => internal}/genswagger/BUILD.bazel | 10 +- .../{ => internal}/genswagger/doc.go | 0 .../{ => internal}/genswagger/generator.go | 4 +- .../{ => internal}/genswagger/helpers.go | 0 .../genswagger/helpers_go111_old.go | 0 .../{ => internal}/genswagger/template.go | 2 +- .../genswagger/template_test.go | 4 +- .../{ => internal}/genswagger/types.go | 2 +- protoc-gen-swagger/main.go | 6 +- runtime/BUILD.bazel | 2 +- runtime/handler_test.go | 3 +- runtime/internal/examplepb/BUILD.bazel | 31 + runtime/internal/examplepb/example.pb.go | 807 ++++++++++++++++++ runtime/internal/examplepb/example.proto | 115 +++ runtime/marshal_json_test.go | 2 +- runtime/marshal_jsonpb_test.go | 12 +- runtime/marshal_proto_test.go | 2 +- 224 files changed, 2040 insertions(+), 1066 deletions(-) rename examples/{ => internal}/README.md (96%) rename examples/{ => internal}/browser/.gitignore (100%) rename examples/{ => internal}/browser/README.md (100%) rename examples/{ => internal}/browser/a_bit_of_everything_service.spec.js (100%) rename examples/{ => internal}/browser/bin/.gitignore (100%) rename examples/{ => internal}/browser/bower.json (100%) rename examples/{ => internal}/browser/echo_service.spec.js (100%) rename examples/{ => internal}/browser/gulpfile.js (76%) rename examples/{ => internal}/browser/index.html (100%) rename examples/{ => internal}/browser/package.json (100%) rename examples/{ => internal}/clients/abe/.gitignore (100%) rename examples/{ => internal}/clients/abe/.swagger-codegen-ignore (100%) rename examples/{ => internal}/clients/abe/.swagger-codegen/VERSION (100%) rename examples/{ => internal}/clients/abe/BUILD.bazel (88%) rename examples/{ => internal}/clients/abe/api/swagger.yaml (100%) rename examples/{ => internal}/clients/abe/api_a_bit_of_everything_service.go (100%) rename examples/{ => internal}/clients/abe/api_camel_case_service_name.go (100%) rename examples/{ => internal}/clients/abe/api_echo_rpc.go (100%) rename examples/{ => internal}/clients/abe/client.go (100%) rename examples/{ => internal}/clients/abe/configuration.go (100%) rename examples/{ => internal}/clients/abe/enum_helper.go (89%) rename examples/{ => internal}/clients/abe/model_a_bit_of_everything_nested.go (100%) rename examples/{ => internal}/clients/abe/model_examplepb_a_bit_of_everything.go (100%) rename examples/{ => internal}/clients/abe/model_examplepb_a_bit_of_everything_repeated.go (100%) rename examples/{ => internal}/clients/abe/model_examplepb_body.go (100%) rename examples/{ => internal}/clients/abe/model_examplepb_numeric_enum.go (100%) rename examples/{ => internal}/clients/abe/model_examplepb_update_v2_request.go (100%) rename examples/{ => internal}/clients/abe/model_message_path_enum_nested_path_enum.go (100%) rename examples/{ => internal}/clients/abe/model_nested_deep_enum.go (100%) rename examples/{ => internal}/clients/abe/model_pathenum_path_enum.go (100%) rename examples/{ => internal}/clients/abe/model_protobuf_any.go (100%) rename examples/{ => internal}/clients/abe/model_protobuf_field_mask.go (100%) rename examples/{ => internal}/clients/abe/model_runtime_error.go (100%) rename examples/{ => internal}/clients/abe/model_sub_string_message.go (100%) rename examples/{ => internal}/clients/abe/response.go (100%) rename examples/{ => internal}/clients/echo/.gitignore (100%) rename examples/{ => internal}/clients/echo/.swagger-codegen-ignore (100%) rename examples/{ => internal}/clients/echo/.swagger-codegen/VERSION (100%) rename examples/{ => internal}/clients/echo/BUILD.bazel (96%) rename examples/{ => internal}/clients/echo/api/swagger.yaml (100%) rename examples/{ => internal}/clients/echo/api_echo_service.go (100%) rename examples/{ => internal}/clients/echo/client.go (100%) rename examples/{ => internal}/clients/echo/configuration.go (100%) rename examples/{ => internal}/clients/echo/model_examplepb_embedded.go (100%) rename examples/{ => internal}/clients/echo/model_examplepb_simple_message.go (100%) rename examples/{ => internal}/clients/echo/model_protobuf_any.go (100%) rename examples/{ => internal}/clients/echo/model_runtime_error.go (100%) rename examples/{ => internal}/clients/echo/response.go (100%) rename examples/{ => internal}/clients/responsebody/.gitignore (100%) rename examples/{ => internal}/clients/responsebody/.swagger-codegen-ignore (100%) rename examples/{ => internal}/clients/responsebody/.swagger-codegen/VERSION (100%) rename examples/{ => internal}/clients/responsebody/BUILD.bazel (95%) rename examples/{ => internal}/clients/responsebody/api/swagger.yaml (99%) rename examples/{ => internal}/clients/responsebody/api_response_body_service.go (99%) rename examples/{ => internal}/clients/responsebody/client.go (98%) rename examples/{ => internal}/clients/responsebody/configuration.go (97%) rename examples/{ => internal}/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOut.md (100%) rename examples/{ => internal}/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md (100%) rename examples/{ => internal}/clients/responsebody/docs/ExamplepbRepeatedResponseStrings.md (100%) rename examples/{ => internal}/clients/responsebody/docs/ExamplepbResponseBodyMessage.md (100%) rename examples/{ => internal}/clients/responsebody/docs/ExamplepbResponseBodyMessageResponse.md (100%) rename examples/{ => internal}/clients/responsebody/docs/ExamplepbResponseBodyOut.md (100%) rename examples/{ => internal}/clients/responsebody/docs/ExamplepbResponseBodyOutResponse.md (100%) rename examples/{ => internal}/clients/responsebody/docs/ExamplepbResponseBodyReq.md (100%) rename examples/{ => internal}/clients/responsebody/docs/ProtobufAny.md (100%) rename examples/{ => internal}/clients/responsebody/docs/ResponseBodyServiceApi.md (100%) rename examples/{ => internal}/clients/responsebody/docs/ResponseResponseType.md (100%) rename examples/{ => internal}/clients/responsebody/docs/RuntimeError.md (100%) rename examples/{ => internal}/clients/responsebody/model_examplepb_repeated_response_body_out.go (85%) rename examples/{ => internal}/clients/responsebody/model_examplepb_repeated_response_body_out_response.go (86%) rename examples/{ => internal}/clients/responsebody/model_examplepb_repeated_response_strings.go (84%) rename examples/{ => internal}/clients/responsebody/model_examplepb_response_body_out.go (85%) rename examples/{ => internal}/clients/responsebody/model_examplepb_response_body_out_response.go (84%) rename examples/{ => internal}/clients/responsebody/model_protobuf_any.go (98%) rename examples/{ => internal}/clients/responsebody/model_response_response_type.go (88%) rename examples/{ => internal}/clients/responsebody/model_runtime_error.go (87%) rename examples/{ => internal}/clients/responsebody/response.go (95%) rename examples/{ => internal}/clients/unannotatedecho/.gitignore (100%) rename examples/{ => internal}/clients/unannotatedecho/.swagger-codegen-ignore (100%) rename examples/{ => internal}/clients/unannotatedecho/.swagger-codegen/VERSION (100%) rename examples/{ => internal}/clients/unannotatedecho/BUILD.bazel (94%) rename examples/{ => internal}/clients/unannotatedecho/api/swagger.yaml (99%) rename examples/{ => internal}/clients/unannotatedecho/api_unannotated_echo_service.go (99%) rename examples/{ => internal}/clients/unannotatedecho/client.go (98%) rename examples/{ => internal}/clients/unannotatedecho/configuration.go (97%) rename examples/{ => internal}/clients/unannotatedecho/model_examplepb_unannotated_simple_message.go (91%) rename examples/{ => internal}/clients/unannotatedecho/model_protobuf_any.go (98%) rename examples/{ => internal}/clients/unannotatedecho/model_runtime_error.go (90%) rename examples/{ => internal}/clients/unannotatedecho/response.go (95%) rename examples/{ => internal}/cmd/example-gateway-server/BUILD.bazel (82%) rename examples/{ => internal}/cmd/example-gateway-server/main.go (77%) rename examples/{ => internal}/cmd/example-grpc-server/BUILD.bazel (82%) rename examples/{ => internal}/cmd/example-grpc-server/main.go (88%) rename examples/{ => internal}/gateway/BUILD.bazel (86%) rename examples/{ => internal}/gateway/doc.go (100%) rename examples/{ => internal}/gateway/gateway.go (95%) rename examples/{ => internal}/gateway/handlers.go (100%) rename examples/{ => internal}/gateway/main.go (100%) rename examples/{pbwrappers => internal}/helloworld/BUILD.bazel (96%) rename examples/{pbwrappers => internal}/helloworld/helloworld.pb.go (100%) rename examples/{pbwrappers => internal}/helloworld/helloworld.pb.gw.go (100%) rename examples/{pbwrappers => internal}/helloworld/helloworld.proto (100%) rename examples/{ => internal}/integration/BUILD.bazel (61%) rename examples/{ => internal}/integration/client_test.go (95%) rename examples/{ => internal}/integration/fieldmask_test.go (98%) rename examples/{ => internal}/integration/integration_test.go (99%) rename examples/{ => internal}/integration/main_test.go (88%) rename examples/{ => internal}/integration/proto_error_test.go (100%) rename examples/{ => internal}/proto/examplepb/BUILD.bazel (88%) rename examples/{ => internal}/proto/examplepb/a_bit_of_everything.pb.go (67%) rename examples/{ => internal}/proto/examplepb/a_bit_of_everything.pb.gw.go (99%) rename examples/{ => internal}/proto/examplepb/a_bit_of_everything.proto (97%) rename examples/{ => internal}/proto/examplepb/a_bit_of_everything.swagger.json (100%) rename examples/{ => internal}/proto/examplepb/echo_service.pb.go (74%) rename examples/{ => internal}/proto/examplepb/echo_service.pb.gw.go (99%) rename examples/{ => internal}/proto/examplepb/echo_service.proto (97%) rename examples/{ => internal}/proto/examplepb/echo_service.swagger.json (100%) rename examples/{ => internal}/proto/examplepb/flow_combination.pb.go (80%) rename examples/{ => internal}/proto/examplepb/flow_combination.pb.gw.go (99%) rename examples/{ => internal}/proto/examplepb/flow_combination.proto (98%) rename examples/{ => internal}/proto/examplepb/generated_input.proto (75%) rename examples/{ => internal}/proto/examplepb/non_standard_names.pb.go (80%) rename examples/{ => internal}/proto/examplepb/non_standard_names.pb.gw.go (99%) rename examples/{ => internal}/proto/examplepb/non_standard_names.proto (97%) rename examples/{ => internal}/proto/examplepb/response_body_service.pb.go (77%) rename examples/{ => internal}/proto/examplepb/response_body_service.pb.gw.go (99%) rename examples/{ => internal}/proto/examplepb/response_body_service.proto (95%) rename examples/{ => internal}/proto/examplepb/response_body_service.swagger.json (99%) rename examples/{ => internal}/proto/examplepb/stream.pb.go (74%) rename examples/{ => internal}/proto/examplepb/stream.pb.gw.go (98%) rename examples/{ => internal}/proto/examplepb/stream.proto (67%) rename examples/{ => internal}/proto/examplepb/stream.swagger.json (99%) rename examples/{ => internal}/proto/examplepb/unannotated_echo_service.pb.go (76%) rename examples/{ => internal}/proto/examplepb/unannotated_echo_service.pb.gw.go (99%) rename examples/{ => internal}/proto/examplepb/unannotated_echo_service.proto (96%) rename examples/{ => internal}/proto/examplepb/unannotated_echo_service.swagger.json (99%) create mode 100644 examples/internal/proto/examplepb/unannotated_echo_service.yaml rename examples/{ => internal}/proto/examplepb/use_go_template.pb.go (81%) rename examples/{ => internal}/proto/examplepb/use_go_template.pb.gw.go (99%) rename examples/{ => internal}/proto/examplepb/use_go_template.proto (98%) rename examples/{ => internal}/proto/examplepb/use_go_template.swagger.json (99%) rename examples/{ => internal}/proto/examplepb/wrappers.pb.go (76%) rename examples/{ => internal}/proto/examplepb/wrappers.pb.gw.go (99%) rename examples/{ => internal}/proto/examplepb/wrappers.proto (97%) rename examples/{ => internal}/proto/examplepb/wrappers.swagger.json (99%) rename examples/{ => internal}/proto/pathenum/BUILD.bazel (91%) rename examples/{ => internal}/proto/pathenum/path_enum.pb.go (60%) rename examples/{ => internal}/proto/pathenum/path_enum.proto (71%) rename examples/{ => internal}/proto/sub/BUILD.bazel (92%) rename examples/{ => internal}/proto/sub/message.pb.go (65%) rename examples/{ => internal}/proto/sub/message.proto (69%) rename examples/{ => internal}/proto/sub2/BUILD.bazel (92%) rename examples/{ => internal}/proto/sub2/message.pb.go (63%) rename examples/{ => internal}/proto/sub2/message.proto (83%) rename examples/{ => internal}/server/BUILD.bazel (87%) rename examples/{ => internal}/server/a_bit_of_everything.go (97%) rename examples/{ => internal}/server/echo.go (91%) rename examples/{ => internal}/server/fieldmask_helper.go (100%) rename examples/{ => internal}/server/fieldmask_helper_test.go (100%) rename examples/{ => internal}/server/flow_combination.go (96%) rename examples/{ => internal}/server/main.go (91%) rename examples/{ => internal}/server/non_standard_names.go (93%) rename examples/{ => internal}/server/responsebody.go (93%) rename examples/{ => internal}/server/unannotatedecho.go (92%) delete mode 100644 examples/proto/examplepb/unannotated_echo_service.yaml rename {codegenerator => internal/codegenerator}/BUILD.bazel (81%) rename {codegenerator => internal/codegenerator}/doc.go (100%) rename {codegenerator => internal/codegenerator}/parse_req.go (100%) rename {codegenerator => internal/codegenerator}/parse_req_test.go (95%) rename {protoc-gen-grpc-gateway => internal}/descriptor/BUILD.bazel (82%) rename {protoc-gen-grpc-gateway => internal}/descriptor/grpc_api_configuration.go (100%) rename {protoc-gen-grpc-gateway => internal}/descriptor/grpc_api_configuration_test.go (100%) rename {protoc-gen-grpc-gateway => internal}/descriptor/grpc_api_service.go (100%) rename {protoc-gen-grpc-gateway => internal}/descriptor/registry.go (100%) rename {protoc-gen-grpc-gateway => internal}/descriptor/registry_test.go (100%) rename {protoc-gen-grpc-gateway => internal}/descriptor/services.go (98%) rename {protoc-gen-grpc-gateway => internal}/descriptor/services_test.go (99%) rename {protoc-gen-grpc-gateway => internal}/descriptor/types.go (99%) rename {protoc-gen-grpc-gateway => internal}/descriptor/types_test.go (100%) rename {protoc-gen-grpc-gateway => internal}/generator/BUILD.bazel (51%) rename {protoc-gen-grpc-gateway => internal}/generator/generator.go (83%) rename {protoc-gen-grpc-gateway => internal}/httprule/BUILD.bazel (81%) rename {protoc-gen-grpc-gateway => internal}/httprule/compile.go (100%) rename {protoc-gen-grpc-gateway => internal}/httprule/compile_test.go (100%) rename {protoc-gen-grpc-gateway => internal}/httprule/fuzz.go (100%) rename {protoc-gen-grpc-gateway => internal}/httprule/parse.go (100%) rename {protoc-gen-grpc-gateway => internal}/httprule/parse_test.go (100%) rename {protoc-gen-grpc-gateway => internal}/httprule/types.go (100%) rename {protoc-gen-grpc-gateway => internal}/httprule/types_test.go (100%) rename protoc-gen-grpc-gateway/{ => internal}/gengateway/BUILD.bazel (77%) rename protoc-gen-grpc-gateway/{ => internal}/gengateway/doc.go (100%) rename protoc-gen-grpc-gateway/{ => internal}/gengateway/generator.go (96%) rename protoc-gen-grpc-gateway/{ => internal}/gengateway/generator_test.go (98%) rename protoc-gen-grpc-gateway/{ => internal}/gengateway/template.go (99%) rename protoc-gen-grpc-gateway/{ => internal}/gengateway/template_test.go (99%) rename protoc-gen-swagger/{ => internal}/genswagger/BUILD.bazel (84%) rename protoc-gen-swagger/{ => internal}/genswagger/doc.go (100%) rename protoc-gen-swagger/{ => internal}/genswagger/generator.go (97%) rename protoc-gen-swagger/{ => internal}/genswagger/helpers.go (100%) rename protoc-gen-swagger/{ => internal}/genswagger/helpers_go111_old.go (100%) rename protoc-gen-swagger/{ => internal}/genswagger/template.go (99%) rename protoc-gen-swagger/{ => internal}/genswagger/template_test.go (99%) rename protoc-gen-swagger/{ => internal}/genswagger/types.go (99%) create mode 100644 runtime/internal/examplepb/BUILD.bazel create mode 100644 runtime/internal/examplepb/example.pb.go create mode 100644 runtime/internal/examplepb/example.proto diff --git a/.circleci/config.yml b/.circleci/config.yml index f9554d0dc95..7dc1c25c06f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,7 +26,7 @@ jobs: - run: go mod vendor - run: > . $HOME/.nvm/nvm.sh && - cd examples/browser && + cd examples/internal/browser && npm install gulp-cli && npm install && ./node_modules/.bin/gulp diff --git a/Makefile b/Makefile index 03766b669ee..bf3e882eb46 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,8 @@ SWAGGER_PLUGIN=bin/protoc-gen-swagger SWAGGER_PLUGIN_SRC= utilities/doc.go \ utilities/pattern.go \ utilities/trie.go \ - protoc-gen-swagger/genswagger/generator.go \ - protoc-gen-swagger/genswagger/template.go \ + protoc-gen-swagger/internal/genswagger/generator.go \ + protoc-gen-swagger/internal/genswagger/template.go \ protoc-gen-swagger/main.go SWAGGER_PLUGIN_PKG=./protoc-gen-swagger GATEWAY_PLUGIN=bin/protoc-gen-grpc-gateway @@ -21,22 +21,22 @@ GATEWAY_PLUGIN_SRC= utilities/doc.go \ utilities/pattern.go \ utilities/trie.go \ protoc-gen-grpc-gateway \ - protoc-gen-grpc-gateway/descriptor \ - protoc-gen-grpc-gateway/descriptor/registry.go \ - protoc-gen-grpc-gateway/descriptor/services.go \ - protoc-gen-grpc-gateway/descriptor/types.go \ - protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go \ - protoc-gen-grpc-gateway/descriptor/grpc_api_service.go \ - protoc-gen-grpc-gateway/generator \ - protoc-gen-grpc-gateway/generator/generator.go \ - protoc-gen-grpc-gateway/gengateway \ - protoc-gen-grpc-gateway/gengateway/doc.go \ - protoc-gen-grpc-gateway/gengateway/generator.go \ - protoc-gen-grpc-gateway/gengateway/template.go \ - protoc-gen-grpc-gateway/httprule \ - protoc-gen-grpc-gateway/httprule/compile.go \ - protoc-gen-grpc-gateway/httprule/parse.go \ - protoc-gen-grpc-gateway/httprule/types.go \ + internal/descriptor \ + internal/descriptor/registry.go \ + internal/descriptor/services.go \ + internal/descriptor/types.go \ + internal/descriptor/grpc_api_configuration.go \ + internal/descriptor/grpc_api_service.go \ + internal/generator \ + internal/generator/generator.go \ + protoc-gen-grpc-gateway/internal/gengateway \ + protoc-gen-grpc-gateway/internal/gengateway/doc.go \ + protoc-gen-grpc-gateway/internal/gengateway/generator.go \ + protoc-gen-grpc-gateway/internal/gengateway/template.go \ + internal/httprule \ + internal/httprule/compile.go \ + internal/httprule/parse.go \ + internal/httprule/types.go \ protoc-gen-grpc-gateway/main.go GATEWAY_PLUGIN_FLAGS?= SWAGGER_PLUGIN_FLAGS?= @@ -50,7 +50,7 @@ RUNTIME_GO=$(RUNTIME_PROTO:.proto=.pb.go) OPENAPIV2_PROTO=protoc-gen-swagger/options/openapiv2.proto protoc-gen-swagger/options/annotations.proto OPENAPIV2_GO=$(OPENAPIV2_PROTO:.proto=.pb.go) -PKGMAP=Mgoogle/protobuf/field_mask.proto=google.golang.org/genproto/protobuf/field_mask,Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mexamples/proto/sub/message.proto=github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub +PKGMAP=Mgoogle/protobuf/field_mask.proto=google.golang.org/genproto/protobuf/field_mask,Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mexamples/internal/proto/sub/message.proto=github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub ADDITIONAL_GW_FLAGS= ifneq "$(GATEWAY_PLUGIN_FLAGS)" "" ADDITIONAL_GW_FLAGS=,$(GATEWAY_PLUGIN_FLAGS) @@ -59,39 +59,42 @@ ADDITIONAL_SWG_FLAGS= ifneq "$(SWAGGER_PLUGIN_FLAGS)" "" ADDITIONAL_SWG_FLAGS=,$(SWAGGER_PLUGIN_FLAGS) endif -SWAGGER_EXAMPLES=examples/proto/examplepb/echo_service.proto \ - examples/proto/examplepb/a_bit_of_everything.proto \ - examples/proto/examplepb/wrappers.proto \ - examples/proto/examplepb/stream.proto \ - examples/proto/examplepb/unannotated_echo_service.proto \ - examples/proto/examplepb/use_go_template.proto \ - examples/proto/examplepb/response_body_service.proto - -EXAMPLES=examples/proto/examplepb/echo_service.proto \ - examples/proto/examplepb/a_bit_of_everything.proto \ - examples/proto/examplepb/stream.proto \ - examples/proto/examplepb/flow_combination.proto \ - examples/proto/examplepb/non_standard_names.proto \ - examples/proto/examplepb/wrappers.proto \ - examples/proto/examplepb/unannotated_echo_service.proto \ - examples/proto/examplepb/use_go_template.proto \ - examples/proto/examplepb/response_body_service.proto +SWAGGER_EXAMPLES=examples/internal/proto/examplepb/echo_service.proto \ + examples/internal/proto/examplepb/a_bit_of_everything.proto \ + examples/internal/proto/examplepb/wrappers.proto \ + examples/internal/proto/examplepb/stream.proto \ + examples/internal/proto/examplepb/unannotated_echo_service.proto \ + examples/internal/proto/examplepb/use_go_template.proto \ + examples/internal/proto/examplepb/response_body_service.proto + +EXAMPLES=examples/internal/proto/examplepb/echo_service.proto \ + examples/internal/proto/examplepb/a_bit_of_everything.proto \ + examples/internal/proto/examplepb/stream.proto \ + examples/internal/proto/examplepb/flow_combination.proto \ + examples/internal/proto/examplepb/non_standard_names.proto \ + examples/internal/proto/examplepb/wrappers.proto \ + examples/internal/proto/examplepb/unannotated_echo_service.proto \ + examples/internal/proto/examplepb/use_go_template.proto \ + examples/internal/proto/examplepb/response_body_service.proto EXAMPLE_SVCSRCS=$(EXAMPLES:.proto=.pb.go) EXAMPLE_GWSRCS=$(EXAMPLES:.proto=.pb.gw.go) EXAMPLE_SWAGGERSRCS=$(SWAGGER_EXAMPLES:.proto=.swagger.json) -EXAMPLE_DEPS=examples/proto/pathenum/path_enum.proto examples/proto/sub/message.proto examples/proto/sub2/message.proto +EXAMPLE_DEPS=examples/internal/proto/pathenum/path_enum.proto examples/internal/proto/sub/message.proto examples/internal/proto/sub2/message.proto EXAMPLE_DEPSRCS=$(EXAMPLE_DEPS:.proto=.pb.go) -EXAMPLE_CLIENT_DIR=examples/clients -ECHO_EXAMPLE_SPEC=examples/proto/examplepb/echo_service.swagger.json +RUNTIME_TEST_PROTO=runtime/internal/examplepb/example.proto +RUNTIME_TEST_SRCS=$(RUNTIME_TEST_PROTO:.proto=pb.go) + +EXAMPLE_CLIENT_DIR=examples/internal/clients +ECHO_EXAMPLE_SPEC=examples/internal/proto/examplepb/echo_service.swagger.json ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/echo/client.go \ $(EXAMPLE_CLIENT_DIR)/echo/response.go \ $(EXAMPLE_CLIENT_DIR)/echo/configuration.go \ $(EXAMPLE_CLIENT_DIR)/echo/api_echo_service.go \ $(EXAMPLE_CLIENT_DIR)/echo/model_examplepb_simple_message.go \ $(EXAMPLE_CLIENT_DIR)/echo/model_examplepb_embedded.go -ABE_EXAMPLE_SPEC=examples/proto/examplepb/a_bit_of_everything.swagger.json +ABE_EXAMPLE_SPEC=examples/internal/proto/examplepb/a_bit_of_everything.swagger.json ABE_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/abe/model_a_bit_of_everything_nested.go \ $(EXAMPLE_CLIENT_DIR)/abe/api_a_bit_of_everything_service.go \ $(EXAMPLE_CLIENT_DIR)/abe/client.go \ @@ -108,13 +111,13 @@ ABE_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/abe/model_a_bit_of_everything_nested.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_pathenum_path_enum.go \ $(EXAMPLE_CLIENT_DIR)/abe/model_protobuf_field_mask.go \ $(EXAMPLE_CLIENT_DIR)/abe/response.go -UNANNOTATED_ECHO_EXAMPLE_SPEC=examples/proto/examplepb/unannotated_echo_service.swagger.json +UNANNOTATED_ECHO_EXAMPLE_SPEC=examples/internal/proto/examplepb/unannotated_echo_service.swagger.json UNANNOTATED_ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/unannotatedecho/client.go \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/response.go \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/configuration.go \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/model_examplepb_unannotated_simple_message.go \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/api_unannotated_echo_service.go -RESPONSE_BODY_EXAMPLE_SPEC=examples/proto/examplepb/response_body_service.swagger.json +RESPONSE_BODY_EXAMPLE_SPEC=examples/internal/proto/examplepb/response_body_service.swagger.json RESPONSE_BODY_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/responsebody/client.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/response.go \ $(EXAMPLE_CLIENT_DIR)/responsebody/configuration.go \ @@ -157,39 +160,43 @@ $(EXAMPLE_DEPSRCS): $(GO_PLUGIN) $(EXAMPLE_DEPS) protoc -I $(PROTOC_INC_PATH) -I. --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP),plugins=grpc,paths=source_relative:$(OUTPUT_DIR) $(@:.pb.go=.proto) cp $(OUTPUT_DIR)/$@ $@ || cp $(OUTPUT_DIR)/$@ $@ -$(EXAMPLE_GWSRCS): ADDITIONAL_GW_FLAGS:=$(ADDITIONAL_GW_FLAGS),grpc_api_configuration=examples/proto/examplepb/unannotated_echo_service.yaml +$(RUNTIME_TEST_SRCS): $(GO_PLUGIN) $(RUNTIME_TEST_PROTO) + protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP),plugins=grpc,paths=source_relative:. $(RUNTIME_TEST_PROTO) + +$(EXAMPLE_GWSRCS): ADDITIONAL_GW_FLAGS:=$(ADDITIONAL_GW_FLAGS),grpc_api_configuration=examples/internal/proto/examplepb/unannotated_echo_service.yaml $(EXAMPLE_GWSRCS): $(GATEWAY_PLUGIN) $(EXAMPLES) protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GATEWAY_PLUGIN) --grpc-gateway_out=logtostderr=true,allow_repeated_fields_in_body=true,$(PKGMAP)$(ADDITIONAL_GW_FLAGS):. $(EXAMPLES) -$(EXAMPLE_SWAGGERSRCS): ADDITIONAL_SWG_FLAGS:=$(ADDITIONAL_SWG_FLAGS),grpc_api_configuration=examples/proto/examplepb/unannotated_echo_service.yaml +$(EXAMPLE_SWAGGERSRCS): ADDITIONAL_SWG_FLAGS:=$(ADDITIONAL_SWG_FLAGS),grpc_api_configuration=examples/internal/proto/examplepb/unannotated_echo_service.yaml $(EXAMPLE_SWAGGERSRCS): $(SWAGGER_PLUGIN) $(SWAGGER_EXAMPLES) protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(SWAGGER_PLUGIN) --swagger_out=logtostderr=true,allow_repeated_fields_in_body=true,use_go_templates=true,$(PKGMAP)$(ADDITIONAL_SWG_FLAGS):. $(SWAGGER_EXAMPLES) $(ECHO_EXAMPLE_SRCS): $(ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ECHO_EXAMPLE_SPEC) \ - -l go -o examples/clients/echo --additional-properties packageName=echo + -l go -o examples/internal/clients/echo --additional-properties packageName=echo @rm -f $(EXAMPLE_CLIENT_DIR)/echo/README.md \ $(EXAMPLE_CLIENT_DIR)/echo/git_push.sh $(ABE_EXAMPLE_SRCS): $(ABE_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(ABE_EXAMPLE_SPEC) \ - -l go -o examples/clients/abe --additional-properties packageName=abe + -l go -o examples/internal/clients/abe --additional-properties packageName=abe @rm -f $(EXAMPLE_CLIENT_DIR)/abe/README.md \ $(EXAMPLE_CLIENT_DIR)/abe/git_push.sh $(UNANNOTATED_ECHO_EXAMPLE_SRCS): $(UNANNOTATED_ECHO_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(UNANNOTATED_ECHO_EXAMPLE_SPEC) \ - -l go -o examples/clients/unannotatedecho --additional-properties packageName=unannotatedecho + -l go -o examples/internal/clients/unannotatedecho --additional-properties packageName=unannotatedecho @rm -f $(EXAMPLE_CLIENT_DIR)/unannotatedecho/README.md \ $(EXAMPLE_CLIENT_DIR)/unannotatedecho/git_push.sh $(RESPONSE_BODY_EXAMPLE_SRCS): $(RESPONSE_BODY_EXAMPLE_SPEC) $(SWAGGER_CODEGEN) generate -i $(RESPONSE_BODY_EXAMPLE_SPEC) \ - -l go -o examples/clients/responsebody --additional-properties packageName=responsebody + -l go -o examples/internal/clients/responsebody --additional-properties packageName=responsebody @rm -f $(EXAMPLE_CLIENT_DIR)/responsebody/README.md \ $(EXAMPLE_CLIENT_DIR)/responsebody/git_push.sh examples: $(EXAMPLE_DEPSRCS) $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) -test: examples +testproto: $(RUNTIME_TEST_SRCS) +test: examples testproto go test -short -race ./... - go test -race ./examples/integration -args -network=unix -endpoint=test.sock + go test -race ./examples/internal/integration -args -network=unix -endpoint=test.sock changelog: docker run --rm \ --interactive \ @@ -224,5 +231,6 @@ realclean: distclean rm -f $(EXAMPLE_SWAGGERSRCS) rm -f $(EXAMPLE_CLIENT_SRCS) rm -f $(OPENAPIV2_GO) + rm -f $(RUNTIME_TEST_SRCS) .PHONY: generate examples test lint clean distclean realclean diff --git a/README.md b/README.md index 4b9aa56b23b..79ca1d25d96 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ annotation to your .proto file } ``` - See [a_bit_of_everything.proto](examples/proto/examplepb/a_bit_of_everything.proto) + See [a_bit_of_everything.proto](examples/internal/proto/examplepb/a_bit_of_everything.proto) for examples of more annotations you can add to customize gateway behavior and generated Swagger output. @@ -261,7 +261,7 @@ instead of protobuf names). Run `protoc-gen-swagger --help` for more flag details. Further Swagger customization is possible by annotating your `.proto` files with options from [openapiv2.proto](protoc-gen-swagger/options/openapiv2.proto) - see -[a_bit_of_everything.proto](examples/proto/examplepb/a_bit_of_everything.proto) +[a_bit_of_everything.proto](examples/internal/proto/examplepb/a_bit_of_everything.proto) for examples. ## More Examples diff --git a/docs/_docs/examples.md b/docs/_docs/examples.md index 78d93d720db..e8d5f4c77ae 100644 --- a/docs/_docs/examples.md +++ b/docs/_docs/examples.md @@ -4,7 +4,7 @@ category: documentation # Examples -Examples are available under `examples` directory. +Examples are available under `examples/internal` directory. * `proto/examplepb/echo_service.proto`, `proto/examplepb/a_bit_of_everything.proto`, `proto/examplepb/unannotated_echo_service.proto`: service definition * `proto/examplepb/echo_service.pb.go`, `proto/examplepb/a_bit_of_everything.pb.go`, `proto/examplepb/unannotated_echo_service.pb.go`: [generated] stub of the service * `proto/examplepb/echo_service.pb.gw.go`, `proto/examplepb/a_bit_of_everything.pb.gw.go`, `proto/examplepb/uannotated_echo_service.pb.gw.go`: [generated] reverse proxy for the service diff --git a/docs/_docs/faq.md b/docs/_docs/faq.md index 766c402c80b..35307c66424 100644 --- a/docs/_docs/faq.md +++ b/docs/_docs/faq.md @@ -17,7 +17,7 @@ See the question above at first. Grpc-gateway is intended to cover 80% of use cases without forcing you to write comprehensive but complicated annotations. So grpc-gateway itself does not always cover all the use cases you have by design. In other words, grpc-gateway automates typical boring boilerplate mapping between gRPC and HTTP/1 communication, but it does not do arbitrarily complex custom mappings for you. On the other hand, you can still add whatever you want as a middleware which wraps [`runtime.ServeMux`](http://godoc.org/github.com/grpc-ecosystem/grpc-gateway/runtime#ServeMux). Since `runtime.ServeMux` is just a standard [`http.Handler`](http://golang.org/pkg/http#Handler), you can easily write a custom wrapper of `runtime.ServeMux`, leveraged with existing third-party libraries in Go. -e.g. https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/main.go +e.g. https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/internal/main.go ## My gRPC server is written in (Scala|C++|Ruby|Haskell|....). Is there a (Scala|C++|Ruby|Haskell|....) version of grpc-gateway? diff --git a/docs/_docs/patch.md b/docs/_docs/patch.md index 2eaac3b0166..d1543eb8350 100644 --- a/docs/_docs/patch.md +++ b/docs/_docs/patch.md @@ -7,8 +7,8 @@ The HTTP PATCH method allows a resource to be partially updated. The idea, If a binding is mapped to patch and the request message has exactly one FieldMask message in it, additional code is rendered for the gateway handler that will populate the FieldMask based on the request body. There are two scenarios: -- The FieldMask is hidden from the REST request as per the [Google API design guide](https://cloud.google.com/apis/design/standard_methods#update) (as in the first additional binding in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto#L366) example). In this case, the FieldMask is updated from the request body and set in the gRPC request message. -- The FieldMask is exposed to the REST request (as in the second additional binding in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto#L370) example). For this case, the field mask is left untouched by the gateway. +- The FieldMask is hidden from the REST request as per the [Google API design guide](https://cloud.google.com/apis/design/standard_methods#update) (as in the first additional binding in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/internal/proto/examplepb/a_bit_of_everything.proto#L366) example). In this case, the FieldMask is updated from the request body and set in the gRPC request message. +- The FieldMask is exposed to the REST request (as in the second additional binding in the [UpdateV2](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/internal/proto/examplepb/a_bit_of_everything.proto#L370) example). For this case, the field mask is left untouched by the gateway. ## Example Usage 1. Create PATCH request. diff --git a/docs/_docs/usage.md b/docs/_docs/usage.md index 7ccf52e0abd..02eed3d1e0e 100644 --- a/docs/_docs/usage.md +++ b/docs/_docs/usage.md @@ -68,7 +68,7 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`. } ``` - See [a_bit_of_everything.proto](examples/proto/examplepb/a_bit_of_everything.proto) + See [a_bit_of_everything.proto](examples/internal/proto/examplepb/a_bit_of_everything.proto) for examples of more annotations you can add to customize gateway behavior and generated Swagger output. @@ -202,7 +202,7 @@ instead of protobuf names). Run `protoc-gen-swagger --help` for more flag details. Further Swagger customization is possible by annotating your `.proto` files with options from [openapiv2.proto](protoc-gen-swagger/options/openapiv2.proto) - see -[a_bit_of_everything.proto](examples/proto/examplepb/a_bit_of_everything.proto) +[a_bit_of_everything.proto](examples/internal/proto/examplepb/a_bit_of_everything.proto) for examples. # Mapping gRPC to HTTP diff --git a/docs/_docs/usegotemplates.md b/docs/_docs/usegotemplates.md index 69dfa9474a7..f2ae6c9ce5c 100644 --- a/docs/_docs/usegotemplates.md +++ b/docs/_docs/usegotemplates.md @@ -90,4 +90,4 @@ This is how the swagger file would be rendered in [Postman](https://www.getpostm ![Screenshot swaggerfile in Postman](../_imgs/gotemplates/postman.png "Postman") -For a more detailed example of a protofile that has Go templates enabled, [click here](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/use_go_template.proto "Example protofile with Go template"). +For a more detailed example of a protofile that has Go templates enabled, [click here](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/internal/proto/examplepb/use_go_template.proto "Example protofile with Go template"). diff --git a/examples/README.md b/examples/internal/README.md similarity index 96% rename from examples/README.md rename to examples/internal/README.md index b7b486f244f..26d568c8a34 100644 --- a/examples/README.md +++ b/examples/internal/README.md @@ -9,7 +9,7 @@ Follow the guides from this [README.md](./browser/README.md) to run the server a ```bash # Make sure you are in the correct directory: # $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/examples -$ cd examples/browser +$ cd examples/internal/browser $ pwd # Install gulp diff --git a/examples/browser/.gitignore b/examples/internal/browser/.gitignore similarity index 100% rename from examples/browser/.gitignore rename to examples/internal/browser/.gitignore diff --git a/examples/browser/README.md b/examples/internal/browser/README.md similarity index 100% rename from examples/browser/README.md rename to examples/internal/browser/README.md diff --git a/examples/browser/a_bit_of_everything_service.spec.js b/examples/internal/browser/a_bit_of_everything_service.spec.js similarity index 100% rename from examples/browser/a_bit_of_everything_service.spec.js rename to examples/internal/browser/a_bit_of_everything_service.spec.js diff --git a/examples/browser/bin/.gitignore b/examples/internal/browser/bin/.gitignore similarity index 100% rename from examples/browser/bin/.gitignore rename to examples/internal/browser/bin/.gitignore diff --git a/examples/browser/bower.json b/examples/internal/browser/bower.json similarity index 100% rename from examples/browser/bower.json rename to examples/internal/browser/bower.json diff --git a/examples/browser/echo_service.spec.js b/examples/internal/browser/echo_service.spec.js similarity index 100% rename from examples/browser/echo_service.spec.js rename to examples/internal/browser/echo_service.spec.js diff --git a/examples/browser/gulpfile.js b/examples/internal/browser/gulpfile.js similarity index 76% rename from examples/browser/gulpfile.js rename to examples/internal/browser/gulpfile.js index 233afed40e0..a0a2411525d 100644 --- a/examples/browser/gulpfile.js +++ b/examples/internal/browser/gulpfile.js @@ -11,28 +11,28 @@ var shell = require('gulp-shell'); var jasmineBrowser = require('gulp-jasmine-browser'); var webpack = require('webpack-stream'); -gulp.task('bower', function(){ +gulp.task('bower', function () { return bower(); }); gulp.task('server', shell.task([ - 'go build -o bin/example-server github.com/grpc-ecosystem/grpc-gateway/examples/cmd/example-grpc-server', + 'go build -o bin/example-server github.com/grpc-ecosystem/grpc-gateway/examples/internal/cmd/example-grpc-server', ])); gulp.task('gateway', shell.task([ - 'go build -o bin/example-gw github.com/grpc-ecosystem/grpc-gateway/examples/cmd/example-gateway-server', + 'go build -o bin/example-gw github.com/grpc-ecosystem/grpc-gateway/examples/internal/cmd/example-gateway-server', ])); -gulp.task('serve-server', ['server'], function(){ +gulp.task('serve-server', ['server'], function () { gprocess.start('server-server', 'bin/example-server', [ - '--logtostderr', + '--logtostderr', ]); gulp.watch('bin/example-server', ['serve-server']); }); -gulp.task('serve-gateway', ['gateway', 'serve-server'], function(){ +gulp.task('serve-gateway', ['gateway', 'serve-server'], function () { gprocess.start('gateway-server', 'bin/example-gw', [ - '--logtostderr', '--swagger_dir', path.join(__dirname, "../proto/examplepb"), + '--logtostderr', '--swagger_dir', path.join(__dirname, "../proto/examplepb"), ]); gulp.watch('bin/example-gw', ['serve-gateway']); }); @@ -40,9 +40,9 @@ gulp.task('serve-gateway', ['gateway', 'serve-server'], function(){ gulp.task('backends', ['serve-gateway', 'serve-server']); var specFiles = ['*.spec.js']; -gulp.task('test', ['backends'], function(done) { +gulp.task('test', ['backends'], function (done) { return gulp.src(specFiles) - .pipe(webpack({output: {filename: 'spec.js'}})) + .pipe(webpack({ output: { filename: 'spec.js' } })) .pipe(jasmineBrowser.specRunner({ console: true, sourceMappedStacktrace: true, @@ -52,20 +52,20 @@ gulp.task('test', ['backends'], function(done) { catch: true, throwFailures: true, })) - .on('error', function(err) { + .on('error', function (err) { done(err); process.exit(1); }) .pipe(exit()); }); -gulp.task('serve', ['backends'], function(done) { +gulp.task('serve', ['backends'], function (done) { var JasminePlugin = require('gulp-jasmine-browser/webpack/jasmine-plugin'); var plugin = new JasminePlugin(); return gulp.src(specFiles) .pipe(webpack({ - output: {filename: 'spec.js'}, + output: { filename: 'spec.js' }, watch: true, plugins: [plugin], })) diff --git a/examples/browser/index.html b/examples/internal/browser/index.html similarity index 100% rename from examples/browser/index.html rename to examples/internal/browser/index.html diff --git a/examples/browser/package.json b/examples/internal/browser/package.json similarity index 100% rename from examples/browser/package.json rename to examples/internal/browser/package.json diff --git a/examples/clients/abe/.gitignore b/examples/internal/clients/abe/.gitignore similarity index 100% rename from examples/clients/abe/.gitignore rename to examples/internal/clients/abe/.gitignore diff --git a/examples/clients/abe/.swagger-codegen-ignore b/examples/internal/clients/abe/.swagger-codegen-ignore similarity index 100% rename from examples/clients/abe/.swagger-codegen-ignore rename to examples/internal/clients/abe/.swagger-codegen-ignore diff --git a/examples/clients/abe/.swagger-codegen/VERSION b/examples/internal/clients/abe/.swagger-codegen/VERSION similarity index 100% rename from examples/clients/abe/.swagger-codegen/VERSION rename to examples/internal/clients/abe/.swagger-codegen/VERSION diff --git a/examples/clients/abe/BUILD.bazel b/examples/internal/clients/abe/BUILD.bazel similarity index 88% rename from examples/clients/abe/BUILD.bazel rename to examples/internal/clients/abe/BUILD.bazel index a54d462444e..9c1bfc9ce2b 100644 --- a/examples/clients/abe/BUILD.bazel +++ b/examples/internal/clients/abe/BUILD.bazel @@ -26,10 +26,10 @@ go_library( "model_sub_string_message.go", "response.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/clients/abe", deps = [ - "//examples/proto/examplepb:go_default_library", - "//examples/proto/pathenum:go_default_library", + "//examples/internal/proto/examplepb:go_default_library", + "//examples/internal/proto/pathenum:go_default_library", "//runtime:go_default_library", "@com_github_antihax_optional//:go_default_library", "@org_golang_x_oauth2//:go_default_library", diff --git a/examples/clients/abe/api/swagger.yaml b/examples/internal/clients/abe/api/swagger.yaml similarity index 100% rename from examples/clients/abe/api/swagger.yaml rename to examples/internal/clients/abe/api/swagger.yaml diff --git a/examples/clients/abe/api_a_bit_of_everything_service.go b/examples/internal/clients/abe/api_a_bit_of_everything_service.go similarity index 100% rename from examples/clients/abe/api_a_bit_of_everything_service.go rename to examples/internal/clients/abe/api_a_bit_of_everything_service.go diff --git a/examples/clients/abe/api_camel_case_service_name.go b/examples/internal/clients/abe/api_camel_case_service_name.go similarity index 100% rename from examples/clients/abe/api_camel_case_service_name.go rename to examples/internal/clients/abe/api_camel_case_service_name.go diff --git a/examples/clients/abe/api_echo_rpc.go b/examples/internal/clients/abe/api_echo_rpc.go similarity index 100% rename from examples/clients/abe/api_echo_rpc.go rename to examples/internal/clients/abe/api_echo_rpc.go diff --git a/examples/clients/abe/client.go b/examples/internal/clients/abe/client.go similarity index 100% rename from examples/clients/abe/client.go rename to examples/internal/clients/abe/client.go diff --git a/examples/clients/abe/configuration.go b/examples/internal/clients/abe/configuration.go similarity index 100% rename from examples/clients/abe/configuration.go rename to examples/internal/clients/abe/configuration.go diff --git a/examples/clients/abe/enum_helper.go b/examples/internal/clients/abe/enum_helper.go similarity index 89% rename from examples/clients/abe/enum_helper.go rename to examples/internal/clients/abe/enum_helper.go index df9e20fb66e..01a68b848dd 100644 --- a/examples/clients/abe/enum_helper.go +++ b/examples/internal/clients/abe/enum_helper.go @@ -1,8 +1,8 @@ package abe import ( - pbexamplepb "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" - pbpathenum "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" + pbexamplepb "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" + pbpathenum "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/pathenum" "github.com/grpc-ecosystem/grpc-gateway/runtime" ) diff --git a/examples/clients/abe/model_a_bit_of_everything_nested.go b/examples/internal/clients/abe/model_a_bit_of_everything_nested.go similarity index 100% rename from examples/clients/abe/model_a_bit_of_everything_nested.go rename to examples/internal/clients/abe/model_a_bit_of_everything_nested.go diff --git a/examples/clients/abe/model_examplepb_a_bit_of_everything.go b/examples/internal/clients/abe/model_examplepb_a_bit_of_everything.go similarity index 100% rename from examples/clients/abe/model_examplepb_a_bit_of_everything.go rename to examples/internal/clients/abe/model_examplepb_a_bit_of_everything.go diff --git a/examples/clients/abe/model_examplepb_a_bit_of_everything_repeated.go b/examples/internal/clients/abe/model_examplepb_a_bit_of_everything_repeated.go similarity index 100% rename from examples/clients/abe/model_examplepb_a_bit_of_everything_repeated.go rename to examples/internal/clients/abe/model_examplepb_a_bit_of_everything_repeated.go diff --git a/examples/clients/abe/model_examplepb_body.go b/examples/internal/clients/abe/model_examplepb_body.go similarity index 100% rename from examples/clients/abe/model_examplepb_body.go rename to examples/internal/clients/abe/model_examplepb_body.go diff --git a/examples/clients/abe/model_examplepb_numeric_enum.go b/examples/internal/clients/abe/model_examplepb_numeric_enum.go similarity index 100% rename from examples/clients/abe/model_examplepb_numeric_enum.go rename to examples/internal/clients/abe/model_examplepb_numeric_enum.go diff --git a/examples/clients/abe/model_examplepb_update_v2_request.go b/examples/internal/clients/abe/model_examplepb_update_v2_request.go similarity index 100% rename from examples/clients/abe/model_examplepb_update_v2_request.go rename to examples/internal/clients/abe/model_examplepb_update_v2_request.go diff --git a/examples/clients/abe/model_message_path_enum_nested_path_enum.go b/examples/internal/clients/abe/model_message_path_enum_nested_path_enum.go similarity index 100% rename from examples/clients/abe/model_message_path_enum_nested_path_enum.go rename to examples/internal/clients/abe/model_message_path_enum_nested_path_enum.go diff --git a/examples/clients/abe/model_nested_deep_enum.go b/examples/internal/clients/abe/model_nested_deep_enum.go similarity index 100% rename from examples/clients/abe/model_nested_deep_enum.go rename to examples/internal/clients/abe/model_nested_deep_enum.go diff --git a/examples/clients/abe/model_pathenum_path_enum.go b/examples/internal/clients/abe/model_pathenum_path_enum.go similarity index 100% rename from examples/clients/abe/model_pathenum_path_enum.go rename to examples/internal/clients/abe/model_pathenum_path_enum.go diff --git a/examples/clients/abe/model_protobuf_any.go b/examples/internal/clients/abe/model_protobuf_any.go similarity index 100% rename from examples/clients/abe/model_protobuf_any.go rename to examples/internal/clients/abe/model_protobuf_any.go diff --git a/examples/clients/abe/model_protobuf_field_mask.go b/examples/internal/clients/abe/model_protobuf_field_mask.go similarity index 100% rename from examples/clients/abe/model_protobuf_field_mask.go rename to examples/internal/clients/abe/model_protobuf_field_mask.go diff --git a/examples/clients/abe/model_runtime_error.go b/examples/internal/clients/abe/model_runtime_error.go similarity index 100% rename from examples/clients/abe/model_runtime_error.go rename to examples/internal/clients/abe/model_runtime_error.go diff --git a/examples/clients/abe/model_sub_string_message.go b/examples/internal/clients/abe/model_sub_string_message.go similarity index 100% rename from examples/clients/abe/model_sub_string_message.go rename to examples/internal/clients/abe/model_sub_string_message.go diff --git a/examples/clients/abe/response.go b/examples/internal/clients/abe/response.go similarity index 100% rename from examples/clients/abe/response.go rename to examples/internal/clients/abe/response.go diff --git a/examples/clients/echo/.gitignore b/examples/internal/clients/echo/.gitignore similarity index 100% rename from examples/clients/echo/.gitignore rename to examples/internal/clients/echo/.gitignore diff --git a/examples/clients/echo/.swagger-codegen-ignore b/examples/internal/clients/echo/.swagger-codegen-ignore similarity index 100% rename from examples/clients/echo/.swagger-codegen-ignore rename to examples/internal/clients/echo/.swagger-codegen-ignore diff --git a/examples/clients/echo/.swagger-codegen/VERSION b/examples/internal/clients/echo/.swagger-codegen/VERSION similarity index 100% rename from examples/clients/echo/.swagger-codegen/VERSION rename to examples/internal/clients/echo/.swagger-codegen/VERSION diff --git a/examples/clients/echo/BUILD.bazel b/examples/internal/clients/echo/BUILD.bazel similarity index 96% rename from examples/clients/echo/BUILD.bazel rename to examples/internal/clients/echo/BUILD.bazel index 5700dd477c1..9f4aaa27eca 100644 --- a/examples/clients/echo/BUILD.bazel +++ b/examples/internal/clients/echo/BUILD.bazel @@ -14,7 +14,7 @@ go_library( "model_runtime_error.go", "response.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/clients/echo", deps = [ "@com_github_antihax_optional//:go_default_library", "@org_golang_x_oauth2//:go_default_library", diff --git a/examples/clients/echo/api/swagger.yaml b/examples/internal/clients/echo/api/swagger.yaml similarity index 100% rename from examples/clients/echo/api/swagger.yaml rename to examples/internal/clients/echo/api/swagger.yaml diff --git a/examples/clients/echo/api_echo_service.go b/examples/internal/clients/echo/api_echo_service.go similarity index 100% rename from examples/clients/echo/api_echo_service.go rename to examples/internal/clients/echo/api_echo_service.go diff --git a/examples/clients/echo/client.go b/examples/internal/clients/echo/client.go similarity index 100% rename from examples/clients/echo/client.go rename to examples/internal/clients/echo/client.go diff --git a/examples/clients/echo/configuration.go b/examples/internal/clients/echo/configuration.go similarity index 100% rename from examples/clients/echo/configuration.go rename to examples/internal/clients/echo/configuration.go diff --git a/examples/clients/echo/model_examplepb_embedded.go b/examples/internal/clients/echo/model_examplepb_embedded.go similarity index 100% rename from examples/clients/echo/model_examplepb_embedded.go rename to examples/internal/clients/echo/model_examplepb_embedded.go diff --git a/examples/clients/echo/model_examplepb_simple_message.go b/examples/internal/clients/echo/model_examplepb_simple_message.go similarity index 100% rename from examples/clients/echo/model_examplepb_simple_message.go rename to examples/internal/clients/echo/model_examplepb_simple_message.go diff --git a/examples/clients/echo/model_protobuf_any.go b/examples/internal/clients/echo/model_protobuf_any.go similarity index 100% rename from examples/clients/echo/model_protobuf_any.go rename to examples/internal/clients/echo/model_protobuf_any.go diff --git a/examples/clients/echo/model_runtime_error.go b/examples/internal/clients/echo/model_runtime_error.go similarity index 100% rename from examples/clients/echo/model_runtime_error.go rename to examples/internal/clients/echo/model_runtime_error.go diff --git a/examples/clients/echo/response.go b/examples/internal/clients/echo/response.go similarity index 100% rename from examples/clients/echo/response.go rename to examples/internal/clients/echo/response.go diff --git a/examples/clients/responsebody/.gitignore b/examples/internal/clients/responsebody/.gitignore similarity index 100% rename from examples/clients/responsebody/.gitignore rename to examples/internal/clients/responsebody/.gitignore diff --git a/examples/clients/responsebody/.swagger-codegen-ignore b/examples/internal/clients/responsebody/.swagger-codegen-ignore similarity index 100% rename from examples/clients/responsebody/.swagger-codegen-ignore rename to examples/internal/clients/responsebody/.swagger-codegen-ignore diff --git a/examples/clients/responsebody/.swagger-codegen/VERSION b/examples/internal/clients/responsebody/.swagger-codegen/VERSION similarity index 100% rename from examples/clients/responsebody/.swagger-codegen/VERSION rename to examples/internal/clients/responsebody/.swagger-codegen/VERSION diff --git a/examples/clients/responsebody/BUILD.bazel b/examples/internal/clients/responsebody/BUILD.bazel similarity index 95% rename from examples/clients/responsebody/BUILD.bazel rename to examples/internal/clients/responsebody/BUILD.bazel index cf94bfa564a..4b5a31badea 100644 --- a/examples/clients/responsebody/BUILD.bazel +++ b/examples/internal/clients/responsebody/BUILD.bazel @@ -16,7 +16,7 @@ go_library( "model_runtime_error.go", "response.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/responsebody", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/clients/responsebody", visibility = ["//visibility:public"], deps = ["@org_golang_x_oauth2//:go_default_library"], ) diff --git a/examples/clients/responsebody/api/swagger.yaml b/examples/internal/clients/responsebody/api/swagger.yaml similarity index 99% rename from examples/clients/responsebody/api/swagger.yaml rename to examples/internal/clients/responsebody/api/swagger.yaml index 30d7604c7ff..1b9cedfa7cc 100644 --- a/examples/clients/responsebody/api/swagger.yaml +++ b/examples/internal/clients/responsebody/api/swagger.yaml @@ -2,7 +2,7 @@ swagger: "2.0" info: version: "version not set" - title: "examples/proto/examplepb/response_body_service.proto" + title: "examples/internal/proto/examplepb/response_body_service.proto" consumes: - "application/json" produces: diff --git a/examples/clients/responsebody/api_response_body_service.go b/examples/internal/clients/responsebody/api_response_body_service.go similarity index 99% rename from examples/clients/responsebody/api_response_body_service.go rename to examples/internal/clients/responsebody/api_response_body_service.go index 575d8b40eb4..12637f0acfa 100644 --- a/examples/clients/responsebody/api_response_body_service.go +++ b/examples/internal/clients/responsebody/api_response_body_service.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/responsebody/client.go b/examples/internal/clients/responsebody/client.go similarity index 98% rename from examples/clients/responsebody/client.go rename to examples/internal/clients/responsebody/client.go index e728fd1eecd..dfe97e57135 100644 --- a/examples/clients/responsebody/client.go +++ b/examples/internal/clients/responsebody/client.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * @@ -37,7 +37,7 @@ var ( xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") ) -// APIClient manages communication with the examples/proto/examplepb/response_body_service.proto API vversion not set +// APIClient manages communication with the examples/internal/proto/examplepb/response_body_service.proto API vversion not set // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration diff --git a/examples/clients/responsebody/configuration.go b/examples/internal/clients/responsebody/configuration.go similarity index 97% rename from examples/clients/responsebody/configuration.go rename to examples/internal/clients/responsebody/configuration.go index cae2bff96f6..fa7de58d731 100644 --- a/examples/clients/responsebody/configuration.go +++ b/examples/internal/clients/responsebody/configuration.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOut.md b/examples/internal/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOut.md similarity index 100% rename from examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOut.md rename to examples/internal/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOut.md diff --git a/examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md b/examples/internal/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md similarity index 100% rename from examples/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md rename to examples/internal/clients/responsebody/docs/ExamplepbRepeatedResponseBodyOutResponse.md diff --git a/examples/clients/responsebody/docs/ExamplepbRepeatedResponseStrings.md b/examples/internal/clients/responsebody/docs/ExamplepbRepeatedResponseStrings.md similarity index 100% rename from examples/clients/responsebody/docs/ExamplepbRepeatedResponseStrings.md rename to examples/internal/clients/responsebody/docs/ExamplepbRepeatedResponseStrings.md diff --git a/examples/clients/responsebody/docs/ExamplepbResponseBodyMessage.md b/examples/internal/clients/responsebody/docs/ExamplepbResponseBodyMessage.md similarity index 100% rename from examples/clients/responsebody/docs/ExamplepbResponseBodyMessage.md rename to examples/internal/clients/responsebody/docs/ExamplepbResponseBodyMessage.md diff --git a/examples/clients/responsebody/docs/ExamplepbResponseBodyMessageResponse.md b/examples/internal/clients/responsebody/docs/ExamplepbResponseBodyMessageResponse.md similarity index 100% rename from examples/clients/responsebody/docs/ExamplepbResponseBodyMessageResponse.md rename to examples/internal/clients/responsebody/docs/ExamplepbResponseBodyMessageResponse.md diff --git a/examples/clients/responsebody/docs/ExamplepbResponseBodyOut.md b/examples/internal/clients/responsebody/docs/ExamplepbResponseBodyOut.md similarity index 100% rename from examples/clients/responsebody/docs/ExamplepbResponseBodyOut.md rename to examples/internal/clients/responsebody/docs/ExamplepbResponseBodyOut.md diff --git a/examples/clients/responsebody/docs/ExamplepbResponseBodyOutResponse.md b/examples/internal/clients/responsebody/docs/ExamplepbResponseBodyOutResponse.md similarity index 100% rename from examples/clients/responsebody/docs/ExamplepbResponseBodyOutResponse.md rename to examples/internal/clients/responsebody/docs/ExamplepbResponseBodyOutResponse.md diff --git a/examples/clients/responsebody/docs/ExamplepbResponseBodyReq.md b/examples/internal/clients/responsebody/docs/ExamplepbResponseBodyReq.md similarity index 100% rename from examples/clients/responsebody/docs/ExamplepbResponseBodyReq.md rename to examples/internal/clients/responsebody/docs/ExamplepbResponseBodyReq.md diff --git a/examples/clients/responsebody/docs/ProtobufAny.md b/examples/internal/clients/responsebody/docs/ProtobufAny.md similarity index 100% rename from examples/clients/responsebody/docs/ProtobufAny.md rename to examples/internal/clients/responsebody/docs/ProtobufAny.md diff --git a/examples/clients/responsebody/docs/ResponseBodyServiceApi.md b/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md similarity index 100% rename from examples/clients/responsebody/docs/ResponseBodyServiceApi.md rename to examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md diff --git a/examples/clients/responsebody/docs/ResponseResponseType.md b/examples/internal/clients/responsebody/docs/ResponseResponseType.md similarity index 100% rename from examples/clients/responsebody/docs/ResponseResponseType.md rename to examples/internal/clients/responsebody/docs/ResponseResponseType.md diff --git a/examples/clients/responsebody/docs/RuntimeError.md b/examples/internal/clients/responsebody/docs/RuntimeError.md similarity index 100% rename from examples/clients/responsebody/docs/RuntimeError.md rename to examples/internal/clients/responsebody/docs/RuntimeError.md diff --git a/examples/clients/responsebody/model_examplepb_repeated_response_body_out.go b/examples/internal/clients/responsebody/model_examplepb_repeated_response_body_out.go similarity index 85% rename from examples/clients/responsebody/model_examplepb_repeated_response_body_out.go rename to examples/internal/clients/responsebody/model_examplepb_repeated_response_body_out.go index 8ca6f95e154..574246373eb 100644 --- a/examples/clients/responsebody/model_examplepb_repeated_response_body_out.go +++ b/examples/internal/clients/responsebody/model_examplepb_repeated_response_body_out.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/responsebody/model_examplepb_repeated_response_body_out_response.go b/examples/internal/clients/responsebody/model_examplepb_repeated_response_body_out_response.go similarity index 86% rename from examples/clients/responsebody/model_examplepb_repeated_response_body_out_response.go rename to examples/internal/clients/responsebody/model_examplepb_repeated_response_body_out_response.go index 9b15a6a5b2c..1ea5daf3fae 100644 --- a/examples/clients/responsebody/model_examplepb_repeated_response_body_out_response.go +++ b/examples/internal/clients/responsebody/model_examplepb_repeated_response_body_out_response.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/responsebody/model_examplepb_repeated_response_strings.go b/examples/internal/clients/responsebody/model_examplepb_repeated_response_strings.go similarity index 84% rename from examples/clients/responsebody/model_examplepb_repeated_response_strings.go rename to examples/internal/clients/responsebody/model_examplepb_repeated_response_strings.go index f25b08479ba..47ec55c7f12 100644 --- a/examples/clients/responsebody/model_examplepb_repeated_response_strings.go +++ b/examples/internal/clients/responsebody/model_examplepb_repeated_response_strings.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/responsebody/model_examplepb_response_body_out.go b/examples/internal/clients/responsebody/model_examplepb_response_body_out.go similarity index 85% rename from examples/clients/responsebody/model_examplepb_response_body_out.go rename to examples/internal/clients/responsebody/model_examplepb_response_body_out.go index 4775292258a..ea912e8976d 100644 --- a/examples/clients/responsebody/model_examplepb_response_body_out.go +++ b/examples/internal/clients/responsebody/model_examplepb_response_body_out.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/responsebody/model_examplepb_response_body_out_response.go b/examples/internal/clients/responsebody/model_examplepb_response_body_out_response.go similarity index 84% rename from examples/clients/responsebody/model_examplepb_response_body_out_response.go rename to examples/internal/clients/responsebody/model_examplepb_response_body_out_response.go index 8ef1dd1469e..b78f80ec655 100644 --- a/examples/clients/responsebody/model_examplepb_response_body_out_response.go +++ b/examples/internal/clients/responsebody/model_examplepb_response_body_out_response.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/responsebody/model_protobuf_any.go b/examples/internal/clients/responsebody/model_protobuf_any.go similarity index 98% rename from examples/clients/responsebody/model_protobuf_any.go rename to examples/internal/clients/responsebody/model_protobuf_any.go index 902926206f8..28dac0342e2 100644 --- a/examples/clients/responsebody/model_protobuf_any.go +++ b/examples/internal/clients/responsebody/model_protobuf_any.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/responsebody/model_response_response_type.go b/examples/internal/clients/responsebody/model_response_response_type.go similarity index 88% rename from examples/clients/responsebody/model_response_response_type.go rename to examples/internal/clients/responsebody/model_response_response_type.go index 4db9360c72f..b249571ee56 100644 --- a/examples/clients/responsebody/model_response_response_type.go +++ b/examples/internal/clients/responsebody/model_response_response_type.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/responsebody/model_runtime_error.go b/examples/internal/clients/responsebody/model_runtime_error.go similarity index 87% rename from examples/clients/responsebody/model_runtime_error.go rename to examples/internal/clients/responsebody/model_runtime_error.go index a7f7a1d0569..c23ba823000 100644 --- a/examples/clients/responsebody/model_runtime_error.go +++ b/examples/internal/clients/responsebody/model_runtime_error.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/responsebody/response.go b/examples/internal/clients/responsebody/response.go similarity index 95% rename from examples/clients/responsebody/response.go rename to examples/internal/clients/responsebody/response.go index 1fdaa337c51..09f1698e322 100644 --- a/examples/clients/responsebody/response.go +++ b/examples/internal/clients/responsebody/response.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/response_body_service.proto + * examples/internal/proto/examplepb/response_body_service.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/examples/clients/unannotatedecho/.gitignore b/examples/internal/clients/unannotatedecho/.gitignore similarity index 100% rename from examples/clients/unannotatedecho/.gitignore rename to examples/internal/clients/unannotatedecho/.gitignore diff --git a/examples/clients/unannotatedecho/.swagger-codegen-ignore b/examples/internal/clients/unannotatedecho/.swagger-codegen-ignore similarity index 100% rename from examples/clients/unannotatedecho/.swagger-codegen-ignore rename to examples/internal/clients/unannotatedecho/.swagger-codegen-ignore diff --git a/examples/clients/unannotatedecho/.swagger-codegen/VERSION b/examples/internal/clients/unannotatedecho/.swagger-codegen/VERSION similarity index 100% rename from examples/clients/unannotatedecho/.swagger-codegen/VERSION rename to examples/internal/clients/unannotatedecho/.swagger-codegen/VERSION diff --git a/examples/clients/unannotatedecho/BUILD.bazel b/examples/internal/clients/unannotatedecho/BUILD.bazel similarity index 94% rename from examples/clients/unannotatedecho/BUILD.bazel rename to examples/internal/clients/unannotatedecho/BUILD.bazel index f34a3fac4e0..95d9d6b3b67 100644 --- a/examples/clients/unannotatedecho/BUILD.bazel +++ b/examples/internal/clients/unannotatedecho/BUILD.bazel @@ -13,7 +13,7 @@ go_library( "model_runtime_error.go", "response.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/clients/unannotatedecho", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/clients/unannotatedecho", deps = [ "@com_github_antihax_optional//:go_default_library", "@org_golang_x_oauth2//:go_default_library", diff --git a/examples/clients/unannotatedecho/api/swagger.yaml b/examples/internal/clients/unannotatedecho/api/swagger.yaml similarity index 99% rename from examples/clients/unannotatedecho/api/swagger.yaml rename to examples/internal/clients/unannotatedecho/api/swagger.yaml index da2fb50e598..2dbae78a5f6 100644 --- a/examples/clients/unannotatedecho/api/swagger.yaml +++ b/examples/internal/clients/unannotatedecho/api/swagger.yaml @@ -6,7 +6,7 @@ info: \ in\ngRPC API configuration format.\n\nEcho Service API consists of a single\ \ service which returns\na message." version: "version not set" - title: "examples/proto/examplepb/unannotated_echo_service.proto" + title: "examples/internal/proto/examplepb/unannotated_echo_service.proto" consumes: - "application/json" produces: diff --git a/examples/clients/unannotatedecho/api_unannotated_echo_service.go b/examples/internal/clients/unannotatedecho/api_unannotated_echo_service.go similarity index 99% rename from examples/clients/unannotatedecho/api_unannotated_echo_service.go rename to examples/internal/clients/unannotatedecho/api_unannotated_echo_service.go index d864a7411e7..8eec8d0fede 100644 --- a/examples/clients/unannotatedecho/api_unannotated_echo_service.go +++ b/examples/internal/clients/unannotatedecho/api_unannotated_echo_service.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/unannotated_echo_service.proto + * examples/internal/proto/examplepb/unannotated_echo_service.proto * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/unannotatedecho/client.go b/examples/internal/clients/unannotatedecho/client.go similarity index 98% rename from examples/clients/unannotatedecho/client.go rename to examples/internal/clients/unannotatedecho/client.go index a7cdc750e4e..7907be83032 100644 --- a/examples/clients/unannotatedecho/client.go +++ b/examples/internal/clients/unannotatedecho/client.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/unannotated_echo_service.proto + * examples/internal/proto/examplepb/unannotated_echo_service.proto * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * @@ -37,7 +37,7 @@ var ( xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") ) -// APIClient manages communication with the examples/proto/examplepb/unannotated_echo_service.proto API vversion not set +// APIClient manages communication with the examples/internal/proto/examplepb/unannotated_echo_service.proto API vversion not set // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration diff --git a/examples/clients/unannotatedecho/configuration.go b/examples/internal/clients/unannotatedecho/configuration.go similarity index 97% rename from examples/clients/unannotatedecho/configuration.go rename to examples/internal/clients/unannotatedecho/configuration.go index fe53e0374ad..1b38b7fb35f 100644 --- a/examples/clients/unannotatedecho/configuration.go +++ b/examples/internal/clients/unannotatedecho/configuration.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/unannotated_echo_service.proto + * examples/internal/proto/examplepb/unannotated_echo_service.proto * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/unannotatedecho/model_examplepb_unannotated_simple_message.go b/examples/internal/clients/unannotatedecho/model_examplepb_unannotated_simple_message.go similarity index 91% rename from examples/clients/unannotatedecho/model_examplepb_unannotated_simple_message.go rename to examples/internal/clients/unannotatedecho/model_examplepb_unannotated_simple_message.go index c400daa0b55..689ee5b1981 100644 --- a/examples/clients/unannotatedecho/model_examplepb_unannotated_simple_message.go +++ b/examples/internal/clients/unannotatedecho/model_examplepb_unannotated_simple_message.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/unannotated_echo_service.proto + * examples/internal/proto/examplepb/unannotated_echo_service.proto * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/unannotatedecho/model_protobuf_any.go b/examples/internal/clients/unannotatedecho/model_protobuf_any.go similarity index 98% rename from examples/clients/unannotatedecho/model_protobuf_any.go rename to examples/internal/clients/unannotatedecho/model_protobuf_any.go index 6959023a2ac..57dcc002ecb 100644 --- a/examples/clients/unannotatedecho/model_protobuf_any.go +++ b/examples/internal/clients/unannotatedecho/model_protobuf_any.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/unannotated_echo_service.proto + * examples/internal/proto/examplepb/unannotated_echo_service.proto * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/unannotatedecho/model_runtime_error.go b/examples/internal/clients/unannotatedecho/model_runtime_error.go similarity index 90% rename from examples/clients/unannotatedecho/model_runtime_error.go rename to examples/internal/clients/unannotatedecho/model_runtime_error.go index 30f7572025d..8518d725074 100644 --- a/examples/clients/unannotatedecho/model_runtime_error.go +++ b/examples/internal/clients/unannotatedecho/model_runtime_error.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/unannotated_echo_service.proto + * examples/internal/proto/examplepb/unannotated_echo_service.proto * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * diff --git a/examples/clients/unannotatedecho/response.go b/examples/internal/clients/unannotatedecho/response.go similarity index 95% rename from examples/clients/unannotatedecho/response.go rename to examples/internal/clients/unannotatedecho/response.go index 3121acc8950..56f6b3e0bf8 100644 --- a/examples/clients/unannotatedecho/response.go +++ b/examples/internal/clients/unannotatedecho/response.go @@ -1,5 +1,5 @@ /* - * examples/proto/examplepb/unannotated_echo_service.proto + * examples/internal/proto/examplepb/unannotated_echo_service.proto * * Unannotated Echo Service Similar to echo_service.proto but without annotations. See unannotated_echo_service.yaml for the equivalent of the annotations in gRPC API configuration format. Echo Service API consists of a single service which returns a message. * diff --git a/examples/cmd/example-gateway-server/BUILD.bazel b/examples/internal/cmd/example-gateway-server/BUILD.bazel similarity index 82% rename from examples/cmd/example-gateway-server/BUILD.bazel rename to examples/internal/cmd/example-gateway-server/BUILD.bazel index 0f7c5052e7e..324b14b8351 100644 --- a/examples/cmd/example-gateway-server/BUILD.bazel +++ b/examples/internal/cmd/example-gateway-server/BUILD.bazel @@ -3,10 +3,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_library( name = "go_default_library", srcs = ["main.go"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/cmd/example-gateway-server", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/cmd/example-gateway-server", visibility = ["//visibility:private"], deps = [ - "//examples/gateway:go_default_library", + "//examples/internal/gateway:go_default_library", "@com_github_golang_glog//:go_default_library", ], ) diff --git a/examples/cmd/example-gateway-server/main.go b/examples/internal/cmd/example-gateway-server/main.go similarity index 77% rename from examples/cmd/example-gateway-server/main.go rename to examples/internal/cmd/example-gateway-server/main.go index 0273ffbbbc1..ba10f1b9e5b 100644 --- a/examples/cmd/example-gateway-server/main.go +++ b/examples/internal/cmd/example-gateway-server/main.go @@ -9,13 +9,13 @@ import ( "flag" "github.com/golang/glog" - "github.com/grpc-ecosystem/grpc-gateway/examples/gateway" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/gateway" ) var ( endpoint = flag.String("endpoint", "localhost:9090", "endpoint of the gRPC service") network = flag.String("network", "tcp", `one of "tcp" or "unix". Must be consistent to -endpoint`) - swaggerDir = flag.String("swagger_dir", "examples/proto/examplepb", "path to the directory which contains swagger definitions") + swaggerDir = flag.String("swagger_dir", "examples/internal/proto/examplepb", "path to the directory which contains swagger definitions") ) func main() { diff --git a/examples/cmd/example-grpc-server/BUILD.bazel b/examples/internal/cmd/example-grpc-server/BUILD.bazel similarity index 82% rename from examples/cmd/example-grpc-server/BUILD.bazel rename to examples/internal/cmd/example-grpc-server/BUILD.bazel index 1c66416c6ba..925cb981256 100644 --- a/examples/cmd/example-grpc-server/BUILD.bazel +++ b/examples/internal/cmd/example-grpc-server/BUILD.bazel @@ -5,9 +5,9 @@ package(default_visibility = ["//visibility:private"]) go_library( name = "go_default_library", srcs = ["main.go"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/cmd/example-grpc-server", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/cmd/example-grpc-server", deps = [ - "//examples/server:go_default_library", + "//examples/internal/server:go_default_library", "@com_github_golang_glog//:go_default_library", ], ) diff --git a/examples/cmd/example-grpc-server/main.go b/examples/internal/cmd/example-grpc-server/main.go similarity index 88% rename from examples/cmd/example-grpc-server/main.go rename to examples/internal/cmd/example-grpc-server/main.go index 7f6c45f56e5..1e44a161536 100644 --- a/examples/cmd/example-grpc-server/main.go +++ b/examples/internal/cmd/example-grpc-server/main.go @@ -9,7 +9,7 @@ import ( "flag" "github.com/golang/glog" - "github.com/grpc-ecosystem/grpc-gateway/examples/server" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/server" ) var ( diff --git a/examples/gateway/BUILD.bazel b/examples/internal/gateway/BUILD.bazel similarity index 86% rename from examples/gateway/BUILD.bazel rename to examples/internal/gateway/BUILD.bazel index 393a7c41f9c..f9c1e8a9ede 100644 --- a/examples/gateway/BUILD.bazel +++ b/examples/internal/gateway/BUILD.bazel @@ -8,10 +8,10 @@ go_library( "handlers.go", "main.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/gateway", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/gateway", visibility = ["//visibility:public"], deps = [ - "//examples/proto/examplepb:go_default_library", + "//examples/internal/proto/examplepb:go_default_library", "//runtime:go_default_library", "@com_github_golang_glog//:go_default_library", "@org_golang_google_grpc//:go_default_library", diff --git a/examples/gateway/doc.go b/examples/internal/gateway/doc.go similarity index 100% rename from examples/gateway/doc.go rename to examples/internal/gateway/doc.go diff --git a/examples/gateway/gateway.go b/examples/internal/gateway/gateway.go similarity index 95% rename from examples/gateway/gateway.go rename to examples/internal/gateway/gateway.go index 5fccade22ce..e85fb4219b4 100644 --- a/examples/gateway/gateway.go +++ b/examples/internal/gateway/gateway.go @@ -7,7 +7,7 @@ import ( "net/http" "time" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc" ) diff --git a/examples/gateway/handlers.go b/examples/internal/gateway/handlers.go similarity index 100% rename from examples/gateway/handlers.go rename to examples/internal/gateway/handlers.go diff --git a/examples/gateway/main.go b/examples/internal/gateway/main.go similarity index 100% rename from examples/gateway/main.go rename to examples/internal/gateway/main.go diff --git a/examples/pbwrappers/helloworld/BUILD.bazel b/examples/internal/helloworld/BUILD.bazel similarity index 96% rename from examples/pbwrappers/helloworld/BUILD.bazel rename to examples/internal/helloworld/BUILD.bazel index 01949ef7e9d..d926aca22b9 100644 --- a/examples/pbwrappers/helloworld/BUILD.bazel +++ b/examples/internal/helloworld/BUILD.bazel @@ -15,7 +15,7 @@ proto_library( go_proto_library( name = "helloworld_go_proto", compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/pbwrappers/helloworld", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/helloworld", proto = ":helloworld_proto", visibility = ["//visibility:public"], deps = ["@go_googleapis//google/api:annotations_go_proto"], @@ -25,7 +25,7 @@ go_library( name = "go_default_library", srcs = ["helloworld.pb.gw.go"], embed = [":helloworld_go_proto"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/pbwrappers/helloworld", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/helloworld", visibility = ["//visibility:public"], deps = [ "//runtime:go_default_library", diff --git a/examples/pbwrappers/helloworld/helloworld.pb.go b/examples/internal/helloworld/helloworld.pb.go similarity index 100% rename from examples/pbwrappers/helloworld/helloworld.pb.go rename to examples/internal/helloworld/helloworld.pb.go diff --git a/examples/pbwrappers/helloworld/helloworld.pb.gw.go b/examples/internal/helloworld/helloworld.pb.gw.go similarity index 100% rename from examples/pbwrappers/helloworld/helloworld.pb.gw.go rename to examples/internal/helloworld/helloworld.pb.gw.go diff --git a/examples/pbwrappers/helloworld/helloworld.proto b/examples/internal/helloworld/helloworld.proto similarity index 100% rename from examples/pbwrappers/helloworld/helloworld.proto rename to examples/internal/helloworld/helloworld.proto diff --git a/examples/integration/BUILD.bazel b/examples/internal/integration/BUILD.bazel similarity index 61% rename from examples/integration/BUILD.bazel rename to examples/internal/integration/BUILD.bazel index cee9f33f7f8..57a5e220e53 100644 --- a/examples/integration/BUILD.bazel +++ b/examples/internal/integration/BUILD.bazel @@ -10,14 +10,14 @@ go_test( "proto_error_test.go", ], deps = [ - "//examples/clients/abe:go_default_library", - "//examples/clients/echo:go_default_library", - "//examples/clients/unannotatedecho:go_default_library", - "//examples/gateway:go_default_library", - "//examples/proto/examplepb:go_default_library", - "//examples/proto/pathenum:go_default_library", - "//examples/proto/sub:go_default_library", - "//examples/server:go_default_library", + "//examples/internal/clients/abe:go_default_library", + "//examples/internal/clients/echo:go_default_library", + "//examples/internal/clients/unannotatedecho:go_default_library", + "//examples/internal/gateway:go_default_library", + "//examples/internal/proto/examplepb:go_default_library", + "//examples/internal/proto/pathenum:go_default_library", + "//examples/internal/proto/sub:go_default_library", + "//examples/internal/server:go_default_library", "//runtime:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", diff --git a/examples/integration/client_test.go b/examples/internal/integration/client_test.go similarity index 95% rename from examples/integration/client_test.go rename to examples/internal/integration/client_test.go index 8ca2807d97b..813158025aa 100644 --- a/examples/integration/client_test.go +++ b/examples/internal/integration/client_test.go @@ -4,9 +4,9 @@ import ( "context" "testing" - "github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe" - "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo" - "github.com/grpc-ecosystem/grpc-gateway/examples/clients/unannotatedecho" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/clients/abe" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/clients/echo" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/clients/unannotatedecho" ) func TestEchoClient(t *testing.T) { diff --git a/examples/integration/fieldmask_test.go b/examples/internal/integration/fieldmask_test.go similarity index 98% rename from examples/integration/fieldmask_test.go rename to examples/internal/integration/fieldmask_test.go index 94131079cea..18f494ac457 100644 --- a/examples/integration/fieldmask_test.go +++ b/examples/internal/integration/fieldmask_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/golang/protobuf/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/genproto/protobuf/field_mask" ) diff --git a/examples/integration/integration_test.go b/examples/internal/integration/integration_test.go similarity index 99% rename from examples/integration/integration_test.go rename to examples/internal/integration/integration_test.go index bdc5fd23777..31370468f05 100644 --- a/examples/integration/integration_test.go +++ b/examples/internal/integration/integration_test.go @@ -20,9 +20,9 @@ import ( "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" - gw "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" + gw "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/pathenum" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/grpc/codes" diff --git a/examples/integration/main_test.go b/examples/internal/integration/main_test.go similarity index 88% rename from examples/integration/main_test.go rename to examples/internal/integration/main_test.go index d9ff64c3cc9..3c43d6a2087 100644 --- a/examples/integration/main_test.go +++ b/examples/internal/integration/main_test.go @@ -10,15 +10,15 @@ import ( "time" "github.com/golang/glog" - "github.com/grpc-ecosystem/grpc-gateway/examples/gateway" - server "github.com/grpc-ecosystem/grpc-gateway/examples/server" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/gateway" + server "github.com/grpc-ecosystem/grpc-gateway/examples/internal/server" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" ) var ( endpoint = flag.String("endpoint", "localhost:9090", "endpoint of the gRPC service") network = flag.String("network", "tcp", `one of "tcp" or "unix". Must be consistent to -endpoint`) - swaggerDir = flag.String("swagger_dir", "examples/proto/examplepb", "path to the directory which contains swagger definitions") + swaggerDir = flag.String("swagger_dir", "examples/internal/proto/examplepb", "path to the directory which contains swagger definitions") ) func runGateway(ctx context.Context, addr string, opts ...gwruntime.ServeMuxOption) error { diff --git a/examples/integration/proto_error_test.go b/examples/internal/integration/proto_error_test.go similarity index 100% rename from examples/integration/proto_error_test.go rename to examples/internal/integration/proto_error_test.go diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/internal/proto/examplepb/BUILD.bazel similarity index 88% rename from examples/proto/examplepb/BUILD.bazel rename to examples/internal/proto/examplepb/BUILD.bazel index ac90b28a4ba..4dd1475c710 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/internal/proto/examplepb/BUILD.bazel @@ -39,9 +39,9 @@ proto_library( "wrappers.proto", ], deps = [ - "//examples/proto/pathenum:pathenum_proto", - "//examples/proto/sub:sub_proto", - "//examples/proto/sub2:sub2_proto", + "//examples/internal/proto/pathenum:pathenum_proto", + "//examples/internal/proto/sub:sub_proto", + "//examples/internal/proto/sub2:sub2_proto", "//protoc-gen-swagger/options:options_proto", "@com_google_protobuf//:duration_proto", "@com_google_protobuf//:empty_proto", @@ -58,12 +58,12 @@ go_proto_library( "@io_bazel_rules_go//proto:go_grpc", "//protoc-gen-grpc-gateway:go_gen_grpc_gateway", # keep ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb", proto = ":examplepb_proto", deps = [ - "//examples/proto/pathenum:go_default_library", - "//examples/proto/sub:go_default_library", - "//examples/proto/sub2:go_default_library", + "//examples/internal/proto/pathenum:go_default_library", + "//examples/internal/proto/sub:go_default_library", + "//examples/internal/proto/sub2:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", # keep "@go_googleapis//google/api:annotations_go_proto", @@ -74,7 +74,7 @@ go_library( name = "go_default_library", srcs = ["unannotated_echo_service.pb.gw.go"], embed = [":examplepb_go_proto"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb", deps = [ "//runtime:go_default_library", "//utilities:go_default_library", diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/internal/proto/examplepb/a_bit_of_everything.pb.go similarity index 67% rename from examples/proto/examplepb/a_bit_of_everything.pb.go rename to examples/internal/proto/examplepb/a_bit_of_everything.pb.go index a1320ed9b51..a34ed9d779a 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/internal/proto/examplepb/a_bit_of_everything.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/examplepb/a_bit_of_everything.proto +// source: examples/internal/proto/examplepb/a_bit_of_everything.proto package examplepb @@ -11,9 +11,9 @@ import ( empty "github.com/golang/protobuf/ptypes/empty" timestamp "github.com/golang/protobuf/ptypes/timestamp" wrappers "github.com/golang/protobuf/ptypes/wrappers" - pathenum "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" - sub "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" - sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" + pathenum "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/pathenum" + sub "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub" + sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub2" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" _ "google.golang.org/genproto/googleapis/api/annotations" field_mask "google.golang.org/genproto/protobuf/field_mask" @@ -59,7 +59,7 @@ func (x NumericEnum) String() string { } func (NumericEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_3978364c010e812a, []int{0} + return fileDescriptor_e6ccf6cab3ab66ab, []int{0} } // DeepEnum is one or zero. @@ -87,7 +87,7 @@ func (x ABitOfEverything_Nested_DeepEnum) String() string { } func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_3978364c010e812a, []int{0, 0, 0} + return fileDescriptor_e6ccf6cab3ab66ab, []int{0, 0, 0} } // Intentionally complicated message type to cover many features of Protobuf. @@ -106,9 +106,9 @@ type ABitOfEverything struct { StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` BytesValue []byte `protobuf:"bytes,29,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` - EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` - PathEnumValue pathenum.PathEnum `protobuf:"varint,30,opt,name=path_enum_value,json=pathEnumValue,proto3,enum=grpc.gateway.examples.pathenum.PathEnum" json:"path_enum_value,omitempty"` - NestedPathEnumValue pathenum.MessagePathEnum_NestedPathEnum `protobuf:"varint,31,opt,name=nested_path_enum_value,json=nestedPathEnumValue,proto3,enum=grpc.gateway.examples.pathenum.MessagePathEnum_NestedPathEnum" json:"nested_path_enum_value,omitempty"` + EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,proto3,enum=grpc.gateway.examples.internal.examplepb.NumericEnum" json:"enum_value,omitempty"` + PathEnumValue pathenum.PathEnum `protobuf:"varint,30,opt,name=path_enum_value,json=pathEnumValue,proto3,enum=grpc.gateway.examples.internal.pathenum.PathEnum" json:"path_enum_value,omitempty"` + NestedPathEnumValue pathenum.MessagePathEnum_NestedPathEnum `protobuf:"varint,31,opt,name=nested_path_enum_value,json=nestedPathEnumValue,proto3,enum=grpc.gateway.examples.internal.pathenum.MessagePathEnum_NestedPathEnum" json:"nested_path_enum_value,omitempty"` Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value,proto3" json:"sfixed32_value,omitempty"` Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value,proto3" json:"sfixed64_value,omitempty"` Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value,proto3" json:"sint32_value,omitempty"` @@ -118,17 +118,17 @@ type ABitOfEverything struct { // *ABitOfEverything_OneofEmpty // *ABitOfEverything_OneofString OneofValue isABitOfEverything_OneofValue `protobuf_oneof:"oneof_value"` - MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue,proto3" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum"` + MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue,proto3" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=grpc.gateway.examples.internal.examplepb.NumericEnum"` MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue,proto3" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue,proto3" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue,proto3" json:"nonConventionalNameValue,omitempty"` TimestampValue *timestamp.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue,proto3" json:"timestamp_value,omitempty"` // repeated enum value. it is comma-separated in query - RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` + RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,proto3,enum=grpc.gateway.examples.internal.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` // repeated numeric enum comment (This comment is overridden by the field annotation) - RepeatedEnumAnnotation []NumericEnum `protobuf:"varint,32,rep,packed,name=repeated_enum_annotation,json=repeatedEnumAnnotation,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_annotation,omitempty"` + RepeatedEnumAnnotation []NumericEnum `protobuf:"varint,32,rep,packed,name=repeated_enum_annotation,json=repeatedEnumAnnotation,proto3,enum=grpc.gateway.examples.internal.examplepb.NumericEnum" json:"repeated_enum_annotation,omitempty"` // numeric enum comment (This comment is overridden by the field annotation) - EnumValueAnnotation NumericEnum `protobuf:"varint,33,opt,name=enum_value_annotation,json=enumValueAnnotation,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value_annotation,omitempty"` + EnumValueAnnotation NumericEnum `protobuf:"varint,33,opt,name=enum_value_annotation,json=enumValueAnnotation,proto3,enum=grpc.gateway.examples.internal.examplepb.NumericEnum" json:"enum_value_annotation,omitempty"` // repeated string comment (This comment is overridden by the field annotation) RepeatedStringAnnotation []string `protobuf:"bytes,34,rep,name=repeated_string_annotation,json=repeatedStringAnnotation,proto3" json:"repeated_string_annotation,omitempty"` // repeated nested object comment (This comment is overridden by the field annotation) @@ -145,7 +145,7 @@ func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything) ProtoMessage() {} func (*ABitOfEverything) Descriptor() ([]byte, []int) { - return fileDescriptor_3978364c010e812a, []int{0} + return fileDescriptor_e6ccf6cab3ab66ab, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { @@ -455,7 +455,7 @@ type ABitOfEverything_Nested struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Amount uint32 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` // DeepEnum comment. - Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,proto3,enum=grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` + Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,proto3,enum=grpc.gateway.examples.internal.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -465,7 +465,7 @@ func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { - return fileDescriptor_3978364c010e812a, []int{0, 0} + return fileDescriptor_e6ccf6cab3ab66ab, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { @@ -521,7 +521,7 @@ type ABitOfEverythingRepeated struct { PathRepeatedStringValue []string `protobuf:"bytes,9,rep,name=path_repeated_string_value,json=pathRepeatedStringValue,proto3" json:"path_repeated_string_value,omitempty"` PathRepeatedBytesValue [][]byte `protobuf:"bytes,10,rep,name=path_repeated_bytes_value,json=pathRepeatedBytesValue,proto3" json:"path_repeated_bytes_value,omitempty"` PathRepeatedUint32Value []uint32 `protobuf:"varint,11,rep,packed,name=path_repeated_uint32_value,json=pathRepeatedUint32Value,proto3" json:"path_repeated_uint32_value,omitempty"` - PathRepeatedEnumValue []NumericEnum `protobuf:"varint,12,rep,packed,name=path_repeated_enum_value,json=pathRepeatedEnumValue,proto3,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"path_repeated_enum_value,omitempty"` + PathRepeatedEnumValue []NumericEnum `protobuf:"varint,12,rep,packed,name=path_repeated_enum_value,json=pathRepeatedEnumValue,proto3,enum=grpc.gateway.examples.internal.examplepb.NumericEnum" json:"path_repeated_enum_value,omitempty"` PathRepeatedSfixed32Value []int32 `protobuf:"fixed32,13,rep,packed,name=path_repeated_sfixed32_value,json=pathRepeatedSfixed32Value,proto3" json:"path_repeated_sfixed32_value,omitempty"` PathRepeatedSfixed64Value []int64 `protobuf:"fixed64,14,rep,packed,name=path_repeated_sfixed64_value,json=pathRepeatedSfixed64Value,proto3" json:"path_repeated_sfixed64_value,omitempty"` PathRepeatedSint32Value []int32 `protobuf:"zigzag32,15,rep,packed,name=path_repeated_sint32_value,json=pathRepeatedSint32Value,proto3" json:"path_repeated_sint32_value,omitempty"` @@ -535,7 +535,7 @@ func (m *ABitOfEverythingRepeated) Reset() { *m = ABitOfEverythingRepeat func (m *ABitOfEverythingRepeated) String() string { return proto.CompactTextString(m) } func (*ABitOfEverythingRepeated) ProtoMessage() {} func (*ABitOfEverythingRepeated) Descriptor() ([]byte, []int) { - return fileDescriptor_3978364c010e812a, []int{1} + return fileDescriptor_e6ccf6cab3ab66ab, []int{1} } func (m *ABitOfEverythingRepeated) XXX_Unmarshal(b []byte) error { @@ -679,7 +679,7 @@ func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} func (*Body) Descriptor() ([]byte, []int) { - return fileDescriptor_3978364c010e812a, []int{2} + return fileDescriptor_e6ccf6cab3ab66ab, []int{2} } func (m *Body) XXX_Unmarshal(b []byte) error { @@ -719,7 +719,7 @@ func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} func (*MessageWithBody) Descriptor() ([]byte, []int) { - return fileDescriptor_3978364c010e812a, []int{3} + return fileDescriptor_e6ccf6cab3ab66ab, []int{3} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { @@ -767,7 +767,7 @@ func (m *UpdateV2Request) Reset() { *m = UpdateV2Request{} } func (m *UpdateV2Request) String() string { return proto.CompactTextString(m) } func (*UpdateV2Request) ProtoMessage() {} func (*UpdateV2Request) Descriptor() ([]byte, []int) { - return fileDescriptor_3978364c010e812a, []int{4} + return fileDescriptor_e6ccf6cab3ab66ab, []int{4} } func (m *UpdateV2Request) XXX_Unmarshal(b []byte) error { @@ -803,252 +803,253 @@ func (m *UpdateV2Request) GetUpdateMask() *field_mask.FieldMask { } func init() { - proto.RegisterEnum("grpc.gateway.examples.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) - proto.RegisterEnum("grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value) - proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything") - proto.RegisterMapType((map[string]NumericEnum)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.MapValueEntry") - proto.RegisterMapType((map[string]*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.MappedNestedValueEntry") - proto.RegisterMapType((map[string]string)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.MappedStringValueEntry") - proto.RegisterType((*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.Nested") - proto.RegisterType((*ABitOfEverythingRepeated)(nil), "grpc.gateway.examples.examplepb.ABitOfEverythingRepeated") - proto.RegisterType((*Body)(nil), "grpc.gateway.examples.examplepb.Body") - proto.RegisterType((*MessageWithBody)(nil), "grpc.gateway.examples.examplepb.MessageWithBody") - proto.RegisterType((*UpdateV2Request)(nil), "grpc.gateway.examples.examplepb.UpdateV2Request") + proto.RegisterEnum("grpc.gateway.examples.internal.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) + proto.RegisterEnum("grpc.gateway.examples.internal.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value) + proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.examples.internal.examplepb.ABitOfEverything") + proto.RegisterMapType((map[string]NumericEnum)(nil), "grpc.gateway.examples.internal.examplepb.ABitOfEverything.MapValueEntry") + proto.RegisterMapType((map[string]*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.internal.examplepb.ABitOfEverything.MappedNestedValueEntry") + proto.RegisterMapType((map[string]string)(nil), "grpc.gateway.examples.internal.examplepb.ABitOfEverything.MappedStringValueEntry") + proto.RegisterType((*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.internal.examplepb.ABitOfEverything.Nested") + proto.RegisterType((*ABitOfEverythingRepeated)(nil), "grpc.gateway.examples.internal.examplepb.ABitOfEverythingRepeated") + proto.RegisterType((*Body)(nil), "grpc.gateway.examples.internal.examplepb.Body") + proto.RegisterType((*MessageWithBody)(nil), "grpc.gateway.examples.internal.examplepb.MessageWithBody") + proto.RegisterType((*UpdateV2Request)(nil), "grpc.gateway.examples.internal.examplepb.UpdateV2Request") } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_3978364c010e812a) -} - -var fileDescriptor_3978364c010e812a = []byte{ - // 3621 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4f, 0x70, 0x1c, 0xc7, - 0x5a, 0xd7, 0xec, 0x48, 0xb2, 0xd4, 0xb2, 0x2c, 0xa9, 0x65, 0xd9, 0xf2, 0x5a, 0x89, 0xda, 0x63, - 0xe7, 0x65, 0xbc, 0xcf, 0xbb, 0x23, 0x8d, 0x94, 0xc4, 0xde, 0xf0, 0x92, 0xec, 0x4a, 0xb2, 0x23, - 0x3b, 0x91, 0x95, 0xb1, 0x63, 0x82, 0x5f, 0xfc, 0x44, 0xef, 0x6e, 0x4b, 0x3b, 0xd6, 0xce, 0xf4, - 0xbc, 0x99, 0x1e, 0x59, 0x6b, 0xb1, 0xf0, 0x0a, 0x28, 0x28, 0x78, 0xb7, 0x7d, 0xfc, 0x29, 0x48, - 0xc1, 0x85, 0xe2, 0x42, 0xbd, 0x13, 0x55, 0x9c, 0xa8, 0x82, 0x0b, 0x9c, 0x38, 0x40, 0x85, 0x2a, - 0x8a, 0x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c, 0x1b, - 0x5e, 0x01, 0x67, 0x6b, 0xd4, 0xaf, 0x34, 0x48, 0x28, 0x6c, 0x14, 0x49, 0xaa, 0x64, 0x4c, 0x05, - 0x73, 0x01, 0xc9, 0x32, 0x98, 0x32, 0x6d, 0xf6, 0xee, 0x7a, 0x48, 0x31, 0x86, 0x24, 0x55, 0x36, - 0x80, 0x98, 0xea, 0xc8, 0xf0, 0xe3, 0x14, 0xe3, 0x48, 0x52, 0x47, 0x8d, 0x29, 0x3f, 0x46, 0x12, - 0xc8, 0x58, 0xd3, 0x43, 0x8a, 0x33, 0x48, 0x52, 0xc7, 0x84, 0x8c, 0x35, 0x3d, 0x20, 0xb8, 0x0a, - 0xa6, 0xf7, 0xcd, 0x63, 0x52, 0xeb, 0x08, 0x99, 0x40, 0x92, 0x3a, 0x6e, 0x9c, 0x0d, 0x27, 0x93, - 0x44, 0x1d, 0x39, 0x93, 0x48, 0x52, 0xcf, 0x84, 0x44, 0x91, 0xa4, 0x37, 0x00, 0xa8, 0x50, 0xda, - 0x08, 0x29, 0x00, 0x92, 0xd4, 0x09, 0x63, 0x92, 0xcf, 0x74, 0x94, 0xf5, 0x98, 0x6b, 0xda, 0x07, - 0x21, 0xc1, 0x14, 0x77, 0x00, 0x63, 0x2a, 0x98, 0xeb, 0x28, 0x5b, 0x69, 0x32, 0xe2, 0x85, 0x14, - 0x6f, 0x20, 0x49, 0x3d, 0x6b, 0x00, 0x31, 0x95, 0x30, 0xb8, 0xa3, 0xc6, 0x34, 0x92, 0xd4, 0xe9, - 0xc0, 0xe0, 0x48, 0x8b, 0x7b, 0x00, 0xf0, 0x5b, 0x17, 0x12, 0x9c, 0x43, 0x92, 0x7a, 0x4e, 0xbf, - 0x71, 0xea, 0xc9, 0xef, 0xf8, 0x16, 0x71, 0xcd, 0xea, 0x96, 0xed, 0x5b, 0xc6, 0x24, 0xe7, 0x0f, - 0x84, 0xed, 0x82, 0x99, 0xce, 0x3d, 0x0e, 0x25, 0xbe, 0x29, 0x24, 0xaa, 0x03, 0x24, 0x46, 0xd7, - 0xbf, 0xb0, 0x8b, 0x59, 0x5d, 0x48, 0x9b, 0x76, 0xc2, 0xaf, 0x40, 0xa2, 0x07, 0x2e, 0x04, 0xce, - 0xb4, 0x97, 0x16, 0xbc, 0x2c, 0x04, 0x7f, 0x70, 0x9a, 0xe0, 0x4f, 0x83, 0x80, 0x10, 0xc9, 0x0f, - 0x5d, 0xb4, 0x03, 0x37, 0x6f, 0x27, 0xc6, 0x01, 0xe8, 0x5b, 0xe0, 0x9c, 0x97, 0x3c, 0xbf, 0x19, - 0x24, 0xa9, 0x33, 0xc6, 0xb4, 0x97, 0x38, 0xc0, 0x0e, 0x59, 0xc7, 0x17, 0x66, 0x91, 0xa4, 0xce, - 0x46, 0x64, 0x31, 0xaf, 0xf3, 0xe2, 0x87, 0x30, 0x87, 0x24, 0x75, 0xce, 0x98, 0xf2, 0x62, 0x87, - 0x10, 0x92, 0x74, 0xe4, 0x40, 0x24, 0xa9, 0x30, 0x20, 0x89, 0xa4, 0xe8, 0x60, 0xc1, 0x25, 0x0e, - 0xc1, 0x7c, 0x2b, 0x12, 0x7e, 0x31, 0x8f, 0x64, 0x75, 0xd2, 0x98, 0x8f, 0x16, 0x1f, 0xc4, 0xfc, - 0xe3, 0x16, 0x98, 0xa2, 0x36, 0xe1, 0x49, 0x84, 0x47, 0xf0, 0xc5, 0xf3, 0x22, 0x30, 0x5d, 0x28, - 0x04, 0x41, 0xb1, 0x10, 0x05, 0xc5, 0xc2, 0x16, 0x5f, 0xfd, 0x78, 0xc4, 0x00, 0x82, 0x58, 0x8c, - 0xe0, 0x55, 0x70, 0x36, 0x60, 0x0d, 0xb0, 0x16, 0x17, 0xb8, 0xf7, 0x7d, 0x3c, 0x62, 0x04, 0x02, - 0x03, 0x10, 0xf8, 0x25, 0x98, 0xb4, 0xb0, 0x13, 0xea, 0x71, 0x41, 0x04, 0x8d, 0x0f, 0x87, 0x0f, - 0x1a, 0x9f, 0x62, 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9, 0x55, 0xf1, 0xd2, 0xce, 0x40, - 0xcd, 0xe6, 0x3b, 0xb1, 0x35, 0xa6, 0xd6, 0x11, 0xc8, 0xa6, 0x43, 0x41, 0x4c, 0x35, 0x85, 0xc7, - 0x83, 0xf2, 0xcd, 0x76, 0xe9, 0x9d, 0xdc, 0x42, 0xc7, 0xf6, 0x80, 0x2c, 0xc4, 0x5b, 0x4a, 0x4f, - 0x27, 0x20, 0x17, 0x93, 0x91, 0x24, 0x86, 0xfb, 0x57, 0x52, 0x0c, 0x38, 0xbc, 0x19, 0x31, 0xe0, - 0xab, 0xaf, 0x57, 0x35, 0x94, 0x6f, 0xb7, 0x4b, 0x1b, 0xb9, 0xae, 0x6e, 0x01, 0x00, 0xa2, 0x95, - 0xa7, 0xa4, 0xca, 0x42, 0xcd, 0xaf, 0x0e, 0x58, 0xed, 0x6f, 0x40, 0x20, 0x37, 0x66, 0xc0, 0x57, - 0x12, 0x98, 0xeb, 0xd5, 0xfb, 0xda, 0xeb, 0xd5, 0x6b, 0xe5, 0xf5, 0x76, 0x69, 0x35, 0x37, 0xbf, - 0xd3, 0x47, 0xdd, 0xec, 0xce, 0x60, 0x2d, 0x67, 0xed, 0xb4, 0x76, 0xef, 0x81, 0xf9, 0x20, 0x07, - 0xd0, 0x23, 0xe2, 0xba, 0x66, 0x8d, 0xec, 0xb1, 0xa6, 0x43, 0x16, 0xdf, 0xe2, 0x65, 0x4c, 0xf9, - 0x4c, 0xbb, 0x34, 0xfa, 0x87, 0x19, 0x49, 0x36, 0xe6, 0x04, 0xcd, 0xfd, 0x90, 0xe4, 0x61, 0xd3, - 0x21, 0xd9, 0x7f, 0x91, 0xc0, 0x78, 0x58, 0x2d, 0x42, 0x30, 0x6a, 0x63, 0x8b, 0x04, 0xd5, 0xa2, - 0x21, 0xbe, 0xe1, 0x05, 0x30, 0x8e, 0x2d, 0xea, 0xdb, 0x6c, 0x31, 0x23, 0xd2, 0x7f, 0x38, 0x82, - 0x16, 0xc8, 0xd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x70, 0x22, 0x3b, 0x4e, 0xf9, 0x40, 0xbf, - 0xfb, 0x8b, 0xe0, 0xcd, 0x41, 0x94, 0xd4, 0x35, 0x9f, 0x13, 0x17, 0x7e, 0x90, 0xfb, 0x39, 0x30, - 0x03, 0x46, 0x05, 0xdf, 0x99, 0xec, 0x18, 0xa3, 0x87, 0xc4, 0x06, 0xd7, 0xc1, 0x52, 0x97, 0xc4, - 0x20, 0x9e, 0xdf, 0x60, 0x0f, 0x59, 0x63, 0xdb, 0x7e, 0xc0, 0x63, 0x4f, 0xcd, 0xeb, 0xd4, 0xbf, - 0x3b, 0x1f, 0x81, 0x7f, 0x92, 0x3a, 0xaf, 0x07, 0x7f, 0x27, 0x4d, 0xc8, 0xea, 0xa8, 0x7e, 0x35, - 0xf2, 0xb9, 0x98, 0x83, 0x6a, 0x42, 0x1f, 0xad, 0x23, 0xb4, 0xb8, 0x3c, 0x98, 0x48, 0xa8, 0x50, - 0xfe, 0x15, 0x90, 0x0d, 0x1e, 0x23, 0x20, 0xbc, 0xe3, 0x62, 0x9b, 0x79, 0x88, 0x0f, 0xc2, 0xb3, - 0x04, 0x4b, 0xe1, 0x13, 0x05, 0x9c, 0x0f, 0x17, 0xc5, 0x28, 0x5a, 0xdd, 0x00, 0x63, 0xb8, 0x66, - 0x99, 0x36, 0x2c, 0x26, 0x58, 0xed, 0x5a, 0x82, 0x4c, 0xb8, 0x06, 0x27, 0x33, 0x3d, 0xc6, 0x6b, - 0xc9, 0x23, 0xde, 0x32, 0xec, 0x53, 0xd7, 0x12, 0xde, 0x57, 0x59, 0x06, 0xd3, 0xf1, 0x83, 0x19, - 0x49, 0x3f, 0x9b, 0x54, 0xae, 0x0f, 0x7c, 0x38, 0x49, 0x93, 0xba, 0xdb, 0xe0, 0xe2, 0xa7, 0xdd, - 0x68, 0x19, 0x8f, 0x01, 0xc3, 0xde, 0xfd, 0xe7, 0x97, 0x01, 0x3c, 0xce, 0xc7, 0x67, 0xf8, 0x25, - 0x81, 0x63, 0x59, 0xb9, 0x82, 0xdd, 0xe7, 0x2a, 0xb8, 0x98, 0x5a, 0xac, 0xe0, 0xe7, 0xf9, 0x86, - 0xe9, 0x31, 0x38, 0xad, 0x4f, 0x81, 0xb1, 0xac, 0x4c, 0x6d, 0x02, 0x32, 0x48, 0x7a, 0x3c, 0xd9, - 0x71, 0xc7, 0xca, 0xb8, 0x08, 0x63, 0x6b, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xe8, 0xcf, 0x9c, - 0x94, 0x33, 0x2c, 0x00, 0x00, + proto.RegisterFile("examples/internal/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_e6ccf6cab3ab66ab) +} + +var fileDescriptor_e6ccf6cab3ab66ab = []byte{ + // 3643 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4b, 0x6c, 0x1b, 0x49, + 0x7a, 0x56, 0xb1, 0xa9, 0x57, 0xc9, 0x92, 0xa8, 0x92, 0x65, 0xcb, 0xb4, 0x66, 0x5c, 0x43, 0x7b, + 0x77, 0xdb, 0x5c, 0x93, 0x2d, 0xb5, 0xe4, 0x19, 0x9b, 0x93, 0xdd, 0x19, 0x52, 0x92, 0x3d, 0xb2, + 0x3d, 0xb2, 0xdd, 0xd6, 0x78, 0x67, 0xbc, 0x98, 0x55, 0x8a, 0x64, 0x51, 0x6c, 0x8b, 0xfd, 0xd8, + 0xee, 0x6a, 0x59, 0xb4, 0x42, 0x64, 0x12, 0x24, 0x58, 0x20, 0x09, 0x90, 0x80, 0x41, 0x12, 0x24, + 0x93, 0xb9, 0x25, 0x97, 0x60, 0x0f, 0xb9, 0xe4, 0x10, 0xec, 0x21, 0xa7, 0x60, 0x0f, 0xb9, 0x4d, + 0x80, 0xbd, 0x07, 0x09, 0x72, 0x08, 0x72, 0x0b, 0x30, 0x40, 0x0e, 0x0b, 0x04, 0x55, 0xdd, 0x4d, + 0x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05, 0xcf, 0x55, 0x2d, + 0xaf, 0xdc, 0xa0, 0x81, 0xb0, 0x24, 0x06, 0x32, 0xd0, 0xa6, 0xfc, 0x39, 0x9f, 0xe4, 0x0a, 0x9c, + 0xd2, 0x4d, 0xf6, 0xf6, 0x5a, 0x40, 0x31, 0x8a, 0x81, 0x2c, 0x69, 0x50, 0x4c, 0x75, 0x64, 0x78, + 0x51, 0x8a, 0x31, 0x0c, 0xe4, 0xa4, 0x36, 0xe5, 0x45, 0x48, 0x7c, 0x19, 0xab, 0x6a, 0x40, 0x31, + 0x8e, 0x81, 0x3c, 0x2a, 0x64, 0xac, 0xaa, 0x3e, 0xc1, 0x55, 0x38, 0x5d, 0xd3, 0x0f, 0x69, 0xb5, + 0x23, 0x64, 0x02, 0x03, 0x79, 0x4c, 0x3b, 0x17, 0x4c, 0xc6, 0x89, 0x3a, 0x72, 0x26, 0x31, 0x90, + 0xc7, 0x03, 0xa2, 0x50, 0xd2, 0x1b, 0x10, 0x96, 0x2d, 0xab, 0x11, 0x50, 0x40, 0x0c, 0xe4, 0x09, + 0x6d, 0x92, 0xcf, 0x74, 0xc0, 0xba, 0xcc, 0xd1, 0xcd, 0xbd, 0x80, 0x60, 0x8a, 0x7b, 0x82, 0x36, + 0xe5, 0xcf, 0x75, 0xc0, 0x96, 0x9b, 0x8c, 0xba, 0x01, 0xc5, 0x1b, 0x18, 0xc8, 0xe7, 0x34, 0x28, + 0xa6, 0x62, 0x06, 0x77, 0x60, 0x4c, 0x63, 0x20, 0x4f, 0xfb, 0x06, 0x87, 0x28, 0x76, 0x20, 0xe4, + 0x6f, 0x66, 0x40, 0x30, 0x83, 0x81, 0x3c, 0xa3, 0xde, 0x3c, 0xb9, 0x0b, 0x6c, 0x7b, 0x06, 0x75, + 0xf4, 0xca, 0xa6, 0xe9, 0x19, 0xda, 0x24, 0x17, 0xe4, 0x4b, 0xfd, 0x04, 0xce, 0x76, 0x5e, 0xfa, + 0x40, 0xf4, 0x9b, 0x42, 0xf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64, 0x8b, 0x09, 0x51, 0x63, 0x04, 0x23, 0x74, 0x00, 0x13, 0xd6, + 0xbe, 0xa8, 0xfc, 0x66, 0xd4, 0x7b, 0x67, 0xde, 0x86, 0xfc, 0x06, 0xa5, 0xb6, 0xf0, 0xfc, 0x74, + 0xbb, 0x78, 0x51, 0x5d, 0x08, 0x87, 0x71, 0xab, 0x13, 0xd6, 0x7e, 0xe6, 0x0a, 0x9c, 0x08, 0x17, + 0xd1, 0x24, 0x1c, 0xbd, 0x53, 0x7c, 0xf0, 0x64, 0x33, 0x35, 0x82, 0x26, 0x60, 0x72, 0x47, 0xfb, + 0x68, 0x33, 0x05, 0x0a, 0x17, 0xdb, 0xc5, 0xf3, 0x2a, 0x42, 0xa9, 0x23, 0x9c, 0xb1, 0xf6, 0x33, + 0x05, 0x9c, 0xe1, 0xf3, 0x19, 0xdc, 0x4a, 0x3b, 0x70, 0x3a, 0x96, 0x6d, 0x50, 0x0a, 0x4a, 0xfb, + 0xb4, 0x19, 0x58, 0xcb, 0x1f, 0xd1, 0x7d, 0x38, 0xea, 0x87, 0xb7, 0xc4, 0x59, 0xca, 0x25, 0x5f, + 0x46, 0x21, 0x71, 0x0b, 0xa4, 0x37, 0xe0, 0x85, 0xc1, 0xf9, 0x66, 0x80, 0xf2, 0xf3, 0x51, 0xe5, + 0x93, 0x51, 0x29, 0x3f, 0x03, 0xa1, 0x98, 0xde, 0x94, 0x31, 0x40, 0xcc, 0x8f, 0xa2, 0x62, 0x5e, + 0x4b, 0xd5, 0xdf, 0x45, 0x52, 0xf8, 0xcb, 0x44, 0xbb, 0xf8, 0x67, 0x09, 0xf8, 0x7b, 0x20, 0x3b, + 0x5f, 0xc4, 0x65, 0x9d, 0x61, 0xab, 0x86, 0xbb, 0xed, 0xaf, 0xba, 0xb5, 0x65, 0xb2, 0x30, 0x0f, + 0x35, 0x71, 0xc5, 0x32, 0xec, 0x86, 0x5e, 0x11, 0xaf, 0x5e, 0xd0, 0xd0, 0x61, 0xee,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x57, 0xc7, 0xda, 0xb6, 0x59, + 0x2c, 0xc9, 0x73, 0x3d, 0xc7, 0x14, 0xd9, 0xae, 0x81, 0xcc, 0x91, 0xc6, 0x50, 0x92, 0x51, 0x3f, + 0x73, 0xa0, 0xb9, 0x50, 0x6f, 0x17, 0xa9, 0x5a, 0x41, 0xe4, 0x08, 0x67, 0x86, 0x79, 0x58, 0xa6, + 0x80, 0x7f, 0xcc, 0x1c, 0x8f, 0xde, 0xc0, 0xfe, 0xff, 0x35, 0xd2, 0x70, 0x83, 0xc1, 0xa7, 0x37, + 0x7a, 0xd9, 0x22, 0xb8, 0x39, 0xdf, 0xca, 0x0d, 0xac, 0xde, 0xc0, 0xab, 0x9f, 0xe2, 0x56, 0x26, + 0x0d, 0x93, 0x25, 0xab, 0xda, 0x1c, 0x94, 0xde, 0x33, 0x14, 0xce, 0x06, 0xdd, 0xf2, 0x8f, 0x74, + 0x56, 0x17, 0x64, 0x33, 0x30, 0x11, 0xde, 0x4f, 0x69, 0x09, 0xbd, 0x8a, 0x4a, 0x30, 0x59, 0x25, + 0x8c, 0x04, 0xf9, 0x24, 0x7f, 0x72, 0x07, 0xe0, 0xd2, 0x34, 0xc1, 0x9b, 0xf9, 0x6b, 0x00, 0x67, + 0x3f, 0xb2, 0xab, 0x84, 0xd1, 0xa7, 0xaa, 0x46, 0x7f, 0xea, 0x51, 0x97, 0xa1, 0x07, 0x50, 0x22, + 0x65, 0x1f, 0xcd, 0x94, 0x5a, 0xf8, 0xfa, 0x69, 0x4a, 0xe3, 0x62, 0xd0, 0xbb, 0x70, 0xca, 0x13, + 0x0a, 0xc4, 0xf5, 0x68, 0x00, 0xb6, 0xbf, 0xd1, 0xb9, 0xa3, 0xd3, 0x46, 0xf5, 0x43, 0xe2, 0xee, + 0x6b, 0xd0, 0x27, 0xe7, 0xcf, 0x59, 0x0c, 0xa7, 0x22, 0xde, 0xca, 0x8b, 0x89, 0x67, 0x9b, 0xda, + 0xc3, 0xd4, 0x08, 0x1a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, 0x02, 0x2f, 0x2f, 0x43, 0x74, + 0x98, 0x8b, 0xce, 0xf0, 0xb7, 0x05, 0x8d, 0xa6, 0xa5, 0x32, 0x71, 0x5e, 0xca, 0xf0, 0x62, 0xcf, + 0x62, 0x99, 0xbc, 0xcc, 0x35, 0x74, 0x97, 0xa1, 0x69, 0x75, 0x0a, 0x8e, 0xa6, 0x25, 0xcb, 0xa4, + 0x30, 0x81, 0xc1, 0xb3, 0xc9, 0x8e, 0x3b, 0x96, 0xc7, 0x44, 0x3c, 0x5b, 0xfd, 0xbf, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xaf, 0x42, 0x84, 0x1a, 0xde, 0x2d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1104,7 +1105,7 @@ func NewABitOfEverythingServiceClient(cc *grpc.ClientConn) ABitOfEverythingServi func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Create", in, out, opts...) if err != nil { return nil, err } @@ -1113,7 +1114,7 @@ func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEv func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/CreateBody", in, out, opts...) if err != nil { return nil, err } @@ -1122,7 +1123,7 @@ func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABit func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Lookup", in, out, opts...) if err != nil { return nil, err } @@ -1131,7 +1132,7 @@ func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdM func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Update", in, out, opts...) if err != nil { return nil, err } @@ -1140,7 +1141,7 @@ func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEv func (c *aBitOfEverythingServiceClient) UpdateV2(ctx context.Context, in *UpdateV2Request, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/UpdateV2", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/UpdateV2", in, out, opts...) if err != nil { return nil, err } @@ -1149,7 +1150,7 @@ func (c *aBitOfEverythingServiceClient) UpdateV2(ctx context.Context, in *Update func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Delete", in, out, opts...) if err != nil { return nil, err } @@ -1158,7 +1159,7 @@ func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdM func (c *aBitOfEverythingServiceClient) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/GetQuery", in, out, opts...) if err != nil { return nil, err } @@ -1167,7 +1168,7 @@ func (c *aBitOfEverythingServiceClient) GetQuery(ctx context.Context, in *ABitOf func (c *aBitOfEverythingServiceClient) GetRepeatedQuery(ctx context.Context, in *ABitOfEverythingRepeated, opts ...grpc.CallOption) (*ABitOfEverythingRepeated, error) { out := new(ABitOfEverythingRepeated) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetRepeatedQuery", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/GetRepeatedQuery", in, out, opts...) if err != nil { return nil, err } @@ -1176,7 +1177,7 @@ func (c *aBitOfEverythingServiceClient) GetRepeatedQuery(ctx context.Context, in func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *sub.StringMessage, opts ...grpc.CallOption) (*sub.StringMessage, error) { out := new(sub.StringMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Echo", in, out, opts...) if err != nil { return nil, err } @@ -1185,7 +1186,7 @@ func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *sub.String func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, opts...) if err != nil { return nil, err } @@ -1194,7 +1195,7 @@ func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *AB func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *duration.Duration, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/NoBindings", in, out, opts...) if err != nil { return nil, err } @@ -1203,7 +1204,7 @@ func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *dura func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Timeout", in, out, opts...) if err != nil { return nil, err } @@ -1212,7 +1213,7 @@ func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *empty.E func (c *aBitOfEverythingServiceClient) ErrorWithDetails(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/ErrorWithDetails", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/ErrorWithDetails", in, out, opts...) if err != nil { return nil, err } @@ -1221,7 +1222,7 @@ func (c *aBitOfEverythingServiceClient) ErrorWithDetails(ctx context.Context, in func (c *aBitOfEverythingServiceClient) GetMessageWithBody(ctx context.Context, in *MessageWithBody, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetMessageWithBody", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/GetMessageWithBody", in, out, opts...) if err != nil { return nil, err } @@ -1230,7 +1231,7 @@ func (c *aBitOfEverythingServiceClient) GetMessageWithBody(ctx context.Context, func (c *aBitOfEverythingServiceClient) PostWithEmptyBody(ctx context.Context, in *Body, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PostWithEmptyBody", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/PostWithEmptyBody", in, out, opts...) if err != nil { return nil, err } @@ -1239,7 +1240,7 @@ func (c *aBitOfEverythingServiceClient) PostWithEmptyBody(ctx context.Context, i func (c *aBitOfEverythingServiceClient) CheckGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckGetQueryParams", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/CheckGetQueryParams", in, out, opts...) if err != nil { return nil, err } @@ -1248,7 +1249,7 @@ func (c *aBitOfEverythingServiceClient) CheckGetQueryParams(ctx context.Context, func (c *aBitOfEverythingServiceClient) CheckNestedEnumGetQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckNestedEnumGetQueryParams", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/CheckNestedEnumGetQueryParams", in, out, opts...) if err != nil { return nil, err } @@ -1257,7 +1258,7 @@ func (c *aBitOfEverythingServiceClient) CheckNestedEnumGetQueryParams(ctx contex func (c *aBitOfEverythingServiceClient) CheckPostQueryParams(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckPostQueryParams", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/CheckPostQueryParams", in, out, opts...) if err != nil { return nil, err } @@ -1266,7 +1267,7 @@ func (c *aBitOfEverythingServiceClient) CheckPostQueryParams(ctx context.Context func (c *aBitOfEverythingServiceClient) OverwriteResponseContentType(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*wrappers.StringValue, error) { out := new(wrappers.StringValue) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/OverwriteResponseContentType", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/OverwriteResponseContentType", in, out, opts...) if err != nil { return nil, err } @@ -1382,7 +1383,7 @@ func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Create(ctx, req.(*ABitOfEverything)) @@ -1400,7 +1401,7 @@ func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/CreateBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, req.(*ABitOfEverything)) @@ -1418,7 +1419,7 @@ func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Lookup", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Lookup(ctx, req.(*sub2.IdMessage)) @@ -1436,7 +1437,7 @@ func _ABitOfEverythingService_Update_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Update(ctx, req.(*ABitOfEverything)) @@ -1454,7 +1455,7 @@ func _ABitOfEverythingService_UpdateV2_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/UpdateV2", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/UpdateV2", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).UpdateV2(ctx, req.(*UpdateV2Request)) @@ -1472,7 +1473,7 @@ func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Delete(ctx, req.(*sub2.IdMessage)) @@ -1490,7 +1491,7 @@ func _ABitOfEverythingService_GetQuery_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/GetQuery", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).GetQuery(ctx, req.(*ABitOfEverything)) @@ -1508,7 +1509,7 @@ func _ABitOfEverythingService_GetRepeatedQuery_Handler(srv interface{}, ctx cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetRepeatedQuery", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/GetRepeatedQuery", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).GetRepeatedQuery(ctx, req.(*ABitOfEverythingRepeated)) @@ -1526,7 +1527,7 @@ func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Echo(ctx, req.(*sub.StringMessage)) @@ -1544,7 +1545,7 @@ func _ABitOfEverythingService_DeepPathEcho_Handler(srv interface{}, ctx context. } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/DeepPathEcho", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).DeepPathEcho(ctx, req.(*ABitOfEverything)) @@ -1562,7 +1563,7 @@ func _ABitOfEverythingService_NoBindings_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/NoBindings", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, req.(*duration.Duration)) @@ -1580,7 +1581,7 @@ func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/Timeout", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).Timeout(ctx, req.(*empty.Empty)) @@ -1598,7 +1599,7 @@ func _ABitOfEverythingService_ErrorWithDetails_Handler(srv interface{}, ctx cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/ErrorWithDetails", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/ErrorWithDetails", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).ErrorWithDetails(ctx, req.(*empty.Empty)) @@ -1616,7 +1617,7 @@ func _ABitOfEverythingService_GetMessageWithBody_Handler(srv interface{}, ctx co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetMessageWithBody", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/GetMessageWithBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).GetMessageWithBody(ctx, req.(*MessageWithBody)) @@ -1634,7 +1635,7 @@ func _ABitOfEverythingService_PostWithEmptyBody_Handler(srv interface{}, ctx con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/PostWithEmptyBody", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/PostWithEmptyBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).PostWithEmptyBody(ctx, req.(*Body)) @@ -1652,7 +1653,7 @@ func _ABitOfEverythingService_CheckGetQueryParams_Handler(srv interface{}, ctx c } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckGetQueryParams", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/CheckGetQueryParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CheckGetQueryParams(ctx, req.(*ABitOfEverything)) @@ -1670,7 +1671,7 @@ func _ABitOfEverythingService_CheckNestedEnumGetQueryParams_Handler(srv interfac } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckNestedEnumGetQueryParams", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/CheckNestedEnumGetQueryParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CheckNestedEnumGetQueryParams(ctx, req.(*ABitOfEverything)) @@ -1688,7 +1689,7 @@ func _ABitOfEverythingService_CheckPostQueryParams_Handler(srv interface{}, ctx } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CheckPostQueryParams", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/CheckPostQueryParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).CheckPostQueryParams(ctx, req.(*ABitOfEverything)) @@ -1706,7 +1707,7 @@ func _ABitOfEverythingService_OverwriteResponseContentType_Handler(srv interface } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/OverwriteResponseContentType", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ABitOfEverythingService/OverwriteResponseContentType", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ABitOfEverythingServiceServer).OverwriteResponseContentType(ctx, req.(*empty.Empty)) @@ -1715,7 +1716,7 @@ func _ABitOfEverythingService_OverwriteResponseContentType_Handler(srv interface } var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.ABitOfEverythingService", + ServiceName: "grpc.gateway.examples.internal.examplepb.ABitOfEverythingService", HandlerType: (*ABitOfEverythingServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -1796,7 +1797,7 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "examples/proto/examplepb/a_bit_of_everything.proto", + Metadata: "examples/internal/proto/examplepb/a_bit_of_everything.proto", } // CamelCaseServiceNameClient is the client API for CamelCaseServiceName service. @@ -1816,7 +1817,7 @@ func NewCamelCaseServiceNameClient(cc *grpc.ClientConn) CamelCaseServiceNameClie func (c *camelCaseServiceNameClient) Empty(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.camelCaseServiceName/Empty", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.camelCaseServiceName/Empty", in, out, opts...) if err != nil { return nil, err } @@ -1850,7 +1851,7 @@ func _CamelCaseServiceName_Empty_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.camelCaseServiceName/Empty", + FullMethod: "/grpc.gateway.examples.internal.examplepb.camelCaseServiceName/Empty", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CamelCaseServiceNameServer).Empty(ctx, req.(*empty.Empty)) @@ -1859,7 +1860,7 @@ func _CamelCaseServiceName_Empty_Handler(srv interface{}, ctx context.Context, d } var _CamelCaseServiceName_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.camelCaseServiceName", + ServiceName: "grpc.gateway.examples.internal.examplepb.camelCaseServiceName", HandlerType: (*CamelCaseServiceNameServer)(nil), Methods: []grpc.MethodDesc{ { @@ -1868,7 +1869,7 @@ var _CamelCaseServiceName_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "examples/proto/examplepb/a_bit_of_everything.proto", + Metadata: "examples/internal/proto/examplepb/a_bit_of_everything.proto", } // AnotherServiceWithNoBindingsClient is the client API for AnotherServiceWithNoBindings service. @@ -1888,7 +1889,7 @@ func NewAnotherServiceWithNoBindingsClient(cc *grpc.ClientConn) AnotherServiceWi func (c *anotherServiceWithNoBindingsClient) NoBindings(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, opts...) if err != nil { return nil, err } @@ -1922,7 +1923,7 @@ func _AnotherServiceWithNoBindings_NoBindings_Handler(srv interface{}, ctx conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", + FullMethod: "/grpc.gateway.examples.internal.examplepb.AnotherServiceWithNoBindings/NoBindings", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, req.(*empty.Empty)) @@ -1931,7 +1932,7 @@ func _AnotherServiceWithNoBindings_NoBindings_Handler(srv interface{}, ctx conte } var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings", + ServiceName: "grpc.gateway.examples.internal.examplepb.AnotherServiceWithNoBindings", HandlerType: (*AnotherServiceWithNoBindingsServer)(nil), Methods: []grpc.MethodDesc{ { @@ -1940,5 +1941,5 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "examples/proto/examplepb/a_bit_of_everything.proto", + Metadata: "examples/internal/proto/examplepb/a_bit_of_everything.proto", } diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go b/examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go similarity index 99% rename from examples/proto/examplepb/a_bit_of_everything.pb.gw.go rename to examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go index 2135d7f8a54..cc444791c2a 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: examples/proto/examplepb/a_bit_of_everything.proto +// source: examples/internal/proto/examplepb/a_bit_of_everything.proto /* Package examplepb is a reverse proxy. @@ -16,9 +16,9 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/pathenum" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub2" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" "google.golang.org/grpc" diff --git a/examples/proto/examplepb/a_bit_of_everything.proto b/examples/internal/proto/examplepb/a_bit_of_everything.proto similarity index 97% rename from examples/proto/examplepb/a_bit_of_everything.proto rename to examples/internal/proto/examplepb/a_bit_of_everything.proto index b5e394b2970..e391ffa65e3 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/internal/proto/examplepb/a_bit_of_everything.proto @@ -1,15 +1,15 @@ syntax = "proto3"; option go_package = "examplepb"; -package grpc.gateway.examples.examplepb; +package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/wrappers.proto"; -import "examples/proto/pathenum/path_enum.proto"; -import "examples/proto/sub/message.proto"; -import "examples/proto/sub2/message.proto"; +import "examples/internal/proto/pathenum/path_enum.proto"; +import "examples/internal/proto/sub/message.proto"; +import "examples/internal/proto/sub2/message.proto"; import "google/protobuf/timestamp.proto"; import "protoc-gen-swagger/options/annotations.proto"; @@ -155,7 +155,7 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { description: "I'm a teapot."; schema: { json_schema: { - ref: ".grpc.gateway.examples.examplepb.NumericEnum"; + ref: ".grpc.gateway.examples.internal.examplepb.NumericEnum"; } } } @@ -428,7 +428,7 @@ service ABitOfEverythingService { // This makes it useful when validating that the OpenAPI v2 API // description exposes documentation correctly on all paths // defined as additional_bindings in the proto. - rpc Echo(grpc.gateway.examples.sub.StringMessage) returns (grpc.gateway.examples.sub.StringMessage) { + rpc Echo(grpc.gateway.examples.internal.sub.StringMessage) returns (grpc.gateway.examples.internal.sub.StringMessage) { option (google.api.http) = { get: "/v1/example/a_bit_of_everything/echo/{value}" additional_bindings { diff --git a/examples/proto/examplepb/a_bit_of_everything.swagger.json b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json similarity index 100% rename from examples/proto/examplepb/a_bit_of_everything.swagger.json rename to examples/internal/proto/examplepb/a_bit_of_everything.swagger.json diff --git a/examples/proto/examplepb/echo_service.pb.go b/examples/internal/proto/examplepb/echo_service.pb.go similarity index 74% rename from examples/proto/examplepb/echo_service.pb.go rename to examples/internal/proto/examplepb/echo_service.pb.go index b9f5743303b..3ca940dce39 100644 --- a/examples/proto/examplepb/echo_service.pb.go +++ b/examples/internal/proto/examplepb/echo_service.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/examplepb/echo_service.proto +// source: examples/internal/proto/examplepb/echo_service.proto // Echo Service // @@ -45,7 +45,7 @@ func (m *Embedded) Reset() { *m = Embedded{} } func (m *Embedded) String() string { return proto.CompactTextString(m) } func (*Embedded) ProtoMessage() {} func (*Embedded) Descriptor() ([]byte, []int) { - return fileDescriptor_01041da8d77029c8, []int{0} + return fileDescriptor_2919b738e91bb561, []int{0} } func (m *Embedded) XXX_Unmarshal(b []byte) error { @@ -134,7 +134,7 @@ func (m *SimpleMessage) Reset() { *m = SimpleMessage{} } func (m *SimpleMessage) String() string { return proto.CompactTextString(m) } func (*SimpleMessage) ProtoMessage() {} func (*SimpleMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_01041da8d77029c8, []int{1} + return fileDescriptor_2919b738e91bb561, []int{1} } func (m *SimpleMessage) XXX_Unmarshal(b []byte) error { @@ -261,46 +261,46 @@ func (*SimpleMessage) XXX_OneofWrappers() []interface{} { } func init() { - proto.RegisterType((*Embedded)(nil), "grpc.gateway.examples.examplepb.Embedded") - proto.RegisterType((*SimpleMessage)(nil), "grpc.gateway.examples.examplepb.SimpleMessage") + proto.RegisterType((*Embedded)(nil), "grpc.gateway.examples.internal.examplepb.Embedded") + proto.RegisterType((*SimpleMessage)(nil), "grpc.gateway.examples.internal.examplepb.SimpleMessage") } func init() { - proto.RegisterFile("examples/proto/examplepb/echo_service.proto", fileDescriptor_01041da8d77029c8) -} - -var fileDescriptor_01041da8d77029c8 = []byte{ - // 470 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0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86, 0x32, 0xab, 0x8d, 0xfd, 0xcb, 0xc9, 0x90, 0xb2, 0xff, 0xbb, 0x86, 0xeb, 0xb6, 0x66, - 0x95, 0x4b, 0x56, 0xaf, 0x9c, 0x0e, 0xcd, 0x81, 0x5c, 0xcb, 0x3b, 0x62, 0xb5, 0x54, 0xab, 0x32, - 0xfd, 0x42, 0xa0, 0x6d, 0x0c, 0x1a, 0x2b, 0xb1, 0xd8, 0xba, 0x49, 0x7d, 0xeb, 0x51, 0xef, 0xaa, - 0x45, 0xd3, 0x99, 0x12, 0x8b, 0x97, 0xe4, 0x98, 0x7e, 0x25, 0x00, 0x46, 0xce, 0x1b, 0xcc, 0x50, - 0xe3, 0xd6, 0x05, 0x1d, 0x59, 0x41, 0x8f, 0x8f, 0x1f, 0x5d, 0x11, 0x24, 0xac, 0x80, 0x71, 0x77, - 0xd2, 0xd9, 0x60, 0x67, 0x2d, 0xfb, 0xcf, 0xbe, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xe9, 0xdb, - 0x6f, 0x39, 0x21, 0x04, 0x00, 0x00, + proto.RegisterFile("examples/internal/proto/examplepb/echo_service.proto", fileDescriptor_2919b738e91bb561) +} + +var fileDescriptor_2919b738e91bb561 = []byte{ + // 480 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x53, 0xcf, 0x6a, 0x13, 0x41, + 0x18, 0xef, 0xec, 0xa6, 0x69, 0xf2, 0x05, 0xa5, 0x0c, 0x8a, 0x6b, 0x5a, 0x31, 0x2c, 0x1e, 0x42, + 0x0f, 0x3b, 0x24, 0x0a, 0x82, 0xc7, 0xd0, 0x4a, 0x11, 0xf4, 0xb0, 0xbd, 0xe5, 0x12, 0x26, 0x3b, + 0x1f, 0xdb, 0xc5, 0xdd, 0x99, 0x65, 0x67, 0x52, 0x1b, 0x96, 0x5c, 0xf4, 0x11, 0x3c, 0x78, 0xd3, + 0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0x7c, 0x45, + 0x8e, 0xe8, 0x37, 0x02, 0x60, 0x05, 0x1e, 0x63, 0x8e, 0x06, 0xef, 0x40, 0xe2, 0x53, 0x27, 0xf1, + 0xf1, 0xd1, 0xa3, 0x2b, 0x12, 0x85, 0x93, 0x34, 0xe9, 0x4d, 0xbb, 0xdb, 0xd9, 0x79, 0xdb, 0xbd, + 0xfd, 0xe7, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x28, 0x11, 0xad, 0x90, 0x7b, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -336,7 +336,7 @@ func NewEchoServiceClient(cc *grpc.ClientConn) EchoServiceClient { func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/Echo", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.EchoService/Echo", in, out, opts...) if err != nil { return nil, err } @@ -345,7 +345,7 @@ func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts .. func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoBody", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.EchoService/EchoBody", in, out, opts...) if err != nil { return nil, err } @@ -354,7 +354,7 @@ func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opt func (c *echoServiceClient) EchoDelete(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { out := new(SimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoDelete", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.EchoService/EchoDelete", in, out, opts...) if err != nil { return nil, err } @@ -402,7 +402,7 @@ func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.EchoService/Echo", + FullMethod: "/grpc.gateway.examples.internal.examplepb.EchoService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EchoServiceServer).Echo(ctx, req.(*SimpleMessage)) @@ -420,7 +420,7 @@ func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.EchoService/EchoBody", + FullMethod: "/grpc.gateway.examples.internal.examplepb.EchoService/EchoBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EchoServiceServer).EchoBody(ctx, req.(*SimpleMessage)) @@ -438,7 +438,7 @@ func _EchoService_EchoDelete_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.EchoService/EchoDelete", + FullMethod: "/grpc.gateway.examples.internal.examplepb.EchoService/EchoDelete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EchoServiceServer).EchoDelete(ctx, req.(*SimpleMessage)) @@ -447,7 +447,7 @@ func _EchoService_EchoDelete_Handler(srv interface{}, ctx context.Context, dec f } var _EchoService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.EchoService", + ServiceName: "grpc.gateway.examples.internal.examplepb.EchoService", HandlerType: (*EchoServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -464,5 +464,5 @@ var _EchoService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "examples/proto/examplepb/echo_service.proto", + Metadata: "examples/internal/proto/examplepb/echo_service.proto", } diff --git a/examples/proto/examplepb/echo_service.pb.gw.go b/examples/internal/proto/examplepb/echo_service.pb.gw.go similarity index 99% rename from examples/proto/examplepb/echo_service.pb.gw.go rename to examples/internal/proto/examplepb/echo_service.pb.gw.go index 001f9661119..eed383c2df6 100644 --- a/examples/proto/examplepb/echo_service.pb.gw.go +++ b/examples/internal/proto/examplepb/echo_service.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: examples/proto/examplepb/echo_service.proto +// source: examples/internal/proto/examplepb/echo_service.proto /* Package examplepb is a reverse proxy. diff --git a/examples/proto/examplepb/echo_service.proto b/examples/internal/proto/examplepb/echo_service.proto similarity index 97% rename from examples/proto/examplepb/echo_service.proto rename to examples/internal/proto/examplepb/echo_service.proto index 710d0576e45..29eceaa3e6d 100644 --- a/examples/proto/examplepb/echo_service.proto +++ b/examples/internal/proto/examplepb/echo_service.proto @@ -5,7 +5,7 @@ option go_package = "examplepb"; // // Echo Service API consists of a single service which returns // a message. -package grpc.gateway.examples.examplepb; +package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; diff --git a/examples/proto/examplepb/echo_service.swagger.json b/examples/internal/proto/examplepb/echo_service.swagger.json similarity index 100% rename from examples/proto/examplepb/echo_service.swagger.json rename to examples/internal/proto/examplepb/echo_service.swagger.json diff --git a/examples/proto/examplepb/flow_combination.pb.go b/examples/internal/proto/examplepb/flow_combination.pb.go similarity index 80% rename from examples/proto/examplepb/flow_combination.pb.go rename to examples/internal/proto/examplepb/flow_combination.pb.go index fb214da5738..baaf20c2376 100644 --- a/examples/proto/examplepb/flow_combination.pb.go +++ b/examples/internal/proto/examplepb/flow_combination.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/examplepb/flow_combination.proto +// source: examples/internal/proto/examplepb/flow_combination.proto package examplepb @@ -35,7 +35,7 @@ func (m *EmptyProto) Reset() { *m = EmptyProto{} } func (m *EmptyProto) String() string { return proto.CompactTextString(m) } func (*EmptyProto) ProtoMessage() {} func (*EmptyProto) Descriptor() ([]byte, []int) { - return fileDescriptor_53e866bab3f236bf, []int{0} + return fileDescriptor_005d0d82a8c98d3c, []int{0} } func (m *EmptyProto) XXX_Unmarshal(b []byte) error { @@ -69,7 +69,7 @@ func (m *NonEmptyProto) Reset() { *m = NonEmptyProto{} } func (m *NonEmptyProto) String() string { return proto.CompactTextString(m) } func (*NonEmptyProto) ProtoMessage() {} func (*NonEmptyProto) Descriptor() ([]byte, []int) { - return fileDescriptor_53e866bab3f236bf, []int{1} + return fileDescriptor_005d0d82a8c98d3c, []int{1} } func (m *NonEmptyProto) XXX_Unmarshal(b []byte) error { @@ -122,7 +122,7 @@ func (m *UnaryProto) Reset() { *m = UnaryProto{} } func (m *UnaryProto) String() string { return proto.CompactTextString(m) } func (*UnaryProto) ProtoMessage() {} func (*UnaryProto) Descriptor() ([]byte, []int) { - return fileDescriptor_53e866bab3f236bf, []int{2} + return fileDescriptor_005d0d82a8c98d3c, []int{2} } func (m *UnaryProto) XXX_Unmarshal(b []byte) error { @@ -163,7 +163,7 @@ func (m *NestedProto) Reset() { *m = NestedProto{} } func (m *NestedProto) String() string { return proto.CompactTextString(m) } func (*NestedProto) ProtoMessage() {} func (*NestedProto) Descriptor() ([]byte, []int) { - return fileDescriptor_53e866bab3f236bf, []int{3} + return fileDescriptor_005d0d82a8c98d3c, []int{3} } func (m *NestedProto) XXX_Unmarshal(b []byte) error { @@ -216,7 +216,7 @@ func (m *SingleNestedProto) Reset() { *m = SingleNestedProto{} } func (m *SingleNestedProto) String() string { return proto.CompactTextString(m) } func (*SingleNestedProto) ProtoMessage() {} func (*SingleNestedProto) Descriptor() ([]byte, []int) { - return fileDescriptor_53e866bab3f236bf, []int{4} + return fileDescriptor_005d0d82a8c98d3c, []int{4} } func (m *SingleNestedProto) XXX_Unmarshal(b []byte) error { @@ -245,60 +245,62 @@ func (m *SingleNestedProto) GetA() *UnaryProto { } func init() { - proto.RegisterType((*EmptyProto)(nil), "grpc.gateway.examples.examplepb.EmptyProto") - proto.RegisterType((*NonEmptyProto)(nil), "grpc.gateway.examples.examplepb.NonEmptyProto") - proto.RegisterType((*UnaryProto)(nil), "grpc.gateway.examples.examplepb.UnaryProto") - proto.RegisterType((*NestedProto)(nil), "grpc.gateway.examples.examplepb.NestedProto") - proto.RegisterType((*SingleNestedProto)(nil), "grpc.gateway.examples.examplepb.SingleNestedProto") + proto.RegisterType((*EmptyProto)(nil), "grpc.gateway.examples.internal.examplepb.EmptyProto") + proto.RegisterType((*NonEmptyProto)(nil), "grpc.gateway.examples.internal.examplepb.NonEmptyProto") + proto.RegisterType((*UnaryProto)(nil), "grpc.gateway.examples.internal.examplepb.UnaryProto") + proto.RegisterType((*NestedProto)(nil), "grpc.gateway.examples.internal.examplepb.NestedProto") + proto.RegisterType((*SingleNestedProto)(nil), "grpc.gateway.examples.internal.examplepb.SingleNestedProto") } func init() { - proto.RegisterFile("examples/proto/examplepb/flow_combination.proto", fileDescriptor_53e866bab3f236bf) -} - -var fileDescriptor_53e866bab3f236bf = []byte{ - // 655 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0xbf, 0x8f, 0x12, 0x41, - 0x14, 0xc7, 0xf3, 0xb8, 0xc4, 0xe4, 0x86, 0xfb, 0xc1, 0x2d, 0x06, 0x81, 0xc3, 0xe3, 0x6e, 0xbc, - 0x44, 0xe2, 0x8f, 0x5d, 0x82, 0xd5, 0x51, 0x9e, 0xd1, 0x92, 0x5c, 0xb8, 0xd8, 0x6c, 0x63, 0x66, - 0x87, 0x15, 0x48, 0x60, 0x67, 0x6e, 0x77, 0x0d, 0x5e, 0x08, 0x31, 0xb1, 0xb1, 0xb4, 0xf0, 0x0f, - 0xb0, 0xb4, 0xf2, 0x1f, 0xb0, 0xb3, 0xb2, 0x31, 0xb1, 0x30, 0xb1, 0xb3, 0xb3, 0xf3, 0x9f, 0x30, - 0xfb, 0xf6, 0xc7, 0xb0, 0x0a, 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0xa7, 0x79, 0x73, 0x33, 0x41, 0xb2, 0xae, 0xe0, 0x3f, 0xa0, - 0x7b, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x36, 0xcd, 0x7d, 0x1f, 0x73, 0x09, 0x00, 0x00, + proto.RegisterFile("examples/internal/proto/examplepb/flow_combination.proto", fileDescriptor_005d0d82a8c98d3c) +} + +var fileDescriptor_005d0d82a8c98d3c = []byte{ + // 673 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x96, 0x4f, 0x8b, 0x13, 0x3f, + 0x18, 0xc7, 0x49, 0x17, 0x7e, 0xb0, 0xe9, 0xee, 0xfe, 0xda, 0xa9, 0xd4, 0xb6, 0x5b, 0xf7, 0x4f, + 0x5c, 0xb0, 0x08, 0x4e, 0xca, 0xaa, 0xa8, 0xf5, 0x56, 0xd1, 0xe3, 0xb2, 0x74, 0x11, 0x61, 0x2e, + 0x92, 0x49, 0xc7, 0xb6, 0x30, 0x9d, 0x64, 0x67, 0x22, 0x75, 0x29, 0x3d, 0xe8, 0x3b, 0x10, 0x4f, + 0x1e, 0x7d, 0x09, 0x1e, 0xf5, 0x22, 0xbe, 0x02, 0x0f, 0x82, 0xe0, 0xdd, 0xbb, 0xaf, 0x40, 0x90, + 0xc9, 0x64, 0x26, 0x1d, 0x6d, 0x6d, 0xb7, 0x4a, 0x7b, 0x6b, 0x92, 0xe7, 0x79, 0xe6, 0x93, 0xef, + 0xf3, 0x7d, 0x42, 0xe1, 0x6d, 0xe7, 0x19, 0xe9, 0x73, 0xd7, 0x09, 0x70, 0xcf, 0x13, 0x8e, 0xef, + 0x11, 0x17, 0x73, 0x9f, 0x09, 0x86, 0xd5, 0x3e, 0xb7, 0xf1, 0x13, 0x97, 0x0d, 0x1e, 0x53, 0xd6, + 0xb7, 0x7b, 0x1e, 0x11, 0x3d, 0xe6, 0x99, 0x32, 0xc0, 0xa8, 0x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+ 0x52, 0xb1, 0xca, 0x12, 0xab, 0x80, 0xf2, 0x63, 0x58, 0x81, 0xc4, 0xa8, 0x03, 0xc9, 0x16, 0x31, + 0xad, 0x44, 0x32, 0xcd, 0x16, 0x11, 0x69, 0xd5, 0x6a, 0xc0, 0x78, 0x03, 0x60, 0x7e, 0x8c, 0x6d, + 0x05, 0xd2, 0x55, 0x25, 0x5e, 0x11, 0x5d, 0x48, 0xe3, 0x45, 0x8b, 0x1a, 0xa8, 0x03, 0xe3, 0x43, + 0x06, 0xc2, 0x16, 0xa7, 0x4d, 0xd6, 0x96, 0xda, 0xdd, 0x9a, 0xff, 0x33, 0xa9, 0xe9, 0x5e, 0x90, + 0xef, 0x23, 0x90, 0x80, 0xef, 0x01, 0xda, 0x94, 0xcd, 0xb5, 0x59, 0x5b, 0x8a, 0xd7, 0x00, 0x57, + 0xad, 0x6d, 0x54, 0x96, 0x7b, 0x9c, 0x88, 0x2e, 0x1e, 0x92, 0x11, 0x1e, 0xda, 0x23, 0x3c, 0xa4, + 0xa3, 0x70, 0xd3, 0x8a, 0x4d, 0x7a, 0xfa, 0xd4, 0xf1, 0x65, 0x86, 0xb5, 0x8b, 0x2a, 0xba, 0x44, + 0x2a, 0x47, 0xd6, 0xa3, 0x56, 0x09, 0x15, 0x74, 0x40, 0x92, 0x17, 0x9e, 0xec, 0xa3, 0xea, 0x84, + 0xd4, 0x54, 0x48, 0x19, 0x5d, 0x4c, 0xc3, 0x24, 0xa7, 0xc6, 0x5b, 0x00, 0x8b, 0x2d, 0x4e, 0x8f, + 0x89, 0xe8, 0x8e, 0x3f, 0x13, 0xa1, 0x9a, 0x77, 0xe7, 0x17, 0xe5, 0xb7, 0x17, 0x66, 0x41, 0x45, + 0x0f, 0xa4, 0xa0, 0x3b, 0xea, 0x46, 0x21, 0xee, 0x35, 0x4f, 0x16, 0xc5, 0x43, 0x62, 0x06, 0xc2, + 0x97, 0x72, 0x18, 0xdf, 0x01, 0xcc, 0x29, 0x66, 0x4d, 0x7b, 0xf3, 0x1c, 0xbd, 0xff, 0x6b, 0x4e, + 0x4f, 0x72, 0x76, 0xd1, 0xde, 0x54, 0xce, 0xb1, 0xd6, 0xcd, 0xb8, 0x4e, 0xd2, 0xc0, 0x29, 0xe7, + 0x0d, 0x40, 0x8d, 0xaf, 0x19, 0xb8, 0xa9, 0x7c, 0xae, 0xe6, 0x70, 0xc9, 0x56, 0xff, 0x12, 0x59, + 0xfd, 0x13, 0x40, 0x39, 0x6d, 0xb6, 0x68, 0x10, 0x43, 0xb7, 0x8f, 0x5f, 0x31, 0xe5, 0xf6, 0x28, + 0xc4, 0x8a, 0x9f, 0xbf, 0xc8, 0x77, 0x6a, 0x13, 0xa1, 0x4b, 0x53, 0x3c, 0x1f, 0x17, 0xa6, 0xd6, + 0x36, 0x2a, 0xfe, 0x6a, 0x7b, 0x7d, 0x78, 0x80, 0x76, 0xa7, 0x3a, 0x5f, 0x47, 0x55, 0xd5, 0x68, + 0x4d, 0x0c, 0xa8, 0x03, 0xe3, 0x1d, 0x80, 0xe5, 0x09, 0x13, 0xa0, 0x74, 0x5e, 0xc1, 0x10, 0x5c, + 0x91, 0x52, 0xef, 0xab, 0xcb, 0x4d, 0x72, 0x45, 0xc2, 0xfe, 0x03, 0xc0, 0x42, 0x6a, 0x12, 0x14, + 0xf5, 0x52, 0x87, 0x61, 0x20, 0x79, 0x4f, 0xd1, 0xe5, 0x3f, 0x0e, 0x83, 0x6e, 0xc8, 0xec, 0x9b, + 0x25, 0x9d, 0x9d, 0x1e, 0xd2, 0x00, 0xb4, 0x0e, 0x9a, 0x59, 0x6b, 0x3d, 0x41, 0xb2, 0xff, 0x93, + 0x7f, 0xe4, 0xae, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x96, 0x5c, 0xd1, 0x4c, 0x0a, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -335,7 +337,7 @@ func NewFlowCombinationClient(cc *grpc.ClientConn) FlowCombinationClient { func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcEmptyRpc", in, out, opts...) if err != nil { return nil, err } @@ -343,7 +345,7 @@ func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, } func (c *flowCombinationClient) RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[0], "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyStream", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[0], "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcEmptyStream", opts...) if err != nil { return nil, err } @@ -375,7 +377,7 @@ func (x *flowCombinationRpcEmptyStreamClient) Recv() (*EmptyProto, error) { } func (c *flowCombinationClient) StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[1], "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyRpc", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[1], "/grpc.gateway.examples.internal.examplepb.FlowCombination/StreamEmptyRpc", opts...) if err != nil { return nil, err } @@ -409,7 +411,7 @@ func (x *flowCombinationStreamEmptyRpcClient) CloseAndRecv() (*EmptyProto, error } func (c *flowCombinationClient) StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[2], "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyStream", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[2], "/grpc.gateway.examples.internal.examplepb.FlowCombination/StreamEmptyStream", opts...) if err != nil { return nil, err } @@ -441,7 +443,7 @@ func (x *flowCombinationStreamEmptyStreamClient) Recv() (*EmptyProto, error) { func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcBodyRpc", in, out, opts...) if err != nil { return nil, err } @@ -450,7 +452,7 @@ func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProt func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, opts...) if err != nil { return nil, err } @@ -459,7 +461,7 @@ func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in * func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { out := new(EmptyProto) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcPathNestedRpc", in, out, opts...) if err != nil { return nil, err } @@ -467,7 +469,7 @@ func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *Nested } func (c *flowCombinationClient) RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[3], "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyStream", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[3], "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcBodyStream", opts...) if err != nil { return nil, err } @@ -499,7 +501,7 @@ func (x *flowCombinationRpcBodyStreamClient) Recv() (*EmptyProto, error) { } func (c *flowCombinationClient) RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[4], "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[4], "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...) if err != nil { return nil, err } @@ -531,7 +533,7 @@ func (x *flowCombinationRpcPathSingleNestedStreamClient) Recv() (*EmptyProto, er } func (c *flowCombinationClient) RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[5], "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedStream", opts...) + stream, err := c.cc.NewStream(ctx, &_FlowCombination_serviceDesc.Streams[5], "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcPathNestedStream", opts...) if err != nil { return nil, err } @@ -625,7 +627,7 @@ func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", + FullMethod: "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcEmptyRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, req.(*EmptyProto)) @@ -716,7 +718,7 @@ func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", + FullMethod: "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcBodyRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcBodyRpc(ctx, req.(*NonEmptyProto)) @@ -734,7 +736,7 @@ func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", + FullMethod: "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcPathSingleNestedRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, req.(*SingleNestedProto)) @@ -752,7 +754,7 @@ func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", + FullMethod: "/grpc.gateway.examples.internal.examplepb.FlowCombination/RpcPathNestedRpc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, req.(*NestedProto)) @@ -824,7 +826,7 @@ func (x *flowCombinationRpcPathNestedStreamServer) Send(m *EmptyProto) error { } var _FlowCombination_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.FlowCombination", + ServiceName: "grpc.gateway.examples.internal.examplepb.FlowCombination", HandlerType: (*FlowCombinationServer)(nil), Methods: []grpc.MethodDesc{ { @@ -877,5 +879,5 @@ var _FlowCombination_serviceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "examples/proto/examplepb/flow_combination.proto", + Metadata: "examples/internal/proto/examplepb/flow_combination.proto", } diff --git a/examples/proto/examplepb/flow_combination.pb.gw.go b/examples/internal/proto/examplepb/flow_combination.pb.gw.go similarity index 99% rename from examples/proto/examplepb/flow_combination.pb.gw.go rename to examples/internal/proto/examplepb/flow_combination.pb.gw.go index 14599e7a759..ffad64a1eed 100644 --- a/examples/proto/examplepb/flow_combination.pb.gw.go +++ b/examples/internal/proto/examplepb/flow_combination.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: examples/proto/examplepb/flow_combination.proto +// source: examples/internal/proto/examplepb/flow_combination.proto /* Package examplepb is a reverse proxy. diff --git a/examples/proto/examplepb/flow_combination.proto b/examples/internal/proto/examplepb/flow_combination.proto similarity index 98% rename from examples/proto/examplepb/flow_combination.proto rename to examples/internal/proto/examplepb/flow_combination.proto index 60096081ee1..aabde901153 100644 --- a/examples/proto/examplepb/flow_combination.proto +++ b/examples/internal/proto/examplepb/flow_combination.proto @@ -1,6 +1,6 @@ syntax = "proto3"; option go_package = "examplepb"; -package grpc.gateway.examples.examplepb; +package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; diff --git a/examples/proto/examplepb/generated_input.proto b/examples/internal/proto/examplepb/generated_input.proto similarity index 75% rename from examples/proto/examplepb/generated_input.proto rename to examples/internal/proto/examplepb/generated_input.proto index 8a1b7af3498..e0e26d90c0a 100644 --- a/examples/proto/examplepb/generated_input.proto +++ b/examples/internal/proto/examplepb/generated_input.proto @@ -1,11 +1,10 @@ syntax = "proto3"; option go_package = "examplepb"; -package grpc.gateway.examples.examplepb; +package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; -import "examples/proto/examplepb/a_bit_of_everything.proto"; -import "examples/proto/sub/message.proto"; +import "examples/internal/proto/examplepb/a_bit_of_everything.proto"; // This file is run through a genrule. diff --git a/examples/proto/examplepb/non_standard_names.pb.go b/examples/internal/proto/examplepb/non_standard_names.pb.go similarity index 80% rename from examples/proto/examplepb/non_standard_names.pb.go rename to examples/internal/proto/examplepb/non_standard_names.pb.go index 2858e1e82d1..962da2cdfe3 100644 --- a/examples/proto/examplepb/non_standard_names.pb.go +++ b/examples/internal/proto/examplepb/non_standard_names.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/examplepb/non_standard_names.proto +// source: examples/internal/proto/examplepb/non_standard_names.proto package examplepb @@ -46,7 +46,7 @@ func (m *NonStandardMessage) Reset() { *m = NonStandardMessage{} } func (m *NonStandardMessage) String() string { return proto.CompactTextString(m) } func (*NonStandardMessage) ProtoMessage() {} func (*NonStandardMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_fa36ad8828f19375, []int{0} + return fileDescriptor_a1fc3d96d9306f6b, []int{0} } func (m *NonStandardMessage) XXX_Unmarshal(b []byte) error { @@ -134,7 +134,7 @@ func (m *NonStandardMessage_Thing) Reset() { *m = NonStandardMessage_Thi func (m *NonStandardMessage_Thing) String() string { return proto.CompactTextString(m) } func (*NonStandardMessage_Thing) ProtoMessage() {} func (*NonStandardMessage_Thing) Descriptor() ([]byte, []int) { - return fileDescriptor_fa36ad8828f19375, []int{0, 0} + return fileDescriptor_a1fc3d96d9306f6b, []int{0, 0} } func (m *NonStandardMessage_Thing) XXX_Unmarshal(b []byte) error { @@ -173,7 +173,7 @@ func (m *NonStandardMessage_Thing_SubThing) Reset() { *m = NonStandardMe func (m *NonStandardMessage_Thing_SubThing) String() string { return proto.CompactTextString(m) } func (*NonStandardMessage_Thing_SubThing) ProtoMessage() {} func (*NonStandardMessage_Thing_SubThing) Descriptor() ([]byte, []int) { - return fileDescriptor_fa36ad8828f19375, []int{0, 0, 0} + return fileDescriptor_a1fc3d96d9306f6b, []int{0, 0, 0} } func (m *NonStandardMessage_Thing_SubThing) XXX_Unmarshal(b []byte) error { @@ -213,7 +213,7 @@ func (m *NonStandardUpdateRequest) Reset() { *m = NonStandardUpdateReque func (m *NonStandardUpdateRequest) String() string { return proto.CompactTextString(m) } func (*NonStandardUpdateRequest) ProtoMessage() {} func (*NonStandardUpdateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_fa36ad8828f19375, []int{1} + return fileDescriptor_a1fc3d96d9306f6b, []int{1} } func (m *NonStandardUpdateRequest) XXX_Unmarshal(b []byte) error { @@ -268,7 +268,7 @@ func (m *NonStandardMessageWithJSONNames) Reset() { *m = NonStandardMess func (m *NonStandardMessageWithJSONNames) String() string { return proto.CompactTextString(m) } func (*NonStandardMessageWithJSONNames) ProtoMessage() {} func (*NonStandardMessageWithJSONNames) Descriptor() ([]byte, []int) { - return fileDescriptor_fa36ad8828f19375, []int{2} + return fileDescriptor_a1fc3d96d9306f6b, []int{2} } func (m *NonStandardMessageWithJSONNames) XXX_Unmarshal(b []byte) error { @@ -356,7 +356,7 @@ func (m *NonStandardMessageWithJSONNames_Thing) Reset() { *m = NonStanda func (m *NonStandardMessageWithJSONNames_Thing) String() string { return proto.CompactTextString(m) } func (*NonStandardMessageWithJSONNames_Thing) ProtoMessage() {} func (*NonStandardMessageWithJSONNames_Thing) Descriptor() ([]byte, []int) { - return fileDescriptor_fa36ad8828f19375, []int{2, 0} + return fileDescriptor_a1fc3d96d9306f6b, []int{2, 0} } func (m *NonStandardMessageWithJSONNames_Thing) XXX_Unmarshal(b []byte) error { @@ -399,7 +399,7 @@ func (m *NonStandardMessageWithJSONNames_Thing_SubThing) String() string { } func (*NonStandardMessageWithJSONNames_Thing_SubThing) ProtoMessage() {} func (*NonStandardMessageWithJSONNames_Thing_SubThing) Descriptor() ([]byte, []int) { - return fileDescriptor_fa36ad8828f19375, []int{2, 0, 0} + return fileDescriptor_a1fc3d96d9306f6b, []int{2, 0, 0} } func (m *NonStandardMessageWithJSONNames_Thing_SubThing) XXX_Unmarshal(b []byte) error { @@ -439,7 +439,7 @@ func (m *NonStandardWithJSONNamesUpdateRequest) Reset() { *m = NonStanda func (m *NonStandardWithJSONNamesUpdateRequest) String() string { return proto.CompactTextString(m) } func (*NonStandardWithJSONNamesUpdateRequest) ProtoMessage() {} func (*NonStandardWithJSONNamesUpdateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_fa36ad8828f19375, []int{3} + return fileDescriptor_a1fc3d96d9306f6b, []int{3} } func (m *NonStandardWithJSONNamesUpdateRequest) XXX_Unmarshal(b []byte) error { @@ -475,62 +475,62 @@ func (m *NonStandardWithJSONNamesUpdateRequest) GetUpdateMask() *field_mask.Fiel } func init() { - proto.RegisterType((*NonStandardMessage)(nil), "grpc.gateway.examples.examplepb.NonStandardMessage") - proto.RegisterType((*NonStandardMessage_Thing)(nil), "grpc.gateway.examples.examplepb.NonStandardMessage.Thing") - proto.RegisterType((*NonStandardMessage_Thing_SubThing)(nil), "grpc.gateway.examples.examplepb.NonStandardMessage.Thing.SubThing") - proto.RegisterType((*NonStandardUpdateRequest)(nil), "grpc.gateway.examples.examplepb.NonStandardUpdateRequest") - proto.RegisterType((*NonStandardMessageWithJSONNames)(nil), "grpc.gateway.examples.examplepb.NonStandardMessageWithJSONNames") - proto.RegisterType((*NonStandardMessageWithJSONNames_Thing)(nil), "grpc.gateway.examples.examplepb.NonStandardMessageWithJSONNames.Thing") - proto.RegisterType((*NonStandardMessageWithJSONNames_Thing_SubThing)(nil), "grpc.gateway.examples.examplepb.NonStandardMessageWithJSONNames.Thing.SubThing") - proto.RegisterType((*NonStandardWithJSONNamesUpdateRequest)(nil), "grpc.gateway.examples.examplepb.NonStandardWithJSONNamesUpdateRequest") + proto.RegisterType((*NonStandardMessage)(nil), "grpc.gateway.examples.internal.examplepb.NonStandardMessage") + proto.RegisterType((*NonStandardMessage_Thing)(nil), "grpc.gateway.examples.internal.examplepb.NonStandardMessage.Thing") + proto.RegisterType((*NonStandardMessage_Thing_SubThing)(nil), "grpc.gateway.examples.internal.examplepb.NonStandardMessage.Thing.SubThing") + proto.RegisterType((*NonStandardUpdateRequest)(nil), "grpc.gateway.examples.internal.examplepb.NonStandardUpdateRequest") + proto.RegisterType((*NonStandardMessageWithJSONNames)(nil), "grpc.gateway.examples.internal.examplepb.NonStandardMessageWithJSONNames") + proto.RegisterType((*NonStandardMessageWithJSONNames_Thing)(nil), "grpc.gateway.examples.internal.examplepb.NonStandardMessageWithJSONNames.Thing") + proto.RegisterType((*NonStandardMessageWithJSONNames_Thing_SubThing)(nil), "grpc.gateway.examples.internal.examplepb.NonStandardMessageWithJSONNames.Thing.SubThing") + proto.RegisterType((*NonStandardWithJSONNamesUpdateRequest)(nil), "grpc.gateway.examples.internal.examplepb.NonStandardWithJSONNamesUpdateRequest") } func init() { - proto.RegisterFile("examples/proto/examplepb/non_standard_names.proto", fileDescriptor_fa36ad8828f19375) -} - -var fileDescriptor_fa36ad8828f19375 = []byte{ - // 626 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x41, 0x6f, 0xd3, 0x3c, - 0x18, 0xc7, 0x95, 0x66, 0xed, 0x5a, 0x57, 0x7a, 0x5f, 0xe4, 0x21, 0x14, 0xc2, 0xa4, 0x56, 0x95, - 0xd0, 0x7a, 0x21, 0xd1, 0xb2, 0x03, 0x02, 0x84, 0x04, 0x15, 0xac, 0x1a, 0x62, 0xad, 0x94, 0x74, - 0x20, 0x21, 0x41, 0xe4, 0x2c, 0x5e, 0x1a, 0x9a, 0xda, 0xa1, 0x76, 0x3a, 0x7a, 0xe5, 0x13, 0x4c, - 0xe2, 0x0e, 0xdc, 0xf8, 0x0e, 0xf0, 0x31, 0xb8, 0x73, 0xe2, 0x83, 0xa0, 0xd8, 0x69, 0xa9, 0x55, - 0xa1, 0xb1, 0x6e, 0xa7, 0xfa, 0x79, 0x6c, 0xff, 0x9f, 0xe7, 0x6f, 0xff, 0xe2, 0x82, 0x5d, 0xfc, - 0x1e, 0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x88, - 0x8a, 0xd5, 0x82, 0xa8, 0x8a, 0xf8, 0x99, 0x99, 0x9f, 0x16, 0x48, 0x8d, 0x56, 0x90, 0xea, 0x5f, - 0x4d, 0xad, 0x25, 0xbe, 0xe6, 0x23, 0xb3, 0xbd, 0xc4, 0xd7, 0xf6, 0x2a, 0x5f, 0x22, 0x21, 0x01, - 0xfb, 0xa6, 0x81, 0xdb, 0x4b, 0x65, 0x14, 0x7d, 0x95, 0xb6, 0x81, 0x42, 0xdb, 0xa3, 0xcb, 0x36, - 0x7f, 0x05, 0xe8, 0x39, 0x9f, 0xd5, 0x07, 0xcb, 0xc3, 0x93, 0x69, 0x7c, 0x8c, 0xe1, 0x57, 0x0d, - 0x54, 0x64, 0xef, 0xf0, 0x42, 0x8f, 0x82, 0xe2, 0xd7, 0x5c, 0xe7, 0x7b, 0x6a, 0xdd, 0xf9, 0xf0, - 0xe3, 0xd7, 0xc7, 0xd2, 0x8e, 0xd3, 0xb0, 0xa7, 0xbb, 0xf3, 0x37, 0x5d, 0x79, 0xd1, 0x6d, 0xd9, - 0xfe, 0x7d, 0xe9, 0xfe, 0xa7, 0x06, 0xb6, 0x64, 0x55, 0xf5, 0x7b, 0xb9, 0x10, 0x86, 0x7f, 0xbf, - 0x33, 0xf3, 0xd2, 0xb7, 0xd4, 0x7a, 0x28, 0x0c, 0xdd, 0x75, 0xec, 0x73, 0x0c, 0xf9, 0xa7, 0x31, - 0x1f, 0xfa, 0x6f, 0x19, 0x25, 0xf2, 0x3f, 0x4b, 0x1a, 0xec, 0xd4, 0x5f, 0xd5, 0x16, 0xb5, 0x82, - 0x8a, 0xb8, 0xce, 0xbd, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x18, 0x50, 0x51, 0xb2, 0xfc, 0x06, - 0x00, 0x00, + proto.RegisterFile("examples/internal/proto/examplepb/non_standard_names.proto", fileDescriptor_a1fc3d96d9306f6b) +} + +var fileDescriptor_a1fc3d96d9306f6b = []byte{ + // 636 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4f, 0x6f, 0xd3, 0x3e, + 0x18, 0xc7, 0x95, 0x66, 0xed, 0x5a, 0x57, 0xfa, 0xfd, 0x90, 0x87, 0x50, 0x08, 0x93, 0x56, 0x55, + 0x42, 0xeb, 0x05, 0x47, 0x84, 0x03, 0xd2, 0x80, 0x03, 0x15, 0x30, 0x0d, 0x58, 0x87, 0x92, 0x0e, + 0x26, 0x24, 0x14, 0x39, 0x8b, 0x9b, 0x86, 0xa5, 0x76, 0xa8, 0x9d, 0x8e, 0x5e, 0x79, 0x0b, 0x9c, + 0xb8, 0x72, 0x41, 0xbc, 0x04, 0xce, 0x3b, 0x73, 0xe2, 0x2d, 0xf0, 0x02, 0x78, 0x09, 0x28, 0x76, + 0x52, 0x1a, 0x55, 0x88, 0xa9, 0xed, 0x29, 0x7e, 0x1e, 0x5b, 0xdf, 0xe7, 0xdf, 0x27, 0x36, 0xd8, + 0x23, 0xef, 0xf1, 0x28, 0x89, 0x09, 0xb7, 0x22, 0x2a, 0xc8, 0x98, 0xe2, 0xd8, 0x4a, 0xc6, 0x4c, + 0x30, 0x2b, 0xf7, 0x27, 0xbe, 0x45, 0x19, 0xf5, 0xb8, 0xc0, 0x34, 0xc0, 0xe3, 0xc0, 0xa3, 0x78, + 0x44, 0x38, 0x92, 0x47, 0x60, 0x27, 0x1c, 0x27, 0xa7, 0x28, 0xc4, 0x82, 0x9c, 0xe3, 0x29, 0x2a, + 0x84, 0x50, 0x21, 0x84, 0x66, 0x12, 0xe6, 0x76, 0xc8, 0x58, 0x18, 0x13, 0x0b, 0x27, 0x91, 0x85, + 0x29, 0x65, 0x02, 0x8b, 0x88, 0xd1, 0x5c, 0xc7, 0x6c, 0xe5, 0xbb, 0xd2, 0xf2, 0xd3, 0x81, 0x35, + 0x88, 0x48, 0x1c, 0x78, 0x23, 0xcc, 0xcf, 0xd4,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f9, 0xda, 0xb7, 0x3e, 0xfc, 0xf8, 0xf9, 0xb1, 0xb2, 0x6b, 0xef, + 0x58, 0x93, 0xdb, 0xc5, 0x23, 0x51, 0x7a, 0x22, 0x2c, 0x55, 0xd0, 0x9e, 0xea, 0xc7, 0x2f, 0x0d, + 0x6c, 0xa9, 0xf0, 0xe5, 0x9f, 0x6b, 0x39, 0x66, 0xff, 0x3e, 0x57, 0x73, 0x7d, 0x93, 0x6c, 0x3f, + 0x90, 0x25, 0xde, 0xb5, 0xad, 0x7f, 0x94, 0xe8, 0x9d, 0x47, 0x62, 0xe8, 0xbd, 0xe5, 0x8c, 0xaa, + 0x67, 0x51, 0x95, 0xdc, 0x6d, 0xbe, 0x6e, 0xcc, 0x62, 0xf9, 0x35, 0x39, 0xf2, 0x3b, 0xbf, 0x03, + 0x00, 0x00, 0xff, 0xff, 0x0f, 0xef, 0xfa, 0x6c, 0x68, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -561,7 +561,7 @@ func NewNonStandardServiceClient(cc *grpc.ClientConn) NonStandardServiceClient { func (c *nonStandardServiceClient) Update(ctx context.Context, in *NonStandardUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessage, error) { out := new(NonStandardMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.NonStandardService/Update", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.NonStandardService/Update", in, out, opts...) if err != nil { return nil, err } @@ -570,7 +570,7 @@ func (c *nonStandardServiceClient) Update(ctx context.Context, in *NonStandardUp func (c *nonStandardServiceClient) UpdateWithJSONNames(ctx context.Context, in *NonStandardWithJSONNamesUpdateRequest, opts ...grpc.CallOption) (*NonStandardMessageWithJSONNames, error) { out := new(NonStandardMessageWithJSONNames) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.NonStandardService/UpdateWithJSONNames", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.NonStandardService/UpdateWithJSONNames", in, out, opts...) if err != nil { return nil, err } @@ -610,7 +610,7 @@ func _NonStandardService_Update_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.NonStandardService/Update", + FullMethod: "/grpc.gateway.examples.internal.examplepb.NonStandardService/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NonStandardServiceServer).Update(ctx, req.(*NonStandardUpdateRequest)) @@ -628,7 +628,7 @@ func _NonStandardService_UpdateWithJSONNames_Handler(srv interface{}, ctx contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.NonStandardService/UpdateWithJSONNames", + FullMethod: "/grpc.gateway.examples.internal.examplepb.NonStandardService/UpdateWithJSONNames", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NonStandardServiceServer).UpdateWithJSONNames(ctx, req.(*NonStandardWithJSONNamesUpdateRequest)) @@ -637,7 +637,7 @@ func _NonStandardService_UpdateWithJSONNames_Handler(srv interface{}, ctx contex } var _NonStandardService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.NonStandardService", + ServiceName: "grpc.gateway.examples.internal.examplepb.NonStandardService", HandlerType: (*NonStandardServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -650,5 +650,5 @@ var _NonStandardService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "examples/proto/examplepb/non_standard_names.proto", + Metadata: "examples/internal/proto/examplepb/non_standard_names.proto", } diff --git a/examples/proto/examplepb/non_standard_names.pb.gw.go b/examples/internal/proto/examplepb/non_standard_names.pb.gw.go similarity index 99% rename from examples/proto/examplepb/non_standard_names.pb.gw.go rename to examples/internal/proto/examplepb/non_standard_names.pb.gw.go index 11cb0b98adc..d3e79338163 100644 --- a/examples/proto/examplepb/non_standard_names.pb.gw.go +++ b/examples/internal/proto/examplepb/non_standard_names.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: examples/proto/examplepb/non_standard_names.proto +// source: examples/internal/proto/examplepb/non_standard_names.proto /* Package examplepb is a reverse proxy. diff --git a/examples/proto/examplepb/non_standard_names.proto b/examples/internal/proto/examplepb/non_standard_names.proto similarity index 97% rename from examples/proto/examplepb/non_standard_names.proto rename to examples/internal/proto/examplepb/non_standard_names.proto index 0bf130239a4..acb2203e1d5 100644 --- a/examples/proto/examplepb/non_standard_names.proto +++ b/examples/internal/proto/examplepb/non_standard_names.proto @@ -1,6 +1,6 @@ syntax = "proto3"; option go_package = "examplepb"; -package grpc.gateway.examples.examplepb; +package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; import "google/protobuf/field_mask.proto"; diff --git a/examples/proto/examplepb/response_body_service.pb.go b/examples/internal/proto/examplepb/response_body_service.pb.go similarity index 77% rename from examples/proto/examplepb/response_body_service.pb.go rename to examples/internal/proto/examplepb/response_body_service.pb.go index 879091d3e74..9bfa2cb7932 100644 --- a/examples/proto/examplepb/response_body_service.pb.go +++ b/examples/internal/proto/examplepb/response_body_service.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/examplepb/response_body_service.proto +// source: examples/internal/proto/examplepb/response_body_service.proto package examplepb @@ -53,7 +53,7 @@ func (x RepeatedResponseBodyOut_Response_ResponseType) String() string { } func (RepeatedResponseBodyOut_Response_ResponseType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_df4b27f252df323f, []int{2, 0, 0} + return fileDescriptor_272b2870183bbe20, []int{2, 0, 0} } type ResponseBodyIn struct { @@ -67,7 +67,7 @@ func (m *ResponseBodyIn) Reset() { *m = ResponseBodyIn{} } func (m *ResponseBodyIn) String() string { return proto.CompactTextString(m) } func (*ResponseBodyIn) ProtoMessage() {} func (*ResponseBodyIn) Descriptor() ([]byte, []int) { - return fileDescriptor_df4b27f252df323f, []int{0} + return fileDescriptor_272b2870183bbe20, []int{0} } func (m *ResponseBodyIn) XXX_Unmarshal(b []byte) error { @@ -106,7 +106,7 @@ func (m *ResponseBodyOut) Reset() { *m = ResponseBodyOut{} } func (m *ResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut) ProtoMessage() {} func (*ResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_df4b27f252df323f, []int{1} + return fileDescriptor_272b2870183bbe20, []int{1} } func (m *ResponseBodyOut) XXX_Unmarshal(b []byte) error { @@ -145,7 +145,7 @@ func (m *ResponseBodyOut_Response) Reset() { *m = ResponseBodyOut_Respon func (m *ResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*ResponseBodyOut_Response) ProtoMessage() {} func (*ResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_df4b27f252df323f, []int{1, 0} + return fileDescriptor_272b2870183bbe20, []int{1, 0} } func (m *ResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { @@ -184,7 +184,7 @@ func (m *RepeatedResponseBodyOut) Reset() { *m = RepeatedResponseBodyOut func (m *RepeatedResponseBodyOut) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseBodyOut) ProtoMessage() {} func (*RepeatedResponseBodyOut) Descriptor() ([]byte, []int) { - return fileDescriptor_df4b27f252df323f, []int{2} + return fileDescriptor_272b2870183bbe20, []int{2} } func (m *RepeatedResponseBodyOut) XXX_Unmarshal(b []byte) error { @@ -214,7 +214,7 @@ func (m *RepeatedResponseBodyOut) GetResponse() []*RepeatedResponseBodyOut_Respo type RepeatedResponseBodyOut_Response struct { Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - Type RepeatedResponseBodyOut_Response_ResponseType `protobuf:"varint,3,opt,name=type,proto3,enum=grpc.gateway.examples.examplepb.RepeatedResponseBodyOut_Response_ResponseType" json:"type,omitempty"` + Type RepeatedResponseBodyOut_Response_ResponseType `protobuf:"varint,3,opt,name=type,proto3,enum=grpc.gateway.examples.internal.examplepb.RepeatedResponseBodyOut_Response_ResponseType" json:"type,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -224,7 +224,7 @@ func (m *RepeatedResponseBodyOut_Response) Reset() { *m = RepeatedRespon func (m *RepeatedResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseBodyOut_Response) ProtoMessage() {} func (*RepeatedResponseBodyOut_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_df4b27f252df323f, []int{2, 0} + return fileDescriptor_272b2870183bbe20, []int{2, 0} } func (m *RepeatedResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { @@ -270,7 +270,7 @@ func (m *RepeatedResponseStrings) Reset() { *m = RepeatedResponseStrings func (m *RepeatedResponseStrings) String() string { return proto.CompactTextString(m) } func (*RepeatedResponseStrings) ProtoMessage() {} func (*RepeatedResponseStrings) Descriptor() ([]byte, []int) { - return fileDescriptor_df4b27f252df323f, []int{3} + return fileDescriptor_272b2870183bbe20, []int{3} } func (m *RepeatedResponseStrings) XXX_Unmarshal(b []byte) error { @@ -299,49 +299,50 @@ func (m *RepeatedResponseStrings) GetValues() []string { } func init() { - proto.RegisterEnum("grpc.gateway.examples.examplepb.RepeatedResponseBodyOut_Response_ResponseType", RepeatedResponseBodyOut_Response_ResponseType_name, RepeatedResponseBodyOut_Response_ResponseType_value) - proto.RegisterType((*ResponseBodyIn)(nil), "grpc.gateway.examples.examplepb.ResponseBodyIn") - proto.RegisterType((*ResponseBodyOut)(nil), "grpc.gateway.examples.examplepb.ResponseBodyOut") - proto.RegisterType((*ResponseBodyOut_Response)(nil), "grpc.gateway.examples.examplepb.ResponseBodyOut.Response") - proto.RegisterType((*RepeatedResponseBodyOut)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseBodyOut") - proto.RegisterType((*RepeatedResponseBodyOut_Response)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseBodyOut.Response") - proto.RegisterType((*RepeatedResponseStrings)(nil), "grpc.gateway.examples.examplepb.RepeatedResponseStrings") + proto.RegisterEnum("grpc.gateway.examples.internal.examplepb.RepeatedResponseBodyOut_Response_ResponseType", RepeatedResponseBodyOut_Response_ResponseType_name, RepeatedResponseBodyOut_Response_ResponseType_value) + proto.RegisterType((*ResponseBodyIn)(nil), "grpc.gateway.examples.internal.examplepb.ResponseBodyIn") + proto.RegisterType((*ResponseBodyOut)(nil), "grpc.gateway.examples.internal.examplepb.ResponseBodyOut") + proto.RegisterType((*ResponseBodyOut_Response)(nil), "grpc.gateway.examples.internal.examplepb.ResponseBodyOut.Response") + proto.RegisterType((*RepeatedResponseBodyOut)(nil), "grpc.gateway.examples.internal.examplepb.RepeatedResponseBodyOut") + proto.RegisterType((*RepeatedResponseBodyOut_Response)(nil), "grpc.gateway.examples.internal.examplepb.RepeatedResponseBodyOut.Response") + proto.RegisterType((*RepeatedResponseStrings)(nil), "grpc.gateway.examples.internal.examplepb.RepeatedResponseStrings") } func init() { - proto.RegisterFile("examples/proto/examplepb/response_body_service.proto", fileDescriptor_df4b27f252df323f) -} - -var fileDescriptor_df4b27f252df323f = []byte{ - // 441 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0xcf, 0xaa, 0xd3, 0x40, - 0x14, 0xc6, 0x9d, 0xb4, 0x5e, 0x6f, 0x27, 0x72, 0x6f, 0x99, 0x2b, 0xf7, 0x86, 0x22, 0x1a, 0x07, - 0xd1, 0xb8, 0x49, 0x34, 0xba, 0xd0, 0x65, 0xbb, 0x91, 0xa2, 0xa4, 0x90, 0x5a, 0x04, 0x41, 0xca, - 0xa4, 0x39, 0x84, 0x40, 0xcd, 0x0c, 0x99, 0x69, 0x35, 0x88, 0x1b, 0x57, 0x2e, 0xdc, 0xb9, 0xf5, - 0x01, 0x74, 0xe1, 0xd3, 0xf8, 0x0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ff, 0x07, 0xc9, 0xea, 0x62, 0xa8, 0x04, 0x00, 0x00, + proto.RegisterFile("examples/internal/proto/examplepb/response_body_service.proto", fileDescriptor_272b2870183bbe20) +} + +var fileDescriptor_272b2870183bbe20 = []byte{ + // 451 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0xd4, 0xcf, 0x6a, 0xd4, 0x40, + 0x1c, 0x07, 0x70, 0x27, 0xbb, 0xd6, 0xee, 0x44, 0xda, 0x65, 0x2a, 0x6d, 0x58, 0x44, 0xe2, 0x20, + 0x1a, 0x2f, 0x09, 0xc6, 0x8b, 0x1e, 0x3c, 0x34, 0x17, 0xa9, 0xca, 0x16, 0x52, 0xa5, 0xe0, 0xc1, + 0x32, 0x69, 0x7e, 0x86, 0xc1, 0x38, 0x33, 0x64, 0xa6, 0xd5, 0x20, 0x5e, 0x7c, 0x03, 0xf1, 0x3d, + 0x3c, 0x7a, 0xd0, 0x9b, 0xaf, 0xe0, 0x2b, 0xf8, 0x20, 0xb2, 0xd9, 0x64, 0x88, 0x35, 0x88, 0xb6, + 0x82, 0xa7, 0x9d, 0x7f, 0x7c, 0xe7, 0xc3, 0xfe, 0x7e, 0x13, 0x7c, 0x0f, 0x5e, 0xb3, 0x97, 0xaa, + 0x04, 0x1d, 0x71, 0x61, 0xa0, 0x12, 0xac, 0x8c, 0x54, 0x25, 0x8d, 0x8c, 0xda, 0x75, 0x95, 0x45, + 0x15, 0x68, 0x25, 0x85, 0x86, 0x83, 0x4c, 0xe6, 0xf5, 0x81, 0x86, 0xea, 0x98, 0x1f, 0x42, 0xd8, + 0x9c, 0x22, 0x41, 0x51, 0xa9, 0xc3, 0xb0, 0x60, 0x06, 0x5e, 0xb1, 0x3a, 0xec, 0xb2, 0xc2, 0x2e, + 0x2b, 0xb4, 0x29, 0xb3, 0xcb, 0x85, 0x94, 0x45, 0x09, 0x11, 0x53, 0x3c, 0x62, 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0x88, 0xf0, 0xfa, 0x7d, 0x30, 0xfd, 0x2d, 0x72, 0xe7, 0x74, 0x9d, 0xb0, 0x23, 0x66, 0x77, + 0x4f, 0xdd, 0x43, 0xf4, 0xfa, 0xbb, 0x6f, 0xdf, 0x3f, 0x38, 0x3e, 0xb9, 0x64, 0x1f, 0xce, 0xe2, + 0xdd, 0x44, 0x6f, 0x16, 0x85, 0x78, 0x9b, 0xd9, 0xa2, 0x91, 0x2f, 0x08, 0x93, 0x47, 0x5c, 0xf7, + 0xc5, 0x1c, 0xf4, 0x19, 0xcc, 0xdb, 0x67, 0x2e, 0x2b, 0x0d, 0x1a, 0x3b, 0x25, 0x9b, 0x7d, 0x3b, + 0x07, 0x3d, 0xa8, 0xdf, 0xe8, 0xeb, 0xbb, 0xb2, 0xfd, 0x17, 0x7e, 0x7b, 0x39, 0xbd, 0xd1, 0xf0, + 0xaf, 0x92, 0x2d, 0xcb, 0xd7, 0xcb, 0x9d, 0xce, 0xdf, 0x36, 0x51, 0xe2, 0x3e, 0x9d, 0xd8, 0xb4, + 0x6c, 0xa5, 0xf9, 0x04, 0xdd, 0xfe, 0x11, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x10, 0x29, 0xfa, 0x0b, + 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -371,7 +372,7 @@ func NewResponseBodyServiceClient(cc *grpc.ClientConn) ResponseBodyServiceClient func (c *responseBodyServiceClient) GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) { out := new(ResponseBodyOut) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ResponseBodyService/GetResponseBody", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ResponseBodyService/GetResponseBody", in, out, opts...) if err != nil { return nil, err } @@ -380,7 +381,7 @@ func (c *responseBodyServiceClient) GetResponseBody(ctx context.Context, in *Res func (c *responseBodyServiceClient) ListResponseBodies(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseBodyOut, error) { out := new(RepeatedResponseBodyOut) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ResponseBodyService/ListResponseBodies", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ResponseBodyService/ListResponseBodies", in, out, opts...) if err != nil { return nil, err } @@ -389,7 +390,7 @@ func (c *responseBodyServiceClient) ListResponseBodies(ctx context.Context, in * func (c *responseBodyServiceClient) ListResponseStrings(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseStrings, error) { out := new(RepeatedResponseStrings) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ResponseBodyService/ListResponseStrings", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.ResponseBodyService/ListResponseStrings", in, out, opts...) if err != nil { return nil, err } @@ -431,7 +432,7 @@ func _ResponseBodyService_GetResponseBody_Handler(srv interface{}, ctx context.C } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ResponseBodyService/GetResponseBody", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ResponseBodyService/GetResponseBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ResponseBodyServiceServer).GetResponseBody(ctx, req.(*ResponseBodyIn)) @@ -449,7 +450,7 @@ func _ResponseBodyService_ListResponseBodies_Handler(srv interface{}, ctx contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ResponseBodyService/ListResponseBodies", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ResponseBodyService/ListResponseBodies", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ResponseBodyServiceServer).ListResponseBodies(ctx, req.(*ResponseBodyIn)) @@ -467,7 +468,7 @@ func _ResponseBodyService_ListResponseStrings_Handler(srv interface{}, ctx conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.ResponseBodyService/ListResponseStrings", + FullMethod: "/grpc.gateway.examples.internal.examplepb.ResponseBodyService/ListResponseStrings", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ResponseBodyServiceServer).ListResponseStrings(ctx, req.(*ResponseBodyIn)) @@ -476,7 +477,7 @@ func _ResponseBodyService_ListResponseStrings_Handler(srv interface{}, ctx conte } var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.ResponseBodyService", + ServiceName: "grpc.gateway.examples.internal.examplepb.ResponseBodyService", HandlerType: (*ResponseBodyServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -493,5 +494,5 @@ var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "examples/proto/examplepb/response_body_service.proto", + Metadata: "examples/internal/proto/examplepb/response_body_service.proto", } diff --git a/examples/proto/examplepb/response_body_service.pb.gw.go b/examples/internal/proto/examplepb/response_body_service.pb.gw.go similarity index 99% rename from examples/proto/examplepb/response_body_service.pb.gw.go rename to examples/internal/proto/examplepb/response_body_service.pb.gw.go index 86d9c4ed9be..558cd0617cf 100644 --- a/examples/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/internal/proto/examplepb/response_body_service.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: examples/proto/examplepb/response_body_service.proto +// source: examples/internal/proto/examplepb/response_body_service.proto /* Package examplepb is a reverse proxy. diff --git a/examples/proto/examplepb/response_body_service.proto b/examples/internal/proto/examplepb/response_body_service.proto similarity index 95% rename from examples/proto/examplepb/response_body_service.proto rename to examples/internal/proto/examplepb/response_body_service.proto index 215591daf95..2a04e786e95 100644 --- a/examples/proto/examplepb/response_body_service.proto +++ b/examples/internal/proto/examplepb/response_body_service.proto @@ -1,7 +1,7 @@ syntax = "proto3"; option go_package = "examplepb"; -package grpc.gateway.examples.examplepb; +package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; diff --git a/examples/proto/examplepb/response_body_service.swagger.json b/examples/internal/proto/examplepb/response_body_service.swagger.json similarity index 99% rename from examples/proto/examplepb/response_body_service.swagger.json rename to examples/internal/proto/examplepb/response_body_service.swagger.json index 50fa2d025c4..1786b2dba94 100644 --- a/examples/proto/examplepb/response_body_service.swagger.json +++ b/examples/internal/proto/examplepb/response_body_service.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "examples/proto/examplepb/response_body_service.proto", + "title": "examples/internal/proto/examplepb/response_body_service.proto", "version": "version not set" }, "consumes": [ diff --git a/examples/proto/examplepb/stream.pb.go b/examples/internal/proto/examplepb/stream.pb.go similarity index 74% rename from examples/proto/examplepb/stream.pb.go rename to examples/internal/proto/examplepb/stream.pb.go index 993391ebea5..93eab149b03 100644 --- a/examples/proto/examplepb/stream.pb.go +++ b/examples/internal/proto/examplepb/stream.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/examplepb/stream.proto +// source: examples/internal/proto/examplepb/stream.proto package examplepb @@ -8,7 +8,7 @@ import ( fmt "fmt" proto "github.com/golang/protobuf/proto" empty "github.com/golang/protobuf/ptypes/empty" - sub "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" + sub "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -28,31 +28,32 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package func init() { - proto.RegisterFile("examples/proto/examplepb/stream.proto", fileDescriptor_a31ab0177843ce10) -} - -var fileDescriptor_a31ab0177843ce10 = []byte{ - // 319 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xb1, 0x4e, 0xc3, 0x30, - 0x10, 0x86, 0x15, 0x40, 0x08, 0x8c, 0x58, 0x3c, 0x30, 0x04, 0xa4, 0x42, 0x05, 0xa2, 0x30, 0xd8, - 0x6d, 0xd9, 0xd8, 0x28, 0xea, 0x06, 0x62, 0xe8, 0xc6, 0x52, 0xd9, 0xd1, 0xd5, 0xb5, 0x9a, 0xc4, - 0x96, 0x7d, 0x29, 0x54, 0x62, 0x62, 0x64, 0xed, 0x8b, 0xf0, 0x2e, 0xbc, 0x02, 0x0f, 0x82, 0xea, - 0xa4, 0x1d, 0x10, 0x51, 0xcb, 0x78, 0xbe, 0xff, 0xf7, 0xfd, 0xdf, 0x4f, 0x2e, 0xe0, 0x55, 0x64, - 0x36, 0x05, 0xcf, 0xad, 0x33, 0x68, 0x78, 0x35, 0x5a, 0xc9, 0x3d, 0x3a, 0x10, 0x19, 0x0b, 0xcf, - 0xb4, 0xa1, 0x9c, 0x4d, 0x98, 0x12, 0x08, 0x2f, 0x62, 0xc6, 0x96, 0x1e, 0xb6, 0x52, 0xc7, 0x27, - 0xca, 0x18, 0x95, 0x02, 0x17, 0x56, 0x73, 0x91, 0xe7, 0x06, 0x05, 0x6a, 0x93, 0xfb, 0xd2, 0x1e, - 0x1f, 0x57, 0xdb, 0x30, 0xc9, 0x62, 0xc4, 0x21, 0xb3, 0x38, 0xab, 0x96, 0xdd, 0xda, 0x08, 0x62, - 0x28, 0x35, 0x0e, 0xcd, 0x68, 0x08, 0x53, 0x70, 0x33, 0x1c, 0xeb, 0x5c, 0x55, 0x9e, 0xd3, 0x5f, - 0x1e, 0x5f, 0x48, 0x9e, 0x81, 0xf7, 0x42, 0x41, 0xa9, 0xe8, 0x7e, 0x6e, 0x93, 0xc3, 0x41, 0x40, - 0x18, 0x80, 0x9b, 0xea, 0x04, 0xe8, 0x47, 0x44, 0x48, 0xaf, 0x48, 0x27, 0xf7, 0x0e, 0x04, 0x02, - 0xed, 0xb0, 0x35, 0x4c, 0xec, 0xae, 0xa7, 0xf1, 0x69, 0xd4, 0x5f, 0xdd, 0x8e, 0x8f, 0x58, 0xc9, - 0xc1, 0x96, 0x1c, 0xac, 0xbf, 0xe0, 0x68, 0xf2, 0xf7, 0xaf, 0xef, 0xf9, 0xd6, 0x55, 0xf3, 0x9c, - 0x4f, 0x3b, 0xcb, 0xf8, 0x7f, 0x85, 0xe7, 0xb2, 0x48, 0x27, 0xb7, 0xd1, 0x75, 0x2b, 0xa2, 0x6f, - 0x64, 0xe7, 0x41, 0x7b, 0xa4, 0x35, 0x5f, 0xc6, 0xff, 0x4f, 0xd7, 0xbc, 0x0c, 0x29, 0xce, 0x68, - 0x63, 0x4d, 0x8a, 0x76, 0x44, 0xe7, 0x11, 0xd9, 0x5b, 0x54, 0xd1, 0x4f, 0xc6, 0x86, 0xb6, 0x6a, - 0x4e, 0xf9, 0x42, 0xb2, 0x01, 0x3a, 0x9d, 0xab, 0xc7, 0xb2, 0xd9, 0x78, 0x63, 0xe5, 0xe6, 0x8d, - 0x40, 0x32, 0x36, 0xa1, 0x91, 0x76, 0xd4, 0x3b, 0x78, 0xde, 0x5f, 0xe1, 0xc9, 0xdd, 0x50, 0xc8, - 0xcd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x63, 0x7a, 0xd9, 0xa1, 0x02, 0x00, 0x00, + proto.RegisterFile("examples/internal/proto/examplepb/stream.proto", fileDescriptor_cc5dba844cf4f624) +} + +var fileDescriptor_cc5dba844cf4f624 = []byte{ + // 328 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x90, 0xb1, 0x4e, 0xeb, 0x30, + 0x14, 0x86, 0xe5, 0x7b, 0x11, 0x82, 0x20, 0x16, 0x0f, 0x0c, 0x01, 0x09, 0x51, 0x21, 0xd1, 0x32, + 0xd8, 0x2d, 0x6c, 0x65,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xad, 0xc8, 0x86, 0x2b, 0xc5, + 0x16, 0x7f, 0xfd, 0xf8, 0x5a, 0xfe, 0xeb, 0xb4, 0xce, 0xf9, 0xbc, 0xb7, 0x16, 0xfa, 0x49, 0x87, + 0xcb, 0x22, 0x9d, 0xf5, 0xc9, 0x65, 0x9b, 0xd0, 0x37, 0x12, 0xed, 0xdc, 0x6b, 0x8f, 0x74, 0xc3, + 0xcd, 0xf8, 0x0f, 0x39, 0x5b, 0x17, 0x21, 0xcf, 0x19, 0x3d, 0x6d, 0xc8, 0xd3, 0x25, 0xf4, 0x9d, + 0x44, 0x7b, 0xab, 0x76, 0x86, 0xc9, 0xd4, 0xd2, 0x5e, 0xd3, 0x9b, 0xbe, 0x90, 0x6c, 0x84, 0x4e, + 0x1b, 0xf5, 0x50, 0xb6, 0x1e, 0xff, 0x1e, 0xd9, 0xbe, 0x2d, 0x48, 0xa6, 0x36, 0xb4, 0xd5, 0x25, + 0x83, 0x83, 0xa7, 0xfd, 0x5a, 0x58, 0xee, 0x86, 0xae, 0xae, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, + 0xb8, 0x9c, 0x62, 0x91, 0xea, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -81,7 +82,7 @@ func NewStreamServiceClient(cc *grpc.ClientConn) StreamServiceClient { } func (c *streamServiceClient) BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) { - stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[0], "/grpc.gateway.examples.examplepb.StreamService/BulkCreate", opts...) + stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[0], "/grpc.gateway.examples.internal.examplepb.StreamService/BulkCreate", opts...) if err != nil { return nil, err } @@ -115,7 +116,7 @@ func (x *streamServiceBulkCreateClient) CloseAndRecv() (*empty.Empty, error) { } func (c *streamServiceClient) List(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error) { - stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[1], "/grpc.gateway.examples.examplepb.StreamService/List", opts...) + stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[1], "/grpc.gateway.examples.internal.examplepb.StreamService/List", opts...) if err != nil { return nil, err } @@ -147,7 +148,7 @@ func (x *streamServiceListClient) Recv() (*ABitOfEverything, error) { } func (c *streamServiceClient) BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) { - stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[2], "/grpc.gateway.examples.examplepb.StreamService/BulkEcho", opts...) + stream, err := c.cc.NewStream(ctx, &_StreamService_serviceDesc.Streams[2], "/grpc.gateway.examples.internal.examplepb.StreamService/BulkEcho", opts...) if err != nil { return nil, err } @@ -276,7 +277,7 @@ func (x *streamServiceBulkEchoServer) Recv() (*sub.StringMessage, error) { } var _StreamService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.StreamService", + ServiceName: "grpc.gateway.examples.internal.examplepb.StreamService", HandlerType: (*StreamServiceServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ @@ -297,5 +298,5 @@ var _StreamService_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: "examples/proto/examplepb/stream.proto", + Metadata: "examples/internal/proto/examplepb/stream.proto", } diff --git a/examples/proto/examplepb/stream.pb.gw.go b/examples/internal/proto/examplepb/stream.pb.gw.go similarity index 98% rename from examples/proto/examplepb/stream.pb.gw.go rename to examples/internal/proto/examplepb/stream.pb.gw.go index 8b33ff5c40a..3cece1b712c 100644 --- a/examples/proto/examplepb/stream.pb.gw.go +++ b/examples/internal/proto/examplepb/stream.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: examples/proto/examplepb/stream.proto +// source: examples/internal/proto/examplepb/stream.proto /* Package examplepb is a reverse proxy. @@ -16,7 +16,7 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" "google.golang.org/grpc" diff --git a/examples/proto/examplepb/stream.proto b/examples/internal/proto/examplepb/stream.proto similarity index 67% rename from examples/proto/examplepb/stream.proto rename to examples/internal/proto/examplepb/stream.proto index 66e59dde758..8cfa647cc15 100644 --- a/examples/proto/examplepb/stream.proto +++ b/examples/internal/proto/examplepb/stream.proto @@ -1,11 +1,11 @@ syntax = "proto3"; option go_package = "examplepb"; -package grpc.gateway.examples.examplepb; +package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; -import "examples/proto/examplepb/a_bit_of_everything.proto"; -import "examples/proto/sub/message.proto"; +import "examples/internal/proto/examplepb/a_bit_of_everything.proto"; +import "examples/internal/proto/sub/message.proto"; // Defines some more operations to be added to ABitOfEverythingService service StreamService { @@ -20,7 +20,7 @@ service StreamService { get: "/v1/example/a_bit_of_everything" }; } - rpc BulkEcho(stream grpc.gateway.examples.sub.StringMessage) returns (stream grpc.gateway.examples.sub.StringMessage) { + rpc BulkEcho(stream grpc.gateway.examples.internal.sub.StringMessage) returns (stream grpc.gateway.examples.internal.sub.StringMessage) { option (google.api.http) = { post: "/v1/example/a_bit_of_everything/echo" body: "*" diff --git a/examples/proto/examplepb/stream.swagger.json b/examples/internal/proto/examplepb/stream.swagger.json similarity index 99% rename from examples/proto/examplepb/stream.swagger.json rename to examples/internal/proto/examplepb/stream.swagger.json index c4c696989a6..faef15b04e4 100644 --- a/examples/proto/examplepb/stream.swagger.json +++ b/examples/internal/proto/examplepb/stream.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "examples/proto/examplepb/stream.proto", + "title": "examples/internal/proto/examplepb/stream.proto", "version": "version not set" }, "consumes": [ diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.go b/examples/internal/proto/examplepb/unannotated_echo_service.pb.go similarity index 76% rename from examples/proto/examplepb/unannotated_echo_service.pb.go rename to examples/internal/proto/examplepb/unannotated_echo_service.pb.go index ba678e9a081..60c4d917a2a 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.go +++ b/examples/internal/proto/examplepb/unannotated_echo_service.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/examplepb/unannotated_echo_service.proto +// source: examples/internal/proto/examplepb/unannotated_echo_service.proto // Unannotated Echo Service // Similar to echo_service.proto but without annotations. See @@ -48,7 +48,7 @@ func (m *UnannotatedSimpleMessage) Reset() { *m = UnannotatedSimpleMessa func (m *UnannotatedSimpleMessage) String() string { return proto.CompactTextString(m) } func (*UnannotatedSimpleMessage) ProtoMessage() {} func (*UnannotatedSimpleMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_a57876726ab5dd80, []int{0} + return fileDescriptor_ab29419944ad9f3b, []int{0} } func (m *UnannotatedSimpleMessage) XXX_Unmarshal(b []byte) error { @@ -91,32 +91,33 @@ func (m *UnannotatedSimpleMessage) GetDuration() *duration.Duration { } func init() { - proto.RegisterType((*UnannotatedSimpleMessage)(nil), "grpc.gateway.examples.examplepb.UnannotatedSimpleMessage") + proto.RegisterType((*UnannotatedSimpleMessage)(nil), "grpc.gateway.examples.internal.examplepb.UnannotatedSimpleMessage") } func init() { - proto.RegisterFile("examples/proto/examplepb/unannotated_echo_service.proto", fileDescriptor_a57876726ab5dd80) + proto.RegisterFile("examples/internal/proto/examplepb/unannotated_echo_service.proto", fileDescriptor_ab29419944ad9f3b) } -var fileDescriptor_a57876726ab5dd80 = []byte{ - // 268 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08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24, 0x5b, 0x5d, 0x93, 0x33, 0xf2, - 0x83, 0x21, 0xde, 0x12, 0xaa, 0xe1, 0x62, 0x01, 0x71, 0x85, 0x2c, 0xf5, 0x08, 0xf8, 0x4c, 0x0f, - 0x97, 0xb3, 0xa5, 0xc8, 0xd7, 0x2a, 0xd4, 0xc0, 0xc8, 0xc5, 0x01, 0xb2, 0xde, 0x29, 0x3f, 0xa5, - 0x72, 0x80, 0x9c, 0xd0, 0xc4, 0xc8, 0xc5, 0x05, 0x72, 0x82, 0x4b, 0x6a, 0x4e, 0x6a, 0x49, 0xea, - 0xc0, 0x38, 0xc2, 0x89, 0x3b, 0x8a, 0x13, 0xae, 0x2a, 0x89, 0x0d, 0x1c, 0x95, 0xc6, 0x80, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x9a, 0xa7, 0x7c, 0x41, 0xa5, 0x02, 0x00, 0x00, +var fileDescriptor_ab29419944ad9f3b = []byte{ + // 280 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x92, 0x31, 0x4b, 0xfb, 0x40, + 0x18, 0xc6, 0xb9, 0xe4, 0xcf, 0x9f, 0xf6, 0x2d, 0x88, 0xdc, 0x20, 0xb1, 0x83, 0x04, 0xa7, 0x4c, + 0x6f, 0xa0, 0xe2, 0x2e, 0xa1, 0x8e, 0x2e, 0x29, 0x2e, 0x2e, 0xe5, 0x92, 0xbc, 0xa6, 0x07, 0xe9, + 0x5d, 0xb8, 0xbb, 0xa8, 0xfd, 0x12, 0x0e, 0xe2, 0x57, 0xf3, 0xfb, 0xc8, 0x35, 0x4d, 0x74, 0x11, + 0x1c, 0x1c, 0xba, 0x25, 0xc7, 0x73, 0xbf, 0xdf, 0xf3, 0xc0, 0xc1, 0x0d, 0xbd, 0x88, 0x6d, 0xdb, + 0x90, 0x4d, 0xa5, 0x72, 0x64, 0x94, 0x68, 0xd2, 0xd6, 0x68, 0xa7, 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x7d, 0x8e, 0xee, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -152,7 +153,7 @@ func NewUnannotatedEchoServiceClient(cc *grpc.ClientConn) UnannotatedEchoService func (c *unannotatedEchoServiceClient) Echo(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/Echo", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.UnannotatedEchoService/Echo", in, out, opts...) if err != nil { return nil, err } @@ -161,7 +162,7 @@ func (c *unannotatedEchoServiceClient) Echo(ctx context.Context, in *Unannotated func (c *unannotatedEchoServiceClient) EchoBody(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoBody", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.UnannotatedEchoService/EchoBody", in, out, opts...) if err != nil { return nil, err } @@ -170,7 +171,7 @@ func (c *unannotatedEchoServiceClient) EchoBody(ctx context.Context, in *Unannot func (c *unannotatedEchoServiceClient) EchoDelete(ctx context.Context, in *UnannotatedSimpleMessage, opts ...grpc.CallOption) (*UnannotatedSimpleMessage, error) { out := new(UnannotatedSimpleMessage) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoDelete", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.UnannotatedEchoService/EchoDelete", in, out, opts...) if err != nil { return nil, err } @@ -218,7 +219,7 @@ func _UnannotatedEchoService_Echo_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.UnannotatedEchoService/Echo", + FullMethod: "/grpc.gateway.examples.internal.examplepb.UnannotatedEchoService/Echo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UnannotatedEchoServiceServer).Echo(ctx, req.(*UnannotatedSimpleMessage)) @@ -236,7 +237,7 @@ func _UnannotatedEchoService_EchoBody_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoBody", + FullMethod: "/grpc.gateway.examples.internal.examplepb.UnannotatedEchoService/EchoBody", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UnannotatedEchoServiceServer).EchoBody(ctx, req.(*UnannotatedSimpleMessage)) @@ -254,7 +255,7 @@ func _UnannotatedEchoService_EchoDelete_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.UnannotatedEchoService/EchoDelete", + FullMethod: "/grpc.gateway.examples.internal.examplepb.UnannotatedEchoService/EchoDelete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UnannotatedEchoServiceServer).EchoDelete(ctx, req.(*UnannotatedSimpleMessage)) @@ -263,7 +264,7 @@ func _UnannotatedEchoService_EchoDelete_Handler(srv interface{}, ctx context.Con } var _UnannotatedEchoService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.UnannotatedEchoService", + ServiceName: "grpc.gateway.examples.internal.examplepb.UnannotatedEchoService", HandlerType: (*UnannotatedEchoServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -280,5 +281,5 @@ var _UnannotatedEchoService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "examples/proto/examplepb/unannotated_echo_service.proto", + Metadata: "examples/internal/proto/examplepb/unannotated_echo_service.proto", } diff --git a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go b/examples/internal/proto/examplepb/unannotated_echo_service.pb.gw.go similarity index 99% rename from examples/proto/examplepb/unannotated_echo_service.pb.gw.go rename to examples/internal/proto/examplepb/unannotated_echo_service.pb.gw.go index 27258d252ad..8936c57c0aa 100644 --- a/examples/proto/examplepb/unannotated_echo_service.pb.gw.go +++ b/examples/internal/proto/examplepb/unannotated_echo_service.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: examples/proto/examplepb/unannotated_echo_service.proto +// source: examples/internal/proto/examplepb/unannotated_echo_service.proto /* Package examplepb is a reverse proxy. diff --git a/examples/proto/examplepb/unannotated_echo_service.proto b/examples/internal/proto/examplepb/unannotated_echo_service.proto similarity index 96% rename from examples/proto/examplepb/unannotated_echo_service.proto rename to examples/internal/proto/examplepb/unannotated_echo_service.proto index 6c3dbfeaf9a..4f926d3c6fc 100644 --- a/examples/proto/examplepb/unannotated_echo_service.proto +++ b/examples/internal/proto/examplepb/unannotated_echo_service.proto @@ -8,7 +8,7 @@ option go_package = "examplepb"; // // Echo Service API consists of a single service which returns // a message. -package grpc.gateway.examples.examplepb; +package grpc.gateway.examples.internal.examplepb; // Do not need annotations.proto, can still use well known types as usual import "google/protobuf/duration.proto"; diff --git a/examples/proto/examplepb/unannotated_echo_service.swagger.json b/examples/internal/proto/examplepb/unannotated_echo_service.swagger.json similarity index 99% rename from examples/proto/examplepb/unannotated_echo_service.swagger.json rename to examples/internal/proto/examplepb/unannotated_echo_service.swagger.json index c33a67d98f6..36720e9367b 100644 --- a/examples/proto/examplepb/unannotated_echo_service.swagger.json +++ b/examples/internal/proto/examplepb/unannotated_echo_service.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "examples/proto/examplepb/unannotated_echo_service.proto", + "title": "examples/internal/proto/examplepb/unannotated_echo_service.proto", "description": "Unannotated Echo Service\nSimilar to echo_service.proto but without annotations. See\nunannotated_echo_service.yaml for the equivalent of the annotations in\ngRPC API configuration format.\n\nEcho Service API consists of a single service which returns\na message.", "version": "version not set" }, diff --git a/examples/internal/proto/examplepb/unannotated_echo_service.yaml b/examples/internal/proto/examplepb/unannotated_echo_service.yaml new file mode 100644 index 00000000000..0f14d1fa2fb --- /dev/null +++ b/examples/internal/proto/examplepb/unannotated_echo_service.yaml @@ -0,0 +1,15 @@ +type: google.api.Service +config_version: 3 + +http: + rules: + - selector: grpc.gateway.examples.internal.examplepb.UnannotatedEchoService.Echo + post: "/v1/example/echo/{id}" + additional_bindings: + - get: "/v1/example/echo/{id}/{num}" + - selector: grpc.gateway.examples.internal.examplepb.UnannotatedEchoService.EchoBody + post: "/v1/example/echo_body" + body: "*" + - selector: grpc.gateway.examples.internal.examplepb.UnannotatedEchoService.EchoDelete + delete: "/v1/example/echo_delete" + diff --git a/examples/proto/examplepb/use_go_template.pb.go b/examples/internal/proto/examplepb/use_go_template.pb.go similarity index 81% rename from examples/proto/examplepb/use_go_template.pb.go rename to examples/internal/proto/examplepb/use_go_template.pb.go index 46e939310ac..6eac47ee393 100644 --- a/examples/proto/examplepb/use_go_template.pb.go +++ b/examples/internal/proto/examplepb/use_go_template.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/examplepb/use_go_template.proto +// source: examples/internal/proto/examplepb/use_go_template.proto package examplepb @@ -39,7 +39,7 @@ func (m *LoginRequest) Reset() { *m = LoginRequest{} } func (m *LoginRequest) String() string { return proto.CompactTextString(m) } func (*LoginRequest) ProtoMessage() {} func (*LoginRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_11d6ea622d77f66b, []int{0} + return fileDescriptor_ed0d8910d38fbb31, []int{0} } func (m *LoginRequest) XXX_Unmarshal(b []byte) error { @@ -87,7 +87,7 @@ func (m *LoginReply) Reset() { *m = LoginReply{} } func (m *LoginReply) String() string { return proto.CompactTextString(m) } func (*LoginReply) ProtoMessage() {} func (*LoginReply) Descriptor() ([]byte, []int) { - return fileDescriptor_11d6ea622d77f66b, []int{1} + return fileDescriptor_ed0d8910d38fbb31, []int{1} } func (m *LoginReply) XXX_Unmarshal(b []byte) error { @@ -146,7 +146,7 @@ func (m *LogoutRequest) Reset() { *m = LogoutRequest{} } func (m *LogoutRequest) String() string { return proto.CompactTextString(m) } func (*LogoutRequest) ProtoMessage() {} func (*LogoutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_11d6ea622d77f66b, []int{2} + return fileDescriptor_ed0d8910d38fbb31, []int{2} } func (m *LogoutRequest) XXX_Unmarshal(b []byte) error { @@ -201,7 +201,7 @@ func (m *LogoutReply) Reset() { *m = LogoutReply{} } func (m *LogoutReply) String() string { return proto.CompactTextString(m) } func (*LogoutReply) ProtoMessage() {} func (*LogoutReply) Descriptor() ([]byte, []int) { - return fileDescriptor_11d6ea622d77f66b, []int{3} + return fileDescriptor_ed0d8910d38fbb31, []int{3} } func (m *LogoutReply) XXX_Unmarshal(b []byte) error { @@ -230,41 +230,42 @@ func (m *LogoutReply) GetMessage() string { } func init() { - proto.RegisterType((*LoginRequest)(nil), "grpc.gateway.examples.examplepb.LoginRequest") - proto.RegisterType((*LoginReply)(nil), "grpc.gateway.examples.examplepb.LoginReply") - proto.RegisterType((*LogoutRequest)(nil), "grpc.gateway.examples.examplepb.LogoutRequest") - proto.RegisterType((*LogoutReply)(nil), "grpc.gateway.examples.examplepb.LogoutReply") + proto.RegisterType((*LoginRequest)(nil), "grpc.gateway.examples.internal.examplepb.LoginRequest") + proto.RegisterType((*LoginReply)(nil), "grpc.gateway.examples.internal.examplepb.LoginReply") + proto.RegisterType((*LogoutRequest)(nil), "grpc.gateway.examples.internal.examplepb.LogoutRequest") + proto.RegisterType((*LogoutReply)(nil), "grpc.gateway.examples.internal.examplepb.LogoutReply") } func init() { - proto.RegisterFile("examples/proto/examplepb/use_go_template.proto", fileDescriptor_11d6ea622d77f66b) -} - -var fileDescriptor_11d6ea622d77f66b = []byte{ - // 360 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02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9b, 0x45, 0x11, 0x6a, 0x6d, 0x13, 0x3a, 0x61, 0x89, 0x68, 0x0c, 0xff, 0x66, 0x82, 0x8b, 0xdc, - 0x54, 0x45, 0x28, 0xf4, 0x4d, 0x9c, 0xa2, 0xb8, 0x4b, 0x2c, 0x5d, 0xe6, 0x7c, 0xe1, 0x08, 0x81, - 0x3f, 0x06, 0xb5, 0xb1, 0x51, 0xad, 0xd0, 0x3e, 0x93, 0x11, 0xf4, 0xb4, 0x51, 0x71, 0xc6, 0x99, - 0x52, 0xac, 0x70, 0x9b, 0xa3, 0xe6, 0xb8, 0x1b, 0x6e, 0x53, 0xf4, 0x10, 0x7a, 0xd5, 0xab, 0x7e, - 0xec, 0x7a, 0xf6, 0xda, 0x28, 0xc7, 0xb9, 0x46, 0xb5, 0x8c, 0x23, 0x24, 0x8f, 0x0e, 0xb4, 0x2c, - 0x41, 0x4e, 0xfc, 0x5f, 0x66, 0xf7, 0xb7, 0x57, 0xf5, 0x8e, 0x76, 0x3d, 0x97, 0x49, 0x41, 0x87, - 0x4f, 0x6f, 0xef, 0x2f, 0x8d, 0x01, 0xfd, 0x1f, 0x2c, 0x4f, 0xab, 0xcf, 0x1f, 0x24, 0x6b, 0x7d, - 0xea, 0x4c, 0xc8, 0xb3, 0x03, 0xed, 0x4d, 0x7d, 0xe2, 0xef, 0x92, 0xfa, 0x39, 0xa9, 0x77, 0xbc, - 0xf3, 0xfd, 0xba, 0xc6, 0xbe, 0xad, 0xb1, 0x47, 0xc9, 0xb7, 0x1a, 0x22, 0x37, 0x53, 0x67, 0x72, - 0xd9, 0xbb, 0xe9, 0xd6, 0xbe, 0x45, 0xdb, 0xfe, 0x4c, 0xe7, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0xf3, 0xee, 0xed, 0x28, 0xbd, 0x02, 0x00, 0x00, + proto.RegisterFile("examples/internal/proto/examplepb/use_go_template.proto", fileDescriptor_ed0d8910d38fbb31) +} + +var fileDescriptor_ed0d8910d38fbb31 = []byte{ + // 373 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xbd, 0x8e, 0x1a, 0x31, + 0x14, 0x85, 0x35, 0x10, 0x08, 0x18, 0x52, 0xc4, 0x05, 0x19, 0x8d, 0x88, 0x84, 0xdc, 0x04, 0x51, + 0x8c, 0x95, 0x5f, 0x24, 0x8a, 0x14, 0x29, 0x52, 0x51, 0x4d, 0xba, 0x34, 0xc8, 0x4c, 0x6e, 0x2c, + 0x4b, 0x9e, 0xb1, 0x63, 0x7b, 0x20, 0xd3, 0xee, 0x2b, 0x50, 0xec, 0xdb, 0xec, 0x4b, 0xec, 0x2b, + 0xec, 0x83, 0xac, 0xc6, 0x8c, 0x59, 0x76, 0x8b, 0xd5, 0xd2, 0xcd, 0x3d, 0x57, 0xe7, 0x9b, 0xe3, + 0xa3, 0x8b, 0x96, 0xf0, 0x9f, 0x15, 0x5a, 0x82, 0xa5, 0xa2, 0x74, 0x60, 0x4a, 0x26, 0xa9, 0x36, + 0xca, 0x29, 0xda, 0xea, 0x7a, 0x4b, 0x2b, 0x0b, 0x1b, 0xae, 0x36, 0x0e, 0x0a, 0x2d, 0x99, 0x83, + 0xd4, 0xef, 0xf1, 0x9c, 0x1b, 0x9d, 0xa7, 0x9c, 0x39, 0xd8, 0xb3, 0x3a, 0x0d, 0x94, 0x34, 0x50, + 0xd2, 0x93, 0x3f, 0x99, 0x72, 0xa5, 0xb8, 0x04, 0xca, 0xb4, 0xa0, 0xac, 0x2c, 0x95, 0x63, 0x4e, + 0xa8, 0xd2, 0x1e, 0x39, 0xe4, 0x27, 0x1a, 0xaf, 0x15, 0x17, 0x65, 0x06, 0xff, 0x2a, 0xb0, 0x0e, + 0x27, 0x68, 0x50, 0xd9, 0x06, 0x51, 0x40, 0x1c, 0xcd, 0xa2, 0xf9, 0x30, 0x3b, 0xcd, 0xcd, 0x4e, + 0x33, 0x6b, 0xf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 0xef, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xc0, 0x42, + 0xdb, 0xf3, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -321,7 +322,7 @@ func NewLoginServiceClient(cc *grpc.ClientConn) LoginServiceClient { func (c *loginServiceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error) { out := new(LoginReply) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.LoginService/Login", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.LoginService/Login", in, out, opts...) if err != nil { return nil, err } @@ -330,7 +331,7 @@ func (c *loginServiceClient) Login(ctx context.Context, in *LoginRequest, opts . func (c *loginServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutReply, error) { out := new(LogoutReply) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.LoginService/Logout", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.LoginService/Logout", in, out, opts...) if err != nil { return nil, err } @@ -396,7 +397,7 @@ func _LoginService_Login_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.LoginService/Login", + FullMethod: "/grpc.gateway.examples.internal.examplepb.LoginService/Login", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LoginServiceServer).Login(ctx, req.(*LoginRequest)) @@ -414,7 +415,7 @@ func _LoginService_Logout_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.LoginService/Logout", + FullMethod: "/grpc.gateway.examples.internal.examplepb.LoginService/Logout", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(LoginServiceServer).Logout(ctx, req.(*LogoutRequest)) @@ -423,7 +424,7 @@ func _LoginService_Logout_Handler(srv interface{}, ctx context.Context, dec func } var _LoginService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.LoginService", + ServiceName: "grpc.gateway.examples.internal.examplepb.LoginService", HandlerType: (*LoginServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -436,5 +437,5 @@ var _LoginService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "examples/proto/examplepb/use_go_template.proto", + Metadata: "examples/internal/proto/examplepb/use_go_template.proto", } diff --git a/examples/proto/examplepb/use_go_template.pb.gw.go b/examples/internal/proto/examplepb/use_go_template.pb.gw.go similarity index 99% rename from examples/proto/examplepb/use_go_template.pb.gw.go rename to examples/internal/proto/examplepb/use_go_template.pb.gw.go index 68236c143ee..5019a18f448 100644 --- a/examples/proto/examplepb/use_go_template.pb.gw.go +++ b/examples/internal/proto/examplepb/use_go_template.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: examples/proto/examplepb/use_go_template.proto +// source: examples/internal/proto/examplepb/use_go_template.proto /* Package examplepb is a reverse proxy. diff --git a/examples/proto/examplepb/use_go_template.proto b/examples/internal/proto/examplepb/use_go_template.proto similarity index 98% rename from examples/proto/examplepb/use_go_template.proto rename to examples/internal/proto/examplepb/use_go_template.proto index 5a1b3161630..706fd8f136a 100644 --- a/examples/proto/examplepb/use_go_template.proto +++ b/examples/internal/proto/examplepb/use_go_template.proto @@ -1,6 +1,6 @@ syntax = "proto3"; option go_package = "examplepb"; -package grpc.gateway.examples.examplepb; +package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; @@ -82,4 +82,4 @@ message LogoutReply { // Message that tells you whether your // logout was succesful or not string message = 1; -} \ No newline at end of file +} diff --git a/examples/proto/examplepb/use_go_template.swagger.json b/examples/internal/proto/examplepb/use_go_template.swagger.json similarity index 99% rename from examples/proto/examplepb/use_go_template.swagger.json rename to examples/internal/proto/examplepb/use_go_template.swagger.json index c85ad10e119..642ab4539fa 100644 --- a/examples/proto/examplepb/use_go_template.swagger.json +++ b/examples/internal/proto/examplepb/use_go_template.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "examples/proto/examplepb/use_go_template.proto", + "title": "examples/internal/proto/examplepb/use_go_template.proto", "version": "version not set" }, "consumes": [ diff --git a/examples/proto/examplepb/wrappers.pb.go b/examples/internal/proto/examplepb/wrappers.pb.go similarity index 76% rename from examples/proto/examplepb/wrappers.pb.go rename to examples/internal/proto/examplepb/wrappers.pb.go index fa9e68e2d30..bdba354be83 100644 --- a/examples/proto/examplepb/wrappers.pb.go +++ b/examples/internal/proto/examplepb/wrappers.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/examplepb/wrappers.proto +// source: examples/internal/proto/examplepb/wrappers.proto package examplepb @@ -46,7 +46,7 @@ func (m *Wrappers) Reset() { *m = Wrappers{} } func (m *Wrappers) String() string { return proto.CompactTextString(m) } func (*Wrappers) ProtoMessage() {} func (*Wrappers) Descriptor() ([]byte, []int) { - return fileDescriptor_aa1e7ec5682437b9, []int{0} + return fileDescriptor_70304970d74748a4, []int{0} } func (m *Wrappers) XXX_Unmarshal(b []byte) error { @@ -131,52 +131,52 @@ func (m *Wrappers) GetBytesValue() *wrappers.BytesValue { } func init() { - proto.RegisterType((*Wrappers)(nil), "grpc.gateway.examples.examplepb.Wrappers") + proto.RegisterType((*Wrappers)(nil), "grpc.gateway.examples.internal.examplepb.Wrappers") } func init() { - proto.RegisterFile("examples/proto/examplepb/wrappers.proto", fileDescriptor_aa1e7ec5682437b9) -} - -var fileDescriptor_aa1e7ec5682437b9 = []byte{ - // 578 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0xdd, 0x6e, 0xd3, 0x30, - 0x14, 0xc7, 0xd5, 0x31, 0xca, 0xea, 0x0c, 0xc6,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xff, 0x05, 0x83, 0xaf, 0x71, 0xa0, 0x07, - 0x00, 0x00, + proto.RegisterFile("examples/internal/proto/examplepb/wrappers.proto", fileDescriptor_70304970d74748a4) +} + +var fileDescriptor_70304970d74748a4 = []byte{ + // 587 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x95, 0xdd, 0x6e, 0xd3, 0x30, + 0x14, 0xc7, 0xd5, 0x31, 0xca, 0xea, 0x0c, 0xc6, 0x0c, 0x82, 0xcd, 0x9b, 0x00, 0xe5, 0x6a, 0xda, + 0x85, 0x03, 0x5d, 0x55, 0x89, 0x09, 0x09, 0xa9, 0x7c, 0x48, 0xdc, 0x32, 0x8d, 0x49, 0xdc, 0x20, + 0x67, 0x73, 0xa3, 0xa0, 0x2c, 0x8e, 0x12, 0xa7, 0xa3, 0xb7, 0xbc, 0x01, 0xe2, 0x4d, 0x78, 0x03, + 0x9e, 0x81, 0x57, 0xe0, 0x41, 0x90, 0xbf, 0xf2, 0xd1, 0x2c, 0x47, 0x68, 0x77, 0x8e, 0xff, 0xe7, + 0x77, 0xfe, 0xf5, 0xf1, 0x39, 0x2e, 0x7a, 0xce, 0xbf, 0xb1, 0xcb, 0x2c, 0xe1, 0x45, 0x10, 0xa7, + 0x92, 0xe7, 0x29, 0x4b, 0x82, 0x2c, 0x17, 0x52, 0x04, 0x76, 0x3f, 0x0b, 0x83, 0xab, 0x9c, 0x65, + 0x19, 0xcf, 0x0b, 0xaa, 0x05, 0x7c, 0x10, 0xe5, 0xd9, 0x39, 0x8d, 0x98, 0xe4, 0x57, 0x6c, 0x49, + 0x1d, 0x4e, 0x1d, 0x4e, 0x2b, 0x90, 0xec, 0x47, 0x42, 0x44, 0x09, 0x0f, 0x58, 0x16, 0x07, 0x2c, + 0x4d, 0x85, 0x64, 0x32, 0x16, 0xa9, 0xcd, 0x43, 0x9e, 0x58, 0x55, 0x7f, 0x85, 0xe5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, 0x08, 0xa8, 0x5e, 0xef, 0xb5, 0xd2, 0x0f, + 0xf5, 0x9b, 0x80, 0xa1, 0x07, 0x83, 0x40, 0x62, 0xb7, 0x1f, 0xb4, 0xa6, 0x7c, 0xce, 0x90, 0x67, + 0x7c, 0xde, 0xa9, 0x3f, 0x2d, 0xfc, 0xa8, 0x93, 0x45, 0xef, 0x93, 0x9e, 0xfd, 0x6e, 0x62, 0xbd, + 0x7d, 0x3c, 0x38, 0x9c, 0x79, 0x9f, 0x47, 0xd5, 0x1b, 0x12, 0x0e, 0x35, 0x76, 0xf4, 0x2f, 0x00, + 0x00, 0xff, 0xff, 0xfe, 0xb0, 0x38, 0x00, 0xc5, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -214,7 +214,7 @@ func NewWrappersServiceClient(cc *grpc.ClientConn) WrappersServiceClient { func (c *wrappersServiceClient) Create(ctx context.Context, in *Wrappers, opts ...grpc.CallOption) (*Wrappers, error) { out := new(Wrappers) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/Create", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/Create", in, out, opts...) if err != nil { return nil, err } @@ -223,7 +223,7 @@ func (c *wrappersServiceClient) Create(ctx context.Context, in *Wrappers, opts . func (c *wrappersServiceClient) CreateStringValue(ctx context.Context, in *wrappers.StringValue, opts ...grpc.CallOption) (*wrappers.StringValue, error) { out := new(wrappers.StringValue) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateStringValue", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateStringValue", in, out, opts...) if err != nil { return nil, err } @@ -232,7 +232,7 @@ func (c *wrappersServiceClient) CreateStringValue(ctx context.Context, in *wrapp func (c *wrappersServiceClient) CreateInt32Value(ctx context.Context, in *wrappers.Int32Value, opts ...grpc.CallOption) (*wrappers.Int32Value, error) { out := new(wrappers.Int32Value) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateInt32Value", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateInt32Value", in, out, opts...) if err != nil { return nil, err } @@ -241,7 +241,7 @@ func (c *wrappersServiceClient) CreateInt32Value(ctx context.Context, in *wrappe func (c *wrappersServiceClient) CreateInt64Value(ctx context.Context, in *wrappers.Int64Value, opts ...grpc.CallOption) (*wrappers.Int64Value, error) { out := new(wrappers.Int64Value) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateInt64Value", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateInt64Value", in, out, opts...) if err != nil { return nil, err } @@ -250,7 +250,7 @@ func (c *wrappersServiceClient) CreateInt64Value(ctx context.Context, in *wrappe func (c *wrappersServiceClient) CreateFloatValue(ctx context.Context, in *wrappers.FloatValue, opts ...grpc.CallOption) (*wrappers.FloatValue, error) { out := new(wrappers.FloatValue) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateFloatValue", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateFloatValue", in, out, opts...) if err != nil { return nil, err } @@ -259,7 +259,7 @@ func (c *wrappersServiceClient) CreateFloatValue(ctx context.Context, in *wrappe func (c *wrappersServiceClient) CreateDoubleValue(ctx context.Context, in *wrappers.DoubleValue, opts ...grpc.CallOption) (*wrappers.DoubleValue, error) { out := new(wrappers.DoubleValue) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateDoubleValue", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateDoubleValue", in, out, opts...) if err != nil { return nil, err } @@ -268,7 +268,7 @@ func (c *wrappersServiceClient) CreateDoubleValue(ctx context.Context, in *wrapp func (c *wrappersServiceClient) CreateBoolValue(ctx context.Context, in *wrappers.BoolValue, opts ...grpc.CallOption) (*wrappers.BoolValue, error) { out := new(wrappers.BoolValue) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateBoolValue", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateBoolValue", in, out, opts...) if err != nil { return nil, err } @@ -277,7 +277,7 @@ func (c *wrappersServiceClient) CreateBoolValue(ctx context.Context, in *wrapper func (c *wrappersServiceClient) CreateUInt32Value(ctx context.Context, in *wrappers.UInt32Value, opts ...grpc.CallOption) (*wrappers.UInt32Value, error) { out := new(wrappers.UInt32Value) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateUInt32Value", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateUInt32Value", in, out, opts...) if err != nil { return nil, err } @@ -286,7 +286,7 @@ func (c *wrappersServiceClient) CreateUInt32Value(ctx context.Context, in *wrapp func (c *wrappersServiceClient) CreateUInt64Value(ctx context.Context, in *wrappers.UInt64Value, opts ...grpc.CallOption) (*wrappers.UInt64Value, error) { out := new(wrappers.UInt64Value) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateUInt64Value", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateUInt64Value", in, out, opts...) if err != nil { return nil, err } @@ -295,7 +295,7 @@ func (c *wrappersServiceClient) CreateUInt64Value(ctx context.Context, in *wrapp func (c *wrappersServiceClient) CreateBytesValue(ctx context.Context, in *wrappers.BytesValue, opts ...grpc.CallOption) (*wrappers.BytesValue, error) { out := new(wrappers.BytesValue) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateBytesValue", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateBytesValue", in, out, opts...) if err != nil { return nil, err } @@ -304,7 +304,7 @@ func (c *wrappersServiceClient) CreateBytesValue(ctx context.Context, in *wrappe func (c *wrappersServiceClient) CreateEmpty(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc.gateway.examples.examplepb.WrappersService/CreateEmpty", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateEmpty", in, out, opts...) if err != nil { return nil, err } @@ -378,7 +378,7 @@ func _WrappersService_Create_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/Create", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).Create(ctx, req.(*Wrappers)) @@ -396,7 +396,7 @@ func _WrappersService_CreateStringValue_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateStringValue", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateStringValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateStringValue(ctx, req.(*wrappers.StringValue)) @@ -414,7 +414,7 @@ func _WrappersService_CreateInt32Value_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateInt32Value", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateInt32Value", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateInt32Value(ctx, req.(*wrappers.Int32Value)) @@ -432,7 +432,7 @@ func _WrappersService_CreateInt64Value_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateInt64Value", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateInt64Value", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateInt64Value(ctx, req.(*wrappers.Int64Value)) @@ -450,7 +450,7 @@ func _WrappersService_CreateFloatValue_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateFloatValue", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateFloatValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateFloatValue(ctx, req.(*wrappers.FloatValue)) @@ -468,7 +468,7 @@ func _WrappersService_CreateDoubleValue_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateDoubleValue", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateDoubleValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateDoubleValue(ctx, req.(*wrappers.DoubleValue)) @@ -486,7 +486,7 @@ func _WrappersService_CreateBoolValue_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateBoolValue", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateBoolValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateBoolValue(ctx, req.(*wrappers.BoolValue)) @@ -504,7 +504,7 @@ func _WrappersService_CreateUInt32Value_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateUInt32Value", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateUInt32Value", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateUInt32Value(ctx, req.(*wrappers.UInt32Value)) @@ -522,7 +522,7 @@ func _WrappersService_CreateUInt64Value_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateUInt64Value", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateUInt64Value", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateUInt64Value(ctx, req.(*wrappers.UInt64Value)) @@ -540,7 +540,7 @@ func _WrappersService_CreateBytesValue_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateBytesValue", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateBytesValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateBytesValue(ctx, req.(*wrappers.BytesValue)) @@ -558,7 +558,7 @@ func _WrappersService_CreateEmpty_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc.gateway.examples.examplepb.WrappersService/CreateEmpty", + FullMethod: "/grpc.gateway.examples.internal.examplepb.WrappersService/CreateEmpty", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WrappersServiceServer).CreateEmpty(ctx, req.(*empty.Empty)) @@ -567,7 +567,7 @@ func _WrappersService_CreateEmpty_Handler(srv interface{}, ctx context.Context, } var _WrappersService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.gateway.examples.examplepb.WrappersService", + ServiceName: "grpc.gateway.examples.internal.examplepb.WrappersService", HandlerType: (*WrappersServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -616,5 +616,5 @@ var _WrappersService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "examples/proto/examplepb/wrappers.proto", + Metadata: "examples/internal/proto/examplepb/wrappers.proto", } diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/internal/proto/examplepb/wrappers.pb.gw.go similarity index 99% rename from examples/proto/examplepb/wrappers.pb.gw.go rename to examples/internal/proto/examplepb/wrappers.pb.gw.go index edb9b10a020..d6868454185 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/internal/proto/examplepb/wrappers.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: examples/proto/examplepb/wrappers.proto +// source: examples/internal/proto/examplepb/wrappers.proto /* Package examplepb is a reverse proxy. diff --git a/examples/proto/examplepb/wrappers.proto b/examples/internal/proto/examplepb/wrappers.proto similarity index 97% rename from examples/proto/examplepb/wrappers.proto rename to examples/internal/proto/examplepb/wrappers.proto index 48ce5a8ec6e..739e60e1f31 100644 --- a/examples/proto/examplepb/wrappers.proto +++ b/examples/internal/proto/examplepb/wrappers.proto @@ -1,6 +1,6 @@ syntax = "proto3"; option go_package = "examplepb"; -package grpc.gateway.examples.examplepb; +package grpc.gateway.examples.internal.examplepb; import "google/api/annotations.proto"; import "google/protobuf/wrappers.proto"; diff --git a/examples/proto/examplepb/wrappers.swagger.json b/examples/internal/proto/examplepb/wrappers.swagger.json similarity index 99% rename from examples/proto/examplepb/wrappers.swagger.json rename to examples/internal/proto/examplepb/wrappers.swagger.json index b6a93601d36..d42d6f3fb6b 100644 --- a/examples/proto/examplepb/wrappers.swagger.json +++ b/examples/internal/proto/examplepb/wrappers.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "examples/proto/examplepb/wrappers.proto", + "title": "examples/internal/proto/examplepb/wrappers.proto", "version": "version not set" }, "consumes": [ diff --git a/examples/proto/pathenum/BUILD.bazel b/examples/internal/proto/pathenum/BUILD.bazel similarity index 91% rename from examples/proto/pathenum/BUILD.bazel rename to examples/internal/proto/pathenum/BUILD.bazel index 06d17fc4483..d4a69e0316a 100644 --- a/examples/proto/pathenum/BUILD.bazel +++ b/examples/internal/proto/pathenum/BUILD.bazel @@ -11,12 +11,12 @@ proto_library( go_proto_library( name = "pathenum_go_proto", - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/pathenum", proto = ":pathenum_proto", ) go_library( name = "go_default_library", embed = [":pathenum_go_proto"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/pathenum", ) diff --git a/examples/proto/pathenum/path_enum.pb.go b/examples/internal/proto/pathenum/path_enum.pb.go similarity index 60% rename from examples/proto/pathenum/path_enum.pb.go rename to examples/internal/proto/pathenum/path_enum.pb.go index 2a2e6a5e96e..10f5c55ddf1 100644 --- a/examples/proto/pathenum/path_enum.pb.go +++ b/examples/internal/proto/pathenum/path_enum.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/pathenum/path_enum.proto +// source: examples/internal/proto/pathenum/path_enum.proto package pathenum @@ -42,7 +42,7 @@ func (x PathEnum) String() string { } func (PathEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_dfe1d80fc8dac3c4, []int{0} + return fileDescriptor_83f42520181de088, []int{0} } type MessagePathEnum_NestedPathEnum int32 @@ -67,7 +67,7 @@ func (x MessagePathEnum_NestedPathEnum) String() string { } func (MessagePathEnum_NestedPathEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_dfe1d80fc8dac3c4, []int{0, 0} + return fileDescriptor_83f42520181de088, []int{0, 0} } type MessagePathEnum struct { @@ -80,7 +80,7 @@ func (m *MessagePathEnum) Reset() { *m = MessagePathEnum{} } func (m *MessagePathEnum) String() string { return proto.CompactTextString(m) } func (*MessagePathEnum) ProtoMessage() {} func (*MessagePathEnum) Descriptor() ([]byte, []int) { - return fileDescriptor_dfe1d80fc8dac3c4, []int{0} + return fileDescriptor_83f42520181de088, []int{0} } func (m *MessagePathEnum) XXX_Unmarshal(b []byte) error { @@ -102,26 +102,27 @@ func (m *MessagePathEnum) XXX_DiscardUnknown() { var xxx_messageInfo_MessagePathEnum proto.InternalMessageInfo func init() { - proto.RegisterEnum("grpc.gateway.examples.pathenum.PathEnum", PathEnum_name, PathEnum_value) - proto.RegisterEnum("grpc.gateway.examples.pathenum.MessagePathEnum_NestedPathEnum", MessagePathEnum_NestedPathEnum_name, MessagePathEnum_NestedPathEnum_value) - proto.RegisterType((*MessagePathEnum)(nil), "grpc.gateway.examples.pathenum.MessagePathEnum") + proto.RegisterEnum("grpc.gateway.examples.internal.pathenum.PathEnum", PathEnum_name, PathEnum_value) + proto.RegisterEnum("grpc.gateway.examples.internal.pathenum.MessagePathEnum_NestedPathEnum", MessagePathEnum_NestedPathEnum_name, MessagePathEnum_NestedPathEnum_value) + proto.RegisterType((*MessagePathEnum)(nil), "grpc.gateway.examples.internal.pathenum.MessagePathEnum") } func init() { - proto.RegisterFile("examples/proto/pathenum/path_enum.proto", fileDescriptor_dfe1d80fc8dac3c4) -} - -var fileDescriptor_dfe1d80fc8dac3c4 = []byte{ - // 175 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4f, 0xad, 0x48, 0xcc, - 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x48, 0x2c, 0xc9, 0x48, - 0xcd, 0x2b, 0xcd, 0x05, 0x33, 0xe2, 0x41, 0x2c, 0x3d, 0xb0, 0x84, 0x90, 0x5c, 0x7a, 0x51, 0x41, - 0xb2, 0x5e, 0x7a, 0x62, 0x49, 0x6a, 0x79, 0x62, 0xa5, 0x1e, 0x4c, 0x97, 0x1e, 0x4c, 0xbd, 0x92, - 0x29, 0x17, 0xbf, 0x6f, 0x6a, 0x71, 0x71, 0x62, 0x7a, 0x6a, 0x40, 0x62, 0x49, 0x86, 0x2b, 0x48, - 0x48, 0x89, 0x8b, 0xcf, 0x2f, 0xb5, 0xb8, 0x24, 0x35, 0x05, 0x26, 0x22, 0xc4, 0xce, 0xc5, 0xec, - 0xee, 0xe1, 0x29, 0xc0, 0x00, 0x62, 0x78, 0x79, 0xfb, 0x08, 0x30, 0x6a, 0xc9, 0x70, 0x71, 0x20, - 0xcb, 0x3a, 0x3a, 0x39, 0x43, 0x64, 0x5d, 0x5c, 0xdd, 0x04, 0x18, 0x9d, 0x1c, 0xa2, 0xec, 0xd2, - 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x2e, 0xd0, 0x4d, 0x4d, 0xce, - 0x2f, 0xae, 0x2c, 0x2e, 0x49, 0x85, 0x72, 0xa1, 0x0e, 0xd2, 0xc7, 0xe1, 0x8d, 0x24, 0x36, 0x30, - 0xdf, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x9a, 0x10, 0xfc, 0xe8, 0x00, 0x00, 0x00, + proto.RegisterFile("examples/internal/proto/pathenum/path_enum.proto", fileDescriptor_83f42520181de088) +} + +var fileDescriptor_83f42520181de088 = []byte{ + // 187 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0xad, 0x48, 0xcc, + 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x2f, 0x28, + 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x48, 0x2c, 0xc9, 0x48, 0xcd, 0x2b, 0xcd, 0x05, 0x33, 0xe2, 0x41, + 0x2c, 0x3d, 0xb0, 0x84, 0x90, 0x7a, 0x7a, 0x51, 0x41, 0xb2, 0x5e, 0x7a, 0x62, 0x49, 0x6a, 0x79, + 0x62, 0xa5, 0x1e, 0x4c, 0xbb, 0x1e, 0x4c, 0xbb, 0x1e, 0x4c, 0xa3, 0x92, 0x29, 0x17, 0xbf, 0x6f, + 0x6a, 0x71, 0x71, 0x62, 0x7a, 0x6a, 0x40, 0x62, 0x49, 0x86, 0x2b, 0x48, 0x48, 0x89, 0x8b, 0xcf, + 0x2f, 0xb5, 0xb8, 0x24, 0x35, 0x05, 0x26, 0x22, 0xc4, 0xce, 0xc5, 0xec, 0xee, 0xe1, 0x29, 0xc0, + 0x00, 0x62, 0x78, 0x79, 0xfb, 0x08, 0x30, 0x6a, 0xc9, 0x70, 0x71, 0x20, 0xcb, 0x3a, 0x3a, 0x39, + 0x43, 0x64, 0x5d, 0x5c, 0xdd, 0x04, 0x18, 0x9d, 0x3c, 0xa3, 0xdc, 0xd3, 0x33, 0x4b, 0x32, 0x4a, + 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x4e, 0xd1, 0x4d, 0x4d, 0xce, 0x2f, 0xae, 0x2c, 0x2e, + 0x49, 0x85, 0x72, 0xa1, 0x2e, 0xd3, 0x27, 0xe4, 0xb1, 0x24, 0x36, 0x30, 0xdf, 0x18, 0x10, 0x00, + 0x00, 0xff, 0xff, 0xd1, 0xc7, 0x26, 0x4c, 0x03, 0x01, 0x00, 0x00, } diff --git a/examples/proto/pathenum/path_enum.proto b/examples/internal/proto/pathenum/path_enum.proto similarity index 71% rename from examples/proto/pathenum/path_enum.proto rename to examples/internal/proto/pathenum/path_enum.proto index 5c926ff7132..76837929de8 100644 --- a/examples/proto/pathenum/path_enum.proto +++ b/examples/internal/proto/pathenum/path_enum.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum"; -package grpc.gateway.examples.pathenum; +option go_package = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/pathenum"; +package grpc.gateway.examples.internal.pathenum; enum PathEnum { ABC = 0; diff --git a/examples/proto/sub/BUILD.bazel b/examples/internal/proto/sub/BUILD.bazel similarity index 92% rename from examples/proto/sub/BUILD.bazel rename to examples/internal/proto/sub/BUILD.bazel index 4500b5689d9..947ab3e45c7 100644 --- a/examples/proto/sub/BUILD.bazel +++ b/examples/internal/proto/sub/BUILD.bazel @@ -11,12 +11,12 @@ proto_library( go_proto_library( name = "sub_go_proto", - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub", proto = ":sub_proto", ) go_library( name = "go_default_library", embed = [":sub_go_proto"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub", ) diff --git a/examples/proto/sub/message.pb.go b/examples/internal/proto/sub/message.pb.go similarity index 65% rename from examples/proto/sub/message.pb.go rename to examples/internal/proto/sub/message.pb.go index 093f92acf00..ffca991b93d 100644 --- a/examples/proto/sub/message.pb.go +++ b/examples/internal/proto/sub/message.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/sub/message.proto +// source: examples/internal/proto/sub/message.proto package sub @@ -31,7 +31,7 @@ func (m *StringMessage) Reset() { *m = StringMessage{} } func (m *StringMessage) String() string { return proto.CompactTextString(m) } func (*StringMessage) ProtoMessage() {} func (*StringMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_fcc527d41fdbced2, []int{0} + return fileDescriptor_897f299135d10a90, []int{0} } func (m *StringMessage) XXX_Unmarshal(b []byte) error { @@ -60,19 +60,21 @@ func (m *StringMessage) GetValue() string { } func init() { - proto.RegisterType((*StringMessage)(nil), "grpc.gateway.examples.sub.StringMessage") + proto.RegisterType((*StringMessage)(nil), "grpc.gateway.examples.internal.sub.StringMessage") } -func init() { proto.RegisterFile("examples/proto/sub/message.proto", fileDescriptor_fcc527d41fdbced2) } +func init() { + proto.RegisterFile("examples/internal/proto/sub/message.proto", fileDescriptor_897f299135d10a90) +} -var fileDescriptor_fcc527d41fdbced2 = []byte{ - // 114 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xad, 0x48, 0xcc, - 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x2e, 0x4d, 0xd2, 0xcf, - 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x03, 0x8b, 0x08, 0x49, 0xa6, 0x17, 0x15, 0x24, 0xeb, - 0xa5, 0x27, 0x96, 0xa4, 0x96, 0x27, 0x56, 0xea, 0xc1, 0x94, 0xeb, 0x15, 0x97, 0x26, 0x29, 0xa9, - 0x72, 0xf1, 0x06, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0xfb, 0x42, 0x74, 0x08, 0x89, 0x70, 0xb1, 0x96, - 0x25, 0xe6, 0x94, 0xa6, 0x4a, 0x30, 0x2a, 0x30, 0x69, 0x70, 0x06, 0x41, 0x38, 0x4e, 0xac, 0x51, - 0xcc, 0xc5, 0xa5, 0x49, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6c, 0x00, 0x25, 0x33, 0x6b, 0x00, - 0x00, 0x00, +var fileDescriptor_897f299135d10a90 = []byte{ + // 126 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4c, 0xad, 0x48, 0xcc, + 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x2f, 0x28, + 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x2e, 0x4d, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, + 0x03, 0x8b, 0x08, 0x29, 0xa5, 0x17, 0x15, 0x24, 0xeb, 0xa5, 0x27, 0x96, 0xa4, 0x96, 0x27, 0x56, + 0xea, 0xc1, 0xf4, 0xe9, 0xc1, 0xf4, 0xe9, 0x15, 0x97, 0x26, 0x29, 0xa9, 0x72, 0xf1, 0x06, 0x97, + 0x14, 0x65, 0xe6, 0xa5, 0xfb, 0x42, 0xb4, 0x0a, 0x89, 0x70, 0xb1, 0x96, 0x25, 0xe6, 0x94, 0xa6, + 0x4a, 0x30, 0x2a, 0x30, 0x69, 0x70, 0x06, 0x41, 0x38, 0x4e, 0xac, 0x51, 0xcc, 0xc5, 0xa5, 0x49, + 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x14, 0x0c, 0x22, 0x7d, 0x00, 0x00, 0x00, } diff --git a/examples/proto/sub/message.proto b/examples/internal/proto/sub/message.proto similarity index 69% rename from examples/proto/sub/message.proto rename to examples/internal/proto/sub/message.proto index 7702a930d98..d3e67ee6038 100644 --- a/examples/proto/sub/message.proto +++ b/examples/internal/proto/sub/message.proto @@ -1,6 +1,6 @@ syntax = "proto2"; option go_package = "sub"; -package grpc.gateway.examples.sub; +package grpc.gateway.examples.internal.sub; message StringMessage { required string value = 1; diff --git a/examples/proto/sub2/BUILD.bazel b/examples/internal/proto/sub2/BUILD.bazel similarity index 92% rename from examples/proto/sub2/BUILD.bazel rename to examples/internal/proto/sub2/BUILD.bazel index 780d550ccbb..570d10c3c9f 100644 --- a/examples/proto/sub2/BUILD.bazel +++ b/examples/internal/proto/sub2/BUILD.bazel @@ -11,12 +11,12 @@ proto_library( go_proto_library( name = "sub2_go_proto", - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub2", proto = ":sub2_proto", ) go_library( name = "go_default_library", embed = [":sub2_go_proto"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub2", ) diff --git a/examples/proto/sub2/message.pb.go b/examples/internal/proto/sub2/message.pb.go similarity index 63% rename from examples/proto/sub2/message.pb.go rename to examples/internal/proto/sub2/message.pb.go index afda91bd768..60925d0eee5 100644 --- a/examples/proto/sub2/message.pb.go +++ b/examples/internal/proto/sub2/message.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: examples/proto/sub2/message.proto +// source: examples/internal/proto/sub2/message.proto package sub2 @@ -31,7 +31,7 @@ func (m *IdMessage) Reset() { *m = IdMessage{} } func (m *IdMessage) String() string { return proto.CompactTextString(m) } func (*IdMessage) ProtoMessage() {} func (*IdMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_3490899b8414eb79, []int{0} + return fileDescriptor_050dd68add910843, []int{0} } func (m *IdMessage) XXX_Unmarshal(b []byte) error { @@ -63,17 +63,19 @@ func init() { proto.RegisterType((*IdMessage)(nil), "sub2.IdMessage") } -func init() { proto.RegisterFile("examples/proto/sub2/message.proto", fileDescriptor_3490899b8414eb79) } +func init() { + proto.RegisterFile("examples/internal/proto/sub2/message.proto", fileDescriptor_050dd68add910843) +} -var fileDescriptor_3490899b8414eb79 = []byte{ - // 130 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xad, 0x48, 0xcc, - 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, - 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x03, 0x0b, 0x09, 0xb1, 0x80, 0xc4, 0x94, 0xe4, - 0xb9, 0x38, 0x3d, 0x53, 0x7c, 0x21, 0x12, 0x42, 0x42, 0x5c, 0x2c, 0xa5, 0xa5, 0x99, 0x29, 0x12, - 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0xb6, 0x93, 0x4d, 0x94, 0x55, 0x7a, 0x66, 0x49, 0x46, - 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x51, 0x41, 0xb2, 0x6e, 0x6a, 0x72, 0x7e, 0x71, - 0x65, 0x71, 0x49, 0x2a, 0x94, 0x9b, 0x9e, 0x58, 0x92, 0x5a, 0x9e, 0x58, 0xa9, 0x8f, 0xc5, 0xca, - 0x24, 0x36, 0x30, 0xdb, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x49, 0xe7, 0x2f, 0x90, 0x00, - 0x00, 0x00, +var fileDescriptor_050dd68add910843 = []byte{ + // 139 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4a, 0xad, 0x48, 0xcc, + 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x2f, 0x28, + 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, + 0xd5, 0x03, 0x0b, 0x09, 0xb1, 0x80, 0xc4, 0x94, 0xe4, 0xb9, 0x38, 0x3d, 0x53, 0x7c, 0x21, 0x12, + 0x42, 0x42, 0x5c, 0x2c, 0xa5, 0xa5, 0x99, 0x29, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, + 0xb6, 0x93, 0x6b, 0x94, 0x73, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, + 0x7a, 0x51, 0x41, 0xb2, 0x6e, 0x6a, 0x72, 0x7e, 0x71, 0x65, 0x71, 0x49, 0x2a, 0x94, 0x9b, 0x9e, + 0x58, 0x92, 0x5a, 0x9e, 0x58, 0xa9, 0x8f, 0xcf, 0xee, 0x24, 0x36, 0x30, 0xdb, 0x18, 0x10, 0x00, + 0x00, 0xff, 0xff, 0xdd, 0xb8, 0xdb, 0x58, 0xa2, 0x00, 0x00, 0x00, } diff --git a/examples/proto/sub2/message.proto b/examples/internal/proto/sub2/message.proto similarity index 83% rename from examples/proto/sub2/message.proto rename to examples/internal/proto/sub2/message.proto index 59c9bd9f9fc..77f10e80315 100644 --- a/examples/proto/sub2/message.proto +++ b/examples/internal/proto/sub2/message.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2"; +option go_package = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub2"; package sub2; message IdMessage { diff --git a/examples/server/BUILD.bazel b/examples/internal/server/BUILD.bazel similarity index 87% rename from examples/server/BUILD.bazel rename to examples/internal/server/BUILD.bazel index e5b6721790a..4615adb1494 100644 --- a/examples/server/BUILD.bazel +++ b/examples/internal/server/BUILD.bazel @@ -14,11 +14,11 @@ go_library( "responsebody.go", "unannotatedecho.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/server", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/server", deps = [ - "//examples/proto/examplepb:go_default_library", - "//examples/proto/sub:go_default_library", - "//examples/proto/sub2:go_default_library", + "//examples/internal/proto/examplepb:go_default_library", + "//examples/internal/proto/sub:go_default_library", + "//examples/internal/proto/sub2:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", diff --git a/examples/server/a_bit_of_everything.go b/examples/internal/server/a_bit_of_everything.go similarity index 97% rename from examples/server/a_bit_of_everything.go rename to examples/internal/server/a_bit_of_everything.go index 0b87ce02639..ee686c22cd0 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/internal/server/a_bit_of_everything.go @@ -11,9 +11,9 @@ import ( "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/empty" "github.com/golang/protobuf/ptypes/wrappers" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/sub2" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub" + "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/sub2" "github.com/rogpeppe/fastuuid" "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc" diff --git a/examples/server/echo.go b/examples/internal/server/echo.go similarity index 91% rename from examples/server/echo.go rename to examples/internal/server/echo.go index 249aeb0b211..8b749b9060e 100644 --- a/examples/server/echo.go +++ b/examples/internal/server/echo.go @@ -4,7 +4,7 @@ import ( "context" "github.com/golang/glog" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" "google.golang.org/grpc" "google.golang.org/grpc/metadata" ) diff --git a/examples/server/fieldmask_helper.go b/examples/internal/server/fieldmask_helper.go similarity index 100% rename from examples/server/fieldmask_helper.go rename to examples/internal/server/fieldmask_helper.go diff --git a/examples/server/fieldmask_helper_test.go b/examples/internal/server/fieldmask_helper_test.go similarity index 100% rename from examples/server/fieldmask_helper_test.go rename to examples/internal/server/fieldmask_helper_test.go diff --git a/examples/server/flow_combination.go b/examples/internal/server/flow_combination.go similarity index 96% rename from examples/server/flow_combination.go rename to examples/internal/server/flow_combination.go index 516510f4bc6..58d68053a79 100644 --- a/examples/server/flow_combination.go +++ b/examples/internal/server/flow_combination.go @@ -4,7 +4,7 @@ import ( "context" "io" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" ) type flowCombinationServer struct{} diff --git a/examples/server/main.go b/examples/internal/server/main.go similarity index 91% rename from examples/server/main.go rename to examples/internal/server/main.go index d595c367613..5f7912eff3e 100644 --- a/examples/server/main.go +++ b/examples/internal/server/main.go @@ -5,7 +5,7 @@ import ( "net" "github.com/golang/glog" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" "google.golang.org/grpc" ) diff --git a/examples/server/non_standard_names.go b/examples/internal/server/non_standard_names.go similarity index 93% rename from examples/server/non_standard_names.go rename to examples/internal/server/non_standard_names.go index c448259a909..414e3d8e0de 100644 --- a/examples/server/non_standard_names.go +++ b/examples/internal/server/non_standard_names.go @@ -4,7 +4,7 @@ import ( "context" "github.com/golang/glog" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" ) // Implements NonStandardServiceServer diff --git a/examples/server/responsebody.go b/examples/internal/server/responsebody.go similarity index 93% rename from examples/server/responsebody.go rename to examples/internal/server/responsebody.go index e5dc800a423..8df32ede5fa 100644 --- a/examples/server/responsebody.go +++ b/examples/internal/server/responsebody.go @@ -3,7 +3,7 @@ package server import ( "context" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" ) // Implements of ResponseBodyServiceServer diff --git a/examples/server/unannotatedecho.go b/examples/internal/server/unannotatedecho.go similarity index 92% rename from examples/server/unannotatedecho.go rename to examples/internal/server/unannotatedecho.go index bf3bff0dfc1..b99392bf491 100644 --- a/examples/server/unannotatedecho.go +++ b/examples/internal/server/unannotatedecho.go @@ -2,8 +2,9 @@ package server import ( "context" + "github.com/golang/glog" - examples "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb" "google.golang.org/grpc" "google.golang.org/grpc/metadata" ) diff --git a/examples/proto/examplepb/unannotated_echo_service.yaml b/examples/proto/examplepb/unannotated_echo_service.yaml deleted file mode 100644 index cd3a978d897..00000000000 --- a/examples/proto/examplepb/unannotated_echo_service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -type: google.api.Service -config_version: 3 - -http: - rules: - - selector: grpc.gateway.examples.examplepb.UnannotatedEchoService.Echo - post: "/v1/example/echo/{id}" - additional_bindings: - - get: "/v1/example/echo/{id}/{num}" - - selector: grpc.gateway.examples.examplepb.UnannotatedEchoService.EchoBody - post: "/v1/example/echo_body" - body: "*" - - selector: grpc.gateway.examples.examplepb.UnannotatedEchoService.EchoDelete - delete: "/v1/example/echo_delete" - diff --git a/fuzzit.sh b/fuzzit.sh index e5df5f3f843..43c0f23918b 100755 --- a/fuzzit.sh +++ b/fuzzit.sh @@ -9,9 +9,9 @@ cd go-fuzz go get ./... go build ./... -#go get -v -u ./protoc-gen-grpc-gateway/httprule +#go get -v -u ./internal/httprule cd /src/grpc-gateway -go-fuzz-build -libfuzzer -o parse-http-rule.a ./protoc-gen-grpc-gateway/httprule +go-fuzz-build -libfuzzer -o parse-http-rule.a ./internal/httprule clang-9 -fsanitize=fuzzer parse-http-rule.a -o parse-http-rule wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.29/fuzzit_Linux_x86_64 diff --git a/codegenerator/BUILD.bazel b/internal/codegenerator/BUILD.bazel similarity index 81% rename from codegenerator/BUILD.bazel rename to internal/codegenerator/BUILD.bazel index 651177fa157..4682f41e46d 100644 --- a/codegenerator/BUILD.bazel +++ b/internal/codegenerator/BUILD.bazel @@ -1,6 +1,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -package(default_visibility = ["//:generators"]) +package(default_visibility = ["//visibility:public"]) go_library( name = "go_default_library", @@ -8,7 +8,7 @@ go_library( "doc.go", "parse_req.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/codegenerator", + importpath = "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator", deps = [ "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", diff --git a/codegenerator/doc.go b/internal/codegenerator/doc.go similarity index 100% rename from codegenerator/doc.go rename to internal/codegenerator/doc.go diff --git a/codegenerator/parse_req.go b/internal/codegenerator/parse_req.go similarity index 100% rename from codegenerator/parse_req.go rename to internal/codegenerator/parse_req.go diff --git a/codegenerator/parse_req_test.go b/internal/codegenerator/parse_req_test.go similarity index 95% rename from codegenerator/parse_req_test.go rename to internal/codegenerator/parse_req_test.go index 5f37aad9589..c6d439c8047 100644 --- a/codegenerator/parse_req_test.go +++ b/internal/codegenerator/parse_req_test.go @@ -10,7 +10,7 @@ import ( "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/codegenerator" + "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator" ) var parseReqTests = []struct { diff --git a/protoc-gen-grpc-gateway/descriptor/BUILD.bazel b/internal/descriptor/BUILD.bazel similarity index 82% rename from protoc-gen-grpc-gateway/descriptor/BUILD.bazel rename to internal/descriptor/BUILD.bazel index cfbdc277a8c..8d1df906f79 100644 --- a/protoc-gen-grpc-gateway/descriptor/BUILD.bazel +++ b/internal/descriptor/BUILD.bazel @@ -1,6 +1,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -package(default_visibility = ["//:generators"]) +package(default_visibility = ["//visibility:public"]) go_library( name = "go_default_library", @@ -11,9 +11,9 @@ go_library( "services.go", "types.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor", + importpath = "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor", deps = [ - "//protoc-gen-grpc-gateway/httprule:go_default_library", + "//internal/httprule:go_default_library", "@com_github_ghodss_yaml//:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", @@ -36,7 +36,7 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//protoc-gen-grpc-gateway/httprule:go_default_library", + "//internal/httprule:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", diff --git a/protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go b/internal/descriptor/grpc_api_configuration.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go rename to internal/descriptor/grpc_api_configuration.go diff --git a/protoc-gen-grpc-gateway/descriptor/grpc_api_configuration_test.go b/internal/descriptor/grpc_api_configuration_test.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/grpc_api_configuration_test.go rename to internal/descriptor/grpc_api_configuration_test.go diff --git a/protoc-gen-grpc-gateway/descriptor/grpc_api_service.go b/internal/descriptor/grpc_api_service.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/grpc_api_service.go rename to internal/descriptor/grpc_api_service.go diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/internal/descriptor/registry.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/registry.go rename to internal/descriptor/registry.go diff --git a/protoc-gen-grpc-gateway/descriptor/registry_test.go b/internal/descriptor/registry_test.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/registry_test.go rename to internal/descriptor/registry_test.go diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/internal/descriptor/services.go similarity index 98% rename from protoc-gen-grpc-gateway/descriptor/services.go rename to internal/descriptor/services.go index 8916d316d18..2f9103eef4f 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/internal/descriptor/services.go @@ -7,7 +7,7 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" options "google.golang.org/genproto/googleapis/api/annotations" ) @@ -20,7 +20,7 @@ func (r *Registry) loadServices(file *File) error { for _, sd := range file.GetService() { glog.V(2).Infof("Registering %s", sd.GetName()) svc := &Service{ - File: file, + File: file, ServiceDescriptorProto: sd, } for _, md := range sd.GetMethod() { diff --git a/protoc-gen-grpc-gateway/descriptor/services_test.go b/internal/descriptor/services_test.go similarity index 99% rename from protoc-gen-grpc-gateway/descriptor/services_test.go rename to internal/descriptor/services_test.go index 1ccb8fbef0a..26329fd2a08 100644 --- a/protoc-gen-grpc-gateway/descriptor/services_test.go +++ b/internal/descriptor/services_test.go @@ -6,7 +6,7 @@ import ( "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" ) func compilePath(t *testing.T, path string) httprule.Template { diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/internal/descriptor/types.go similarity index 99% rename from protoc-gen-grpc-gateway/descriptor/types.go rename to internal/descriptor/types.go index 4aa75f85dbf..fcdb9940b47 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/internal/descriptor/types.go @@ -6,7 +6,7 @@ import ( "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" ) // IsWellKnownType returns true if the provided fully qualified type name is considered 'well-known'. diff --git a/protoc-gen-grpc-gateway/descriptor/types_test.go b/internal/descriptor/types_test.go similarity index 100% rename from protoc-gen-grpc-gateway/descriptor/types_test.go rename to internal/descriptor/types_test.go diff --git a/protoc-gen-grpc-gateway/generator/BUILD.bazel b/internal/generator/BUILD.bazel similarity index 51% rename from protoc-gen-grpc-gateway/generator/BUILD.bazel rename to internal/generator/BUILD.bazel index 6cb2162d847..17f3d31c5dd 100644 --- a/protoc-gen-grpc-gateway/generator/BUILD.bazel +++ b/internal/generator/BUILD.bazel @@ -1,13 +1,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") -package(default_visibility = ["//:generators"]) +package(default_visibility = ["//visibility:public"]) go_library( name = "go_default_library", srcs = ["generator.go"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator", + importpath = "github.com/grpc-ecosystem/grpc-gateway/internal/generator", deps = [ - "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//internal/descriptor:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", ], ) diff --git a/protoc-gen-grpc-gateway/generator/generator.go b/internal/generator/generator.go similarity index 83% rename from protoc-gen-grpc-gateway/generator/generator.go rename to internal/generator/generator.go index df55da44445..5d03cff15d0 100644 --- a/protoc-gen-grpc-gateway/generator/generator.go +++ b/internal/generator/generator.go @@ -3,7 +3,7 @@ package generator import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" ) // Generator is an abstraction of code generators. diff --git a/protoc-gen-grpc-gateway/httprule/BUILD.bazel b/internal/httprule/BUILD.bazel similarity index 81% rename from protoc-gen-grpc-gateway/httprule/BUILD.bazel rename to internal/httprule/BUILD.bazel index 89f94a14b45..2064217e6a6 100644 --- a/protoc-gen-grpc-gateway/httprule/BUILD.bazel +++ b/internal/httprule/BUILD.bazel @@ -1,6 +1,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -package(default_visibility = ["//:generators"]) +package(default_visibility = ["//visibility:public"]) go_library( name = "go_default_library", @@ -9,7 +9,7 @@ go_library( "parse.go", "types.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule", + importpath = "github.com/grpc-ecosystem/grpc-gateway/internal/httprule", deps = [ "//utilities:go_default_library", "@com_github_golang_glog//:go_default_library", diff --git a/protoc-gen-grpc-gateway/httprule/compile.go b/internal/httprule/compile.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/compile.go rename to internal/httprule/compile.go diff --git a/protoc-gen-grpc-gateway/httprule/compile_test.go b/internal/httprule/compile_test.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/compile_test.go rename to internal/httprule/compile_test.go diff --git a/protoc-gen-grpc-gateway/httprule/fuzz.go b/internal/httprule/fuzz.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/fuzz.go rename to internal/httprule/fuzz.go diff --git a/protoc-gen-grpc-gateway/httprule/parse.go b/internal/httprule/parse.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/parse.go rename to internal/httprule/parse.go diff --git a/protoc-gen-grpc-gateway/httprule/parse_test.go b/internal/httprule/parse_test.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/parse_test.go rename to internal/httprule/parse_test.go diff --git a/protoc-gen-grpc-gateway/httprule/types.go b/internal/httprule/types.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/types.go rename to internal/httprule/types.go diff --git a/protoc-gen-grpc-gateway/httprule/types_test.go b/internal/httprule/types_test.go similarity index 100% rename from protoc-gen-grpc-gateway/httprule/types_test.go rename to internal/httprule/types_test.go diff --git a/protoc-gen-grpc-gateway/BUILD.bazel b/protoc-gen-grpc-gateway/BUILD.bazel index cb772efe9e1..711e038c368 100644 --- a/protoc-gen-grpc-gateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/BUILD.bazel @@ -8,9 +8,9 @@ go_library( srcs = ["main.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway", deps = [ - "//codegenerator:go_default_library", - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-grpc-gateway/gengateway:go_default_library", + "//internal/codegenerator:go_default_library", + "//internal/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/internal/gengateway:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", diff --git a/protoc-gen-grpc-gateway/gengateway/BUILD.bazel b/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel similarity index 77% rename from protoc-gen-grpc-gateway/gengateway/BUILD.bazel rename to protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel index 316010f500d..b3528a9abb3 100644 --- a/protoc-gen-grpc-gateway/gengateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel @@ -9,10 +9,10 @@ go_library( "generator.go", "template.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway", + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/internal/gengateway", deps = [ - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-grpc-gateway/generator:go_default_library", + "//internal/descriptor:go_default_library", + "//internal/generator:go_default_library", "//utilities:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", @@ -30,8 +30,8 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-grpc-gateway/httprule:go_default_library", + "//internal/descriptor:go_default_library", + "//internal/httprule:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], diff --git a/protoc-gen-grpc-gateway/gengateway/doc.go b/protoc-gen-grpc-gateway/internal/gengateway/doc.go similarity index 100% rename from protoc-gen-grpc-gateway/gengateway/doc.go rename to protoc-gen-grpc-gateway/internal/gengateway/doc.go diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/internal/gengateway/generator.go similarity index 96% rename from protoc-gen-grpc-gateway/gengateway/generator.go rename to protoc-gen-grpc-gateway/internal/gengateway/generator.go index 0b6bfbd2b93..d687f32be5b 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/generator.go @@ -11,8 +11,8 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/internal/generator" ) var ( diff --git a/protoc-gen-grpc-gateway/gengateway/generator_test.go b/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go similarity index 98% rename from protoc-gen-grpc-gateway/gengateway/generator_test.go rename to protoc-gen-grpc-gateway/internal/gengateway/generator_test.go index 39e5f141dbe..99d8ae0125d 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go @@ -7,7 +7,7 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" ) func newExampleFileDescriptor() *descriptor.File { diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/internal/gengateway/template.go similarity index 99% rename from protoc-gen-grpc-gateway/gengateway/template.go rename to protoc-gen-grpc-gateway/internal/gengateway/template.go index 1d3d3ca8f19..fd5cc11f9be 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template.go @@ -9,7 +9,7 @@ import ( "github.com/golang/glog" generator2 "github.com/golang/protobuf/protoc-gen-go/generator" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/utilities" ) diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go similarity index 99% rename from protoc-gen-grpc-gateway/gengateway/template_test.go rename to protoc-gen-grpc-gateway/internal/gengateway/template_test.go index 69809792b4c..628d53220dd 100644 --- a/protoc-gen-grpc-gateway/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go @@ -6,8 +6,8 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 291ba7deb2f..f3ed3ae726e 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -17,9 +17,9 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/codegenerator" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway" + "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/internal/gengateway" ) var ( diff --git a/protoc-gen-swagger/BUILD.bazel b/protoc-gen-swagger/BUILD.bazel index d5a1d05fcc7..0aacac9cea5 100644 --- a/protoc-gen-swagger/BUILD.bazel +++ b/protoc-gen-swagger/BUILD.bazel @@ -7,9 +7,9 @@ go_library( srcs = ["main.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger", deps = [ - "//codegenerator:go_default_library", - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-swagger/genswagger:go_default_library", + "//internal/codegenerator:go_default_library", + "//internal/descriptor:go_default_library", + "//protoc-gen-swagger/internal/genswagger:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/internal/genswagger/BUILD.bazel similarity index 84% rename from protoc-gen-swagger/genswagger/BUILD.bazel rename to protoc-gen-swagger/internal/genswagger/BUILD.bazel index c89eb04477d..0ef9926ff20 100644 --- a/protoc-gen-swagger/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/internal/genswagger/BUILD.bazel @@ -12,11 +12,11 @@ go_library( "template.go", "types.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger", + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/internal/genswagger", deps = [ "//internal:go_default_library", - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-grpc-gateway/generator:go_default_library", + "//internal/descriptor:go_default_library", + "//internal/generator:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", @@ -36,8 +36,8 @@ go_test( srcs = ["template_test.go"], embed = [":go_default_library"], deps = [ - "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-grpc-gateway/httprule:go_default_library", + "//internal/descriptor:go_default_library", + "//internal/httprule:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:any_go_proto", diff --git a/protoc-gen-swagger/genswagger/doc.go b/protoc-gen-swagger/internal/genswagger/doc.go similarity index 100% rename from protoc-gen-swagger/genswagger/doc.go rename to protoc-gen-swagger/internal/genswagger/doc.go diff --git a/protoc-gen-swagger/genswagger/generator.go b/protoc-gen-swagger/internal/genswagger/generator.go similarity index 97% rename from protoc-gen-swagger/genswagger/generator.go rename to protoc-gen-swagger/internal/genswagger/generator.go index ecf1135fde7..6e4a554a842 100644 --- a/protoc-gen-swagger/genswagger/generator.go +++ b/protoc-gen-swagger/internal/genswagger/generator.go @@ -16,8 +16,8 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/golang/protobuf/ptypes/any" "github.com/grpc-ecosystem/grpc-gateway/internal" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/internal/generator" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) diff --git a/protoc-gen-swagger/genswagger/helpers.go b/protoc-gen-swagger/internal/genswagger/helpers.go similarity index 100% rename from protoc-gen-swagger/genswagger/helpers.go rename to protoc-gen-swagger/internal/genswagger/helpers.go diff --git a/protoc-gen-swagger/genswagger/helpers_go111_old.go b/protoc-gen-swagger/internal/genswagger/helpers_go111_old.go similarity index 100% rename from protoc-gen-swagger/genswagger/helpers_go111_old.go rename to protoc-gen-swagger/internal/genswagger/helpers_go111_old.go diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/internal/genswagger/template.go similarity index 99% rename from protoc-gen-swagger/genswagger/template.go rename to protoc-gen-swagger/internal/genswagger/template.go index 9e0b5ce58af..320e3f1b6e7 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/internal/genswagger/template.go @@ -20,7 +20,7 @@ import ( pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" structpb "github.com/golang/protobuf/ptypes/struct" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/internal/genswagger/template_test.go similarity index 99% rename from protoc-gen-swagger/genswagger/template_test.go rename to protoc-gen-swagger/internal/genswagger/template_test.go index cda39688835..9c8c913f33f 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/internal/genswagger/template_test.go @@ -12,8 +12,8 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/golang/protobuf/ptypes/any" structpb "github.com/golang/protobuf/ptypes/struct" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/internal/genswagger/types.go similarity index 99% rename from protoc-gen-swagger/genswagger/types.go rename to protoc-gen-swagger/internal/genswagger/types.go index 255f53c77ca..d46f14cf6a1 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/internal/genswagger/types.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" ) type param struct { diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index f25e431b553..bbe25649f46 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -9,9 +9,9 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/codegenerator" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger" + "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator" + "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/internal/genswagger" ) var ( diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index 819c45a7657..c4d18f624a8 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -64,8 +64,8 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//examples/proto/examplepb:go_default_library", "//internal:go_default_library", + "//runtime/internal/examplepb:go_default_library", "//utilities:go_default_library", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", "@com_github_golang_protobuf//proto:go_default_library", diff --git a/runtime/handler_test.go b/runtime/handler_test.go index c9caa25cfc0..f9a17916da1 100644 --- a/runtime/handler_test.go +++ b/runtime/handler_test.go @@ -8,10 +8,11 @@ import ( "testing" "context" + "github.com/golang/protobuf/proto" - pb "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" "github.com/grpc-ecosystem/grpc-gateway/internal" "github.com/grpc-ecosystem/grpc-gateway/runtime" + pb "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/runtime/internal/examplepb/BUILD.bazel b/runtime/internal/examplepb/BUILD.bazel new file mode 100644 index 00000000000..0d36f524d8e --- /dev/null +++ b/runtime/internal/examplepb/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "examplepb_proto", + srcs = [ + "example.proto", + ], + deps = [ + "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +go_proto_library( + name = "examplepb_go_proto", + importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb", + proto = ":examplepb_proto", + deps = [ + "@com_github_golang_protobuf//descriptor:go_default_library_gen", # keep + ], +) + +go_library( + name = "go_default_library", + embed = [":examplepb_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb", +) diff --git a/runtime/internal/examplepb/example.pb.go b/runtime/internal/examplepb/example.pb.go new file mode 100644 index 00000000000..16b27aa6214 --- /dev/null +++ b/runtime/internal/examplepb/example.pb.go @@ -0,0 +1,807 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: runtime/internal/examplepb/example.proto + +package examplepb + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + empty "github.com/golang/protobuf/ptypes/empty" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// NumericEnum is one or zero. +type NumericEnum int32 + +const ( + // ZERO means 0 + NumericEnum_ZERO NumericEnum = 0 + // ONE means 1 + NumericEnum_ONE NumericEnum = 1 +) + +var NumericEnum_name = map[int32]string{ + 0: "ZERO", + 1: "ONE", +} + +var NumericEnum_value = map[string]int32{ + "ZERO": 0, + "ONE": 1, +} + +func (x NumericEnum) String() string { + return proto.EnumName(NumericEnum_name, int32(x)) +} + +func (NumericEnum) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_411aaf1bcbdb81d6, []int{0} +} + +// DeepEnum is one or zero. +type ABitOfEverything_Nested_DeepEnum int32 + +const ( + // FALSE is false. + ABitOfEverything_Nested_FALSE ABitOfEverything_Nested_DeepEnum = 0 + // TRUE is true. + ABitOfEverything_Nested_TRUE ABitOfEverything_Nested_DeepEnum = 1 +) + +var ABitOfEverything_Nested_DeepEnum_name = map[int32]string{ + 0: "FALSE", + 1: "TRUE", +} + +var ABitOfEverything_Nested_DeepEnum_value = map[string]int32{ + "FALSE": 0, + "TRUE": 1, +} + +func (x ABitOfEverything_Nested_DeepEnum) String() string { + return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) +} + +func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_411aaf1bcbdb81d6, []int{1, 0, 0} +} + +type RepeatedResponseBodyOut_Response_ResponseType int32 + +const ( + // UNKNOWN + RepeatedResponseBodyOut_Response_UNKNOWN RepeatedResponseBodyOut_Response_ResponseType = 0 + // A is 1 + RepeatedResponseBodyOut_Response_A RepeatedResponseBodyOut_Response_ResponseType = 1 + // B is 2 + RepeatedResponseBodyOut_Response_B RepeatedResponseBodyOut_Response_ResponseType = 2 +) + +var RepeatedResponseBodyOut_Response_ResponseType_name = map[int32]string{ + 0: "UNKNOWN", + 1: "A", + 2: "B", +} + +var RepeatedResponseBodyOut_Response_ResponseType_value = map[string]int32{ + "UNKNOWN": 0, + "A": 1, + "B": 2, +} + +func (x RepeatedResponseBodyOut_Response_ResponseType) String() string { + return proto.EnumName(RepeatedResponseBodyOut_Response_ResponseType_name, int32(x)) +} + +func (RepeatedResponseBodyOut_Response_ResponseType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_411aaf1bcbdb81d6, []int{3, 0, 0} +} + +// SimpleMessage represents a simple message sent to the Echo service. +type SimpleMessage struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SimpleMessage) Reset() { *m = SimpleMessage{} } +func (m *SimpleMessage) String() string { return proto.CompactTextString(m) } +func (*SimpleMessage) ProtoMessage() {} +func (*SimpleMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_411aaf1bcbdb81d6, []int{0} +} + +func (m *SimpleMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SimpleMessage.Unmarshal(m, b) +} +func (m *SimpleMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SimpleMessage.Marshal(b, m, deterministic) +} +func (m *SimpleMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleMessage.Merge(m, src) +} +func (m *SimpleMessage) XXX_Size() int { + return xxx_messageInfo_SimpleMessage.Size(m) +} +func (m *SimpleMessage) XXX_DiscardUnknown() { + xxx_messageInfo_SimpleMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_SimpleMessage proto.InternalMessageInfo + +func (m *SimpleMessage) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +type ABitOfEverything struct { + SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested,proto3" json:"single_nested,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested,proto3" json:"nested,omitempty"` + FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` + Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` + Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value,proto3" json:"fixed64_value,omitempty"` + Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value,proto3" json:"fixed32_value,omitempty"` + BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` + BytesValue []byte `protobuf:"bytes,29,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` + EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,proto3,enum=grpc.gateway.runtime.internal.examplepb.NumericEnum" json:"enum_value,omitempty"` + Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value,proto3" json:"sfixed32_value,omitempty"` + Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value,proto3" json:"sfixed64_value,omitempty"` + Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value,proto3" json:"sint32_value,omitempty"` + Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value,proto3" json:"sint64_value,omitempty"` + RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue,proto3" json:"repeated_string_value,omitempty"` + // Types that are valid to be assigned to OneofValue: + // *ABitOfEverything_OneofEmpty + // *ABitOfEverything_OneofString + OneofValue isABitOfEverything_OneofValue `protobuf_oneof:"oneof_value"` + MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue,proto3" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=grpc.gateway.runtime.internal.examplepb.NumericEnum"` + MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue,proto3" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue,proto3" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue,proto3" json:"nonConventionalNameValue,omitempty"` + TimestampValue *timestamp.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue,proto3" json:"timestamp_value,omitempty"` + // repeated enum value. it is comma-separated in query + RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,proto3,enum=grpc.gateway.runtime.internal.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` + // repeated numeric enum comment (This comment is overridden by the field annotation) + RepeatedEnumAnnotation []NumericEnum `protobuf:"varint,32,rep,packed,name=repeated_enum_annotation,json=repeatedEnumAnnotation,proto3,enum=grpc.gateway.runtime.internal.examplepb.NumericEnum" json:"repeated_enum_annotation,omitempty"` + // numeric enum comment (This comment is overridden by the field annotation) + EnumValueAnnotation NumericEnum `protobuf:"varint,33,opt,name=enum_value_annotation,json=enumValueAnnotation,proto3,enum=grpc.gateway.runtime.internal.examplepb.NumericEnum" json:"enum_value_annotation,omitempty"` + // repeated string comment (This comment is overridden by the field annotation) + RepeatedStringAnnotation []string `protobuf:"bytes,34,rep,name=repeated_string_annotation,json=repeatedStringAnnotation,proto3" json:"repeated_string_annotation,omitempty"` + // repeated nested object comment (This comment is overridden by the field annotation) + RepeatedNestedAnnotation []*ABitOfEverything_Nested `protobuf:"bytes,35,rep,name=repeated_nested_annotation,json=repeatedNestedAnnotation,proto3" json:"repeated_nested_annotation,omitempty"` + // nested object comments (This comment is overridden by the field annotation) + NestedAnnotation *ABitOfEverything_Nested `protobuf:"bytes,36,opt,name=nested_annotation,json=nestedAnnotation,proto3" json:"nested_annotation,omitempty"` + Int64OverrideType int64 `protobuf:"varint,37,opt,name=int64_override_type,json=int64OverrideType,proto3" json:"int64_override_type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } +func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } +func (*ABitOfEverything) ProtoMessage() {} +func (*ABitOfEverything) Descriptor() ([]byte, []int) { + return fileDescriptor_411aaf1bcbdb81d6, []int{1} +} + +func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) +} +func (m *ABitOfEverything) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ABitOfEverything.Marshal(b, m, deterministic) +} +func (m *ABitOfEverything) XXX_Merge(src proto.Message) { + xxx_messageInfo_ABitOfEverything.Merge(m, src) +} +func (m *ABitOfEverything) XXX_Size() int { + return xxx_messageInfo_ABitOfEverything.Size(m) +} +func (m *ABitOfEverything) XXX_DiscardUnknown() { + xxx_messageInfo_ABitOfEverything.DiscardUnknown(m) +} + +var xxx_messageInfo_ABitOfEverything proto.InternalMessageInfo + +func (m *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested { + if m != nil { + return m.SingleNested + } + return nil +} + +func (m *ABitOfEverything) GetUuid() string { + if m != nil { + return m.Uuid + } + return "" +} + +func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { + if m != nil { + return m.Nested + } + return nil +} + +func (m *ABitOfEverything) GetFloatValue() float32 { + if m != nil { + return m.FloatValue + } + return 0 +} + +func (m *ABitOfEverything) GetDoubleValue() float64 { + if m != nil { + return m.DoubleValue + } + return 0 +} + +func (m *ABitOfEverything) GetInt64Value() int64 { + if m != nil { + return m.Int64Value + } + return 0 +} + +func (m *ABitOfEverything) GetUint64Value() uint64 { + if m != nil { + return m.Uint64Value + } + return 0 +} + +func (m *ABitOfEverything) GetInt32Value() int32 { + if m != nil { + return m.Int32Value + } + return 0 +} + +func (m *ABitOfEverything) GetFixed64Value() uint64 { + if m != nil { + return m.Fixed64Value + } + return 0 +} + +func (m *ABitOfEverything) GetFixed32Value() uint32 { + if m != nil { + return m.Fixed32Value + } + return 0 +} + +func (m *ABitOfEverything) GetBoolValue() bool { + if m != nil { + return m.BoolValue + } + return false +} + +func (m *ABitOfEverything) GetStringValue() string { + if m != nil { + return m.StringValue + } + return "" +} + +func (m *ABitOfEverything) GetBytesValue() []byte { + if m != nil { + return m.BytesValue + } + return nil +} + +func (m *ABitOfEverything) GetUint32Value() uint32 { + if m != nil { + return m.Uint32Value + } + return 0 +} + +func (m *ABitOfEverything) GetEnumValue() NumericEnum { + if m != nil { + return m.EnumValue + } + return NumericEnum_ZERO +} + +func (m *ABitOfEverything) GetSfixed32Value() int32 { + if m != nil { + return m.Sfixed32Value + } + return 0 +} + +func (m *ABitOfEverything) GetSfixed64Value() int64 { + if m != nil { + return m.Sfixed64Value + } + return 0 +} + +func (m *ABitOfEverything) GetSint32Value() int32 { + if m != nil { + return m.Sint32Value + } + return 0 +} + +func (m *ABitOfEverything) GetSint64Value() int64 { + if m != nil { + return m.Sint64Value + } + return 0 +} + +func (m *ABitOfEverything) GetRepeatedStringValue() []string { + if m != nil { + return m.RepeatedStringValue + } + return nil +} + +type isABitOfEverything_OneofValue interface { + isABitOfEverything_OneofValue() +} + +type ABitOfEverything_OneofEmpty struct { + OneofEmpty *empty.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,proto3,oneof"` +} + +type ABitOfEverything_OneofString struct { + OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,proto3,oneof"` +} + +func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} + +func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} + +func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { + if m != nil { + return m.OneofValue + } + return nil +} + +func (m *ABitOfEverything) GetOneofEmpty() *empty.Empty { + if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok { + return x.OneofEmpty + } + return nil +} + +func (m *ABitOfEverything) GetOneofString() string { + if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofString); ok { + return x.OneofString + } + return "" +} + +func (m *ABitOfEverything) GetMapValue() map[string]NumericEnum { + if m != nil { + return m.MapValue + } + return nil +} + +func (m *ABitOfEverything) GetMappedStringValue() map[string]string { + if m != nil { + return m.MappedStringValue + } + return nil +} + +func (m *ABitOfEverything) GetMappedNestedValue() map[string]*ABitOfEverything_Nested { + if m != nil { + return m.MappedNestedValue + } + return nil +} + +func (m *ABitOfEverything) GetNonConventionalNameValue() string { + if m != nil { + return m.NonConventionalNameValue + } + return "" +} + +func (m *ABitOfEverything) GetTimestampValue() *timestamp.Timestamp { + if m != nil { + return m.TimestampValue + } + return nil +} + +func (m *ABitOfEverything) GetRepeatedEnumValue() []NumericEnum { + if m != nil { + return m.RepeatedEnumValue + } + return nil +} + +func (m *ABitOfEverything) GetRepeatedEnumAnnotation() []NumericEnum { + if m != nil { + return m.RepeatedEnumAnnotation + } + return nil +} + +func (m *ABitOfEverything) GetEnumValueAnnotation() NumericEnum { + if m != nil { + return m.EnumValueAnnotation + } + return NumericEnum_ZERO +} + +func (m *ABitOfEverything) GetRepeatedStringAnnotation() []string { + if m != nil { + return m.RepeatedStringAnnotation + } + return nil +} + +func (m *ABitOfEverything) GetRepeatedNestedAnnotation() []*ABitOfEverything_Nested { + if m != nil { + return m.RepeatedNestedAnnotation + } + return nil +} + +func (m *ABitOfEverything) GetNestedAnnotation() *ABitOfEverything_Nested { + if m != nil { + return m.NestedAnnotation + } + return nil +} + +func (m *ABitOfEverything) GetInt64OverrideType() int64 { + if m != nil { + return m.Int64OverrideType + } + return 0 +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ABitOfEverything) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ABitOfEverything_OneofEmpty)(nil), + (*ABitOfEverything_OneofString)(nil), + } +} + +// Nested is nested type. +type ABitOfEverything_Nested struct { + // name is nested field. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Amount uint32 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + // DeepEnum comment. + Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,proto3,enum=grpc.gateway.runtime.internal.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested{} } +func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } +func (*ABitOfEverything_Nested) ProtoMessage() {} +func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { + return fileDescriptor_411aaf1bcbdb81d6, []int{1, 0} +} + +func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) +} +func (m *ABitOfEverything_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ABitOfEverything_Nested.Marshal(b, m, deterministic) +} +func (m *ABitOfEverything_Nested) XXX_Merge(src proto.Message) { + xxx_messageInfo_ABitOfEverything_Nested.Merge(m, src) +} +func (m *ABitOfEverything_Nested) XXX_Size() int { + return xxx_messageInfo_ABitOfEverything_Nested.Size(m) +} +func (m *ABitOfEverything_Nested) XXX_DiscardUnknown() { + xxx_messageInfo_ABitOfEverything_Nested.DiscardUnknown(m) +} + +var xxx_messageInfo_ABitOfEverything_Nested proto.InternalMessageInfo + +func (m *ABitOfEverything_Nested) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ABitOfEverything_Nested) GetAmount() uint32 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *ABitOfEverything_Nested) GetOk() ABitOfEverything_Nested_DeepEnum { + if m != nil { + return m.Ok + } + return ABitOfEverything_Nested_FALSE +} + +type ResponseBodyOut struct { + Response *ResponseBodyOut_Response `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseBodyOut) Reset() { *m = ResponseBodyOut{} } +func (m *ResponseBodyOut) String() string { return proto.CompactTextString(m) } +func (*ResponseBodyOut) ProtoMessage() {} +func (*ResponseBodyOut) Descriptor() ([]byte, []int) { + return fileDescriptor_411aaf1bcbdb81d6, []int{2} +} + +func (m *ResponseBodyOut) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResponseBodyOut.Unmarshal(m, b) +} +func (m *ResponseBodyOut) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResponseBodyOut.Marshal(b, m, deterministic) +} +func (m *ResponseBodyOut) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseBodyOut.Merge(m, src) +} +func (m *ResponseBodyOut) XXX_Size() int { + return xxx_messageInfo_ResponseBodyOut.Size(m) +} +func (m *ResponseBodyOut) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseBodyOut.DiscardUnknown(m) +} + +var xxx_messageInfo_ResponseBodyOut proto.InternalMessageInfo + +func (m *ResponseBodyOut) GetResponse() *ResponseBodyOut_Response { + if m != nil { + return m.Response + } + return nil +} + +type ResponseBodyOut_Response struct { + Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseBodyOut_Response) Reset() { *m = ResponseBodyOut_Response{} } +func (m *ResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } +func (*ResponseBodyOut_Response) ProtoMessage() {} +func (*ResponseBodyOut_Response) Descriptor() ([]byte, []int) { + return fileDescriptor_411aaf1bcbdb81d6, []int{2, 0} +} + +func (m *ResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResponseBodyOut_Response.Unmarshal(m, b) +} +func (m *ResponseBodyOut_Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResponseBodyOut_Response.Marshal(b, m, deterministic) +} +func (m *ResponseBodyOut_Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseBodyOut_Response.Merge(m, src) +} +func (m *ResponseBodyOut_Response) XXX_Size() int { + return xxx_messageInfo_ResponseBodyOut_Response.Size(m) +} +func (m *ResponseBodyOut_Response) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseBodyOut_Response.DiscardUnknown(m) +} + +var xxx_messageInfo_ResponseBodyOut_Response proto.InternalMessageInfo + +func (m *ResponseBodyOut_Response) GetData() string { + if m != nil { + return m.Data + } + return "" +} + +type RepeatedResponseBodyOut struct { + Response []*RepeatedResponseBodyOut_Response `protobuf:"bytes,2,rep,name=response,proto3" json:"response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RepeatedResponseBodyOut) Reset() { *m = RepeatedResponseBodyOut{} } +func (m *RepeatedResponseBodyOut) String() string { return proto.CompactTextString(m) } +func (*RepeatedResponseBodyOut) ProtoMessage() {} +func (*RepeatedResponseBodyOut) Descriptor() ([]byte, []int) { + return fileDescriptor_411aaf1bcbdb81d6, []int{3} +} + +func (m *RepeatedResponseBodyOut) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RepeatedResponseBodyOut.Unmarshal(m, b) +} +func (m *RepeatedResponseBodyOut) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RepeatedResponseBodyOut.Marshal(b, m, deterministic) +} +func (m *RepeatedResponseBodyOut) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepeatedResponseBodyOut.Merge(m, src) +} +func (m *RepeatedResponseBodyOut) XXX_Size() int { + return xxx_messageInfo_RepeatedResponseBodyOut.Size(m) +} +func (m *RepeatedResponseBodyOut) XXX_DiscardUnknown() { + xxx_messageInfo_RepeatedResponseBodyOut.DiscardUnknown(m) +} + +var xxx_messageInfo_RepeatedResponseBodyOut proto.InternalMessageInfo + +func (m *RepeatedResponseBodyOut) GetResponse() []*RepeatedResponseBodyOut_Response { + if m != nil { + return m.Response + } + return nil +} + +type RepeatedResponseBodyOut_Response struct { + Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Type RepeatedResponseBodyOut_Response_ResponseType `protobuf:"varint,3,opt,name=type,proto3,enum=grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut_Response_ResponseType" json:"type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RepeatedResponseBodyOut_Response) Reset() { *m = RepeatedResponseBodyOut_Response{} } +func (m *RepeatedResponseBodyOut_Response) String() string { return proto.CompactTextString(m) } +func (*RepeatedResponseBodyOut_Response) ProtoMessage() {} +func (*RepeatedResponseBodyOut_Response) Descriptor() ([]byte, []int) { + return fileDescriptor_411aaf1bcbdb81d6, []int{3, 0} +} + +func (m *RepeatedResponseBodyOut_Response) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RepeatedResponseBodyOut_Response.Unmarshal(m, b) +} +func (m *RepeatedResponseBodyOut_Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RepeatedResponseBodyOut_Response.Marshal(b, m, deterministic) +} +func (m *RepeatedResponseBodyOut_Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepeatedResponseBodyOut_Response.Merge(m, src) +} +func (m *RepeatedResponseBodyOut_Response) XXX_Size() int { + return xxx_messageInfo_RepeatedResponseBodyOut_Response.Size(m) +} +func (m *RepeatedResponseBodyOut_Response) XXX_DiscardUnknown() { + xxx_messageInfo_RepeatedResponseBodyOut_Response.DiscardUnknown(m) +} + +var xxx_messageInfo_RepeatedResponseBodyOut_Response proto.InternalMessageInfo + +func (m *RepeatedResponseBodyOut_Response) GetData() string { + if m != nil { + return m.Data + } + return "" +} + +func (m *RepeatedResponseBodyOut_Response) GetType() RepeatedResponseBodyOut_Response_ResponseType { + if m != nil { + return m.Type + } + return RepeatedResponseBodyOut_Response_UNKNOWN +} + +func init() { + proto.RegisterEnum("grpc.gateway.runtime.internal.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) + proto.RegisterEnum("grpc.gateway.runtime.internal.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value) + proto.RegisterEnum("grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut_Response_ResponseType", RepeatedResponseBodyOut_Response_ResponseType_name, RepeatedResponseBodyOut_Response_ResponseType_value) + proto.RegisterType((*SimpleMessage)(nil), "grpc.gateway.runtime.internal.examplepb.SimpleMessage") + proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.runtime.internal.examplepb.ABitOfEverything") + proto.RegisterMapType((map[string]NumericEnum)(nil), "grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MapValueEntry") + proto.RegisterMapType((map[string]*ABitOfEverything_Nested)(nil), "grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MappedNestedValueEntry") + proto.RegisterMapType((map[string]string)(nil), "grpc.gateway.runtime.internal.examplepb.ABitOfEverything.MappedStringValueEntry") + proto.RegisterType((*ABitOfEverything_Nested)(nil), "grpc.gateway.runtime.internal.examplepb.ABitOfEverything.Nested") + proto.RegisterType((*ResponseBodyOut)(nil), "grpc.gateway.runtime.internal.examplepb.ResponseBodyOut") + proto.RegisterType((*ResponseBodyOut_Response)(nil), "grpc.gateway.runtime.internal.examplepb.ResponseBodyOut.Response") + proto.RegisterType((*RepeatedResponseBodyOut)(nil), "grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut") + proto.RegisterType((*RepeatedResponseBodyOut_Response)(nil), "grpc.gateway.runtime.internal.examplepb.RepeatedResponseBodyOut.Response") +} + +func init() { + proto.RegisterFile("runtime/internal/examplepb/example.proto", fileDescriptor_411aaf1bcbdb81d6) +} + +var fileDescriptor_411aaf1bcbdb81d6 = []byte{ + // 1101 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x5d, 0x73, 0x1b, 0x35, + 0x1b, 0x8d, 0xec, 0xc4, 0xb1, 0x9f, 0xb5, 0x9d, 0xb5, 0xf2, 0xd1, 0x7d, 0xdd, 0xb7, 0x64, 0xeb, + 0xd0, 0x61, 0xe1, 0x62, 0x33, 0xe3, 0x74, 0x18, 0xe8, 0x70, 0x41, 0xd2, 0x1a, 0x5a, 0xa0, 0x36, + 0xa3, 0xa4, 0x01, 0x3a, 0xc3, 0x78, 0xd6, 0xb5, 0xe2, 0x2e, 0xf1, 0x6a, 0x97, 0xfd, 0x08, 0xf5, + 0x0d, 0xc3, 0x15, 0xd7, 0xfc, 0x14, 0x6e, 0x98, 0xe1, 0x3f, 0xf1, 0x27, 0x98, 0x95, 0xb4, 0x8a, + 0xec, 0x04, 0x26, 0x34, 0xbe, 0x5a, 0xe9, 0xd1, 0xd1, 0x39, 0x47, 0x5a, 0x1d, 0x09, 0x9c, 0x38, + 0x63, 0xa9, 0x1f, 0xd0, 0x7d, 0x9f, 0xa5, 0x34, 0x66, 0xde, 0x74, 0x9f, 0xbe, 0xf1, 0x82, 0x68, + 0x4a, 0xa3, 0x51, 0xd1, 0x72, 0xa3, 0x38, 0x4c, 0x43, 0xfc, 0xde, 0x24, 0x8e, 0x5e, 0xb9, 0x13, + 0x2f, 0xa5, 0x3f, 0x79, 0x33, 0x57, 0x4e, 0x73, 0x8b, 0x69, 0x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 0x40, 0x87, 0x26, 0xca, 0x3f, 0x47, 0x66, + 0xe9, 0x03, 0x1b, 0x0c, 0xed, 0x14, 0xe7, 0xb9, 0x79, 0xd9, 0x23, 0x03, 0x73, 0x05, 0xaf, 0x43, + 0x79, 0xd0, 0xef, 0x99, 0xe8, 0xc8, 0x78, 0x59, 0x53, 0x6e, 0x46, 0x15, 0xfe, 0x82, 0x1d, 0xfc, + 0x1d, 0x00, 0x00, 0xff, 0xff, 0xbb, 0xc2, 0xf3, 0x9b, 0x25, 0x0d, 0x00, 0x00, +} diff --git a/runtime/internal/examplepb/example.proto b/runtime/internal/examplepb/example.proto new file mode 100644 index 00000000000..87d4189a736 --- /dev/null +++ b/runtime/internal/examplepb/example.proto @@ -0,0 +1,115 @@ +syntax = "proto3"; +option go_package = "examplepb"; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/empty.proto"; + +package grpc.gateway.runtime.internal.examplepb; + +// SimpleMessage represents a simple message sent to the Echo service. +message SimpleMessage { + string id = 1; +} + +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 comment. + 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; + bytes bytes_value = 29; + 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 { + google.protobuf.Empty oneof_empty = 20; + string oneof_string = 21; + } + + map map_value = 22; + map mapped_string_value = 23; + map mapped_nested_value = 24; + + string nonConventionalNameValue = 26; + + google.protobuf.Timestamp timestamp_value = 27; + + // repeated enum value. it is comma-separated in query + repeated NumericEnum repeated_enum_value = 28; + + // repeated numeric enum comment (This comment is overridden by the field annotation) + repeated NumericEnum repeated_enum_annotation = 32; + + // numeric enum comment (This comment is overridden by the field annotation) + NumericEnum enum_value_annotation = 33; + + // repeated string comment (This comment is overridden by the field annotation) + repeated string repeated_string_annotation = 34; + + // repeated nested object comment (This comment is overridden by the field annotation) + repeated Nested repeated_nested_annotation = 35; + + // nested object comments (This comment is overridden by the field annotation) + Nested nested_annotation = 36; + + int64 int64_override_type = 37; +} + +// NumericEnum is one or zero. +enum NumericEnum { + // ZERO means 0 + ZERO = 0; + // ONE means 1 + ONE = 1; +} + +message ResponseBodyOut { + message Response { + string data = 1; + } + Response response = 2; +} + +message RepeatedResponseBodyOut { + message Response { + string data = 1; + enum ResponseType { + // UNKNOWN + UNKNOWN = 0; + // A is 1 + A = 1; + // B is 2 + B = 2; + } + ResponseType type = 3; + } + repeated Response response = 2; +} diff --git a/runtime/marshal_json_test.go b/runtime/marshal_json_test.go index 1d226d53665..e7610cead8c 100644 --- a/runtime/marshal_json_test.go +++ b/runtime/marshal_json_test.go @@ -12,8 +12,8 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "github.com/golang/protobuf/ptypes/timestamp" "github.com/golang/protobuf/ptypes/wrappers" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb" ) func TestJSONBuiltinMarshal(t *testing.T) { diff --git a/runtime/marshal_jsonpb_test.go b/runtime/marshal_jsonpb_test.go index 7d60ef7ce35..19d5bc8fb0e 100644 --- a/runtime/marshal_jsonpb_test.go +++ b/runtime/marshal_jsonpb_test.go @@ -14,8 +14,8 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "github.com/golang/protobuf/ptypes/timestamp" "github.com/golang/protobuf/ptypes/wrappers" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb" ) func TestJSONPbMarshal(t *testing.T) { @@ -43,10 +43,10 @@ func TestJSONPbMarshal(t *testing.T) { "b": examplepb.NumericEnum_ZERO, }, RepeatedEnumAnnotation: []examplepb.NumericEnum{}, - EnumValueAnnotation: examplepb.NumericEnum_ONE, + EnumValueAnnotation: examplepb.NumericEnum_ONE, RepeatedStringAnnotation: []string{}, RepeatedNestedAnnotation: []*examplepb.ABitOfEverything_Nested{}, - NestedAnnotation: &examplepb.ABitOfEverything_Nested{}, + NestedAnnotation: &examplepb.ABitOfEverything_Nested{}, } for i, spec := range []struct { @@ -264,10 +264,10 @@ func TestJSONPbEncoder(t *testing.T) { "b": examplepb.NumericEnum_ZERO, }, RepeatedEnumAnnotation: []examplepb.NumericEnum{}, - EnumValueAnnotation: examplepb.NumericEnum_ONE, + EnumValueAnnotation: examplepb.NumericEnum_ONE, RepeatedStringAnnotation: []string{}, RepeatedNestedAnnotation: []*examplepb.ABitOfEverything_Nested{}, - NestedAnnotation: &examplepb.ABitOfEverything_Nested{}, + NestedAnnotation: &examplepb.ABitOfEverything_Nested{}, } for i, spec := range []struct { @@ -359,7 +359,7 @@ func TestJSONPbEncoderFields(t *testing.T) { if err := enc.Encode(fixt.data); err != nil { t.Errorf("enc.Encode(%#v) failed with %v; want success", fixt.data, err) } - if got, want := buf.String(), fixt.json + string(m.Delimiter()); got != want { + if got, want := buf.String(), fixt.json+string(m.Delimiter()); got != want { t.Errorf("enc.Encode(%#v) = %q; want %q", fixt.data, got, want) } } diff --git a/runtime/marshal_proto_test.go b/runtime/marshal_proto_test.go index 1da30b8a8d6..d653aca653a 100644 --- a/runtime/marshal_proto_test.go +++ b/runtime/marshal_proto_test.go @@ -6,8 +6,8 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/timestamp" - "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb" ) var message = &examplepb.ABitOfEverything{ From 10dd170013717a1cfdfa57f6efe44bd743a0de2f Mon Sep 17 00:00:00 2001 From: William Langford Date: Wed, 4 Mar 2020 12:06:35 -0500 Subject: [PATCH 522/552] Use an interface for ContentTypeFromMessage This allows custom Marshaler implementations to vary their Content-Type based on the response --- runtime/errors.go | 4 +-- runtime/errors_test.go | 43 +++++++++++++++++--------- runtime/handler.go | 6 ++-- runtime/handler_test.go | 67 ++++++++++++++++++++++++++++++++++++----- runtime/marshaler.go | 7 +++++ runtime/proto_errors.go | 4 +-- 6 files changed, 103 insertions(+), 28 deletions(-) diff --git a/runtime/errors.go b/runtime/errors.go index 8ec2fc0f1c7..65a5dc690d4 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -123,9 +123,9 @@ func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w // Check marshaler on run time in order to keep backwards compatability // An interface param needs to be added to the ContentType() function on // the Marshal interface to be able to remove this check - if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { + if typeMarshaler, ok := marshaler.(contentTypeMarshaler); ok { pb := s.Proto() - contentType = httpBodyMarshaler.ContentTypeFromMessage(pb) + contentType = typeMarshaler.ContentTypeFromMessage(pb) } w.Header().Set("Content-Type", contentType) diff --git a/runtime/errors_test.go b/runtime/errors_test.go index 6d684d4ed89..b4ce93f3f16 100644 --- a/runtime/errors_test.go +++ b/runtime/errors_test.go @@ -23,26 +23,41 @@ func TestDefaultHTTPError(t *testing.T) { ) for _, spec := range []struct { - err error - status int - msg string - details string + err error + status int + msg string + marshaler runtime.Marshaler + contentType string + details string }{ { - err: fmt.Errorf("example error"), - status: http.StatusInternalServerError, - msg: "example error", + err: fmt.Errorf("example error"), + status: http.StatusInternalServerError, + marshaler: &runtime.JSONPb{}, + contentType: "application/json", + msg: "example error", }, { - err: status.Error(codes.NotFound, "no such resource"), - status: http.StatusNotFound, - msg: "no such resource", + err: status.Error(codes.NotFound, "no such resource"), + status: http.StatusNotFound, + marshaler: &runtime.JSONPb{}, + contentType: "application/json", + msg: "no such resource", }, { - err: statusWithDetails.Err(), - status: http.StatusBadRequest, - msg: "failed precondition", - details: "type.googleapis.com/google.rpc.PreconditionFailure", + err: statusWithDetails.Err(), + status: http.StatusBadRequest, + marshaler: &runtime.JSONPb{}, + contentType: "application/json", + msg: "failed precondition", + details: "type.googleapis.com/google.rpc.PreconditionFailure", + }, + { + err: fmt.Errorf("example error"), + status: http.StatusInternalServerError, + marshaler: &CustomMarshaler{&runtime.JSONPb{}}, + contentType: "Custom-Content-Type", + msg: "example error", }, } { w := httptest.NewRecorder() diff --git a/runtime/handler.go b/runtime/handler.go index 2af900650dc..b894da86bf8 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -1,13 +1,13 @@ package runtime import ( + "context" "errors" "fmt" "io" "net/http" "net/textproto" - "context" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/internal" "google.golang.org/grpc/grpclog" @@ -126,8 +126,8 @@ func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marsha // Check marshaler on run time in order to keep backwards compatability // An interface param needs to be added to the ContentType() function on // the Marshal interface to be able to remove this check - if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { - contentType = httpBodyMarshaler.ContentTypeFromMessage(resp) + if typeMarshaler, ok := marshaler.(contentTypeMarshaler); ok { + contentType = typeMarshaler.ContentTypeFromMessage(resp) } w.Header().Set("Content-Type", contentType) diff --git a/runtime/handler_test.go b/runtime/handler_test.go index f9a17916da1..912cb3acfa5 100644 --- a/runtime/handler_test.go +++ b/runtime/handler_test.go @@ -1,14 +1,13 @@ package runtime_test import ( + "context" "io" "io/ioutil" "net/http" "net/http/httptest" "testing" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/internal" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -134,11 +133,12 @@ type CustomMarshaler struct { m *runtime.JSONPb } -func (c *CustomMarshaler) Marshal(v interface{}) ([]byte, error) { return c.m.Marshal(v) } -func (c *CustomMarshaler) Unmarshal(data []byte, v interface{}) error { return c.m.Unmarshal(data, v) } -func (c *CustomMarshaler) NewDecoder(r io.Reader) runtime.Decoder { return c.m.NewDecoder(r) } -func (c *CustomMarshaler) NewEncoder(w io.Writer) runtime.Encoder { return c.m.NewEncoder(w) } -func (c *CustomMarshaler) ContentType() string { return c.m.ContentType() } +func (c *CustomMarshaler) Marshal(v interface{}) ([]byte, error) { return c.m.Marshal(v) } +func (c *CustomMarshaler) Unmarshal(data []byte, v interface{}) error { return c.m.Unmarshal(data, v) } +func (c *CustomMarshaler) NewDecoder(r io.Reader) runtime.Decoder { return c.m.NewDecoder(r) } +func (c *CustomMarshaler) NewEncoder(w io.Writer) runtime.Encoder { return c.m.NewEncoder(w) } +func (c *CustomMarshaler) ContentType() string { return c.m.ContentType() } +func (c *CustomMarshaler) ContentTypeFromMessage(v interface{}) string { return "Custom-Content-Type" } func TestForwardResponseStreamCustomMarshaler(t *testing.T) { type msg struct { @@ -227,3 +227,56 @@ func TestForwardResponseStreamCustomMarshaler(t *testing.T) { }) } } + +func TestForwardResponseMessage(t *testing.T) { + msg := &pb.SimpleMessage{Id: "One"} + tests := []struct { + name string + marshaler runtime.Marshaler + contentType string + }{{ + name: "standard marshaler", + marshaler: &runtime.JSONPb{}, + contentType: "application/json", + }, { + name: "httpbody marshaler", + marshaler: &runtime.HTTPBodyMarshaler{&runtime.JSONPb{}}, + contentType: "application/json", + }, { + name: "custom marshaler", + marshaler: &CustomMarshaler{&runtime.JSONPb{}}, + contentType: "Custom-Content-Type", + }} + + ctx := runtime.NewServerMetadataContext(context.Background(), runtime.ServerMetadata{}) + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + req := httptest.NewRequest("GET", "http://example.com/foo", nil) + resp := httptest.NewRecorder() + + runtime.ForwardResponseMessage(ctx, runtime.NewServeMux(), tt.marshaler, resp, req, msg) + + w := resp.Result() + if w.StatusCode != http.StatusOK { + t.Errorf("StatusCode %d want %d", w.StatusCode, http.StatusOK) + } + if h := w.Header.Get("Content-Type"); h != tt.contentType { + t.Errorf("Content-Type %v want %v", h, tt.contentType) + } + body, err := ioutil.ReadAll(w.Body) + if err != nil { + t.Errorf("Failed to read response body with %v", err) + } + w.Body.Close() + + want, err := tt.marshaler.Marshal(msg) + if err != nil { + t.Errorf("marshaler.Marshal() failed %v", err) + } + + if string(body) != string(want) { + t.Errorf("ForwardResponseMessage() = \"%s\" want \"%s\"", body, want) + } + }) + } +} diff --git a/runtime/marshaler.go b/runtime/marshaler.go index 98fe6e88ac5..3fdf9fd8738 100644 --- a/runtime/marshaler.go +++ b/runtime/marshaler.go @@ -19,6 +19,13 @@ type Marshaler interface { ContentType() string } +// Marshalers that implement contentTypeMarshaler will have their ContentTypeFromMessage method called +// to set the Content-Type header on the response +type contentTypeMarshaler interface { + // ContentTypeFromMessage returns the Content-Type this marshaler produces from the provided message + ContentTypeFromMessage(v interface{}) string +} + // Decoder decodes a byte sequence type Decoder interface { Decode(v interface{}) error diff --git a/runtime/proto_errors.go b/runtime/proto_errors.go index ca76324efb1..ea75565868d 100644 --- a/runtime/proto_errors.go +++ b/runtime/proto_errors.go @@ -47,9 +47,9 @@ func DefaultHTTPProtoErrorHandler(ctx context.Context, mux *ServeMux, marshaler // Check marshaler on run time in order to keep backwards compatability // An interface param needs to be added to the ContentType() function on // the Marshal interface to be able to remove this check - if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { + if typeMarshaler, ok := marshaler.(contentTypeMarshaler); ok { pb := s.Proto() - contentType = httpBodyMarshaler.ContentTypeFromMessage(pb) + contentType = typeMarshaler.ContentTypeFromMessage(pb) } w.Header().Set("Content-Type", contentType) From cf29b09333c71fe1c8127f8534f47f5d36a0f799 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 4 Mar 2020 21:28:14 +0000 Subject: [PATCH 523/552] Generate changelog for 1.14.0 --- CHANGELOG.md | 27 ++++++++++++++++++++++++++- Makefile | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 614f938ea25..0de59d698e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Change Log +## [v1.14.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.0) (2020-03-04) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.13.0...v1.14.0) + +**Closed issues:** + +- Swagger Codegen With Multiple Additional Bindings is resulting in missing Documentation [\#1149](https://github.com/grpc-ecosystem/grpc-gateway/issues/1149) +- google.api.http option not picked up/mapped correctly? [\#1148](https://github.com/grpc-ecosystem/grpc-gateway/issues/1148) +- cannot use multiple different error handlers in one gateway binary [\#1143](https://github.com/grpc-ecosystem/grpc-gateway/issues/1143) +- Is grpc-gateway a stateless application? [\#1139](https://github.com/grpc-ecosystem/grpc-gateway/issues/1139) +- Support for custom query parameters parsers [\#1128](https://github.com/grpc-ecosystem/grpc-gateway/issues/1128) + +**Merged pull requests:** + +- Use an interface for ContentTypeFromMessage [\#1150](https://github.com/grpc-ecosystem/grpc-gateway/pull/1150) ([wtlangford](https://github.com/wtlangford)) +- Minimize API surface in anticipation of gorelease [\#1146](https://github.com/grpc-ecosystem/grpc-gateway/pull/1146) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Fix \#1143: Support multiple error handlers. [\#1144](https://github.com/grpc-ecosystem/grpc-gateway/pull/1144) ([jgiles](https://github.com/jgiles)) +- Fix customizing your gateway documentation CustomMatcher example [\#1142](https://github.com/grpc-ecosystem/grpc-gateway/pull/1142) ([wiliamsouza](https://github.com/wiliamsouza)) +- protoc-gen-swagger: add flag to disable default errors [\#1141](https://github.com/grpc-ecosystem/grpc-gateway/pull/1141) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Bump nokogiri from 1.10.4 to 1.10.8 in /docs [\#1140](https://github.com/grpc-ecosystem/grpc-gateway/pull/1140) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Configurable query parameters parser [\#1138](https://github.com/grpc-ecosystem/grpc-gateway/pull/1138) ([wp0pw](https://github.com/wp0pw)) +- Improve installation instructions [\#1132](https://github.com/grpc-ecosystem/grpc-gateway/pull/1132) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Add bazel gazelle to CONTRIBUTING [\#1131](https://github.com/grpc-ecosystem/grpc-gateway/pull/1131) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Configure response content type at the method level [\#1130](https://github.com/grpc-ecosystem/grpc-gateway/pull/1130) ([nboukeffa](https://github.com/nboukeffa)) + ## [v1.13.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.13.0) (2020-02-11) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.12.2...v1.13.0) @@ -17,6 +41,7 @@ **Merged pull requests:** +- Generate changelog for 1.13.0 [\#1129](https://github.com/grpc-ecosystem/grpc-gateway/pull/1129) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Fix \#1125: JSON-prefix nested-field params. [\#1126](https://github.com/grpc-ecosystem/grpc-gateway/pull/1126) ([jgiles](https://github.com/jgiles)) - Fix \#1117: Support response examples. [\#1124](https://github.com/grpc-ecosystem/grpc-gateway/pull/1124) ([jgiles](https://github.com/jgiles)) @@ -157,7 +182,7 @@ - nitpick spacing in other proto files [\#1032](https://github.com/grpc-ecosystem/grpc-gateway/pull/1032) ([srenatus](https://github.com/srenatus)) - nitpick a\_bit\_of\_everything.proto [\#1030](https://github.com/grpc-ecosystem/grpc-gateway/pull/1030) ([srenatus](https://github.com/srenatus)) - runtime: stop using nil ponters with Unmarshal [\#1028](https://github.com/grpc-ecosystem/grpc-gateway/pull/1028) ([johanbrandhorst](https://github.com/johanbrandhorst)) -- Small performance fix [\#1027](https://github.com/grpc-ecosystem/grpc-gateway/pull/1027) ([freedemster](https://github.com/freedemster)) +- Small performance fix [\#1027](https://github.com/grpc-ecosystem/grpc-gateway/pull/1027) ([dshemin](https://github.com/dshemin)) - docs need type assertion on proto.Message [\#1026](https://github.com/grpc-ecosystem/grpc-gateway/pull/1026) ([zachgersh](https://github.com/zachgersh)) - Update ISSUE\_TEMPLATE.md [\#1014](https://github.com/grpc-ecosystem/grpc-gateway/pull/1014) ([prologic](https://github.com/prologic)) diff --git a/Makefile b/Makefile index bf3e882eb46..09e41fd58e5 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.13.0 + --future-release=v1.14.0 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From a0307dd6bb21ff430733bb8bce0e1b341d3f5523 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 4 Mar 2020 21:56:24 +0000 Subject: [PATCH 524/552] Update build environment to 1.14 --- .circleci/Dockerfile | 4 ++-- .circleci/README.md | 2 +- .circleci/config.yml | 12 ++++++------ CONTRIBUTING.md | 2 +- go.mod | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile index c44eac5c23d..2eff32c6fdb 100644 --- a/.circleci/Dockerfile +++ b/.circleci/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.4 +FROM golang:1.14.0 # Warm apt cache and install dependencies # bzip2 is required by the node_tests (to extract its dependencies). @@ -9,7 +9,7 @@ RUN apt-get update && \ # Install swagger-codegen ENV SWAGGER_CODEGEN_VERSION=2.4.8 -RUN wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${SWAGGER_CODEGEN_VERSION}/swagger-codegen-cli-${SWAGGER_CODEGEN_VERSION}.jar \ +RUN wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${SWAGGER_CODEGEN_VERSION}/swagger-codegen-cli-${SWAGGER_CODEGEN_VERSION}.jar \ -O /usr/local/bin/swagger-codegen-cli.jar # Wrap the jar for swagger-codgen diff --git a/.circleci/README.md b/.circleci/README.md index c6ce14672fb..5fe0b18c863 100644 --- a/.circleci/README.md +++ b/.circleci/README.md @@ -7,7 +7,7 @@ Contained within is the CI test setup for the Gateway. It runs on Circle CI. Great, it should be as simple as thus (run from the root of the directory): ```bash -$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.13 \ +$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.14 \ /bin/bash -c 'cd /go/src/github.com/grpc-ecosystem/grpc-gateway && \ make realclean && \ make examples' diff --git a/.circleci/config.yml b/.circleci/config.yml index 7dc1c25c06f..bcada21745b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,14 +2,14 @@ version: 2 jobs: build: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.13 + - image: jfbrandhorst/grpc-gateway-build-env:1.14 working_directory: /src/grpc-gateway steps: - checkout - run: go build ./... test: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.13 + - image: jfbrandhorst/grpc-gateway-build-env:1.14 working_directory: /src/grpc-gateway environment: GLOG_logtostderr: '1' @@ -19,7 +19,7 @@ jobs: - run: bash <(curl -s https://codecov.io/bash) node_test: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.13 + - image: jfbrandhorst/grpc-gateway-build-env:1.14 working_directory: /src/grpc-gateway steps: - checkout @@ -32,7 +32,7 @@ jobs: ./node_modules/.bin/gulp generate: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.13 + - image: jfbrandhorst/grpc-gateway-build-env:1.14 working_directory: /src/grpc-gateway steps: - checkout @@ -42,7 +42,7 @@ jobs: - run: git diff --exit-code lint: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.13 + - image: jfbrandhorst/grpc-gateway-build-env:1.14 working_directory: /src/grpc-gateway steps: - checkout @@ -84,7 +84,7 @@ jobs: when: always release: docker: - - image: jfbrandhorst/grpc-gateway-build-env:1.13 + - image: jfbrandhorst/grpc-gateway-build-env:1.14 working_directory: /src/grpc-gateway steps: - checkout diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e2ff6602e2e..5fde7c282f4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,7 @@ All submissions, including submissions by project members, require review. Great, it should be as simple as thus (run from the root of the directory): ```bash -docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.13 \ +docker run -v $(pwd):/src/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env:1.14 \ /bin/bash -c 'cd /src/grpc-gateway && \ make realclean && \ make examples' diff --git a/go.mod b/go.mod index 23003a8626f..c8e880d3044 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/grpc-ecosystem/grpc-gateway -go 1.13 +go 1.14 require ( github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6 From 94b02ac0ee419649109b5ced9a53b84d4e93f621 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 4 Mar 2020 21:43:35 +0000 Subject: [PATCH 525/552] Add gorelease CI step This should help avoid unintentionally breaking changes. --- .circleci/config.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index bcada21745b..5f20a8d3cde 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,6 +82,19 @@ jobs: command: 'bazel run //:buildifier_check || (echo "ERROR: Bazel files not formatted, please run \`bazel run :buildifier\`" >&2; exit 1)' when: always + gorelease: + docker: + - image: jfbrandhorst/grpc-gateway-build-env:1.14 + working_directory: /src/grpc-gateway + steps: + - checkout + - run: + name: Install gorelease outside local module + command: | + cd $(mktemp -d) && + go mod init tmp && + go get golang.org/x/exp/cmd/gorelease@latest + - run: gorelease release: docker: - image: jfbrandhorst/grpc-gateway-build-env:1.14 @@ -101,6 +114,7 @@ workflows: - generate - lint - bazel + - gorelease - release: filters: branches: From 7f82f3050ad3705fca6fe0f789da1f7f56b2c9e4 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Thu, 5 Mar 2020 09:13:51 +0000 Subject: [PATCH 526/552] Move generator and descriptor back to public API These two packages are depended on by at least one other popular package. --- Makefile | 16 ++++++++-------- protoc-gen-grpc-gateway/BUILD.bazel | 2 +- .../descriptor/BUILD.bazel | 2 +- .../descriptor/grpc_api_configuration.go | 0 .../descriptor/grpc_api_configuration_test.go | 0 .../descriptor/grpc_api_service.go | 0 .../descriptor/registry.go | 0 .../descriptor/registry_test.go | 0 .../descriptor/services.go | 0 .../descriptor/services_test.go | 0 .../descriptor/types.go | 0 .../descriptor/types_test.go | 0 .../generator/BUILD.bazel | 4 ++-- .../generator/generator.go | 2 +- .../internal/gengateway/BUILD.bazel | 6 +++--- .../internal/gengateway/generator.go | 4 ++-- .../internal/gengateway/generator_test.go | 2 +- .../internal/gengateway/template.go | 2 +- .../internal/gengateway/template_test.go | 2 +- protoc-gen-grpc-gateway/main.go | 2 +- protoc-gen-swagger/BUILD.bazel | 2 +- .../internal/genswagger/BUILD.bazel | 6 +++--- .../internal/genswagger/generator.go | 4 ++-- .../internal/genswagger/template.go | 2 +- .../internal/genswagger/template_test.go | 2 +- protoc-gen-swagger/internal/genswagger/types.go | 2 +- protoc-gen-swagger/main.go | 2 +- 27 files changed, 32 insertions(+), 32 deletions(-) rename {internal => protoc-gen-grpc-gateway}/descriptor/BUILD.bazel (93%) rename {internal => protoc-gen-grpc-gateway}/descriptor/grpc_api_configuration.go (100%) rename {internal => protoc-gen-grpc-gateway}/descriptor/grpc_api_configuration_test.go (100%) rename {internal => protoc-gen-grpc-gateway}/descriptor/grpc_api_service.go (100%) rename {internal => protoc-gen-grpc-gateway}/descriptor/registry.go (100%) rename {internal => protoc-gen-grpc-gateway}/descriptor/registry_test.go (100%) rename {internal => protoc-gen-grpc-gateway}/descriptor/services.go (100%) rename {internal => protoc-gen-grpc-gateway}/descriptor/services_test.go (100%) rename {internal => protoc-gen-grpc-gateway}/descriptor/types.go (100%) rename {internal => protoc-gen-grpc-gateway}/descriptor/types_test.go (100%) rename {internal => protoc-gen-grpc-gateway}/generator/BUILD.bazel (62%) rename {internal => protoc-gen-grpc-gateway}/generator/generator.go (83%) diff --git a/Makefile b/Makefile index 09e41fd58e5..cc487e260bb 100644 --- a/Makefile +++ b/Makefile @@ -21,14 +21,14 @@ GATEWAY_PLUGIN_SRC= utilities/doc.go \ utilities/pattern.go \ utilities/trie.go \ protoc-gen-grpc-gateway \ - internal/descriptor \ - internal/descriptor/registry.go \ - internal/descriptor/services.go \ - internal/descriptor/types.go \ - internal/descriptor/grpc_api_configuration.go \ - internal/descriptor/grpc_api_service.go \ - internal/generator \ - internal/generator/generator.go \ + protoc-gen-grpc-gateway/descriptor \ + protoc-gen-grpc-gateway/descriptor/registry.go \ + protoc-gen-grpc-gateway/descriptor/services.go \ + protoc-gen-grpc-gateway/descriptor/types.go \ + protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go \ + protoc-gen-grpc-gateway/descriptor/grpc_api_service.go \ + protoc-gen-grpc-gateway/generator \ + protoc-gen-grpc-gateway/generator/generator.go \ protoc-gen-grpc-gateway/internal/gengateway \ protoc-gen-grpc-gateway/internal/gengateway/doc.go \ protoc-gen-grpc-gateway/internal/gengateway/generator.go \ diff --git a/protoc-gen-grpc-gateway/BUILD.bazel b/protoc-gen-grpc-gateway/BUILD.bazel index 711e038c368..22f7c363362 100644 --- a/protoc-gen-grpc-gateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/BUILD.bazel @@ -9,7 +9,7 @@ go_library( importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway", deps = [ "//internal/codegenerator:go_default_library", - "//internal/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/descriptor:go_default_library", "//protoc-gen-grpc-gateway/internal/gengateway:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", diff --git a/internal/descriptor/BUILD.bazel b/protoc-gen-grpc-gateway/descriptor/BUILD.bazel similarity index 93% rename from internal/descriptor/BUILD.bazel rename to protoc-gen-grpc-gateway/descriptor/BUILD.bazel index 8d1df906f79..17a1c0f65ca 100644 --- a/internal/descriptor/BUILD.bazel +++ b/protoc-gen-grpc-gateway/descriptor/BUILD.bazel @@ -11,7 +11,7 @@ go_library( "services.go", "types.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor", + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor", deps = [ "//internal/httprule:go_default_library", "@com_github_ghodss_yaml//:go_default_library", diff --git a/internal/descriptor/grpc_api_configuration.go b/protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go similarity index 100% rename from internal/descriptor/grpc_api_configuration.go rename to protoc-gen-grpc-gateway/descriptor/grpc_api_configuration.go diff --git a/internal/descriptor/grpc_api_configuration_test.go b/protoc-gen-grpc-gateway/descriptor/grpc_api_configuration_test.go similarity index 100% rename from internal/descriptor/grpc_api_configuration_test.go rename to protoc-gen-grpc-gateway/descriptor/grpc_api_configuration_test.go diff --git a/internal/descriptor/grpc_api_service.go b/protoc-gen-grpc-gateway/descriptor/grpc_api_service.go similarity index 100% rename from internal/descriptor/grpc_api_service.go rename to protoc-gen-grpc-gateway/descriptor/grpc_api_service.go diff --git a/internal/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go similarity index 100% rename from internal/descriptor/registry.go rename to protoc-gen-grpc-gateway/descriptor/registry.go diff --git a/internal/descriptor/registry_test.go b/protoc-gen-grpc-gateway/descriptor/registry_test.go similarity index 100% rename from internal/descriptor/registry_test.go rename to protoc-gen-grpc-gateway/descriptor/registry_test.go diff --git a/internal/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go similarity index 100% rename from internal/descriptor/services.go rename to protoc-gen-grpc-gateway/descriptor/services.go diff --git a/internal/descriptor/services_test.go b/protoc-gen-grpc-gateway/descriptor/services_test.go similarity index 100% rename from internal/descriptor/services_test.go rename to protoc-gen-grpc-gateway/descriptor/services_test.go diff --git a/internal/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go similarity index 100% rename from internal/descriptor/types.go rename to protoc-gen-grpc-gateway/descriptor/types.go diff --git a/internal/descriptor/types_test.go b/protoc-gen-grpc-gateway/descriptor/types_test.go similarity index 100% rename from internal/descriptor/types_test.go rename to protoc-gen-grpc-gateway/descriptor/types_test.go diff --git a/internal/generator/BUILD.bazel b/protoc-gen-grpc-gateway/generator/BUILD.bazel similarity index 62% rename from internal/generator/BUILD.bazel rename to protoc-gen-grpc-gateway/generator/BUILD.bazel index 17f3d31c5dd..7c0c6bfc15c 100644 --- a/internal/generator/BUILD.bazel +++ b/protoc-gen-grpc-gateway/generator/BUILD.bazel @@ -5,9 +5,9 @@ package(default_visibility = ["//visibility:public"]) go_library( name = "go_default_library", srcs = ["generator.go"], - importpath = "github.com/grpc-ecosystem/grpc-gateway/internal/generator", + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator", deps = [ - "//internal/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/descriptor:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", ], ) diff --git a/internal/generator/generator.go b/protoc-gen-grpc-gateway/generator/generator.go similarity index 83% rename from internal/generator/generator.go rename to protoc-gen-grpc-gateway/generator/generator.go index 5d03cff15d0..df55da44445 100644 --- a/internal/generator/generator.go +++ b/protoc-gen-grpc-gateway/generator/generator.go @@ -3,7 +3,7 @@ package generator import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) // Generator is an abstraction of code generators. diff --git a/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel b/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel index b3528a9abb3..79b70f54486 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel @@ -11,8 +11,8 @@ go_library( ], importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/internal/gengateway", deps = [ - "//internal/descriptor:go_default_library", - "//internal/generator:go_default_library", + "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/generator:go_default_library", "//utilities:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", @@ -30,8 +30,8 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//internal/descriptor:go_default_library", "//internal/httprule:go_default_library", + "//protoc-gen-grpc-gateway/descriptor:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], diff --git a/protoc-gen-grpc-gateway/internal/gengateway/generator.go b/protoc-gen-grpc-gateway/internal/gengateway/generator.go index d687f32be5b..0b6bfbd2b93 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/generator.go @@ -11,8 +11,8 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" - gen "github.com/grpc-ecosystem/grpc-gateway/internal/generator" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" ) var ( diff --git a/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go b/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go index 99d8ae0125d..39e5f141dbe 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go @@ -7,7 +7,7 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) func newExampleFileDescriptor() *descriptor.File { diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template.go b/protoc-gen-grpc-gateway/internal/gengateway/template.go index fd5cc11f9be..1d3d3ca8f19 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template.go @@ -9,7 +9,7 @@ import ( "github.com/golang/glog" generator2 "github.com/golang/protobuf/protoc-gen-go/generator" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/utilities" ) diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go index 628d53220dd..aff3fa906b2 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go @@ -6,8 +6,8 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index f3ed3ae726e..fb44e412fe5 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -18,7 +18,7 @@ import ( "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/internal/gengateway" ) diff --git a/protoc-gen-swagger/BUILD.bazel b/protoc-gen-swagger/BUILD.bazel index 0aacac9cea5..16ec801494b 100644 --- a/protoc-gen-swagger/BUILD.bazel +++ b/protoc-gen-swagger/BUILD.bazel @@ -8,7 +8,7 @@ go_library( importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger", deps = [ "//internal/codegenerator:go_default_library", - "//internal/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/descriptor:go_default_library", "//protoc-gen-swagger/internal/genswagger:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", diff --git a/protoc-gen-swagger/internal/genswagger/BUILD.bazel b/protoc-gen-swagger/internal/genswagger/BUILD.bazel index 0ef9926ff20..7aa972a18d1 100644 --- a/protoc-gen-swagger/internal/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/internal/genswagger/BUILD.bazel @@ -15,8 +15,8 @@ go_library( importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/internal/genswagger", deps = [ "//internal:go_default_library", - "//internal/descriptor:go_default_library", - "//internal/generator:go_default_library", + "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/generator:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//descriptor:go_default_library_gen", @@ -36,8 +36,8 @@ go_test( srcs = ["template_test.go"], embed = [":go_default_library"], deps = [ - "//internal/descriptor:go_default_library", "//internal/httprule:go_default_library", + "//protoc-gen-grpc-gateway/descriptor:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:any_go_proto", diff --git a/protoc-gen-swagger/internal/genswagger/generator.go b/protoc-gen-swagger/internal/genswagger/generator.go index 6e4a554a842..ecf1135fde7 100644 --- a/protoc-gen-swagger/internal/genswagger/generator.go +++ b/protoc-gen-swagger/internal/genswagger/generator.go @@ -16,8 +16,8 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/golang/protobuf/ptypes/any" "github.com/grpc-ecosystem/grpc-gateway/internal" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" - gen "github.com/grpc-ecosystem/grpc-gateway/internal/generator" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) diff --git a/protoc-gen-swagger/internal/genswagger/template.go b/protoc-gen-swagger/internal/genswagger/template.go index 320e3f1b6e7..9e0b5ce58af 100644 --- a/protoc-gen-swagger/internal/genswagger/template.go +++ b/protoc-gen-swagger/internal/genswagger/template.go @@ -20,7 +20,7 @@ import ( pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" structpb "github.com/golang/protobuf/ptypes/struct" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) diff --git a/protoc-gen-swagger/internal/genswagger/template_test.go b/protoc-gen-swagger/internal/genswagger/template_test.go index 9c8c913f33f..b0822d80183 100644 --- a/protoc-gen-swagger/internal/genswagger/template_test.go +++ b/protoc-gen-swagger/internal/genswagger/template_test.go @@ -12,8 +12,8 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/golang/protobuf/ptypes/any" structpb "github.com/golang/protobuf/ptypes/struct" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) diff --git a/protoc-gen-swagger/internal/genswagger/types.go b/protoc-gen-swagger/internal/genswagger/types.go index d46f14cf6a1..255f53c77ca 100644 --- a/protoc-gen-swagger/internal/genswagger/types.go +++ b/protoc-gen-swagger/internal/genswagger/types.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) type param struct { diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index bbe25649f46..0bf1c66c4dd 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -10,7 +10,7 @@ import ( "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator" - "github.com/grpc-ecosystem/grpc-gateway/internal/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/internal/genswagger" ) From c320621188320d1636e3a1172270f604ab826c6e Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Thu, 5 Mar 2020 10:15:52 +0000 Subject: [PATCH 527/552] Generate changelog for 1.14.1 --- CHANGELOG.md | 10 ++++++++++ Makefile | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0de59d698e1..a813b873355 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## [v1.14.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.1) (2020-03-05) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.0...v1.14.1) + +**Merged pull requests:** + +- Move generator and descriptor back to public API [\#1155](https://github.com/grpc-ecosystem/grpc-gateway/pull/1155) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Update build environment to 1.14 [\#1153](https://github.com/grpc-ecosystem/grpc-gateway/pull/1153) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Add gorelease CI step [\#1152](https://github.com/grpc-ecosystem/grpc-gateway/pull/1152) ([johanbrandhorst](https://github.com/johanbrandhorst)) + ## [v1.14.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.0) (2020-03-04) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.13.0...v1.14.0) @@ -13,6 +22,7 @@ **Merged pull requests:** +- Generate changelog for 1.14.0 [\#1151](https://github.com/grpc-ecosystem/grpc-gateway/pull/1151) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Use an interface for ContentTypeFromMessage [\#1150](https://github.com/grpc-ecosystem/grpc-gateway/pull/1150) ([wtlangford](https://github.com/wtlangford)) - Minimize API surface in anticipation of gorelease [\#1146](https://github.com/grpc-ecosystem/grpc-gateway/pull/1146) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Fix \#1143: Support multiple error handlers. [\#1144](https://github.com/grpc-ecosystem/grpc-gateway/pull/1144) ([jgiles](https://github.com/jgiles)) diff --git a/Makefile b/Makefile index cc487e260bb..d39f4a9190e 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.14.0 + --future-release=v1.14.1 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From ee82785e4f007ebfdb0321593a47bf275530741e Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 9 Mar 2020 11:46:08 +0000 Subject: [PATCH 528/552] Move genswagger to public API again Fixes #1162 --- Makefile | 4 ++-- protoc-gen-swagger/BUILD.bazel | 2 +- protoc-gen-swagger/{internal => }/genswagger/BUILD.bazel | 2 +- protoc-gen-swagger/{internal => }/genswagger/doc.go | 0 protoc-gen-swagger/{internal => }/genswagger/generator.go | 0 protoc-gen-swagger/{internal => }/genswagger/helpers.go | 0 .../{internal => }/genswagger/helpers_go111_old.go | 0 protoc-gen-swagger/{internal => }/genswagger/template.go | 0 protoc-gen-swagger/{internal => }/genswagger/template_test.go | 0 protoc-gen-swagger/{internal => }/genswagger/types.go | 0 protoc-gen-swagger/main.go | 2 +- 11 files changed, 5 insertions(+), 5 deletions(-) rename protoc-gen-swagger/{internal => }/genswagger/BUILD.bazel (98%) rename protoc-gen-swagger/{internal => }/genswagger/doc.go (100%) rename protoc-gen-swagger/{internal => }/genswagger/generator.go (100%) rename protoc-gen-swagger/{internal => }/genswagger/helpers.go (100%) rename protoc-gen-swagger/{internal => }/genswagger/helpers_go111_old.go (100%) rename protoc-gen-swagger/{internal => }/genswagger/template.go (100%) rename protoc-gen-swagger/{internal => }/genswagger/template_test.go (100%) rename protoc-gen-swagger/{internal => }/genswagger/types.go (100%) diff --git a/Makefile b/Makefile index d39f4a9190e..0bf44a9f0cf 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,8 @@ SWAGGER_PLUGIN=bin/protoc-gen-swagger SWAGGER_PLUGIN_SRC= utilities/doc.go \ utilities/pattern.go \ utilities/trie.go \ - protoc-gen-swagger/internal/genswagger/generator.go \ - protoc-gen-swagger/internal/genswagger/template.go \ + protoc-gen-swagger/genswagger/generator.go \ + protoc-gen-swagger/genswagger/template.go \ protoc-gen-swagger/main.go SWAGGER_PLUGIN_PKG=./protoc-gen-swagger GATEWAY_PLUGIN=bin/protoc-gen-grpc-gateway diff --git a/protoc-gen-swagger/BUILD.bazel b/protoc-gen-swagger/BUILD.bazel index 16ec801494b..0c823e2741b 100644 --- a/protoc-gen-swagger/BUILD.bazel +++ b/protoc-gen-swagger/BUILD.bazel @@ -9,7 +9,7 @@ go_library( deps = [ "//internal/codegenerator:go_default_library", "//protoc-gen-grpc-gateway/descriptor:go_default_library", - "//protoc-gen-swagger/internal/genswagger:go_default_library", + "//protoc-gen-swagger/genswagger:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", diff --git a/protoc-gen-swagger/internal/genswagger/BUILD.bazel b/protoc-gen-swagger/genswagger/BUILD.bazel similarity index 98% rename from protoc-gen-swagger/internal/genswagger/BUILD.bazel rename to protoc-gen-swagger/genswagger/BUILD.bazel index 7aa972a18d1..99ba6229f86 100644 --- a/protoc-gen-swagger/internal/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/genswagger/BUILD.bazel @@ -12,7 +12,7 @@ go_library( "template.go", "types.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/internal/genswagger", + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger", deps = [ "//internal:go_default_library", "//protoc-gen-grpc-gateway/descriptor:go_default_library", diff --git a/protoc-gen-swagger/internal/genswagger/doc.go b/protoc-gen-swagger/genswagger/doc.go similarity index 100% rename from protoc-gen-swagger/internal/genswagger/doc.go rename to protoc-gen-swagger/genswagger/doc.go diff --git a/protoc-gen-swagger/internal/genswagger/generator.go b/protoc-gen-swagger/genswagger/generator.go similarity index 100% rename from protoc-gen-swagger/internal/genswagger/generator.go rename to protoc-gen-swagger/genswagger/generator.go diff --git a/protoc-gen-swagger/internal/genswagger/helpers.go b/protoc-gen-swagger/genswagger/helpers.go similarity index 100% rename from protoc-gen-swagger/internal/genswagger/helpers.go rename to protoc-gen-swagger/genswagger/helpers.go diff --git a/protoc-gen-swagger/internal/genswagger/helpers_go111_old.go b/protoc-gen-swagger/genswagger/helpers_go111_old.go similarity index 100% rename from protoc-gen-swagger/internal/genswagger/helpers_go111_old.go rename to protoc-gen-swagger/genswagger/helpers_go111_old.go diff --git a/protoc-gen-swagger/internal/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go similarity index 100% rename from protoc-gen-swagger/internal/genswagger/template.go rename to protoc-gen-swagger/genswagger/template.go diff --git a/protoc-gen-swagger/internal/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go similarity index 100% rename from protoc-gen-swagger/internal/genswagger/template_test.go rename to protoc-gen-swagger/genswagger/template_test.go diff --git a/protoc-gen-swagger/internal/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go similarity index 100% rename from protoc-gen-swagger/internal/genswagger/types.go rename to protoc-gen-swagger/genswagger/types.go diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index 0bf1c66c4dd..fa32f42cbb1 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -11,7 +11,7 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/internal/genswagger" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger" ) var ( From fcf1295e344f3553e655f294653784349196ea22 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Mon, 9 Mar 2020 12:55:21 +0000 Subject: [PATCH 529/552] Generate changelog for 1.14.2 --- CHANGELOG.md | 14 +++++++++++++- Makefile | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a813b873355..b2676120084 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,22 @@ # Change Log +## [v1.14.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.2) (2020-03-09) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.1...v1.14.2) + +**Merged pull requests:** + +- Move genswagger to public API again [\#1163](https://github.com/grpc-ecosystem/grpc-gateway/pull/1163) ([johanbrandhorst](https://github.com/johanbrandhorst)) + +**Closed issues:** + +- 1.14.x breaks clay [\#1161](https://github.com/grpc-ecosystem/grpc-gateway/issues/1161) + ## [v1.14.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.1) (2020-03-05) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.0...v1.14.1) **Merged pull requests:** +- Generate changelog for 1.14.1 [\#1156](https://github.com/grpc-ecosystem/grpc-gateway/pull/1151) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Move generator and descriptor back to public API [\#1155](https://github.com/grpc-ecosystem/grpc-gateway/pull/1155) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Update build environment to 1.14 [\#1153](https://github.com/grpc-ecosystem/grpc-gateway/pull/1153) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Add gorelease CI step [\#1152](https://github.com/grpc-ecosystem/grpc-gateway/pull/1152) ([johanbrandhorst](https://github.com/johanbrandhorst)) @@ -1334,4 +1346,4 @@ -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/Makefile b/Makefile index 0bf44a9f0cf..1b4f4a9f6fd 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.14.1 + --future-release=v1.14.2 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From f131c11d912527c1402a42bec0b8869147d606dc Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 11 Mar 2020 09:25:44 +0000 Subject: [PATCH 530/552] Move httprule back into the public API Fixes #1168 --- Makefile | 8 ++++---- fuzzit.sh | 4 ++-- protoc-gen-grpc-gateway/descriptor/BUILD.bazel | 4 ++-- protoc-gen-grpc-gateway/descriptor/services.go | 2 +- protoc-gen-grpc-gateway/descriptor/services_test.go | 2 +- protoc-gen-grpc-gateway/descriptor/types.go | 2 +- .../httprule/BUILD.bazel | 2 +- {internal => protoc-gen-grpc-gateway}/httprule/compile.go | 0 .../httprule/compile_test.go | 0 {internal => protoc-gen-grpc-gateway}/httprule/fuzz.go | 0 {internal => protoc-gen-grpc-gateway}/httprule/parse.go | 0 .../httprule/parse_test.go | 0 {internal => protoc-gen-grpc-gateway}/httprule/types.go | 0 .../httprule/types_test.go | 0 protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel | 2 +- .../internal/gengateway/template_test.go | 2 +- protoc-gen-swagger/genswagger/BUILD.bazel | 2 +- protoc-gen-swagger/genswagger/template_test.go | 2 +- 18 files changed, 16 insertions(+), 16 deletions(-) rename {internal => protoc-gen-grpc-gateway}/httprule/BUILD.bazel (88%) rename {internal => protoc-gen-grpc-gateway}/httprule/compile.go (100%) rename {internal => protoc-gen-grpc-gateway}/httprule/compile_test.go (100%) rename {internal => protoc-gen-grpc-gateway}/httprule/fuzz.go (100%) rename {internal => protoc-gen-grpc-gateway}/httprule/parse.go (100%) rename {internal => protoc-gen-grpc-gateway}/httprule/parse_test.go (100%) rename {internal => protoc-gen-grpc-gateway}/httprule/types.go (100%) rename {internal => protoc-gen-grpc-gateway}/httprule/types_test.go (100%) diff --git a/Makefile b/Makefile index 1b4f4a9f6fd..6c4a34d3fa2 100644 --- a/Makefile +++ b/Makefile @@ -33,10 +33,10 @@ GATEWAY_PLUGIN_SRC= utilities/doc.go \ protoc-gen-grpc-gateway/internal/gengateway/doc.go \ protoc-gen-grpc-gateway/internal/gengateway/generator.go \ protoc-gen-grpc-gateway/internal/gengateway/template.go \ - internal/httprule \ - internal/httprule/compile.go \ - internal/httprule/parse.go \ - internal/httprule/types.go \ + protoc-gen-grpc-gateway/httprule \ + protoc-gen-grpc-gateway/httprule/compile.go \ + protoc-gen-grpc-gateway/httprule/parse.go \ + protoc-gen-grpc-gateway/httprule/types.go \ protoc-gen-grpc-gateway/main.go GATEWAY_PLUGIN_FLAGS?= SWAGGER_PLUGIN_FLAGS?= diff --git a/fuzzit.sh b/fuzzit.sh index 43c0f23918b..e5df5f3f843 100755 --- a/fuzzit.sh +++ b/fuzzit.sh @@ -9,9 +9,9 @@ cd go-fuzz go get ./... go build ./... -#go get -v -u ./internal/httprule +#go get -v -u ./protoc-gen-grpc-gateway/httprule cd /src/grpc-gateway -go-fuzz-build -libfuzzer -o parse-http-rule.a ./internal/httprule +go-fuzz-build -libfuzzer -o parse-http-rule.a ./protoc-gen-grpc-gateway/httprule clang-9 -fsanitize=fuzzer parse-http-rule.a -o parse-http-rule wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.29/fuzzit_Linux_x86_64 diff --git a/protoc-gen-grpc-gateway/descriptor/BUILD.bazel b/protoc-gen-grpc-gateway/descriptor/BUILD.bazel index 17a1c0f65ca..631f5c8a503 100644 --- a/protoc-gen-grpc-gateway/descriptor/BUILD.bazel +++ b/protoc-gen-grpc-gateway/descriptor/BUILD.bazel @@ -13,7 +13,7 @@ go_library( ], importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor", deps = [ - "//internal/httprule:go_default_library", + "//protoc-gen-grpc-gateway/httprule:go_default_library", "@com_github_ghodss_yaml//:go_default_library", "@com_github_golang_glog//:go_default_library", "@com_github_golang_protobuf//jsonpb:go_default_library_gen", @@ -36,7 +36,7 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//internal/httprule:go_default_library", + "//protoc-gen-grpc-gateway/httprule:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index 2f9103eef4f..9efc9f9754e 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -7,7 +7,7 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" options "google.golang.org/genproto/googleapis/api/annotations" ) diff --git a/protoc-gen-grpc-gateway/descriptor/services_test.go b/protoc-gen-grpc-gateway/descriptor/services_test.go index 26329fd2a08..1ccb8fbef0a 100644 --- a/protoc-gen-grpc-gateway/descriptor/services_test.go +++ b/protoc-gen-grpc-gateway/descriptor/services_test.go @@ -6,7 +6,7 @@ import ( "github.com/golang/protobuf/proto" descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func compilePath(t *testing.T, path string) httprule.Template { diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index fcdb9940b47..4aa75f85dbf 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -6,7 +6,7 @@ import ( "github.com/golang/protobuf/protoc-gen-go/descriptor" gogen "github.com/golang/protobuf/protoc-gen-go/generator" - "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) // IsWellKnownType returns true if the provided fully qualified type name is considered 'well-known'. diff --git a/internal/httprule/BUILD.bazel b/protoc-gen-grpc-gateway/httprule/BUILD.bazel similarity index 88% rename from internal/httprule/BUILD.bazel rename to protoc-gen-grpc-gateway/httprule/BUILD.bazel index 2064217e6a6..bcb42f25112 100644 --- a/internal/httprule/BUILD.bazel +++ b/protoc-gen-grpc-gateway/httprule/BUILD.bazel @@ -9,7 +9,7 @@ go_library( "parse.go", "types.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/internal/httprule", + importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule", deps = [ "//utilities:go_default_library", "@com_github_golang_glog//:go_default_library", diff --git a/internal/httprule/compile.go b/protoc-gen-grpc-gateway/httprule/compile.go similarity index 100% rename from internal/httprule/compile.go rename to protoc-gen-grpc-gateway/httprule/compile.go diff --git a/internal/httprule/compile_test.go b/protoc-gen-grpc-gateway/httprule/compile_test.go similarity index 100% rename from internal/httprule/compile_test.go rename to protoc-gen-grpc-gateway/httprule/compile_test.go diff --git a/internal/httprule/fuzz.go b/protoc-gen-grpc-gateway/httprule/fuzz.go similarity index 100% rename from internal/httprule/fuzz.go rename to protoc-gen-grpc-gateway/httprule/fuzz.go diff --git a/internal/httprule/parse.go b/protoc-gen-grpc-gateway/httprule/parse.go similarity index 100% rename from internal/httprule/parse.go rename to protoc-gen-grpc-gateway/httprule/parse.go diff --git a/internal/httprule/parse_test.go b/protoc-gen-grpc-gateway/httprule/parse_test.go similarity index 100% rename from internal/httprule/parse_test.go rename to protoc-gen-grpc-gateway/httprule/parse_test.go diff --git a/internal/httprule/types.go b/protoc-gen-grpc-gateway/httprule/types.go similarity index 100% rename from internal/httprule/types.go rename to protoc-gen-grpc-gateway/httprule/types.go diff --git a/internal/httprule/types_test.go b/protoc-gen-grpc-gateway/httprule/types_test.go similarity index 100% rename from internal/httprule/types_test.go rename to protoc-gen-grpc-gateway/httprule/types_test.go diff --git a/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel b/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel index 79b70f54486..8483a78ef4f 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel @@ -30,8 +30,8 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//internal/httprule:go_default_library", "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/httprule:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", ], diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go index aff3fa906b2..69809792b4c 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template_test.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template_test.go @@ -6,8 +6,8 @@ import ( "github.com/golang/protobuf/proto" protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" ) func crossLinkFixture(f *descriptor.File) *descriptor.File { diff --git a/protoc-gen-swagger/genswagger/BUILD.bazel b/protoc-gen-swagger/genswagger/BUILD.bazel index 99ba6229f86..c89eb04477d 100644 --- a/protoc-gen-swagger/genswagger/BUILD.bazel +++ b/protoc-gen-swagger/genswagger/BUILD.bazel @@ -36,8 +36,8 @@ go_test( srcs = ["template_test.go"], embed = [":go_default_library"], deps = [ - "//internal/httprule:go_default_library", "//protoc-gen-grpc-gateway/descriptor:go_default_library", + "//protoc-gen-grpc-gateway/httprule:go_default_library", "//protoc-gen-swagger/options:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:any_go_proto", diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index b0822d80183..cda39688835 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -12,8 +12,8 @@ import ( plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/golang/protobuf/ptypes/any" structpb "github.com/golang/protobuf/ptypes/struct" - "github.com/grpc-ecosystem/grpc-gateway/internal/httprule" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" swagger_options "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" ) From c121b51302f6a275f5a975725ed31f37e26c43e5 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 11 Mar 2020 09:42:37 +0000 Subject: [PATCH 531/552] Generate changelog for 1.14.3 --- CHANGELOG.md | 11 +++++++++++ Makefile | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2676120084..816d64543a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## [v1.14.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.3) (2020-03-11) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.2...v1.14.3) + +**Merged pull requests:** + +- Move httprule back into the public API [\#1169](https://github.com/grpc-ecosystem/grpc-gateway/pull/1169) ([johanbrandhorst](https://github.com/johanbrandhorst)) + +**Closed issues:** + +- Missing httprule breaks our module [\#1168](https://github.com/grpc-ecosystem/grpc-gateway/issues/1168) + ## [v1.14.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.2) (2020-03-09) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.1...v1.14.2) diff --git a/Makefile b/Makefile index 6c4a34d3fa2..60db5e3561c 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.14.2 + --future-release=v1.14.3 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 08aa96b7e66315cb972bdba94bbfca6f2b0d870e Mon Sep 17 00:00:00 2001 From: Koptelov Nikita Date: Tue, 10 Mar 2020 13:29:47 +0300 Subject: [PATCH 532/552] genswagger: test-covered #1162(unset default error ref) --- .../genswagger/template_test.go | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index cda39688835..da602b03f3f 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "reflect" + "strings" "testing" "github.com/golang/protobuf/proto" @@ -2074,3 +2075,86 @@ func TestMessageOptionsWithGoTemplate(t *testing.T) { }) } } + +func TestTemplateWithoutErrorDefinition(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{}, + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Echo"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + MessageType: []*protodescriptor.DescriptorProto{msgdesc, msgdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "POST", + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: "/v1/echo", + }, + Body: &descriptor.Body{ + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{}), + }, + }, + }, + }, + }, + }, + }, + } + reg := descriptor.NewRegistry() + reg.Load(&plugin.CodeGeneratorRequest{ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}}) + result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: reg}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + + defRsp, ok := result.Paths["/v1/echo"].Post.Responses["default"] + if !ok { + return + } + + ref := defRsp.Schema.schemaCore.Ref + // TODO utrack: is there a better way to find object by ref? + refName := strings.TrimPrefix(ref, "#/definitions/") + if refName == "" { + t.Fatal("created default Error response with empty reflink") + } + + if _, ok := result.Definitions[refName]; !ok { + t.Errorf("default Error response with reflink '%v', but its definition was not found", refName) + } +} From 02d1cd4ce0f8d554488797f712f0bcf2ac319fe4 Mon Sep 17 00:00:00 2001 From: Koptelov Nikita Date: Tue, 10 Mar 2020 13:42:26 +0300 Subject: [PATCH 533/552] genswagger: no default response when Error is unset Swagger: do not create default response definitions if we can't find Error/StreamError in Registry, even if `DisableDefaultErrors()` is false. Logs are still emitted if default errors are enabled, but error definition was not found. grep: `.grpc.gateway.runtime.Error`, `.grpc.gateway.runtime.StreamError` Closes #1162 --- protoc-gen-swagger/genswagger/template.go | 44 ++++++++++++++++------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 9e0b5ce58af..48de50eff3e 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -518,14 +518,24 @@ func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, r // Take in a FQMN or FQEN and return a swagger safe version of the FQMN func fullyQualifiedNameToSwaggerName(fqn string, reg *descriptor.Registry) string { + ret, _ := fullyQualifiedNameToSwaggerNameOk(fqn, reg) + return ret +} + +// Take in a FQMN or FQEN and return a swagger safe version of the FQMN and +// a boolean indicating if FQMN was properly resolved. +// TODO utrack: bad name? +func fullyQualifiedNameToSwaggerNameOk(fqn string, reg *descriptor.Registry) (string, bool) { registriesSeenMutex.Lock() defer registriesSeenMutex.Unlock() if mapping, present := registriesSeen[reg]; present { - return mapping[fqn] + ret, ok := mapping[fqn] + return ret, ok } mapping := resolveFullyQualifiedNameToSwaggerNames(append(reg.GetAllFQMNs(), reg.GetAllFQENs()...), reg.GetUseFQNForSwaggerName()) registriesSeen[reg] = mapping - return mapping[fqn] + ret, ok := mapping[fqn] + return ret, ok } // registriesSeen is used to memoise calls to resolveFullyQualifiedNameToSwaggerNames so @@ -849,7 +859,8 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re desc += "(streaming responses)" responseSchema.Type = "object" responseSchema.Title = fmt.Sprintf("Stream result of %s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)) - responseSchema.Properties = &swaggerSchemaObjectProperties{ + + props := swaggerSchemaObjectProperties{ keyVal{ Key: "result", Value: swaggerSchemaObject{ @@ -858,14 +869,18 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re }, }, }, - keyVal{ + } + streamErrDef, hasStreamError := fullyQualifiedNameToSwaggerNameOk(".grpc.gateway.runtime.StreamError", reg) + if hasStreamError { + props = append(props, keyVal{ Key: "error", Value: swaggerSchemaObject{ schemaCore: schemaCore{ - Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.StreamError", reg))}, + Ref: fmt.Sprintf("#/definitions/%s", streamErrDef)}, }, - }, + }) } + responseSchema.Properties = &props responseSchema.Ref = "" } @@ -885,14 +900,17 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re }, } if !reg.GetDisableDefaultErrors() { - // https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responses-object - operationObject.Responses["default"] = swaggerResponseObject{ - Description: "An unexpected error response", - Schema: swaggerSchemaObject{ - schemaCore: schemaCore{ - Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.Error", reg)), + errDef, hasErrDef := fullyQualifiedNameToSwaggerNameOk(".grpc.gateway.runtime.Error", reg) + if hasErrDef { + // https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responses-object + operationObject.Responses["default"] = swaggerResponseObject{ + Description: "An unexpected error response", + Schema: swaggerSchemaObject{ + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", errDef), + }, }, - }, + } } } if bIdx == 0 { From bbf519270e7a5b7856e33eb275a6bd5997038e29 Mon Sep 17 00:00:00 2001 From: Koptelov Nikita Date: Wed, 11 Mar 2020 14:14:10 +0300 Subject: [PATCH 534/552] genswagger: emit errors if swagger name can't be resolved --- protoc-gen-swagger/genswagger/template.go | 114 ++++++++++++------ .../genswagger/template_test.go | 1 - protoc-gen-swagger/genswagger/types.go | 10 ++ 3 files changed, 88 insertions(+), 37 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 48de50eff3e..1d3ff8d475c 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -221,28 +221,40 @@ func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descripto for _, svc := range s { for _, meth := range svc.Methods { // Request may be fully included in query - if _, ok := refs[fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg))]; ok { - if !skipRenderingRef(meth.RequestType.FQMN()) { - m[fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)] = meth.RequestType + { + swgReqName, ok := fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg) + if !ok { + glog.Errorf("couldn't resolve swagger name for FQMN '%v'", meth.RequestType.FQMN()) + continue + } + if _, ok := refs[fmt.Sprintf("#/definitions/%s", swgReqName)]; ok { + if !skipRenderingRef(meth.RequestType.FQMN()) { + m[swgReqName] = meth.RequestType + } } } + + swgRspName, ok := fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg) + if !ok && !skipRenderingRef(meth.ResponseType.FQMN()) { + glog.Errorf("couldn't resolve swagger name for FQMN '%v'", meth.ResponseType.FQMN()) + continue + } + findNestedMessagesAndEnumerations(meth.RequestType, reg, m, e) if !skipRenderingRef(meth.ResponseType.FQMN()) { - m[fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)] = meth.ResponseType + m[swgRspName] = meth.ResponseType if meth.GetServerStreaming() { - runtimeStreamError := fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.StreamError", reg) - glog.V(1).Infof("StreamError FQMN: %s", runtimeStreamError) - streamError, err := reg.LookupMsg(".grpc.gateway.runtime", "StreamError") - if err == nil { + streamError, runtimeStreamError, err := lookupMsgAndSwaggerName(".grpc.gateway.runtime", "StreamError", reg) + if err != nil { + glog.Error(err) + } else { glog.V(1).Infof("StreamError: %v", streamError) + glog.V(1).Infof("StreamError FQMN: %s", runtimeStreamError) m[runtimeStreamError] = streamError findNestedMessagesAndEnumerations(streamError, reg, m, e) - } else { - //just in case there is an error looking up StreamError - glog.Error(err) } - ms[fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)] = meth.ResponseType + ms[swgRspName] = meth.ResponseType } } findNestedMessagesAndEnumerations(meth.ResponseType, reg, m, e) @@ -281,6 +293,10 @@ func skipRenderingRef(refName string) bool { func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry, customRefs refMap) { for name, msg := range messages { + swgName, ok := fullyQualifiedNameToSwaggerName(msg.FQMN(), reg) + if !ok { + panic(fmt.Sprintf("can't resolve swagger name from '%v'", msg.FQMN())) + } if skipRenderingRef(name) { continue } @@ -354,7 +370,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, } *schema.Properties = append(*schema.Properties, kv) } - d[fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)] = schema + d[swgName] = schema } } @@ -392,12 +408,15 @@ func schemaOfField(f *descriptor.Field, reg *descriptor.Registry, refs refMap) s props = &swaggerSchemaObjectProperties{} } } else { + swgRef, ok := fullyQualifiedNameToSwaggerName(fd.GetTypeName(), reg) + if !ok { + panic(fmt.Sprintf("can't resolve swagger ref from typename '%v'", fd.GetTypeName())) + } core = schemaCore{ - Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(fd.GetTypeName(), reg), + Ref: "#/definitions/" + swgRef, } if refs != nil { refs[fd.GetTypeName()] = struct{}{} - } } default: @@ -492,6 +511,10 @@ func primitiveSchema(t pbdescriptor.FieldDescriptorProto_Type) (ftype, format st // renderEnumerationsAsDefinition inserts enums into the definitions object. func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { for _, enum := range enums { + swgName, ok := fullyQualifiedNameToSwaggerName(enum.FQEN(), reg) + if !ok { + panic(fmt.Sprintf("can't resolve swagger name from FQEN '%v'", enum.FQEN())) + } enumComments := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index)) // it may be necessary to sort the result of the GetValue function. @@ -512,20 +535,13 @@ func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, r panic(err) } - d[fullyQualifiedNameToSwaggerName(enum.FQEN(), reg)] = enumSchemaObject + d[swgName] = enumSchemaObject } } -// Take in a FQMN or FQEN and return a swagger safe version of the FQMN -func fullyQualifiedNameToSwaggerName(fqn string, reg *descriptor.Registry) string { - ret, _ := fullyQualifiedNameToSwaggerNameOk(fqn, reg) - return ret -} - // Take in a FQMN or FQEN and return a swagger safe version of the FQMN and // a boolean indicating if FQMN was properly resolved. -// TODO utrack: bad name? -func fullyQualifiedNameToSwaggerNameOk(fqn string, reg *descriptor.Registry) (string, bool) { +func fullyQualifiedNameToSwaggerName(fqn string, reg *descriptor.Registry) (string, bool) { registriesSeenMutex.Lock() defer registriesSeenMutex.Unlock() if mapping, present := registriesSeen[reg]; present { @@ -538,6 +554,20 @@ func fullyQualifiedNameToSwaggerNameOk(fqn string, reg *descriptor.Registry) (st return ret, ok } +// Lookup message type by location.name and return a swagger-safe version +// of its FQMN. +func lookupMsgAndSwaggerName(location, name string, reg *descriptor.Registry) (*descriptor.Message, string, error) { + msg, err := reg.LookupMsg(location, name) + if err != nil { + return nil, "", err + } + swgName, ok := fullyQualifiedNameToSwaggerName(msg.FQMN(), reg) + if !ok { + return nil, "", fmt.Errorf("can't map swagger name from FQMN '%v'", msg.FQMN()) + } + return msg, swgName, nil +} + // registriesSeen is used to memoise calls to resolveFullyQualifiedNameToSwaggerNames so // we don't repeat it unnecessarily, since it can take some time. var registriesSeen = map[*descriptor.Registry]map[string]string{} @@ -778,7 +808,10 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re wknSchemaCore, isWkn := wktSchemas[meth.RequestType.FQMN()] if !isWkn { - schema.Ref = fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)) + err := schema.setRefFromFQN(meth.RequestType.FQMN(), reg) + if err != nil { + return err + } } else { schema.schemaCore = wknSchemaCore @@ -836,7 +869,10 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re // well, without a definition wknSchemaCore, isWkn := wktSchemas[meth.ResponseType.FQMN()] if !isWkn { - responseSchema.Ref = fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)) + err := responseSchema.setRefFromFQN(meth.ResponseType.FQMN(), reg) + if err != nil { + return err + } } else { responseSchema.schemaCore = wknSchemaCore @@ -858,7 +894,8 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re if meth.GetServerStreaming() { desc += "(streaming responses)" responseSchema.Type = "object" - responseSchema.Title = fmt.Sprintf("Stream result of %s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)) + swgRef, _ := fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg) + responseSchema.Title = "Stream result of " + swgRef props := swaggerSchemaObjectProperties{ keyVal{ @@ -870,7 +907,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re }, }, } - streamErrDef, hasStreamError := fullyQualifiedNameToSwaggerNameOk(".grpc.gateway.runtime.StreamError", reg) + streamErrDef, hasStreamError := fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.StreamError", reg) if hasStreamError { props = append(props, keyVal{ Key: "error", @@ -900,7 +937,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re }, } if !reg.GetDisableDefaultErrors() { - errDef, hasErrDef := fullyQualifiedNameToSwaggerNameOk(".grpc.gateway.runtime.Error", reg) + errDef, hasErrDef := fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.Error", reg) if hasErrDef { // https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responses-object operationObject.Responses["default"] = swaggerResponseObject{ @@ -1074,9 +1111,9 @@ func applyTemplate(p param) (*swaggerObject, error) { if !p.reg.GetDisableDefaultErrors() { // Add the error type to the message map - runtimeError, err := p.reg.LookupMsg(".grpc.gateway.runtime", "Error") + runtimeError, swgRef, err := lookupMsgAndSwaggerName(".grpc.gateway.runtime", "Error", p.reg) if err == nil { - messages[fullyQualifiedNameToSwaggerName(".grpc.gateway.runtime.Error", p.reg)] = runtimeError + messages[swgRef] = runtimeError } else { // just in case there is an error looking up runtimeError glog.Error(err) @@ -1701,8 +1738,8 @@ func protoJSONSchemaToSwaggerSchemaCore(j *swagger_options.JSONSchema, reg *desc ret := schemaCore{} if j.GetRef() != "" { - swaggerName := fullyQualifiedNameToSwaggerName(j.GetRef(), reg) - if swaggerName != "" { + swaggerName, ok := fullyQualifiedNameToSwaggerName(j.GetRef(), reg) + if ok { ret.Ref = "#/definitions/" + swaggerName if refs != nil { refs[j.GetRef()] = struct{}{} @@ -1838,19 +1875,24 @@ func addCustomRefs(d swaggerDefinitionsObject, reg *descriptor.Registry, refs re msgMap := make(messageMap) enumMap := make(enumMap) for ref := range refs { - if _, ok := d[fullyQualifiedNameToSwaggerName(ref, reg)]; ok { + swgName, swgOk := fullyQualifiedNameToSwaggerName(ref, reg) + if !swgOk { + glog.Errorf("can't resolve swagger name from CustomRef '%v'", ref) + continue + } + if _, ok := d[swgName]; ok { // Skip already existing definitions delete(refs, ref) continue } msg, err := reg.LookupMsg("", ref) if err == nil { - msgMap[fullyQualifiedNameToSwaggerName(ref, reg)] = msg + msgMap[swgName] = msg continue } enum, err := reg.LookupEnum("", ref) if err == nil { - enumMap[fullyQualifiedNameToSwaggerName(ref, reg)] = enum + enumMap[swgName] = enum continue } diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index da602b03f3f..860064e8f04 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -2148,7 +2148,6 @@ func TestTemplateWithoutErrorDefinition(t *testing.T) { } ref := defRsp.Schema.schemaCore.Ref - // TODO utrack: is there a better way to find object by ref? refName := strings.TrimPrefix(ref, "#/definitions/") if refName == "" { t.Fatal("created default Error response with empty reflink") diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 255f53c77ca..0b4c953b3ee 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -3,6 +3,7 @@ package genswagger import ( "bytes" "encoding/json" + "fmt" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" ) @@ -161,6 +162,15 @@ type schemaCore struct { Default string `json:"default,omitempty"` } +func (s *schemaCore) setRefFromFQN(ref string, reg *descriptor.Registry) error { + name, ok := fullyQualifiedNameToSwaggerName(ref, reg) + if !ok { + return fmt.Errorf("setRefFromFQN: can't resolve swagger name from '%v'", ref) + } + s.Ref = fmt.Sprintf("#/definitions/%s", name) + return nil +} + type swaggerItemsObject schemaCore // http://swagger.io/specification/#responsesObject From 663428b8e24ed88c6a56509fbaee21464b11c1da Mon Sep 17 00:00:00 2001 From: Koptelov Nikita Date: Wed, 11 Mar 2020 14:24:53 +0300 Subject: [PATCH 535/552] genswagger: fixed tests now tests require properly loaded registry to lookup swagger names and stuff. :) --- .../genswagger/template_test.go | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 860064e8f04..6b747d58556 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -37,6 +37,15 @@ func crossLinkFixture(f *descriptor.File) *descriptor.File { return f } +func reqFromFile(f *descriptor.File) *plugin.CodeGeneratorRequest { + return &plugin.CodeGeneratorRequest{ + ProtoFile: []*protodescriptor.FileDescriptorProto{ + f.FileDescriptorProto, + }, + FileToGenerate: []string{f.GetName()}, + } +} + func TestMessageToQueryParameters(t *testing.T) { type test struct { MsgDescs []*protodescriptor.DescriptorProto @@ -381,7 +390,14 @@ func TestApplyTemplateSimple(t *testing.T) { }, }, } - result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: descriptor.NewRegistry()}) + reg := descriptor.NewRegistry() + fileCL := crossLinkFixture(&file) + err := reg.Load(reqFromFile(fileCL)) + if err != nil { + t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) + return + } + result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -471,7 +487,15 @@ func TestApplyTemplateOverrideOperationID(t *testing.T) { }, }, } - result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: descriptor.NewRegistry()}) + + reg := descriptor.NewRegistry() + fileCL := crossLinkFixture(&file) + err := reg.Load(reqFromFile(fileCL)) + if err != nil { + t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) + return + } + result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return @@ -585,7 +609,14 @@ func TestApplyTemplateExtensions(t *testing.T) { if err := proto.SetExtension(proto.Message(meth.Options), swagger_options.E_Openapiv2Operation, &swaggerOperation); err != nil { t.Fatalf("proto.SetExtension(MethodDescriptorProto.Options) failed: %v", err) } - result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: descriptor.NewRegistry()}) + reg := descriptor.NewRegistry() + fileCL := crossLinkFixture(&file) + err := reg.Load(reqFromFile(fileCL)) + if err != nil { + t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) + return + } + result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return From 326da76fffff32ae497f3fd04f661405635decc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Czig=C3=A1ny?= Date: Sun, 15 Mar 2020 01:21:37 +0100 Subject: [PATCH 536/552] return error if an external HTTP rule has no matching method --- .../descriptor/registry.go | 23 +++++++++++ .../descriptor/registry_test.go | 40 +++++++++++++++++++ protoc-gen-grpc-gateway/main.go | 5 +++ 3 files changed, 68 insertions(+) diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index e68a9aa233b..88d5050de3f 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -268,6 +268,29 @@ func (r *Registry) AddExternalHTTPRule(qualifiedMethodName string, rule *annotat r.externalHTTPRules[qualifiedMethodName] = append(r.externalHTTPRules[qualifiedMethodName], rule) } +// UnboundExternalHTTPRules returns the list of External HTTPRules +// which does not have a matching method in the registry +func (r *Registry) UnboundExternalHTTPRules() []string { + allServiceMethods := make(map[string]struct{}) + for _, f := range r.files { + for _, s := range f.GetService() { + svc := &Service{File: f, ServiceDescriptorProto: s} + for _, m := range s.GetMethod() { + method := &Method{Service: svc, MethodDescriptorProto: m} + allServiceMethods[method.FQMN()] = struct{}{} + } + } + } + + var missingMethods []string + for httpRuleMethod := range r.externalHTTPRules { + if _, ok := allServiceMethods[httpRuleMethod]; !ok { + missingMethods = append(missingMethods, httpRuleMethod) + } + } + return missingMethods +} + // AddPkgMap adds a mapping from a .proto file to proto package name. func (r *Registry) AddPkgMap(file, protoPkg string) { r.pkgMap[file] = protoPkg diff --git a/protoc-gen-grpc-gateway/descriptor/registry_test.go b/protoc-gen-grpc-gateway/descriptor/registry_test.go index 16e76655d59..36c53d6d4b9 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry_test.go +++ b/protoc-gen-grpc-gateway/descriptor/registry_test.go @@ -586,3 +586,43 @@ func TestLoadGoPackageInputPath(t *testing.T) { t.Errorf("file.GoPkg = %#v; want %#v", got, want) } } + +func TestUnboundExternalHTTPRules(t *testing.T) { + reg := NewRegistry() + methodName := ".example.ExampleService.Echo" + reg.AddExternalHTTPRule(methodName, nil) + assertStringSlice(t, "unbound external HTTP rules", reg.UnboundExternalHTTPRules(), []string{methodName}) + loadFile(t, reg, ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "StringMessage" + output_type: "StringMessage" + > + > + `) + assertStringSlice(t, "unbound external HTTP rules", reg.UnboundExternalHTTPRules(), []string{}) +} + +func assertStringSlice(t *testing.T, message string, got, want []string) { + if len(got) != len(want) { + t.Errorf("%s = %#v len(%d); want %#v len(%d)", message, got, len(got), want, len(want)) + } + for i := range want { + if got[i] != want[i] { + t.Errorf("%s[%d] = %#v; want %#v", message, i, got[i], want[i]) + } + } +} diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index fb44e412fe5..6395796945d 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -103,6 +103,11 @@ func main() { emitError(err) return } + unboundHTTPRules := reg.UnboundExternalHTTPRules() + if len(unboundHTTPRules) != 0 { + emitError(fmt.Errorf("HTTP rules without a matching selector: %s", strings.Join(unboundHTTPRules, ", "))) + return + } var targets []*descriptor.File for _, target := range req.FileToGenerate { From 6f82cb97dff3b40c41317df438971309a44dca93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Czig=C3=A1ny?= Date: Sun, 15 Mar 2020 01:21:09 +0100 Subject: [PATCH 537/552] log warning if a service method has no HTTP rule The original intention was to make this an error too, but that would break example generation badly. --- .../descriptor/services.go | 2 +- .../descriptor/services_test.go | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index 9efc9f9754e..5acd771045b 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -35,7 +35,7 @@ func (r *Registry) loadServices(file *File) error { optsList = append(optsList, opts) } if len(optsList) == 0 { - glog.V(1).Infof("Found non-target method: %s.%s", svc.GetName(), md.GetName()) + glog.Warningf("No HttpRule found for method: %s.%s", svc.GetName(), md.GetName()) } meth, err := r.newMethod(svc, md, optsList) if err != nil { diff --git a/protoc-gen-grpc-gateway/descriptor/services_test.go b/protoc-gen-grpc-gateway/descriptor/services_test.go index 1ccb8fbef0a..8018b0f2932 100644 --- a/protoc-gen-grpc-gateway/descriptor/services_test.go +++ b/protoc-gen-grpc-gateway/descriptor/services_test.go @@ -219,6 +219,65 @@ func TestExtractServicesSimple(t *testing.T) { testExtractServices(t, []*descriptor.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) } +func TestExtractServicesWithoutAnnotation(t *testing.T) { + src := ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "StringMessage" + output_type: "StringMessage" + > + > + ` + var fd descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &fd); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) + } + msg := &Message{ + DescriptorProto: fd.MessageType[0], + Fields: []*Field{ + { + FieldDescriptorProto: fd.MessageType[0].Field[0], + }, + }, + } + file := &File{ + FileDescriptorProto: &fd, + GoPkg: GoPackage{ + Path: "path/to/example.pb", + Name: "example_pb", + }, + Messages: []*Message{msg}, + Services: []*Service{ + { + ServiceDescriptorProto: fd.Service[0], + Methods: []*Method{ + { + MethodDescriptorProto: fd.Service[0].Method[0], + RequestType: msg, + ResponseType: msg, + }, + }, + }, + }, + } + + crossLinkFixture(file) + testExtractServices(t, []*descriptor.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) +} + func TestExtractServicesCrossPackage(t *testing.T) { srcs := []string{ ` From 2cfb60c6e35f6148c5553933169ea07f65b45b72 Mon Sep 17 00:00:00 2001 From: Benjamin Boudreau Date: Sun, 22 Mar 2020 13:50:10 -0400 Subject: [PATCH 538/552] fix version spelling --- protoc-gen-grpc-gateway/main.go | 2 +- protoc-gen-swagger/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 6395796945d..236ce41fcc7 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -34,7 +34,7 @@ var ( repeatedPathParamSeparator = flag.String("repeated_path_param_separator", "csv", "configures how repeated fields should be split. Allowed values are `csv`, `pipes`, `ssv` and `tsv`.") allowPatchFeature = flag.Bool("allow_patch_feature", true, "determines whether to use PATCH feature involving update masks (using google.protobuf.FieldMask).") allowColonFinalSegments = flag.Bool("allow_colon_final_segments", false, "determines whether colons are permitted in the final segment of a path") - versionFlag = flag.Bool("version", false, "print the current verison") + versionFlag = flag.Bool("version", false, "print the current version") ) // Variables set by goreleaser at build time diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index fa32f42cbb1..03d6697fbff 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -23,7 +23,7 @@ var ( mergeFileName = flag.String("merge_file_name", "apidocs", "target swagger file name prefix after merge") useJSONNamesForFields = flag.Bool("json_names_for_fields", false, "if it sets Field.GetJsonName() will be used for generating swagger definitions, otherwise Field.GetName() will be used") repeatedPathParamSeparator = flag.String("repeated_path_param_separator", "csv", "configures how repeated fields should be split. Allowed values are `csv`, `pipes`, `ssv` and `tsv`.") - versionFlag = flag.Bool("version", false, "print the current verison") + versionFlag = flag.Bool("version", false, "print the current version") allowRepeatedFieldsInBody = flag.Bool("allow_repeated_fields_in_body", false, "allows to use repeated field in `body` and `response_body` field of `google.api.http` annotation option") includePackageInTags = flag.Bool("include_package_in_tags", false, "if unset, the gRPC service name is added to the `Tags` field of each operation. if set and the `package` directive is shown in the proto file, the package name will be prepended to the service name") useFQNForSwaggerName = flag.Bool("fqn_for_swagger_name", false, "if set, the object's swagger names will use the fully qualify name from the proto definition (ie my.package.MyMessage.MyInnerMessage") From 169cf7593d37c87e6d8a8dd0d6c8e98c3071b66d Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Mon, 23 Mar 2020 11:02:32 +0100 Subject: [PATCH 539/552] Limit Bazel memory usage in CI. This aims to reduce/eliminate the CircleCI flakes described in #968. It's based on the approach in https://github.com/angular/angular-cli/blob/master/.circleci/bazel.rc --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5f20a8d3cde..99bcb24eeec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -69,6 +69,8 @@ jobs: startup --output_base $HOME/.cache/_grpc_gateway_bazel build --test_output errors build --features race + # Workaround https://github.com/bazelbuild/bazel/issues/3645 + build --local_resources=3072,2.0,1.0 EOF - run: name: Check that Bazel BUILD files are up-to-date From 92506e96eeacfbed6a8a6539507e82f4e7fd4278 Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Mon, 23 Mar 2020 11:31:21 +0100 Subject: [PATCH 540/552] Use 8088 instead of 8080 in integration test. This should avoid a failure on Bazel's Buildkite CI, where 8080 cannot be used. --- examples/internal/integration/client_test.go | 10 ++-- .../internal/integration/integration_test.go | 56 +++++++++---------- examples/internal/integration/main_test.go | 6 +- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/examples/internal/integration/client_test.go b/examples/internal/integration/client_test.go index 813158025aa..90ad997f90f 100644 --- a/examples/internal/integration/client_test.go +++ b/examples/internal/integration/client_test.go @@ -16,7 +16,7 @@ func TestEchoClient(t *testing.T) { } cfg := echo.NewConfiguration() - cfg.BasePath = "http://localhost:8080" + cfg.BasePath = "http://localhost:8088" cl := echo.NewAPIClient(cfg) resp, _, err := cl.EchoServiceApi.Echo(context.Background(), "foo") @@ -35,7 +35,7 @@ func TestEchoBodyClient(t *testing.T) { } cfg := echo.NewConfiguration() - cfg.BasePath = "http://localhost:8080" + cfg.BasePath = "http://localhost:8088" cl := echo.NewAPIClient(cfg) req := echo.ExamplepbSimpleMessage{Id: "foo"} @@ -55,7 +55,7 @@ func TestAbitOfEverythingClient(t *testing.T) { } cfg := abe.NewConfiguration() - cfg.BasePath = "http://localhost:8080" + cfg.BasePath = "http://localhost:8088" cl := abe.NewAPIClient(cfg) @@ -184,7 +184,7 @@ func TestUnannotatedEchoClient(t *testing.T) { } cfg := unannotatedecho.NewConfiguration() - cfg.BasePath = "http://localhost:8080" + cfg.BasePath = "http://localhost:8088" cl := unannotatedecho.NewAPIClient(cfg) @@ -204,7 +204,7 @@ func TestUnannotatedEchoBodyClient(t *testing.T) { } cfg := unannotatedecho.NewConfiguration() - cfg.BasePath = "http://localhost:8080" + cfg.BasePath = "http://localhost:8088" cl := unannotatedecho.NewAPIClient(cfg) diff --git a/examples/internal/integration/integration_test.go b/examples/internal/integration/integration_test.go index 31370468f05..2c569270538 100644 --- a/examples/internal/integration/integration_test.go +++ b/examples/internal/integration/integration_test.go @@ -40,11 +40,11 @@ func TestEcho(t *testing.T) { return } - testEcho(t, 8080, "application/json") - testEchoOneof(t, 8080, "application/json") - testEchoOneof1(t, 8080, "application/json") - testEchoOneof2(t, 8080, "application/json") - testEchoBody(t, 8080) + testEcho(t, 8088, "application/json") + testEchoOneof(t, 8088, "application/json") + testEchoOneof1(t, 8088, "application/json") + testEchoOneof2(t, 8088, "application/json") + testEchoBody(t, 8088) } func TestForwardResponseOption(t *testing.T) { @@ -266,17 +266,17 @@ func TestABE(t *testing.T) { return } - testABECreate(t, 8080) - testABECreateBody(t, 8080) - testABEBulkCreate(t, 8080) - testABEBulkCreateWithError(t, 8080) - testABELookup(t, 8080) - testABELookupNotFound(t, 8080) - testABEList(t, 8080) - testABEBulkEcho(t, 8080) - testABEBulkEchoZeroLength(t, 8080) - testAdditionalBindings(t, 8080) - testABERepeated(t, 8080) + testABECreate(t, 8088) + testABECreateBody(t, 8088) + testABEBulkCreate(t, 8088) + testABEBulkCreateWithError(t, 8088) + testABELookup(t, 8088) + testABELookupNotFound(t, 8088) + testABEList(t, 8088) + testABEBulkEcho(t, 8088) + testABEBulkEchoZeroLength(t, 8088) + testAdditionalBindings(t, 8088) + testABERepeated(t, 8088) } func testABECreate(t *testing.T, port int) { @@ -680,7 +680,7 @@ func TestABEPatch(t *testing.T) { return } - port := 8080 + port := 8088 // create a record with a known string_value and int32_value uuid := postABE(t, port, gw.ABitOfEverything{StringValue: "strprefix/bar", Int32Value: 32}) @@ -724,7 +724,7 @@ func TestABEPatchBody(t *testing.T) { return } - port := 8080 + port := 8088 for _, tc := range []struct { name string @@ -1284,7 +1284,7 @@ func TestTimeout(t *testing.T) { return } - apiURL := "http://localhost:8080/v2/example/timeout" + apiURL := "http://localhost:8088/v2/example/timeout" req, err := http.NewRequest("GET", apiURL, nil) if err != nil { t.Errorf(`http.NewRequest("GET", %q, nil) failed with %v; want success`, apiURL, err) @@ -1309,7 +1309,7 @@ func TestErrorWithDetails(t *testing.T) { return } - apiURL := "http://localhost:8080/v2/example/errorwithdetails" + apiURL := "http://localhost:8088/v2/example/errorwithdetails" resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) @@ -1374,7 +1374,7 @@ func TestPostWithEmptyBody(t *testing.T) { return } - apiURL := "http://localhost:8080/v2/example/postwithemptybody/name" + apiURL := "http://localhost:8088/v2/example/postwithemptybody/name" rep, err := http.Post(apiURL, "application/json", nil) if err != nil { @@ -1395,7 +1395,7 @@ func TestUnknownPath(t *testing.T) { return } - apiURL := "http://localhost:8080" + apiURL := "http://localhost:8088" resp, err := http.Post(apiURL, "application/json", strings.NewReader("{}")) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) @@ -1420,7 +1420,7 @@ func TestMethodNotAllowed(t *testing.T) { return } - apiURL := "http://localhost:8080/v1/example/echo/myid" + apiURL := "http://localhost:8088/v1/example/echo/myid" resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Post(%q) failed with %v; want success", apiURL, err) @@ -1445,7 +1445,7 @@ func TestInvalidArgument(t *testing.T) { return } - apiURL := "http://localhost:8080/v1/example/echo/myid/not_int64" + apiURL := "http://localhost:8088/v1/example/echo/myid/not_int64" resp, err := http.Get(apiURL) if err != nil { t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) @@ -1470,9 +1470,9 @@ func TestResponseBody(t *testing.T) { return } - testResponseBody(t, 8080) - testResponseBodies(t, 8080) - testResponseStrings(t, 8080) + testResponseBody(t, 8088) + testResponseBodies(t, 8088) + testResponseStrings(t, 8088) } func testResponseBody(t *testing.T, port int) { @@ -1594,7 +1594,7 @@ func TestRequestQueryParams(t *testing.T) { return } - port := 8080 + port := 8088 formValues := url.Values{} formValues.Set("string_value", "hello-world") diff --git a/examples/internal/integration/main_test.go b/examples/internal/integration/main_test.go index 3c43d6a2087..43a43d4022e 100644 --- a/examples/internal/integration/main_test.go +++ b/examples/internal/integration/main_test.go @@ -64,7 +64,7 @@ func runServers(ctx context.Context) <-chan error { } }() go func() { - if err := runGateway(ctx, ":8080"); err != nil { + if err := runGateway(ctx, ":8088"); err != nil { ch <- fmt.Errorf("cannot run gateway service: %v", err) } }() @@ -81,8 +81,8 @@ func TestMain(m *testing.M) { ch := make(chan int, 1) go func() { - if err := waitForGateway(ctx, 8080); err != nil { - glog.Errorf("waitForGateway(ctx, 8080) failed with %v; want success", err) + if err := waitForGateway(ctx, 8088); err != nil { + glog.Errorf("waitForGateway(ctx, 8088) failed with %v; want success", err) } ch <- m.Run() }() From 19e0d9389420c3b14a2210ef37f79ecd6ddcf09b Mon Sep 17 00:00:00 2001 From: rowe0x <35551085+rowe0x@users.noreply.github.com> Date: Wed, 25 Mar 2020 16:41:34 +0800 Subject: [PATCH 541/552] Add enums_as_ints flag to protoc-gen-swagger (#1186) * feat: add enumAsInts flag * Update protoc-gen-swagger/genswagger/template.go Co-Authored-By: Johan Brandhorst * fix: typo * feat: add comment * feat: add test Co-authored-by: Johan Brandhorst --- .../descriptor/registry.go | 13 ++ protoc-gen-swagger/genswagger/template.go | 34 +++- .../genswagger/template_test.go | 181 ++++++++++++++++++ protoc-gen-swagger/main.go | 2 + 4 files changed, 228 insertions(+), 2 deletions(-) diff --git a/protoc-gen-grpc-gateway/descriptor/registry.go b/protoc-gen-grpc-gateway/descriptor/registry.go index 88d5050de3f..07b9f47b59c 100644 --- a/protoc-gen-grpc-gateway/descriptor/registry.go +++ b/protoc-gen-grpc-gateway/descriptor/registry.go @@ -76,6 +76,9 @@ type Registry struct { // in your protofile comments useGoTemplate bool + // enumsAsInts render enum as integer, as opposed to string + enumsAsInts bool + // disableDefaultErrors disables the generation of the default error types. // This is useful for users who have defined custom error handling. disableDefaultErrors bool @@ -487,6 +490,16 @@ func (r *Registry) GetUseGoTemplate() bool { return r.useGoTemplate } +// SetEnumsAsInts set enumsAsInts +func (r *Registry) SetEnumsAsInts(enumsAsInts bool) { + r.enumsAsInts = enumsAsInts +} + +// GetEnumsAsInts returns enumsAsInts +func (r *Registry) GetEnumsAsInts() bool { + return r.enumsAsInts +} + // SetDisableDefaultErrors sets disableDefaultErrors func (r *Registry) SetDisableDefaultErrors(use bool) { r.disableDefaultErrors = use diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 1d3ff8d475c..438e3a2f54a 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -92,6 +92,13 @@ func listEnumNames(enum *descriptor.Enum) (names []string) { return names } +func listEnumNumbers(enum *descriptor.Enum) (numbers []string) { + for _, value := range enum.GetValue() { + numbers = append(numbers, strconv.Itoa(int(value.GetNumber()))) + } + return +} + func getEnumDefault(enum *descriptor.Enum) string { for _, value := range enum.GetValue() { if value.GetNumber() == 0 { @@ -182,10 +189,19 @@ func queryParams(message *descriptor.Message, field *descriptor.Field, prefix st Type: "string", Enum: listEnumNames(enum), } + if reg.GetEnumsAsInts() { + param.Items.Type = "integer" + param.Items.Enum = listEnumNumbers(enum) + } } else { param.Type = "string" param.Enum = listEnumNames(enum) param.Default = getEnumDefault(enum) + if reg.GetEnumsAsInts() { + param.Type = "integer" + param.Enum = listEnumNumbers(enum) + param.Default = "0" + } } valueComments := enumValueProtoComments(reg, enum) if valueComments != "" { @@ -531,6 +547,12 @@ func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, r Default: defaultValue, }, } + if reg.GetEnumsAsInts() { + enumSchemaObject.Type = "integer" + enumSchemaObject.Format = "int32" + enumSchemaObject.Default = "0" + enumSchemaObject.Enum = listEnumNumbers(enum) + } if err := updateSwaggerDataFromComments(reg, &enumSchemaObject, enum, enumComments, false); err != nil { panic(err) } @@ -737,13 +759,18 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re return fmt.Errorf("only primitive and well-known types are allowed in path parameters") } case pbdescriptor.FieldDescriptorProto_TYPE_ENUM: - paramType = "string" - paramFormat = "" enum, err := reg.LookupEnum("", parameter.Target.GetTypeName()) if err != nil { return err } + paramType = "string" + paramFormat = "" enumNames = listEnumNames(enum) + if reg.GetEnumsAsInts() { + paramType = "integer" + paramFormat = "" + enumNames = listEnumNumbers(enum) + } schema := schemaOfField(parameter.Target, reg, customRefs) desc = schema.Description defaultValue = schema.Default @@ -1470,6 +1497,9 @@ func enumValueProtoComments(reg *descriptor.Registry, enum *descriptor.Enum) str var comments []string for idx, value := range enum.GetValue() { name := value.GetName() + if reg.GetEnumsAsInts() { + name = strconv.Itoa(int(value.GetNumber())) + } str := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index), protoPath, int32(idx)) if str != "" { comments = append(comments, name+": "+str) diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 6b747d58556..06e1ca763a9 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -46,6 +46,187 @@ func reqFromFile(f *descriptor.File) *plugin.CodeGeneratorRequest { } } +func TestMessageToQueryParametersWithEnumAsInt(t *testing.T) { + type test struct { + MsgDescs []*protodescriptor.DescriptorProto + Message string + Params []swaggerParameterObject + } + + tests := []test{ + { + MsgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("a"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("b"), + Type: protodescriptor.FieldDescriptorProto_TYPE_DOUBLE.Enum(), + Number: proto.Int32(2), + }, + { + Name: proto.String("c"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: protodescriptor.FieldDescriptorProto_LABEL_REPEATED.Enum(), + Number: proto.Int32(3), + }, + }, + }, + }, + Message: "ExampleMessage", + Params: []swaggerParameterObject{ + swaggerParameterObject{ + Name: "a", + In: "query", + Required: false, + Type: "string", + }, + swaggerParameterObject{ + Name: "b", + In: "query", + Required: false, + Type: "number", + Format: "double", + }, + swaggerParameterObject{ + Name: "c", + In: "query", + Required: false, + Type: "array", + CollectionFormat: "multi", + }, + }, + }, + { + MsgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("nested"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String(".example.Nested"), + Number: proto.Int32(1), + }, + }, + }, + &protodescriptor.DescriptorProto{ + Name: proto.String("Nested"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("a"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("deep"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String(".example.Nested.DeepNested"), + Number: proto.Int32(2), + }, + }, + NestedType: []*protodescriptor.DescriptorProto{{ + Name: proto.String("DeepNested"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("b"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("c"), + Type: protodescriptor.FieldDescriptorProto_TYPE_ENUM.Enum(), + TypeName: proto.String(".example.Nested.DeepNested.DeepEnum"), + Number: proto.Int32(2), + }, + }, + EnumType: []*protodescriptor.EnumDescriptorProto{ + { + Name: proto.String("DeepEnum"), + Value: []*protodescriptor.EnumValueDescriptorProto{ + {Name: proto.String("FALSE"), Number: proto.Int32(0)}, + {Name: proto.String("TRUE"), Number: proto.Int32(1)}, + }, + }, + }, + }}, + }, + }, + Message: "ExampleMessage", + Params: []swaggerParameterObject{ + swaggerParameterObject{ + Name: "nested.a", + In: "query", + Required: false, + Type: "string", + }, + swaggerParameterObject{ + Name: "nested.deep.b", + In: "query", + Required: false, + Type: "string", + }, + swaggerParameterObject{ + Name: "nested.deep.c", + In: "query", + Required: false, + Type: "integer", + Enum: []string{"0", "1"}, + Default: "0", + }, + }, + }, + } + + for _, test := range tests { + reg := descriptor.NewRegistry() + reg.SetEnumsAsInts(true) + msgs := []*descriptor.Message{} + for _, msgdesc := range test.MsgDescs { + msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{}, + MessageType: test.MsgDescs, + Service: []*protodescriptor.ServiceDescriptorProto{}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: msgs, + } + reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}, + }) + + message, err := reg.LookupMsg("", ".example."+test.Message) + if err != nil { + t.Fatalf("failed to lookup message: %s", err) + } + params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}) + if err != nil { + t.Fatalf("failed to convert message to query parameters: %s", err) + } + // avoid checking Items for array types + for i := range params { + params[i].Items = nil + } + if !reflect.DeepEqual(params, test.Params) { + t.Errorf("expected %v, got %v", test.Params, params) + } + } +} + func TestMessageToQueryParameters(t *testing.T) { type test struct { MsgDescs []*protodescriptor.DescriptorProto diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index 03d6697fbff..3e9c6545255 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -29,6 +29,7 @@ var ( useFQNForSwaggerName = flag.Bool("fqn_for_swagger_name", false, "if set, the object's swagger names will use the fully qualify name from the proto definition (ie my.package.MyMessage.MyInnerMessage") useGoTemplate = flag.Bool("use_go_templates", false, "if set, you can use Go templates in protofile comments") disableDefaultErrors = flag.Bool("disable_default_errors", false, "if set, disables generation of default errors. This is useful if you have defined custom error handling") + enumsAsInts = flag.Bool("enums_as_ints", false, "whether to render enum values as integers, as opposed to string values") ) // Variables set by goreleaser at build time @@ -81,6 +82,7 @@ func main() { reg.SetIncludePackageInTags(*includePackageInTags) reg.SetUseFQNForSwaggerName(*useFQNForSwaggerName) reg.SetUseGoTemplate(*useGoTemplate) + reg.SetEnumsAsInts(*enumsAsInts) reg.SetDisableDefaultErrors(*disableDefaultErrors) if err := reg.SetRepeatedPathParamSeparator(*repeatedPathParamSeparator); err != nil { emitError(err) From d2d02ec272690ad98ba3b33e62d73d425e41743c Mon Sep 17 00:00:00 2001 From: Xin Zhang Date: Sun, 29 Mar 2020 15:21:40 -0700 Subject: [PATCH 542/552] Support deep levels reserved json name (#1191) * Add message as another argument for supporting deep level reserved json name * Get reserved json name in non direct field of a grpc method * Change variable names based on google naming policy * Change variable names based on google naming policy in test * Reuse variable value * Format code * Update test names * Add doCamelCase and one more test case * Correct a comment in test * Keep all prefix in camel case * Use regular for loop instead of foreach to avoid unnecessary slicing * Update protoc-gen-swagger/genswagger/template_test.go Co-Authored-By: Johan Brandhorst * Add space in comments * Remove a unnecessary comment Co-authored-by: Johan Brandhorst --- protoc-gen-swagger/genswagger/template.go | 58 ++++++-- .../genswagger/template_test.go | 138 +++++++++++++++++- 2 files changed, 179 insertions(+), 17 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 438e3a2f54a..04005e27bd9 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -653,7 +653,7 @@ func resolveFullyQualifiedNameToSwaggerNames(messages []string, useFQNForSwagger var canRegexp = regexp.MustCompile("{([a-zA-Z][a-zA-Z0-9_.]*).*}") // Swagger expects paths of the form /path/{string_value} but grpc-gateway paths are expected to be of the form /path/{string_value=strprefix/*}. This should reformat it correctly. -func templateToSwaggerPath(path string, reg *descriptor.Registry, fields []*descriptor.Field) string { +func templateToSwaggerPath(path string, reg *descriptor.Registry, fields []*descriptor.Field, msgs []*descriptor.Message) string { // It seems like the right thing to do here is to just use // strings.Split(path, "/") but that breaks badly when you hit a url like // /{my_field=prefix/*}/ and end up with 2 sections representing my_field. @@ -682,7 +682,7 @@ func templateToSwaggerPath(path string, reg *descriptor.Registry, fields []*desc if reg.GetUseJSONNamesForFields() && len(jsonBuffer) > 1 { jsonSnakeCaseName := string(jsonBuffer[1:]) - jsonCamelCaseName := string(lowerCamelCase(jsonSnakeCaseName, fields)) + jsonCamelCaseName := string(lowerCamelCase(jsonSnakeCaseName, fields, msgs)) prev := string(buffer[:len(buffer)-len(jsonSnakeCaseName)-2]) buffer = strings.Join([]string{prev, "{", jsonCamelCaseName, "}"}, "") jsonBuffer = "" @@ -731,7 +731,7 @@ func isResourceName(prefix string) bool { return field == "parent" || field == "name" } -func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry, requestResponseRefs, customRefs refMap) error { +func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry, requestResponseRefs, customRefs refMap, msgs []*descriptor.Message) error { // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. for svcIdx, svc := range services { for methIdx, meth := range svc.Methods { @@ -806,7 +806,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } parameterString := parameter.String() if reg.GetUseJSONNamesForFields() { - parameterString = lowerCamelCase(parameterString, meth.RequestType.Fields) + parameterString = lowerCamelCase(parameterString, meth.RequestType.Fields, msgs) } parameters = append(parameters, swaggerParameterObject{ Name: parameterString, @@ -876,7 +876,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re parameters = append(parameters, queryParams...) } - pathItemObject, ok := paths[templateToSwaggerPath(b.PathTmpl.Template, reg, meth.RequestType.Fields)] + pathItemObject, ok := paths[templateToSwaggerPath(b.PathTmpl.Template, reg, meth.RequestType.Fields, msgs)] if !ok { pathItemObject = swaggerPathItemObject{} } @@ -1098,7 +1098,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re pathItemObject.Patch = operationObject break } - paths[templateToSwaggerPath(b.PathTmpl.Template, reg, meth.RequestType.Fields)] = pathItemObject + paths[templateToSwaggerPath(b.PathTmpl.Template, reg, meth.RequestType.Fields, msgs)] = pathItemObject } } } @@ -1128,7 +1128,7 @@ func applyTemplate(p param) (*swaggerObject, error) { // and create entries for all of them. // Also adds custom user specified references to second map. requestResponseRefs, customRefs := refMap{}, refMap{} - if err := renderServices(p.Services, s.Paths, p.reg, requestResponseRefs, customRefs); err != nil { + if err := renderServices(p.Services, s.Paths, p.reg, requestResponseRefs, customRefs, p.Messages); err != nil { panic(err) } @@ -1935,15 +1935,55 @@ func addCustomRefs(d swaggerDefinitionsObject, reg *descriptor.Registry, refs re addCustomRefs(d, reg, refs) } -func lowerCamelCase(fieldName string, fields []*descriptor.Field) string { +func lowerCamelCase(fieldName string, fields []*descriptor.Field, msgs []*descriptor.Message) string { for _, oneField := range fields { if oneField.GetName() == fieldName { return oneField.GetJsonName() } } - parameterString := gogen.CamelCase(fieldName) + messageNameToFieldsToJSONName := make(map[string]map[string]string, 0) + fieldNameToType := make(map[string]string, 0) + for _, msg := range msgs { + fieldNameToJSONName := make(map[string]string, 0) + for _, oneField := range msg.GetField() { + fieldNameToJSONName[oneField.GetName()] = oneField.GetJsonName() + fieldNameToType[oneField.GetName()] = oneField.GetTypeName() + } + messageNameToFieldsToJSONName[msg.GetName()] = fieldNameToJSONName + } + if strings.Contains(fieldName, ".") { + fieldNames := strings.Split(fieldName, ".") + fieldNamesWithCamelCase := make([]string, 0) + for i := 0; i < len(fieldNames) - 1; i++ { + fieldNamesWithCamelCase = append(fieldNamesWithCamelCase, doCamelCase(string(fieldNames[i]))) + } + prefix := strings.Join(fieldNamesWithCamelCase, ".") + reservedJSONName := getReservedJSONName(fieldName, messageNameToFieldsToJSONName,fieldNameToType) + if reservedJSONName != "" { + return prefix + "." + reservedJSONName + } + } + return doCamelCase(fieldName) +} + +func doCamelCase(input string) string { + parameterString := gogen.CamelCase(input) builder := &strings.Builder{} builder.WriteString(strings.ToLower(string(parameterString[0]))) builder.WriteString(parameterString[1:]) return builder.String() } + +func getReservedJSONName(fieldName string, messageNameToFieldsToJSONName map[string]map[string]string, fieldNameToType map[string]string) string { + if len(strings.Split(fieldName, ".")) == 2 { + fieldNames := strings.Split(fieldName, ".") + firstVariable := fieldNames[0] + firstType := fieldNameToType[firstVariable] + firstTypeShortNames := strings.Split(firstType, ".") + firstTypeShortName := firstTypeShortNames[len(firstTypeShortNames) - 1] + return messageNameToFieldsToJSONName[firstTypeShortName][fieldNames[1]] + } + fieldNames := strings.Split(fieldName, ".") + return getReservedJSONName(strings.Join(fieldNames[1:], "."), messageNameToFieldsToJSONName, fieldNameToType) +} + diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index 06e1ca763a9..c7a35a6b6c8 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -1314,6 +1314,37 @@ func generateFieldsForJSONReservedName() []*descriptor.Field { return append(fields, field) } +func generateMsgsForJSONReservedName() []*descriptor.Message { + result := make([]*descriptor.Message, 0) + // The first message, its field is field_abc and its type is NewType + // NewType field_abc + fieldName := "field_abc" + fieldJSONName := "fieldAbc" + messageName1 := "message1" + messageType := "pkg.a.NewType" + pfd := protodescriptor.FieldDescriptorProto{Name: &fieldName, JsonName: &fieldJSONName, TypeName: &messageType} + result = append(result, + &descriptor.Message{ + DescriptorProto: &protodescriptor.DescriptorProto{ + Name: &messageName1, Field: []*protodescriptor.FieldDescriptorProto{&pfd}, + }, + }) + // The second message, its name is NewName, its type is string + // message NewType { + // string field_newName [json_name = RESERVEDJSONNAME] + // } + messageName := "NewType" + field := "field_newName" + fieldJSONName2 := "RESERVEDJSONNAME" + pfd2 := protodescriptor.FieldDescriptorProto{Name: &field, JsonName: &fieldJSONName2,} + result = append(result, &descriptor.Message{ + DescriptorProto: &protodescriptor.DescriptorProto{ + Name: &messageName, Field: []*protodescriptor.FieldDescriptorProto{&pfd2}, + }, + }) + return result +} + func TestTemplateWithJsonCamelCase(t *testing.T) { var tests = []struct { input string @@ -1331,11 +1362,12 @@ func TestTemplateWithJsonCamelCase(t *testing.T) { {"test/{a_a}", "test/{aA}"}, {"test/{ab_c}", "test/{abC}"}, {"test/{json_name}", "test/{jsonNAME}"}, + {"test/{field_abc.field_newName}", "test/{fieldAbc.RESERVEDJSONNAME}"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(true) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } @@ -1358,11 +1390,12 @@ func TestTemplateWithoutJsonCamelCase(t *testing.T) { {"test/{ab}", "test/{ab}"}, {"test/{a_a}", "test/{a_a}"}, {"test/{json_name}", "test/{json_name}"}, + {"test/{field_abc.field_newName}", "test/{field_abc.field_newName}"}, } reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } @@ -1394,14 +1427,14 @@ func TestTemplateToSwaggerPath(t *testing.T) { reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } } reg.SetUseJSONNamesForFields(true) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } @@ -1416,7 +1449,7 @@ func BenchmarkTemplateToSwaggerPath(b *testing.B) { reg.SetUseJSONNamesForFields(false) for i := 0; i < b.N; i++ { - _ = templateToSwaggerPath(input, reg, generateFieldsForJSONReservedName()) + _ = templateToSwaggerPath(input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName()) } }) @@ -1425,7 +1458,7 @@ func BenchmarkTemplateToSwaggerPath(b *testing.B) { reg.SetUseJSONNamesForFields(true) for i := 0; i < b.N; i++ { - _ = templateToSwaggerPath(input, reg, generateFieldsForJSONReservedName()) + _ = templateToSwaggerPath(input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName()) } }) } @@ -1501,14 +1534,14 @@ func TestFQMNtoSwaggerName(t *testing.T) { reg := descriptor.NewRegistry() reg.SetUseJSONNamesForFields(false) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } } reg.SetUseJSONNamesForFields(true) for _, data := range tests { - actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName()) + actual := templateToSwaggerPath(data.input, reg, generateFieldsForJSONReservedName(), generateMsgsForJSONReservedName()) if data.expected != actual { t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) } @@ -2369,3 +2402,92 @@ func TestTemplateWithoutErrorDefinition(t *testing.T) { t.Errorf("default Error response with reflink '%v', but its definition was not found", refName) } } + +func Test_getReservedJsonName(t *testing.T) { + type args struct { + fieldName string + messageNameToFieldsToJSONName map[string]map[string]string + fieldNameToType map[string]string + } + tests := []struct { + name string + args args + want string + }{ + { + "test case 1: single dot use case", + args{ + fieldName: "abc.a_1", + messageNameToFieldsToJSONName: map[string]map[string]string{ + "Msg": { + "a_1": "a1JSONNAME", + "b_1": "b1JSONNAME", + }, + }, + fieldNameToType: map[string]string{ + "abc": "pkg1.test.Msg", + "bcd": "pkg1.test.Msg", + }, + }, + "a1JSONNAME", + }, + { + "test case 2: single dot use case with no existing field", + args{ + fieldName: "abc.d_1", + messageNameToFieldsToJSONName: map[string]map[string]string{ + "Msg": { + "a_1": "a1JSONNAME", + "b_1": "b1JSONNAME", + }, + }, + fieldNameToType: map[string]string{ + "abc": "pkg1.test.Msg", + "bcd": "pkg1.test.Msg", + }, + }, + "", + }, + { + "test case 3: double dot use case", + args{ + fieldName: "pkg.abc.a_1", + messageNameToFieldsToJSONName: map[string]map[string]string{ + "Msg": { + "a_1": "a1JSONNAME", + "b_1": "b1JSONNAME", + }, + }, + fieldNameToType: map[string]string{ + "abc": "pkg1.test.Msg", + "bcd": "pkg1.test.Msg", + }, + }, + "a1JSONNAME", + }, + { + "test case 4: double dot use case with a not existed field", + args{ + fieldName: "pkg.abc.c_1", + messageNameToFieldsToJSONName: map[string]map[string]string{ + "Msg": { + "a_1": "a1JSONNAME", + "b_1": "b1JSONNAME", + }, + }, + fieldNameToType: map[string]string{ + "abc": "pkg1.test.Msg", + "bcd": "pkg1.test.Msg", + }, + }, + "", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := getReservedJSONName(tt.args.fieldName, tt.args.messageNameToFieldsToJSONName, tt.args.fieldNameToType); got != tt.want { + t.Errorf("getReservedJSONName() = %v, want %v", got, tt.want) + } + }) + } +} From 75aa287791e117de5f47332d59e1a68382a422ce Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Tue, 31 Mar 2020 18:01:40 -0400 Subject: [PATCH 543/552] Generate Swagger with Unique Operation IDs (#1193) * OperationId includes service name * Re-generate and fix tests --- .../internal/clients/abe/api/swagger.yaml | 46 +++---- .../abe/api_a_bit_of_everything_service.go | 50 +++---- .../abe/api_camel_case_service_name.go | 2 +- examples/internal/clients/abe/api_echo_rpc.go | 10 +- .../internal/clients/echo/api/swagger.yaml | 14 +- .../internal/clients/echo/api_echo_service.go | 34 ++--- .../clients/responsebody/api/swagger.yaml | 6 +- .../responsebody/api_response_body_service.go | 6 +- .../docs/ResponseBodyServiceApi.md | 18 +-- .../clients/unannotatedecho/api/swagger.yaml | 8 +- .../api_unannotated_echo_service.go | 16 +-- examples/internal/integration/client_test.go | 10 +- .../a_bit_of_everything.swagger.json | 46 +++---- .../proto/examplepb/echo_service.swagger.json | 14 +- .../response_body_service.swagger.json | 6 +- .../proto/examplepb/stream.swagger.json | 6 +- .../unannotated_echo_service.swagger.json | 8 +- .../examplepb/use_go_template.swagger.json | 4 +- .../proto/examplepb/wrappers.swagger.json | 22 ++-- protoc-gen-swagger/genswagger/template.go | 13 +- .../genswagger/template_test.go | 122 +++++++++++++++++- 21 files changed, 286 insertions(+), 175 deletions(-) diff --git a/examples/internal/clients/abe/api/swagger.yaml b/examples/internal/clients/abe/api/swagger.yaml index 52ccf956d97..742056db6f6 100644 --- a/examples/internal/clients/abe/api/swagger.yaml +++ b/examples/internal/clients/abe/api/swagger.yaml @@ -33,7 +33,7 @@ paths: post: tags: - "ABitOfEverythingService" - operationId: "CreateBody" + operationId: "ABitOfEverythingService_CreateBody" parameters: - in: "body" name: "body" @@ -69,7 +69,7 @@ paths: - "echo rpc" summary: "Summary: Echo rpc" description: "Description Echo" - operationId: "Echo" + operationId: "ABitOfEverythingService_Echo" parameters: - name: "value" in: "path" @@ -112,7 +112,7 @@ paths: get: tags: - "ABitOfEverythingService" - operationId: "CheckNestedEnumGetQueryParams" + operationId: "ABitOfEverythingService_CheckNestedEnumGetQueryParams" parameters: - name: "single_nested.ok" in: "path" @@ -400,7 +400,7 @@ paths: get: tags: - "ABitOfEverythingService" - operationId: "CheckGetQueryParams" + operationId: "ABitOfEverythingService_CheckGetQueryParams" parameters: - name: "single_nested.name" in: "path" @@ -695,7 +695,7 @@ paths: post: tags: - "ABitOfEverythingService" - operationId: "CheckPostQueryParams" + operationId: "ABitOfEverythingService_CheckPostQueryParams" parameters: - name: "string_value" in: "path" @@ -734,7 +734,7 @@ paths: get: tags: - "ABitOfEverythingService" - operationId: "GetQuery" + operationId: "ABitOfEverythingService_GetQuery" parameters: - name: "uuid" in: "path" @@ -1042,7 +1042,7 @@ paths: - "ABitOfEverythingService" summary: "Create a new ABitOfEverything" description: "This API creates a new ABitOfEverything" - operationId: "Create" + operationId: "ABitOfEverythingService_Create" parameters: - name: "float_value" in: "path" @@ -1193,7 +1193,7 @@ paths: post: tags: - "ABitOfEverythingService" - operationId: "DeepPathEcho" + operationId: "ABitOfEverythingService_DeepPathEcho" parameters: - name: "single_nested.name" in: "path" @@ -1233,7 +1233,7 @@ paths: get: tags: - "ABitOfEverythingService" - operationId: "Lookup" + operationId: "ABitOfEverythingService_Lookup" parameters: - name: "uuid" in: "path" @@ -1265,7 +1265,7 @@ paths: put: tags: - "ABitOfEverythingService" - operationId: "Update" + operationId: "ABitOfEverythingService_Update" parameters: - name: "uuid" in: "path" @@ -1302,7 +1302,7 @@ paths: delete: tags: - "ABitOfEverythingService" - operationId: "Delete" + operationId: "ABitOfEverythingService_Delete" parameters: - name: "uuid" in: "path" @@ -1340,7 +1340,7 @@ paths: : get: tags: - "ABitOfEverythingService" - operationId: "GetRepeatedQuery" + operationId: "ABitOfEverythingService_GetRepeatedQuery" parameters: - name: "path_repeated_float_value" in: "path" @@ -1531,7 +1531,7 @@ paths: put: tags: - "ABitOfEverythingService" - operationId: "UpdateV2" + operationId: "ABitOfEverythingService_UpdateV2" parameters: - name: "abe.uuid" in: "path" @@ -1568,7 +1568,7 @@ paths: patch: tags: - "ABitOfEverythingService" - operationId: "UpdateV22" + operationId: "ABitOfEverythingService_UpdateV22" parameters: - name: "abe.uuid" in: "path" @@ -1608,7 +1608,7 @@ paths: - "echo rpc" summary: "Summary: Echo rpc" description: "Description Echo" - operationId: "Echo3" + operationId: "ABitOfEverythingService_Echo3" parameters: - name: "value" in: "query" @@ -1653,7 +1653,7 @@ paths: - "echo rpc" summary: "Summary: Echo rpc" description: "Description Echo" - operationId: "Echo2" + operationId: "ABitOfEverythingService_Echo2" parameters: - in: "body" name: "body" @@ -1697,7 +1697,7 @@ paths: get: tags: - "camelCaseServiceName" - operationId: "Empty" + operationId: "camelCaseServiceName_Empty" parameters: [] responses: 200: @@ -1724,7 +1724,7 @@ paths: get: tags: - "ABitOfEverythingService" - operationId: "ErrorWithDetails" + operationId: "ABitOfEverythingService_ErrorWithDetails" parameters: [] responses: 200: @@ -1751,7 +1751,7 @@ paths: get: tags: - "ABitOfEverythingService" - operationId: "OverwriteResponseContentType" + operationId: "ABitOfEverythingService_OverwriteResponseContentType" produces: - "application/text" parameters: [] @@ -1781,7 +1781,7 @@ paths: post: tags: - "ABitOfEverythingService" - operationId: "PostWithEmptyBody" + operationId: "ABitOfEverythingService_PostWithEmptyBody" parameters: - name: "name" in: "path" @@ -1819,7 +1819,7 @@ paths: get: tags: - "ABitOfEverythingService" - operationId: "Timeout" + operationId: "ABitOfEverythingService_Timeout" parameters: [] responses: 200: @@ -1846,7 +1846,7 @@ paths: post: tags: - "ABitOfEverythingService" - operationId: "GetMessageWithBody" + operationId: "ABitOfEverythingService_GetMessageWithBody" parameters: - name: "id" in: "path" @@ -1884,7 +1884,7 @@ paths: patch: tags: - "ABitOfEverythingService" - operationId: "UpdateV23" + operationId: "ABitOfEverythingService_UpdateV23" parameters: - name: "abe.uuid" in: "path" diff --git a/examples/internal/clients/abe/api_a_bit_of_everything_service.go b/examples/internal/clients/abe/api_a_bit_of_everything_service.go index 326be923b33..419a2454a4a 100644 --- a/examples/internal/clients/abe/api_a_bit_of_everything_service.go +++ b/examples/internal/clients/abe/api_a_bit_of_everything_service.go @@ -32,7 +32,7 @@ ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param singleNestedName name is nested field. * @param floatValue Float value field - * @param optional nil or *CheckGetQueryParamsOpts - Optional Parameters: + * @param optional nil or *ABitOfEverythingServiceCheckGetQueryParamsOpts - Optional Parameters: * @param "SingleNestedAmount" (optional.Int64) - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Uuid" (optional.String) - @@ -68,7 +68,7 @@ ABitOfEverythingServiceApiService @return ExamplepbABitOfEverything */ -type CheckGetQueryParamsOpts struct { +type ABitOfEverythingServiceCheckGetQueryParamsOpts struct { SingleNestedAmount optional.Int64 SingleNestedOk optional.String Uuid optional.String @@ -102,7 +102,7 @@ type CheckGetQueryParamsOpts struct { Int64OverrideType optional.Int64 } -func (a *ABitOfEverythingServiceApiService) CheckGetQueryParams(ctx context.Context, singleNestedName string, floatValue float32, localVarOptionals *CheckGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckGetQueryParams(ctx context.Context, singleNestedName string, floatValue float32, localVarOptionals *ABitOfEverythingServiceCheckGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -339,7 +339,7 @@ ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param singleNestedOk DeepEnum description. * @param floatValue Float value field - * @param optional nil or *CheckNestedEnumGetQueryParamsOpts - Optional Parameters: + * @param optional nil or *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts - Optional Parameters: * @param "SingleNestedName" (optional.String) - name is nested field. * @param "SingleNestedAmount" (optional.Int64) - * @param "Uuid" (optional.String) - @@ -375,7 +375,7 @@ ABitOfEverythingServiceApiService @return ExamplepbABitOfEverything */ -type CheckNestedEnumGetQueryParamsOpts struct { +type ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts struct { SingleNestedName optional.String SingleNestedAmount optional.Int64 Uuid optional.String @@ -409,7 +409,7 @@ type CheckNestedEnumGetQueryParamsOpts struct { Int64OverrideType optional.Int64 } -func (a *ABitOfEverythingServiceApiService) CheckNestedEnumGetQueryParams(ctx context.Context, singleNestedOk string, floatValue float32, localVarOptionals *CheckNestedEnumGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckNestedEnumGetQueryParams(ctx context.Context, singleNestedOk string, floatValue float32, localVarOptionals *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -649,7 +649,7 @@ ABitOfEverythingServiceApiService @return ExamplepbABitOfEverything */ -func (a *ABitOfEverythingServiceApiService) CheckPostQueryParams(ctx context.Context, stringValue string, body ABitOfEverythingNested) (ExamplepbABitOfEverything, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckPostQueryParams(ctx context.Context, stringValue string, body ABitOfEverythingNested) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -815,7 +815,7 @@ This API creates a new ABitOfEverything @return ExamplepbABitOfEverything */ -func (a *ABitOfEverythingServiceApiService) Create(ctx context.Context, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, enumValueAnnotation string) (ExamplepbABitOfEverything, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreate(ctx context.Context, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, enumValueAnnotation string) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -978,7 +978,7 @@ ABitOfEverythingServiceApiService @return ExamplepbABitOfEverything */ -func (a *ABitOfEverythingServiceApiService) CreateBody(ctx context.Context, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreateBody(ctx context.Context, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -1125,7 +1125,7 @@ ABitOfEverythingServiceApiService @return ExamplepbABitOfEverything */ -func (a *ABitOfEverythingServiceApiService) DeepPathEcho(ctx context.Context, singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDeepPathEcho(ctx context.Context, singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -1272,7 +1272,7 @@ ABitOfEverythingServiceApiService @return interface{} */ -func (a *ABitOfEverythingServiceApiService) Delete(ctx context.Context, uuid string) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDelete(ctx context.Context, uuid string) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} @@ -1416,7 +1416,7 @@ ABitOfEverythingServiceApiService @return interface{} */ -func (a *ABitOfEverythingServiceApiService) ErrorWithDetails(ctx context.Context) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceErrorWithDetails(ctx context.Context) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -1561,7 +1561,7 @@ ABitOfEverythingServiceApiService @return interface{} */ -func (a *ABitOfEverythingServiceApiService) GetMessageWithBody(ctx context.Context, id string, body ExamplepbBody) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetMessageWithBody(ctx context.Context, id string, body ExamplepbBody) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -1706,7 +1706,7 @@ ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param uuid * @param floatValue Float value field - * @param optional nil or *GetQueryOpts - Optional Parameters: + * @param optional nil or *ABitOfEverythingServiceGetQueryOpts - Optional Parameters: * @param "SingleNestedName" (optional.String) - name is nested field. * @param "SingleNestedAmount" (optional.Int64) - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. @@ -1743,7 +1743,7 @@ ABitOfEverythingServiceApiService @return interface{} */ -type GetQueryOpts struct { +type ABitOfEverythingServiceGetQueryOpts struct { SingleNestedName optional.String SingleNestedAmount optional.Int64 SingleNestedOk optional.String @@ -1778,7 +1778,7 @@ type GetQueryOpts struct { Int64OverrideType optional.Int64 } -func (a *ABitOfEverythingServiceApiService) GetQuery(ctx context.Context, uuid string, floatValue float32, localVarOptionals *GetQueryOpts) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetQuery(ctx context.Context, uuid string, floatValue float32, localVarOptionals *ABitOfEverythingServiceGetQueryOpts) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -2022,7 +2022,7 @@ ABitOfEverythingServiceApiService @return ExamplepbABitOfEverythingRepeated */ -func (a *ABitOfEverythingServiceApiService) GetRepeatedQuery(ctx context.Context, pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (ExamplepbABitOfEverythingRepeated, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetRepeatedQuery(ctx context.Context, pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (ExamplepbABitOfEverythingRepeated, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -2230,7 +2230,7 @@ ABitOfEverythingServiceApiService @return ExamplepbABitOfEverything */ -func (a *ABitOfEverythingServiceApiService) Lookup(ctx context.Context, uuid string) (ExamplepbABitOfEverything, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceLookup(ctx context.Context, uuid string) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -2374,7 +2374,7 @@ ABitOfEverythingServiceApiService @return string */ -func (a *ABitOfEverythingServiceApiService) OverwriteResponseContentType(ctx context.Context) (string, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteResponseContentType(ctx context.Context) (string, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -2519,7 +2519,7 @@ ABitOfEverythingServiceApiService @return interface{} */ -func (a *ABitOfEverythingServiceApiService) PostWithEmptyBody(ctx context.Context, name string, body ExamplepbBody) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostWithEmptyBody(ctx context.Context, name string, body ExamplepbBody) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -2665,7 +2665,7 @@ ABitOfEverythingServiceApiService @return interface{} */ -func (a *ABitOfEverythingServiceApiService) Timeout(ctx context.Context) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceTimeout(ctx context.Context) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -2810,7 +2810,7 @@ ABitOfEverythingServiceApiService @return interface{} */ -func (a *ABitOfEverythingServiceApiService) Update(ctx context.Context, uuid string, body ExamplepbABitOfEverything) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdate(ctx context.Context, uuid string, body ExamplepbABitOfEverything) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} @@ -2958,7 +2958,7 @@ ABitOfEverythingServiceApiService @return interface{} */ -func (a *ABitOfEverythingServiceApiService) UpdateV2(ctx context.Context, abeUuid string, body ExamplepbABitOfEverything) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV2(ctx context.Context, abeUuid string, body ExamplepbABitOfEverything) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} @@ -3106,7 +3106,7 @@ ABitOfEverythingServiceApiService @return interface{} */ -func (a *ABitOfEverythingServiceApiService) UpdateV22(ctx context.Context, abeUuid string, body ExamplepbABitOfEverything) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV22(ctx context.Context, abeUuid string, body ExamplepbABitOfEverything) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} @@ -3254,7 +3254,7 @@ ABitOfEverythingServiceApiService @return interface{} */ -func (a *ABitOfEverythingServiceApiService) UpdateV23(ctx context.Context, abeUuid string, body ExamplepbUpdateV2Request) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV23(ctx context.Context, abeUuid string, body ExamplepbUpdateV2Request) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} diff --git a/examples/internal/clients/abe/api_camel_case_service_name.go b/examples/internal/clients/abe/api_camel_case_service_name.go index 8a12b878ef7..c7a4a7707e3 100644 --- a/examples/internal/clients/abe/api_camel_case_service_name.go +++ b/examples/internal/clients/abe/api_camel_case_service_name.go @@ -31,7 +31,7 @@ CamelCaseServiceNameApiService @return interface{} */ -func (a *CamelCaseServiceNameApiService) Empty(ctx context.Context) (interface{}, *http.Response, error) { +func (a *CamelCaseServiceNameApiService) CamelCaseServiceNameEmpty(ctx context.Context) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} diff --git a/examples/internal/clients/abe/api_echo_rpc.go b/examples/internal/clients/abe/api_echo_rpc.go index e8979f37579..8e1f06d5ad8 100644 --- a/examples/internal/clients/abe/api_echo_rpc.go +++ b/examples/internal/clients/abe/api_echo_rpc.go @@ -35,7 +35,7 @@ Description Echo @return SubStringMessage */ -func (a *EchoRpcApiService) Echo(ctx context.Context, value string) (SubStringMessage, *http.Response, error) { +func (a *EchoRpcApiService) ABitOfEverythingServiceEcho(ctx context.Context, value string) (SubStringMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -192,7 +192,7 @@ Description Echo @return SubStringMessage */ -func (a *EchoRpcApiService) Echo2(ctx context.Context, body string) (SubStringMessage, *http.Response, error) { +func (a *EchoRpcApiService) ABitOfEverythingServiceEcho2(ctx context.Context, body string) (SubStringMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -346,17 +346,17 @@ func (a *EchoRpcApiService) Echo2(ctx context.Context, body string) (SubStringMe EchoRpcApiService Summary: Echo rpc Description Echo * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *Echo3Opts - Optional Parameters: + * @param optional nil or *ABitOfEverythingServiceEcho3Opts - Optional Parameters: * @param "Value" (optional.String) - @return SubStringMessage */ -type Echo3Opts struct { +type ABitOfEverythingServiceEcho3Opts struct { Value optional.String } -func (a *EchoRpcApiService) Echo3(ctx context.Context, localVarOptionals *Echo3Opts) (SubStringMessage, *http.Response, error) { +func (a *EchoRpcApiService) ABitOfEverythingServiceEcho3(ctx context.Context, localVarOptionals *ABitOfEverythingServiceEcho3Opts) (SubStringMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} diff --git a/examples/internal/clients/echo/api/swagger.yaml b/examples/internal/clients/echo/api/swagger.yaml index 7df1b8731c5..2df4be32a99 100644 --- a/examples/internal/clients/echo/api/swagger.yaml +++ b/examples/internal/clients/echo/api/swagger.yaml @@ -15,7 +15,7 @@ paths: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." - operationId: "Echo" + operationId: "EchoService_Echo" parameters: - name: "id" in: "path" @@ -38,7 +38,7 @@ paths: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." - operationId: "Echo2" + operationId: "EchoService_Echo2" parameters: - name: "id" in: "path" @@ -113,7 +113,7 @@ paths: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." - operationId: "Echo3" + operationId: "EchoService_Echo3" parameters: - name: "id" in: "path" @@ -187,7 +187,7 @@ paths: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." - operationId: "Echo4" + operationId: "EchoService_Echo4" parameters: - name: "id" in: "path" @@ -255,7 +255,7 @@ paths: - "EchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." - operationId: "Echo5" + operationId: "EchoService_Echo5" parameters: - name: "no.note" in: "path" @@ -324,7 +324,7 @@ paths: tags: - "EchoService" summary: "EchoBody method receives a simple message and returns it." - operationId: "EchoBody" + operationId: "EchoService_EchoBody" parameters: - in: "body" name: "body" @@ -346,7 +346,7 @@ paths: tags: - "EchoService" summary: "EchoDelete method receives a simple message and returns it." - operationId: "EchoDelete" + operationId: "EchoService_EchoDelete" parameters: - name: "id" in: "query" diff --git a/examples/internal/clients/echo/api_echo_service.go b/examples/internal/clients/echo/api_echo_service.go index 40524345aa6..b4eeb7dd655 100644 --- a/examples/internal/clients/echo/api_echo_service.go +++ b/examples/internal/clients/echo/api_echo_service.go @@ -34,7 +34,7 @@ The message posted as the id parameter will also be returned. @return ExamplepbSimpleMessage */ -func (a *EchoServiceApiService) Echo(ctx context.Context, id string) (ExamplepbSimpleMessage, *http.Response, error) { +func (a *EchoServiceApiService) EchoServiceEcho(ctx context.Context, id string) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -132,7 +132,7 @@ The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param id Id represents the message identifier. * @param num - * @param optional nil or *Echo2Opts - Optional Parameters: + * @param optional nil or *EchoServiceEcho2Opts - Optional Parameters: * @param "LineNum" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - @@ -144,7 +144,7 @@ The message posted as the id parameter will also be returned. @return ExamplepbSimpleMessage */ -type Echo2Opts struct { +type EchoServiceEcho2Opts struct { LineNum optional.String Lang optional.String StatusProgress optional.String @@ -154,7 +154,7 @@ type Echo2Opts struct { NoNote optional.String } -func (a *EchoServiceApiService) Echo2(ctx context.Context, id string, num string, localVarOptionals *Echo2Opts) (ExamplepbSimpleMessage, *http.Response, error) { +func (a *EchoServiceApiService) EchoServiceEcho2(ctx context.Context, id string, num string, localVarOptionals *EchoServiceEcho2Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -275,7 +275,7 @@ The message posted as the id parameter will also be returned. * @param id Id represents the message identifier. * @param num * @param lang - * @param optional nil or *Echo3Opts - Optional Parameters: + * @param optional nil or *EchoServiceEcho3Opts - Optional Parameters: * @param "LineNum" (optional.String) - * @param "StatusProgress" (optional.String) - * @param "StatusNote" (optional.String) - @@ -286,7 +286,7 @@ The message posted as the id parameter will also be returned. @return ExamplepbSimpleMessage */ -type Echo3Opts struct { +type EchoServiceEcho3Opts struct { LineNum optional.String StatusProgress optional.String StatusNote optional.String @@ -295,7 +295,7 @@ type Echo3Opts struct { NoNote optional.String } -func (a *EchoServiceApiService) Echo3(ctx context.Context, id string, num string, lang string, localVarOptionals *Echo3Opts) (ExamplepbSimpleMessage, *http.Response, error) { +func (a *EchoServiceApiService) EchoServiceEcho3(ctx context.Context, id string, num string, lang string, localVarOptionals *EchoServiceEcho3Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -414,7 +414,7 @@ The message posted as the id parameter will also be returned. * @param id Id represents the message identifier. * @param lineNum * @param statusNote - * @param optional nil or *Echo4Opts - Optional Parameters: + * @param optional nil or *EchoServiceEcho4Opts - Optional Parameters: * @param "Num" (optional.String) - * @param "Lang" (optional.String) - * @param "StatusProgress" (optional.String) - @@ -424,7 +424,7 @@ The message posted as the id parameter will also be returned. @return ExamplepbSimpleMessage */ -type Echo4Opts struct { +type EchoServiceEcho4Opts struct { Num optional.String Lang optional.String StatusProgress optional.String @@ -432,7 +432,7 @@ type Echo4Opts struct { NoProgress optional.String } -func (a *EchoServiceApiService) Echo4(ctx context.Context, id string, lineNum string, statusNote string, localVarOptionals *Echo4Opts) (ExamplepbSimpleMessage, *http.Response, error) { +func (a *EchoServiceApiService) EchoServiceEcho4(ctx context.Context, id string, lineNum string, statusNote string, localVarOptionals *EchoServiceEcho4Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -546,7 +546,7 @@ EchoServiceApiService Echo method receives a simple message and returns it. The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param noNote - * @param optional nil or *Echo5Opts - Optional Parameters: + * @param optional nil or *EchoServiceEcho5Opts - Optional Parameters: * @param "Id" (optional.String) - Id represents the message identifier. * @param "Num" (optional.String) - * @param "LineNum" (optional.String) - @@ -558,7 +558,7 @@ The message posted as the id parameter will also be returned. @return ExamplepbSimpleMessage */ -type Echo5Opts struct { +type EchoServiceEcho5Opts struct { Id optional.String Num optional.String LineNum optional.String @@ -568,7 +568,7 @@ type Echo5Opts struct { NoProgress optional.String } -func (a *EchoServiceApiService) Echo5(ctx context.Context, noNote string, localVarOptionals *Echo5Opts) (ExamplepbSimpleMessage, *http.Response, error) { +func (a *EchoServiceApiService) EchoServiceEcho5(ctx context.Context, noNote string, localVarOptionals *EchoServiceEcho5Opts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -688,7 +688,7 @@ EchoServiceApiService EchoBody method receives a simple message and returns it. @return ExamplepbSimpleMessage */ -func (a *EchoServiceApiService) EchoBody(ctx context.Context, body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, *http.Response, error) { +func (a *EchoServiceApiService) EchoServiceEchoBody(ctx context.Context, body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -784,7 +784,7 @@ func (a *EchoServiceApiService) EchoBody(ctx context.Context, body ExamplepbSimp /* EchoServiceApiService EchoDelete method receives a simple message and returns it. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *EchoDeleteOpts - Optional Parameters: + * @param optional nil or *EchoServiceEchoDeleteOpts - Optional Parameters: * @param "Id" (optional.String) - Id represents the message identifier. * @param "Num" (optional.String) - * @param "LineNum" (optional.String) - @@ -798,7 +798,7 @@ EchoServiceApiService EchoDelete method receives a simple message and returns it @return ExamplepbSimpleMessage */ -type EchoDeleteOpts struct { +type EchoServiceEchoDeleteOpts struct { Id optional.String Num optional.String LineNum optional.String @@ -810,7 +810,7 @@ type EchoDeleteOpts struct { NoNote optional.String } -func (a *EchoServiceApiService) EchoDelete(ctx context.Context, localVarOptionals *EchoDeleteOpts) (ExamplepbSimpleMessage, *http.Response, error) { +func (a *EchoServiceApiService) EchoServiceEchoDelete(ctx context.Context, localVarOptionals *EchoServiceEchoDeleteOpts) (ExamplepbSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} diff --git a/examples/internal/clients/responsebody/api/swagger.yaml b/examples/internal/clients/responsebody/api/swagger.yaml index 1b9cedfa7cc..4a3e595dcce 100644 --- a/examples/internal/clients/responsebody/api/swagger.yaml +++ b/examples/internal/clients/responsebody/api/swagger.yaml @@ -12,7 +12,7 @@ paths: get: tags: - "ResponseBodyService" - operationId: "ListResponseBodies" + operationId: "ResponseBodyService_ListResponseBodies" parameters: - name: "data" in: "path" @@ -34,7 +34,7 @@ paths: get: tags: - "ResponseBodyService" - operationId: "GetResponseBody" + operationId: "ResponseBodyService_GetResponseBody" parameters: - name: "data" in: "path" @@ -54,7 +54,7 @@ paths: get: tags: - "ResponseBodyService" - operationId: "ListResponseStrings" + operationId: "ResponseBodyService_ListResponseStrings" parameters: - name: "data" in: "path" diff --git a/examples/internal/clients/responsebody/api_response_body_service.go b/examples/internal/clients/responsebody/api_response_body_service.go index 12637f0acfa..4a4e2d411a8 100644 --- a/examples/internal/clients/responsebody/api_response_body_service.go +++ b/examples/internal/clients/responsebody/api_response_body_service.go @@ -32,7 +32,7 @@ ResponseBodyServiceApiService @return ExamplepbResponseBodyOutResponse */ -func (a *ResponseBodyServiceApiService) GetResponseBody(ctx context.Context, data string) (ExamplepbResponseBodyOutResponse, *http.Response, error) { +func (a *ResponseBodyServiceApiService) ResponseBodyServiceGetResponseBody(ctx context.Context, data string) (ExamplepbResponseBodyOutResponse, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -131,7 +131,7 @@ ResponseBodyServiceApiService @return []ExamplepbRepeatedResponseBodyOutResponse */ -func (a *ResponseBodyServiceApiService) ListResponseBodies(ctx context.Context, data string) ([]ExamplepbRepeatedResponseBodyOutResponse, *http.Response, error) { +func (a *ResponseBodyServiceApiService) ResponseBodyServiceListResponseBodies(ctx context.Context, data string) ([]ExamplepbRepeatedResponseBodyOutResponse, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -230,7 +230,7 @@ ResponseBodyServiceApiService @return []string */ -func (a *ResponseBodyServiceApiService) ListResponseStrings(ctx context.Context, data string) ([]string, *http.Response, error) { +func (a *ResponseBodyServiceApiService) ResponseBodyServiceListResponseStrings(ctx context.Context, data string) ([]string, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} diff --git a/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md b/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md index 914a90f0113..480b621c095 100644 --- a/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md +++ b/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md @@ -4,13 +4,13 @@ All URIs are relative to *https://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**GetResponseBody**](ResponseBodyServiceApi.md#GetResponseBody) | **Get** /responsebody/{data} | -[**ListResponseBodies**](ResponseBodyServiceApi.md#ListResponseBodies) | **Get** /responsebodies/{data} | -[**ListResponseStrings**](ResponseBodyServiceApi.md#ListResponseStrings) | **Get** /responsestrings/{data} | +[**ResponseBodyServiceGetResponseBody**](ResponseBodyServiceApi.md#ResponseBodyServiceGetResponseBody) | **Get** /responsebody/{data} | +[**ResponseBodyServiceListResponseBodies**](ResponseBodyServiceApi.md#ResponseBodyServiceListResponseBodies) | **Get** /responsebodies/{data} | +[**ResponseBodyServiceListResponseStrings**](ResponseBodyServiceApi.md#ResponseBodyServiceListResponseStrings) | **Get** /responsestrings/{data} | -# **GetResponseBody** -> ExamplepbResponseBodyOutResponse GetResponseBody(ctx, data) +# **ResponseBodyServiceGetResponseBody** +> ExamplepbResponseBodyOutResponse ResponseBodyServiceGetResponseBody(ctx, data) ### Required Parameters @@ -35,8 +35,8 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **ListResponseBodies** -> []ExamplepbRepeatedResponseBodyOutResponse ListResponseBodies(ctx, data) +# **ResponseBodyServiceListResponseBodies** +> []ExamplepbRepeatedResponseBodyOutResponse ResponseBodyServiceListResponseBodies(ctx, data) ### Required Parameters @@ -61,8 +61,8 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **ListResponseStrings** -> []string ListResponseStrings(ctx, data) +# **ResponseBodyServiceListResponseStrings** +> []string ResponseBodyServiceListResponseStrings(ctx, data) ### Required Parameters diff --git a/examples/internal/clients/unannotatedecho/api/swagger.yaml b/examples/internal/clients/unannotatedecho/api/swagger.yaml index 2dbae78a5f6..ab5450bab15 100644 --- a/examples/internal/clients/unannotatedecho/api/swagger.yaml +++ b/examples/internal/clients/unannotatedecho/api/swagger.yaml @@ -18,7 +18,7 @@ paths: - "UnannotatedEchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." - operationId: "Echo" + operationId: "UnannotatedEchoService_Echo" parameters: - name: "id" in: "path" @@ -41,7 +41,7 @@ paths: - "UnannotatedEchoService" summary: "Echo method receives a simple message and returns it." description: "The message posted as the id parameter will also be\nreturned." - operationId: "Echo2" + operationId: "UnannotatedEchoService_Echo2" parameters: - name: "id" in: "path" @@ -75,7 +75,7 @@ paths: tags: - "UnannotatedEchoService" summary: "EchoBody method receives a simple message and returns it." - operationId: "EchoBody" + operationId: "UnannotatedEchoService_EchoBody" parameters: - in: "body" name: "body" @@ -97,7 +97,7 @@ paths: tags: - "UnannotatedEchoService" summary: "EchoDelete method receives a simple message and returns it." - operationId: "EchoDelete" + operationId: "UnannotatedEchoService_EchoDelete" parameters: - name: "id" in: "query" diff --git a/examples/internal/clients/unannotatedecho/api_unannotated_echo_service.go b/examples/internal/clients/unannotatedecho/api_unannotated_echo_service.go index 8eec8d0fede..7f33b29bef0 100644 --- a/examples/internal/clients/unannotatedecho/api_unannotated_echo_service.go +++ b/examples/internal/clients/unannotatedecho/api_unannotated_echo_service.go @@ -34,7 +34,7 @@ The message posted as the id parameter will also be returned. @return ExamplepbUnannotatedSimpleMessage */ -func (a *UnannotatedEchoServiceApiService) Echo(ctx context.Context, id string) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { +func (a *UnannotatedEchoServiceApiService) UnannotatedEchoServiceEcho(ctx context.Context, id string) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -132,17 +132,17 @@ The message posted as the id parameter will also be returned. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param id Id represents the message identifier. * @param num - * @param optional nil or *Echo2Opts - Optional Parameters: + * @param optional nil or *UnannotatedEchoServiceEcho2Opts - Optional Parameters: * @param "Duration" (optional.String) - @return ExamplepbUnannotatedSimpleMessage */ -type Echo2Opts struct { +type UnannotatedEchoServiceEcho2Opts struct { Duration optional.String } -func (a *UnannotatedEchoServiceApiService) Echo2(ctx context.Context, id string, num string, localVarOptionals *Echo2Opts) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { +func (a *UnannotatedEchoServiceApiService) UnannotatedEchoServiceEcho2(ctx context.Context, id string, num string, localVarOptionals *UnannotatedEchoServiceEcho2Opts) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -245,7 +245,7 @@ UnannotatedEchoServiceApiService EchoBody method receives a simple message and r @return ExamplepbUnannotatedSimpleMessage */ -func (a *UnannotatedEchoServiceApiService) EchoBody(ctx context.Context, body ExamplepbUnannotatedSimpleMessage) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { +func (a *UnannotatedEchoServiceApiService) UnannotatedEchoServiceEchoBody(ctx context.Context, body ExamplepbUnannotatedSimpleMessage) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -341,7 +341,7 @@ func (a *UnannotatedEchoServiceApiService) EchoBody(ctx context.Context, body Ex /* UnannotatedEchoServiceApiService EchoDelete method receives a simple message and returns it. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *EchoDeleteOpts - Optional Parameters: + * @param optional nil or *UnannotatedEchoServiceEchoDeleteOpts - Optional Parameters: * @param "Id" (optional.String) - Id represents the message identifier. * @param "Num" (optional.String) - * @param "Duration" (optional.String) - @@ -349,13 +349,13 @@ UnannotatedEchoServiceApiService EchoDelete method receives a simple message and @return ExamplepbUnannotatedSimpleMessage */ -type EchoDeleteOpts struct { +type UnannotatedEchoServiceEchoDeleteOpts struct { Id optional.String Num optional.String Duration optional.String } -func (a *UnannotatedEchoServiceApiService) EchoDelete(ctx context.Context, localVarOptionals *EchoDeleteOpts) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { +func (a *UnannotatedEchoServiceApiService) UnannotatedEchoServiceEchoDelete(ctx context.Context, localVarOptionals *UnannotatedEchoServiceEchoDeleteOpts) (ExamplepbUnannotatedSimpleMessage, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} diff --git a/examples/internal/integration/client_test.go b/examples/internal/integration/client_test.go index 90ad997f90f..ca3b1eacc51 100644 --- a/examples/internal/integration/client_test.go +++ b/examples/internal/integration/client_test.go @@ -19,7 +19,7 @@ func TestEchoClient(t *testing.T) { cfg.BasePath = "http://localhost:8088" cl := echo.NewAPIClient(cfg) - resp, _, err := cl.EchoServiceApi.Echo(context.Background(), "foo") + resp, _, err := cl.EchoServiceApi.EchoServiceEcho(context.Background(), "foo") if err != nil { t.Errorf(`cl.EchoServiceApi.Echo("foo") failed with %v; want success`, err) } @@ -39,7 +39,7 @@ func TestEchoBodyClient(t *testing.T) { cl := echo.NewAPIClient(cfg) req := echo.ExamplepbSimpleMessage{Id: "foo"} - resp, _, err := cl.EchoServiceApi.EchoBody(context.Background(), req) + resp, _, err := cl.EchoServiceApi.EchoServiceEchoBody(context.Background(), req) if err != nil { t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err) } @@ -88,7 +88,7 @@ func testABEClientCreate(t *testing.T, cl *abe.APIClient) { NestedPathEnumValue: &messagePath, EnumValueAnnotation: &enumZero, } - resp, _, err := cl.ABitOfEverythingServiceApi.Create( + resp, _, err := cl.ABitOfEverythingServiceApi.ABitOfEverythingServiceCreate( context.Background(), want.FloatValue, want.DoubleValue, @@ -188,7 +188,7 @@ func TestUnannotatedEchoClient(t *testing.T) { cl := unannotatedecho.NewAPIClient(cfg) - resp, _, err := cl.UnannotatedEchoServiceApi.Echo(context.Background(), "foo") + resp, _, err := cl.UnannotatedEchoServiceApi.UnannotatedEchoServiceEcho(context.Background(), "foo") if err != nil { t.Errorf(`cl.Echo("foo") failed with %v; want success`, err) } @@ -209,7 +209,7 @@ func TestUnannotatedEchoBodyClient(t *testing.T) { cl := unannotatedecho.NewAPIClient(cfg) req := unannotatedecho.ExamplepbUnannotatedSimpleMessage{Id: "foo"} - resp, _, err := cl.UnannotatedEchoServiceApi.EchoBody(context.Background(), req) + resp, _, err := cl.UnannotatedEchoServiceApi.UnannotatedEchoServiceEchoBody(context.Background(), req) if err != nil { t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err) } diff --git a/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json index 5dc22410e8d..76a818c470e 100644 --- a/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json @@ -30,7 +30,7 @@ "paths": { "/v1/example/a_bit_of_everything": { "post": { - "operationId": "CreateBody", + "operationId": "ABitOfEverythingService_CreateBody", "responses": { "200": { "description": "A successful response.", @@ -81,7 +81,7 @@ "get": { "summary": "Summary: Echo rpc", "description": "Description Echo", - "operationId": "Echo", + "operationId": "ABitOfEverythingService_Echo", "responses": { "200": { "description": "A successful response.", @@ -142,7 +142,7 @@ }, "/v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}": { "get": { - "operationId": "CheckNestedEnumGetQueryParams", + "operationId": "ABitOfEverythingService_CheckNestedEnumGetQueryParams", "responses": { "200": { "description": "A successful response.", @@ -457,7 +457,7 @@ }, "/v1/example/a_bit_of_everything/params/get/{single_nested.name}": { "get": { - "operationId": "CheckGetQueryParams", + "operationId": "ABitOfEverythingService_CheckGetQueryParams", "responses": { "200": { "description": "A successful response.", @@ -778,7 +778,7 @@ }, "/v1/example/a_bit_of_everything/params/post/{string_value}": { "post": { - "operationId": "CheckPostQueryParams", + "operationId": "ABitOfEverythingService_CheckPostQueryParams", "responses": { "200": { "description": "A successful response.", @@ -833,7 +833,7 @@ }, "/v1/example/a_bit_of_everything/query/{uuid}": { "get": { - "operationId": "GetQuery", + "operationId": "ABitOfEverythingService_GetQuery", "responses": { "200": { "description": "A successful response.", @@ -1169,7 +1169,7 @@ "post": { "summary": "Create a new ABitOfEverything", "description": "This API creates a new ABitOfEverything", - "operationId": "Create", + "operationId": "ABitOfEverythingService_Create", "responses": { "200": { "description": "A successful response.", @@ -1356,7 +1356,7 @@ }, "/v1/example/a_bit_of_everything/{single_nested.name}": { "post": { - "operationId": "DeepPathEcho", + "operationId": "ABitOfEverythingService_DeepPathEcho", "responses": { "200": { "description": "A successful response.", @@ -1412,7 +1412,7 @@ }, "/v1/example/a_bit_of_everything/{uuid}": { "get": { - "operationId": "Lookup", + "operationId": "ABitOfEverythingService_Lookup", "responses": { "200": { "description": "A successful response.", @@ -1457,7 +1457,7 @@ ] }, "delete": { - "operationId": "Delete", + "operationId": "ABitOfEverythingService_Delete", "responses": { "200": { "description": "A successful response.", @@ -1512,7 +1512,7 @@ "x-irreversible": true }, "put": { - "operationId": "Update", + "operationId": "ABitOfEverythingService_Update", "responses": { "200": { "description": "A successful response.", @@ -1567,7 +1567,7 @@ }, "/v1/example/a_bit_of_everything_repeated/{path_repeated_float_value}/{path_repeated_double_value}/{path_repeated_int64_value}/{path_repeated_uint64_value}/{path_repeated_int32_value}/{path_repeated_fixed64_value}/{path_repeated_fixed32_value}/{path_repeated_bool_value}/{path_repeated_string_value}/{path_repeated_bytes_value}/{path_repeated_uint32_value}/{path_repeated_enum_value}/{path_repeated_sfixed32_value}/{path_repeated_sfixed64_value}/{path_repeated_sint32_value}/{path_repeated_sint64_value}": { "get": { - "operationId": "GetRepeatedQuery", + "operationId": "ABitOfEverythingService_GetRepeatedQuery", "responses": { "200": { "description": "A successful response.", @@ -1803,7 +1803,7 @@ }, "/v2/example/a_bit_of_everything/{abe.uuid}": { "put": { - "operationId": "UpdateV2", + "operationId": "ABitOfEverythingService_UpdateV2", "responses": { "200": { "description": "A successful response.", @@ -1856,7 +1856,7 @@ ] }, "patch": { - "operationId": "UpdateV22", + "operationId": "ABitOfEverythingService_UpdateV22", "responses": { "200": { "description": "A successful response.", @@ -1913,7 +1913,7 @@ "get": { "summary": "Summary: Echo rpc", "description": "Description Echo", - "operationId": "Echo3", + "operationId": "ABitOfEverythingService_Echo3", "responses": { "200": { "description": "A successful response.", @@ -1974,7 +1974,7 @@ "post": { "summary": "Summary: Echo rpc", "description": "Description Echo", - "operationId": "Echo2", + "operationId": "ABitOfEverythingService_Echo2", "responses": { "200": { "description": "A successful response.", @@ -2037,7 +2037,7 @@ }, "/v2/example/empty": { "get": { - "operationId": "Empty", + "operationId": "camelCaseServiceName_Empty", "responses": { "200": { "description": "A successful response.", @@ -2076,7 +2076,7 @@ }, "/v2/example/errorwithdetails": { "get": { - "operationId": "ErrorWithDetails", + "operationId": "ABitOfEverythingService_ErrorWithDetails", "responses": { "200": { "description": "A successful response.", @@ -2115,7 +2115,7 @@ }, "/v2/example/overwriteresponsecontenttype": { "get": { - "operationId": "OverwriteResponseContentType", + "operationId": "ABitOfEverythingService_OverwriteResponseContentType", "responses": { "200": { "description": "A successful response.", @@ -2157,7 +2157,7 @@ }, "/v2/example/postwithemptybody/{name}": { "post": { - "operationId": "PostWithEmptyBody", + "operationId": "ABitOfEverythingService_PostWithEmptyBody", "responses": { "200": { "description": "A successful response.", @@ -2212,7 +2212,7 @@ }, "/v2/example/timeout": { "get": { - "operationId": "Timeout", + "operationId": "ABitOfEverythingService_Timeout", "responses": { "200": { "description": "A successful response.", @@ -2251,7 +2251,7 @@ }, "/v2/example/withbody/{id}": { "post": { - "operationId": "GetMessageWithBody", + "operationId": "ABitOfEverythingService_GetMessageWithBody", "responses": { "200": { "description": "A successful response.", @@ -2306,7 +2306,7 @@ }, "/v2a/example/a_bit_of_everything/{abe.uuid}": { "patch": { - "operationId": "UpdateV23", + "operationId": "ABitOfEverythingService_UpdateV23", "responses": { "200": { "description": "A successful response.", diff --git a/examples/internal/proto/examplepb/echo_service.swagger.json b/examples/internal/proto/examplepb/echo_service.swagger.json index f7b35c2ddee..43d9b608d56 100644 --- a/examples/internal/proto/examplepb/echo_service.swagger.json +++ b/examples/internal/proto/examplepb/echo_service.swagger.json @@ -16,7 +16,7 @@ "post": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", - "operationId": "Echo", + "operationId": "EchoService_Echo", "responses": { "200": { "description": "A successful response.", @@ -49,7 +49,7 @@ "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", - "operationId": "Echo2", + "operationId": "EchoService_Echo2", "responses": { "200": { "description": "A successful response.", @@ -135,7 +135,7 @@ "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", - "operationId": "Echo3", + "operationId": "EchoService_Echo3", "responses": { "200": { "description": "A successful response.", @@ -221,7 +221,7 @@ "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", - "operationId": "Echo4", + "operationId": "EchoService_Echo4", "responses": { "200": { "description": "A successful response.", @@ -301,7 +301,7 @@ "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", - "operationId": "Echo5", + "operationId": "EchoService_Echo5", "responses": { "200": { "description": "A successful response.", @@ -380,7 +380,7 @@ "/v1/example/echo_body": { "post": { "summary": "EchoBody method receives a simple message and returns it.", - "operationId": "EchoBody", + "operationId": "EchoService_EchoBody", "responses": { "200": { "description": "A successful response.", @@ -413,7 +413,7 @@ "/v1/example/echo_delete": { "delete": { "summary": "EchoDelete method receives a simple message and returns it.", - "operationId": "EchoDelete", + "operationId": "EchoService_EchoDelete", "responses": { "200": { "description": "A successful response.", diff --git a/examples/internal/proto/examplepb/response_body_service.swagger.json b/examples/internal/proto/examplepb/response_body_service.swagger.json index 1786b2dba94..11143187def 100644 --- a/examples/internal/proto/examplepb/response_body_service.swagger.json +++ b/examples/internal/proto/examplepb/response_body_service.swagger.json @@ -13,7 +13,7 @@ "paths": { "/responsebodies/{data}": { "get": { - "operationId": "ListResponseBodies", + "operationId": "ResponseBodyService_ListResponseBodies", "responses": { "200": { "description": "", @@ -46,7 +46,7 @@ }, "/responsebody/{data}": { "get": { - "operationId": "GetResponseBody", + "operationId": "ResponseBodyService_GetResponseBody", "responses": { "200": { "description": "", @@ -76,7 +76,7 @@ }, "/responsestrings/{data}": { "get": { - "operationId": "ListResponseStrings", + "operationId": "ResponseBodyService_ListResponseStrings", "responses": { "200": { "description": "", diff --git a/examples/internal/proto/examplepb/stream.swagger.json b/examples/internal/proto/examplepb/stream.swagger.json index faef15b04e4..2d4681d6c4a 100644 --- a/examples/internal/proto/examplepb/stream.swagger.json +++ b/examples/internal/proto/examplepb/stream.swagger.json @@ -13,7 +13,7 @@ "paths": { "/v1/example/a_bit_of_everything": { "get": { - "operationId": "List", + "operationId": "StreamService_List", "responses": { "200": { "description": "A successful response.(streaming responses)", @@ -44,7 +44,7 @@ }, "/v1/example/a_bit_of_everything/bulk": { "post": { - "operationId": "BulkCreate", + "operationId": "StreamService_BulkCreate", "responses": { "200": { "description": "A successful response.", @@ -77,7 +77,7 @@ }, "/v1/example/a_bit_of_everything/echo": { "post": { - "operationId": "BulkEcho", + "operationId": "StreamService_BulkEcho", "responses": { "200": { "description": "A successful response.(streaming responses)", diff --git a/examples/internal/proto/examplepb/unannotated_echo_service.swagger.json b/examples/internal/proto/examplepb/unannotated_echo_service.swagger.json index 36720e9367b..4d383edc489 100644 --- a/examples/internal/proto/examplepb/unannotated_echo_service.swagger.json +++ b/examples/internal/proto/examplepb/unannotated_echo_service.swagger.json @@ -16,7 +16,7 @@ "post": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", - "operationId": "Echo", + "operationId": "UnannotatedEchoService_Echo", "responses": { "200": { "description": "A successful response.", @@ -49,7 +49,7 @@ "get": { "summary": "Echo method receives a simple message and returns it.", "description": "The message posted as the id parameter will also be\nreturned.", - "operationId": "Echo2", + "operationId": "UnannotatedEchoService_Echo2", "responses": { "200": { "description": "A successful response.", @@ -94,7 +94,7 @@ "/v1/example/echo_body": { "post": { "summary": "EchoBody method receives a simple message and returns it.", - "operationId": "EchoBody", + "operationId": "UnannotatedEchoService_EchoBody", "responses": { "200": { "description": "A successful response.", @@ -127,7 +127,7 @@ "/v1/example/echo_delete": { "delete": { "summary": "EchoDelete method receives a simple message and returns it.", - "operationId": "EchoDelete", + "operationId": "UnannotatedEchoService_EchoDelete", "responses": { "200": { "description": "A successful response.", diff --git a/examples/internal/proto/examplepb/use_go_template.swagger.json b/examples/internal/proto/examplepb/use_go_template.swagger.json index 642ab4539fa..2c68208ce1b 100644 --- a/examples/internal/proto/examplepb/use_go_template.swagger.json +++ b/examples/internal/proto/examplepb/use_go_template.swagger.json @@ -15,7 +15,7 @@ "post": { "summary": "Login", "description": "Login is a call with the method(s) POST within the \"LoginService\" service.\nIt takes in \"LoginRequest\" and returns a \"LoginReply\".\n\n## LoginRequest\n| Field ID | Name | Type | Description |\n| ----------- | --------- | --------------------------------------------------------- | ---------------------------- | \n| 1 | username | TYPE_STRING | The entered username | \n| 2 | password | TYPE_STRING | The entered password | \n\n## LoginReply\n| Field ID | Name | Type | Description |\n| ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | \n| 1 | message | TYPE_STRING | | \n| 2 | access | TYPE_BOOL | Whether you have access or not |", - "operationId": "Login", + "operationId": "LoginService_Login", "responses": { "200": { "description": "A successful response.", @@ -49,7 +49,7 @@ "post": { "summary": "Logout", "description": "Logout is a call with the method(s) POST within the \"LoginService\" service.\nIt takes in \"LogoutRequest\" and returns a \"LogoutReply\".\n\n## LogoutRequest\n| Field ID | Name | Type | Description |\n| ----------- | --------- | --------------------------------------------------------- | ---------------------------- | \n| 1 | timeoflogout | TYPE_STRING | The time the logout was registered | \n| 2 | test | TYPE_INT32 | This is the title\u003cbr\u003e\u003cbr\u003eThis is the \"Description\" of field test\u003cbr\u003eyou can use as many newlines as you want\u003cbr\u003e\u003cbr\u003e\u003cbr\u003eit will still format the same in the table | \n| 3 | stringarray | []TYPE_STRING | This is an array\u003cbr\u003e\u003cbr\u003eIt displays that using [] infront of the type | \n\n## LogoutReply\n| Field ID | Name | Type | Description |\n| ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | \n| 1 | message | TYPE_STRING | Message that tells you whether your\u003cbr\u003elogout was succesful or not |", - "operationId": "Logout", + "operationId": "LoginService_Logout", "responses": { "200": { "description": "A successful response.", diff --git a/examples/internal/proto/examplepb/wrappers.swagger.json b/examples/internal/proto/examplepb/wrappers.swagger.json index d42d6f3fb6b..0153c9592df 100644 --- a/examples/internal/proto/examplepb/wrappers.swagger.json +++ b/examples/internal/proto/examplepb/wrappers.swagger.json @@ -13,7 +13,7 @@ "paths": { "/v1/example/wrappers": { "post": { - "operationId": "Create", + "operationId": "WrappersService_Create", "responses": { "200": { "description": "A successful response.", @@ -45,7 +45,7 @@ }, "/v1/testBool": { "post": { - "operationId": "CreateBoolValue", + "operationId": "WrappersService_CreateBoolValue", "responses": { "200": { "description": "A successful response.", @@ -79,7 +79,7 @@ }, "/v1/testBytes": { "post": { - "operationId": "CreateBytesValue", + "operationId": "WrappersService_CreateBytesValue", "responses": { "200": { "description": "A successful response.", @@ -113,7 +113,7 @@ }, "/v1/testDouble": { "post": { - "operationId": "CreateDoubleValue", + "operationId": "WrappersService_CreateDoubleValue", "responses": { "200": { "description": "A successful response.", @@ -147,7 +147,7 @@ }, "/v1/testEmpty": { "post": { - "operationId": "CreateEmpty", + "operationId": "WrappersService_CreateEmpty", "responses": { "200": { "description": "A successful response.", @@ -179,7 +179,7 @@ }, "/v1/testFloat": { "post": { - "operationId": "CreateFloatValue", + "operationId": "WrappersService_CreateFloatValue", "responses": { "200": { "description": "A successful response.", @@ -213,7 +213,7 @@ }, "/v1/testInt32": { "post": { - "operationId": "CreateInt32Value", + "operationId": "WrappersService_CreateInt32Value", "responses": { "200": { "description": "A successful response.", @@ -247,7 +247,7 @@ }, "/v1/testInt64": { "post": { - "operationId": "CreateInt64Value", + "operationId": "WrappersService_CreateInt64Value", "responses": { "200": { "description": "A successful response.", @@ -281,7 +281,7 @@ }, "/v1/testString": { "post": { - "operationId": "CreateStringValue", + "operationId": "WrappersService_CreateStringValue", "responses": { "200": { "description": "A successful response.", @@ -313,7 +313,7 @@ }, "/v1/testUint32": { "post": { - "operationId": "CreateUInt32Value", + "operationId": "WrappersService_CreateUInt32Value", "responses": { "200": { "description": "A successful response.", @@ -347,7 +347,7 @@ }, "/v1/testUint64": { "post": { - "operationId": "CreateUInt64Value", + "operationId": "WrappersService_CreateUInt64Value", "responses": { "200": { "description": "A successful response.", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 04005e27bd9..77c99feac55 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -978,10 +978,10 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } } if bIdx == 0 { - operationObject.OperationID = fmt.Sprintf("%s", meth.GetName()) + operationObject.OperationID = fmt.Sprintf("%s_%s", svc.GetName(), meth.GetName()) } else { // OperationID must be unique in an OpenAPI v2 definition. - operationObject.OperationID = fmt.Sprintf("%s%d", meth.GetName(), bIdx+1) + operationObject.OperationID = fmt.Sprintf("%s_%s%d", svc.GetName(), meth.GetName(), bIdx+1) } // Fill reference map with referenced request messages @@ -1945,7 +1945,7 @@ func lowerCamelCase(fieldName string, fields []*descriptor.Field, msgs []*descri fieldNameToType := make(map[string]string, 0) for _, msg := range msgs { fieldNameToJSONName := make(map[string]string, 0) - for _, oneField := range msg.GetField() { + for _, oneField := range msg.GetField() { fieldNameToJSONName[oneField.GetName()] = oneField.GetJsonName() fieldNameToType[oneField.GetName()] = oneField.GetTypeName() } @@ -1954,11 +1954,11 @@ func lowerCamelCase(fieldName string, fields []*descriptor.Field, msgs []*descri if strings.Contains(fieldName, ".") { fieldNames := strings.Split(fieldName, ".") fieldNamesWithCamelCase := make([]string, 0) - for i := 0; i < len(fieldNames) - 1; i++ { + for i := 0; i < len(fieldNames)-1; i++ { fieldNamesWithCamelCase = append(fieldNamesWithCamelCase, doCamelCase(string(fieldNames[i]))) } prefix := strings.Join(fieldNamesWithCamelCase, ".") - reservedJSONName := getReservedJSONName(fieldName, messageNameToFieldsToJSONName,fieldNameToType) + reservedJSONName := getReservedJSONName(fieldName, messageNameToFieldsToJSONName, fieldNameToType) if reservedJSONName != "" { return prefix + "." + reservedJSONName } @@ -1980,10 +1980,9 @@ func getReservedJSONName(fieldName string, messageNameToFieldsToJSONName map[str firstVariable := fieldNames[0] firstType := fieldNameToType[firstVariable] firstTypeShortNames := strings.Split(firstType, ".") - firstTypeShortName := firstTypeShortNames[len(firstTypeShortNames) - 1] + firstTypeShortName := firstTypeShortNames[len(firstTypeShortNames)-1] return messageNameToFieldsToJSONName[firstTypeShortName][fieldNames[1]] } fieldNames := strings.Split(fieldName, ".") return getReservedJSONName(strings.Join(fieldNames[1:], "."), messageNameToFieldsToJSONName, fieldNameToType) } - diff --git a/protoc-gen-swagger/genswagger/template_test.go b/protoc-gen-swagger/genswagger/template_test.go index c7a35a6b6c8..9176eb07a51 100644 --- a/protoc-gen-swagger/genswagger/template_test.go +++ b/protoc-gen-swagger/genswagger/template_test.go @@ -606,6 +606,118 @@ func TestApplyTemplateSimple(t *testing.T) { } } +func TestApplyTemplateMultiService(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Example"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + } + + // Create two services that have the same method name. We will test that the + // operation IDs are different + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + svc2 := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("OtherService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, + MessageType: []*protodescriptor.DescriptorProto{msgdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + Body: &descriptor.Body{FieldPath: nil}, + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: "/v1/echo", + }, + }, + }, + }, + }, + }, + { + ServiceDescriptorProto: svc2, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + Body: &descriptor.Body{FieldPath: nil}, + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: "/v1/ping", + }, + }, + }, + }, + }, + }, + }, + } + reg := descriptor.NewRegistry() + fileCL := crossLinkFixture(&file) + err := reg.Load(reqFromFile(fileCL)) + if err != nil { + t.Errorf("reg.Load(%#v) failed with %v; want success", file, err) + return + } + result, err := applyTemplate(param{File: fileCL, reg: reg}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + + // Check that the two services have unique operation IDs even though they + // have the same method name. + if want, is := "ExampleService_Example", result.Paths["/v1/echo"].Get.OperationID; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).Paths[0].Get.OperationID = %s want to be %s", file, is, want) + } + if want, is := "OtherService_Example", result.Paths["/v1/ping"].Get.OperationID; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).Paths[0].Get.OperationID = %s want to be %s", file, is, want) + } + + // If there was a failure, print out the input and the json result for debugging. + if t.Failed() { + t.Errorf("had: %s", file) + t.Errorf("got: %s", fmt.Sprint(result)) + } +} + func TestApplyTemplateOverrideOperationID(t *testing.T) { msgdesc := &protodescriptor.DescriptorProto{ Name: proto.String("ExampleMessage"), @@ -1325,10 +1437,10 @@ func generateMsgsForJSONReservedName() []*descriptor.Message { pfd := protodescriptor.FieldDescriptorProto{Name: &fieldName, JsonName: &fieldJSONName, TypeName: &messageType} result = append(result, &descriptor.Message{ - DescriptorProto: &protodescriptor.DescriptorProto{ - Name: &messageName1, Field: []*protodescriptor.FieldDescriptorProto{&pfd}, - }, - }) + DescriptorProto: &protodescriptor.DescriptorProto{ + Name: &messageName1, Field: []*protodescriptor.FieldDescriptorProto{&pfd}, + }, + }) // The second message, its name is NewName, its type is string // message NewType { // string field_newName [json_name = RESERVEDJSONNAME] @@ -1336,7 +1448,7 @@ func generateMsgsForJSONReservedName() []*descriptor.Message { messageName := "NewType" field := "field_newName" fieldJSONName2 := "RESERVEDJSONNAME" - pfd2 := protodescriptor.FieldDescriptorProto{Name: &field, JsonName: &fieldJSONName2,} + pfd2 := protodescriptor.FieldDescriptorProto{Name: &field, JsonName: &fieldJSONName2} result = append(result, &descriptor.Message{ DescriptorProto: &protodescriptor.DescriptorProto{ Name: &messageName, Field: []*protodescriptor.FieldDescriptorProto{&pfd2}, From 2794f4b71acd646d72655d60be7350a6ae6035ff Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 1 Apr 2020 10:11:54 +0100 Subject: [PATCH 544/552] Generate changelog for 1.14.4-rc.1 --- CHANGELOG.md | 51 ++++++++++++++++++++++++++++++++++++++++++--------- Makefile | 2 +- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 816d64543a3..4710a2dc249 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,66 @@ # Change Log -## [v1.14.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.3) (2020-03-11) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.2...v1.14.3) +## [v1.14.4-rc.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.4-rc.1) (2020-04-01) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.3...v1.14.4-rc.1) + +**Implemented enhancements:** + +- proto-gen-\* --version [\#649](https://github.com/grpc-ecosystem/grpc-gateway/issues/649) + +**Closed issues:** + +- protoc-gen-swagger: json\_names\_for\_fields=true does not respect json\_name for \*nested\* path parameters [\#1187](https://github.com/grpc-ecosystem/grpc-gateway/issues/1187) +- protoc-gen-grpc-gateway-ts plugin for generating Typescript types [\#1182](https://github.com/grpc-ecosystem/grpc-gateway/issues/1182) +- protoc-gen-swagger: support outputting enum parameters as integers [\#1177](https://github.com/grpc-ecosystem/grpc-gateway/issues/1177) +- protoc-gen-grpc-gateway should warn or fail if a selector does not exist [\#1175](https://github.com/grpc-ecosystem/grpc-gateway/issues/1175) +- Enum string values not supported by grpc gateway [\#1171](https://github.com/grpc-ecosystem/grpc-gateway/issues/1171) +- Swagger definition is broken if there's no default error response set [\#1162](https://github.com/grpc-ecosystem/grpc-gateway/issues/1162) +- Using golang/protobuf v1.4.0-rc.3 locks up generators [\#1158](https://github.com/grpc-ecosystem/grpc-gateway/issues/1158) **Merged pull requests:** -- Move httprule back into the public API [\#1169](https://github.com/grpc-ecosystem/grpc-gateway/pull/1169) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Generate Swagger with Unique Operation IDs [\#1193](https://github.com/grpc-ecosystem/grpc-gateway/pull/1193) ([dadgar](https://github.com/dadgar)) +- Xin/support deep levels reserved json name [\#1191](https://github.com/grpc-ecosystem/grpc-gateway/pull/1191) ([xin-au](https://github.com/xin-au)) +- feat: add enumAsInts flag [\#1186](https://github.com/grpc-ecosystem/grpc-gateway/pull/1186) ([rowe0x](https://github.com/rowe0x)) +- Use 8088 instead of 8080 in integration test. [\#1184](https://github.com/grpc-ecosystem/grpc-gateway/pull/1184) ([drigz](https://github.com/drigz)) +- Limit Bazel memory usage in CI. [\#1183](https://github.com/grpc-ecosystem/grpc-gateway/pull/1183) ([drigz](https://github.com/drigz)) +- fix version spelling [\#1181](https://github.com/grpc-ecosystem/grpc-gateway/pull/1181) ([seriousben](https://github.com/seriousben)) +- Emit error on HTTP rules without a matching selector and log warning on unbound methods [\#1178](https://github.com/grpc-ecosystem/grpc-gateway/pull/1178) ([andrascz](https://github.com/andrascz)) +- genswagger: don't emit default response if there's no Error definition [\#1166](https://github.com/grpc-ecosystem/grpc-gateway/pull/1166) ([utrack](https://github.com/utrack)) + +## [v1.14.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.3) (2020-03-11) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.2...v1.14.3) **Closed issues:** - Missing httprule breaks our module [\#1168](https://github.com/grpc-ecosystem/grpc-gateway/issues/1168) -## [v1.14.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.2) (2020-03-09) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.1...v1.14.2) - **Merged pull requests:** -- Move genswagger to public API again [\#1163](https://github.com/grpc-ecosystem/grpc-gateway/pull/1163) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Generate changelog for 1.14.3 [\#1170](https://github.com/grpc-ecosystem/grpc-gateway/pull/1170) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Move httprule back into the public API [\#1169](https://github.com/grpc-ecosystem/grpc-gateway/pull/1169) ([johanbrandhorst](https://github.com/johanbrandhorst)) + +## [v1.14.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.2) (2020-03-09) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.1...v1.14.2) **Closed issues:** - 1.14.x breaks clay [\#1161](https://github.com/grpc-ecosystem/grpc-gateway/issues/1161) +- Enum string values not supported by grpc gateway [\#1159](https://github.com/grpc-ecosystem/grpc-gateway/issues/1159) +- Path parameters visible in the body of the request [\#1157](https://github.com/grpc-ecosystem/grpc-gateway/issues/1157) +- 1.14.0 breaks existing pipelines [\#1154](https://github.com/grpc-ecosystem/grpc-gateway/issues/1154) + +**Merged pull requests:** + +- Generate changelog for 1.14.2 [\#1164](https://github.com/grpc-ecosystem/grpc-gateway/pull/1164) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Move genswagger to public API again [\#1163](https://github.com/grpc-ecosystem/grpc-gateway/pull/1163) ([johanbrandhorst](https://github.com/johanbrandhorst)) ## [v1.14.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.1) (2020-03-05) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.0...v1.14.1) **Merged pull requests:** -- Generate changelog for 1.14.1 [\#1156](https://github.com/grpc-ecosystem/grpc-gateway/pull/1151) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Generate changelog for 1.14.1 [\#1156](https://github.com/grpc-ecosystem/grpc-gateway/pull/1156) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Move generator and descriptor back to public API [\#1155](https://github.com/grpc-ecosystem/grpc-gateway/pull/1155) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Update build environment to 1.14 [\#1153](https://github.com/grpc-ecosystem/grpc-gateway/pull/1153) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Add gorelease CI step [\#1152](https://github.com/grpc-ecosystem/grpc-gateway/pull/1152) ([johanbrandhorst](https://github.com/johanbrandhorst)) @@ -1357,4 +1390,4 @@ -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/Makefile b/Makefile index 60db5e3561c..598d343b4ce 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.14.3 + --future-release=v1.14.4-rc.1 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From e9c5530f663fd70cf9015a99d811efda1918e7fb Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 1 Apr 2020 10:11:54 +0100 Subject: [PATCH 545/552] Generate changelog for 1.14.4-rc.1 --- CHANGELOG.md | 51 ++++++++++++++++++++++++++++++++++++++++++--------- Makefile | 2 +- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 816d64543a3..4710a2dc249 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,66 @@ # Change Log -## [v1.14.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.3) (2020-03-11) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.2...v1.14.3) +## [v1.14.4-rc.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.4-rc.1) (2020-04-01) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.3...v1.14.4-rc.1) + +**Implemented enhancements:** + +- proto-gen-\* --version [\#649](https://github.com/grpc-ecosystem/grpc-gateway/issues/649) + +**Closed issues:** + +- protoc-gen-swagger: json\_names\_for\_fields=true does not respect json\_name for \*nested\* path parameters [\#1187](https://github.com/grpc-ecosystem/grpc-gateway/issues/1187) +- protoc-gen-grpc-gateway-ts plugin for generating Typescript types [\#1182](https://github.com/grpc-ecosystem/grpc-gateway/issues/1182) +- protoc-gen-swagger: support outputting enum parameters as integers [\#1177](https://github.com/grpc-ecosystem/grpc-gateway/issues/1177) +- protoc-gen-grpc-gateway should warn or fail if a selector does not exist [\#1175](https://github.com/grpc-ecosystem/grpc-gateway/issues/1175) +- Enum string values not supported by grpc gateway [\#1171](https://github.com/grpc-ecosystem/grpc-gateway/issues/1171) +- Swagger definition is broken if there's no default error response set [\#1162](https://github.com/grpc-ecosystem/grpc-gateway/issues/1162) +- Using golang/protobuf v1.4.0-rc.3 locks up generators [\#1158](https://github.com/grpc-ecosystem/grpc-gateway/issues/1158) **Merged pull requests:** -- Move httprule back into the public API [\#1169](https://github.com/grpc-ecosystem/grpc-gateway/pull/1169) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Generate Swagger with Unique Operation IDs [\#1193](https://github.com/grpc-ecosystem/grpc-gateway/pull/1193) ([dadgar](https://github.com/dadgar)) +- Xin/support deep levels reserved json name [\#1191](https://github.com/grpc-ecosystem/grpc-gateway/pull/1191) ([xin-au](https://github.com/xin-au)) +- feat: add enumAsInts flag [\#1186](https://github.com/grpc-ecosystem/grpc-gateway/pull/1186) ([rowe0x](https://github.com/rowe0x)) +- Use 8088 instead of 8080 in integration test. [\#1184](https://github.com/grpc-ecosystem/grpc-gateway/pull/1184) ([drigz](https://github.com/drigz)) +- Limit Bazel memory usage in CI. [\#1183](https://github.com/grpc-ecosystem/grpc-gateway/pull/1183) ([drigz](https://github.com/drigz)) +- fix version spelling [\#1181](https://github.com/grpc-ecosystem/grpc-gateway/pull/1181) ([seriousben](https://github.com/seriousben)) +- Emit error on HTTP rules without a matching selector and log warning on unbound methods [\#1178](https://github.com/grpc-ecosystem/grpc-gateway/pull/1178) ([andrascz](https://github.com/andrascz)) +- genswagger: don't emit default response if there's no Error definition [\#1166](https://github.com/grpc-ecosystem/grpc-gateway/pull/1166) ([utrack](https://github.com/utrack)) + +## [v1.14.3](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.3) (2020-03-11) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.2...v1.14.3) **Closed issues:** - Missing httprule breaks our module [\#1168](https://github.com/grpc-ecosystem/grpc-gateway/issues/1168) -## [v1.14.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.2) (2020-03-09) -[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.1...v1.14.2) - **Merged pull requests:** -- Move genswagger to public API again [\#1163](https://github.com/grpc-ecosystem/grpc-gateway/pull/1163) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Generate changelog for 1.14.3 [\#1170](https://github.com/grpc-ecosystem/grpc-gateway/pull/1170) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Move httprule back into the public API [\#1169](https://github.com/grpc-ecosystem/grpc-gateway/pull/1169) ([johanbrandhorst](https://github.com/johanbrandhorst)) + +## [v1.14.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.2) (2020-03-09) +[Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.1...v1.14.2) **Closed issues:** - 1.14.x breaks clay [\#1161](https://github.com/grpc-ecosystem/grpc-gateway/issues/1161) +- Enum string values not supported by grpc gateway [\#1159](https://github.com/grpc-ecosystem/grpc-gateway/issues/1159) +- Path parameters visible in the body of the request [\#1157](https://github.com/grpc-ecosystem/grpc-gateway/issues/1157) +- 1.14.0 breaks existing pipelines [\#1154](https://github.com/grpc-ecosystem/grpc-gateway/issues/1154) + +**Merged pull requests:** + +- Generate changelog for 1.14.2 [\#1164](https://github.com/grpc-ecosystem/grpc-gateway/pull/1164) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Move genswagger to public API again [\#1163](https://github.com/grpc-ecosystem/grpc-gateway/pull/1163) ([johanbrandhorst](https://github.com/johanbrandhorst)) ## [v1.14.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.14.1) (2020-03-05) [Full Changelog](https://github.com/grpc-ecosystem/grpc-gateway/compare/v1.14.0...v1.14.1) **Merged pull requests:** -- Generate changelog for 1.14.1 [\#1156](https://github.com/grpc-ecosystem/grpc-gateway/pull/1151) ([johanbrandhorst](https://github.com/johanbrandhorst)) +- Generate changelog for 1.14.1 [\#1156](https://github.com/grpc-ecosystem/grpc-gateway/pull/1156) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Move generator and descriptor back to public API [\#1155](https://github.com/grpc-ecosystem/grpc-gateway/pull/1155) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Update build environment to 1.14 [\#1153](https://github.com/grpc-ecosystem/grpc-gateway/pull/1153) ([johanbrandhorst](https://github.com/johanbrandhorst)) - Add gorelease CI step [\#1152](https://github.com/grpc-ecosystem/grpc-gateway/pull/1152) ([johanbrandhorst](https://github.com/johanbrandhorst)) @@ -1357,4 +1390,4 @@ -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/Makefile b/Makefile index 60db5e3561c..598d343b4ce 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ changelog: --compare-link \ --github-site=https://github.com \ --unreleased-label "**Next release**" \ - --future-release=v1.14.3 + --future-release=v1.14.4-rc.1 lint: golint --set_exit_status ./runtime golint --set_exit_status ./utilities/... From 98a3cda6e938147dc67ad75fff489badb73380db Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 7 Apr 2020 11:12:05 +0100 Subject: [PATCH 546/552] Move codegenerator back to public namespace Fixes #1199 --- {internal/codegenerator => codegenerator}/BUILD.bazel | 2 +- {internal/codegenerator => codegenerator}/doc.go | 0 {internal/codegenerator => codegenerator}/parse_req.go | 0 {internal/codegenerator => codegenerator}/parse_req_test.go | 2 +- protoc-gen-grpc-gateway/BUILD.bazel | 2 +- protoc-gen-grpc-gateway/main.go | 2 +- protoc-gen-swagger/BUILD.bazel | 2 +- protoc-gen-swagger/main.go | 2 +- 8 files changed, 6 insertions(+), 6 deletions(-) rename {internal/codegenerator => codegenerator}/BUILD.bazel (88%) rename {internal/codegenerator => codegenerator}/doc.go (100%) rename {internal/codegenerator => codegenerator}/parse_req.go (100%) rename {internal/codegenerator => codegenerator}/parse_req_test.go (95%) diff --git a/internal/codegenerator/BUILD.bazel b/codegenerator/BUILD.bazel similarity index 88% rename from internal/codegenerator/BUILD.bazel rename to codegenerator/BUILD.bazel index 4682f41e46d..5c8ae566cd6 100644 --- a/internal/codegenerator/BUILD.bazel +++ b/codegenerator/BUILD.bazel @@ -8,7 +8,7 @@ go_library( "doc.go", "parse_req.go", ], - importpath = "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator", + importpath = "github.com/grpc-ecosystem/grpc-gateway/codegenerator", deps = [ "@com_github_golang_protobuf//proto:go_default_library", "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto", diff --git a/internal/codegenerator/doc.go b/codegenerator/doc.go similarity index 100% rename from internal/codegenerator/doc.go rename to codegenerator/doc.go diff --git a/internal/codegenerator/parse_req.go b/codegenerator/parse_req.go similarity index 100% rename from internal/codegenerator/parse_req.go rename to codegenerator/parse_req.go diff --git a/internal/codegenerator/parse_req_test.go b/codegenerator/parse_req_test.go similarity index 95% rename from internal/codegenerator/parse_req_test.go rename to codegenerator/parse_req_test.go index c6d439c8047..5f37aad9589 100644 --- a/internal/codegenerator/parse_req_test.go +++ b/codegenerator/parse_req_test.go @@ -10,7 +10,7 @@ import ( "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator" + "github.com/grpc-ecosystem/grpc-gateway/codegenerator" ) var parseReqTests = []struct { diff --git a/protoc-gen-grpc-gateway/BUILD.bazel b/protoc-gen-grpc-gateway/BUILD.bazel index 22f7c363362..48800845031 100644 --- a/protoc-gen-grpc-gateway/BUILD.bazel +++ b/protoc-gen-grpc-gateway/BUILD.bazel @@ -8,7 +8,7 @@ go_library( srcs = ["main.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway", deps = [ - "//internal/codegenerator:go_default_library", + "//codegenerator:go_default_library", "//protoc-gen-grpc-gateway/descriptor:go_default_library", "//protoc-gen-grpc-gateway/internal/gengateway:go_default_library", "@com_github_golang_glog//:go_default_library", diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index 236ce41fcc7..dec981d4a96 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -17,7 +17,7 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator" + "github.com/grpc-ecosystem/grpc-gateway/codegenerator" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/internal/gengateway" ) diff --git a/protoc-gen-swagger/BUILD.bazel b/protoc-gen-swagger/BUILD.bazel index 0c823e2741b..d5a1d05fcc7 100644 --- a/protoc-gen-swagger/BUILD.bazel +++ b/protoc-gen-swagger/BUILD.bazel @@ -7,7 +7,7 @@ go_library( srcs = ["main.go"], importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger", deps = [ - "//internal/codegenerator:go_default_library", + "//codegenerator:go_default_library", "//protoc-gen-grpc-gateway/descriptor:go_default_library", "//protoc-gen-swagger/genswagger:go_default_library", "@com_github_golang_glog//:go_default_library", diff --git a/protoc-gen-swagger/main.go b/protoc-gen-swagger/main.go index 3e9c6545255..589e3561b94 100644 --- a/protoc-gen-swagger/main.go +++ b/protoc-gen-swagger/main.go @@ -9,7 +9,7 @@ import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/grpc-ecosystem/grpc-gateway/internal/codegenerator" + "github.com/grpc-ecosystem/grpc-gateway/codegenerator" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger" ) From 48de5450410b7bdd3f85073691e8cb5d1ea3f488 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Thu, 9 Apr 2020 11:16:42 +0100 Subject: [PATCH 547/552] Add GopherCon UK link to README --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 79ca1d25d96..acbc2cd76ae 100644 --- a/README.md +++ b/README.md @@ -231,6 +231,15 @@ annotation to your .proto file path/to/your_service.proto ``` +## Video intro + +This GopherCon UK 2019 presentation from our maintainer +[@JohanBrandhorst](https://github.com/johanbrandhorst) provides a good intro to +using the grpc-gateway. It uses the following boilerplate repo as a base: +https://github.com/johanbrandhorst/grpc-gateway-boilerplate. + +[![gRPC-Gateway presentation](https://img.youtube.com/vi/Pq1paKC-fXk/0.jpg)](https://www.youtube.com/watch?v=Pq1paKC-fXk) + ## Parameters and flags During code generation with `protoc`, flags to grpc-gateway tools must be passed From e53442352c4a7443acd5977fa1796c3943802ecf Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Thu, 9 Apr 2020 11:22:47 +0100 Subject: [PATCH 548/552] Remove use of deprecated bazel variable Lets use HOST_RAM*0.5. Hopefully helps a bit with the flakiness. --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 99bcb24eeec..54756aa2433 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,7 +70,8 @@ jobs: build --test_output errors build --features race # Workaround https://github.com/bazelbuild/bazel/issues/3645 - build --local_resources=3072,2.0,1.0 + # See https://docs.bazel.build/versions/0.23.0/command-line-reference.html + build --local_ram_resources=HOST_RAM*.5 EOF - run: name: Check that Bazel BUILD files are up-to-date From c36afcb2216c568e519984a37063237c8e1e5bae Mon Sep 17 00:00:00 2001 From: Anil Dasari Date: Thu, 9 Apr 2020 23:33:01 +0530 Subject: [PATCH 549/552] responsebody support for stream rpc --- .../internal/integration/integration_test.go | 66 ++++++++++++------- .../examplepb/response_body_service.proto | 7 ++ examples/internal/server/responsebody.go | 8 +++ .../internal/gengateway/template.go | 7 ++ runtime/handler.go | 22 ++++--- runtime/handler_test.go | 49 ++++++++++++-- 6 files changed, 122 insertions(+), 37 deletions(-) diff --git a/examples/internal/integration/integration_test.go b/examples/internal/integration/integration_test.go index 2c569270538..a044315295a 100644 --- a/examples/internal/integration/integration_test.go +++ b/examples/internal/integration/integration_test.go @@ -1476,26 +1476,46 @@ func TestResponseBody(t *testing.T) { } func testResponseBody(t *testing.T, port int) { - apiURL := fmt.Sprintf("http://localhost:%d/responsebody/foo", port) - resp, err := http.Get(apiURL) - if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) - return - } - defer resp.Body.Close() - buf, err := ioutil.ReadAll(resp.Body) - if err != nil { - t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) - return - } + tests := []struct { + name string + url string + wantStatus int + wantResponse string + }{{ + name: "unary case", + url: "http://localhost:%d/responsebody/foo", + wantStatus: http.StatusOK, + wantResponse: `{"data":"foo"}`, + }, { + name: "stream case", + url: "http://localhost:%d/responsebody/stream/foo", + wantStatus: http.StatusOK, + wantResponse: `{"data":"foo"}`, + }} + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + apiURL := fmt.Sprintf("http://localhost:%d/responsebody/foo", port) + resp, err := http.Get(apiURL) + if err != nil { + t.Fatalf("http.Get(%q) failed with %v; want success", apiURL, err) + } - if got, want := resp.StatusCode, http.StatusOK; got != want { - t.Errorf("resp.StatusCode = %d; want %d", got, want) - t.Logf("%s", buf) - } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatalf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) + } - if got, want := string(buf), `{"data":"foo"}`; got != want { - t.Errorf("response = %q; want %q", got, want) + if got, want := resp.StatusCode, tt.wantStatus; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + if got, want := string(buf), tt.wantResponse; got != want { + t.Errorf("response = %q; want %q", got, want) + } + }) } } @@ -1526,20 +1546,20 @@ func testResponseBodies(t *testing.T, port int) { func testResponseStrings(t *testing.T, port int) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + + port = 8087 // Run Secondary server with different marshalling ch := make(chan error) go func() { - if err := runGateway(ctx, ":8081", runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{EnumsAsInts: false, EmitDefaults: true})); err != nil { + if err := runGateway(ctx, fmt.Sprintf(":%d", port), runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{EnumsAsInts: false, EmitDefaults: true})); err != nil { ch <- fmt.Errorf("cannot run gateway service: %v", err) } }() - if err := waitForGateway(ctx, 8081); err != nil { + if err := waitForGateway(ctx, uint16(port)); err != nil { t.Fatalf("waitForGateway(ctx, 8081) failed with %v; want success", err) } - port = 8081 - for i, spec := range []struct { endpoint string expectedCode int @@ -1780,4 +1800,4 @@ func testNonStandardNames(t *testing.T, port int, method string, jsonBody string if got, want := string(body), jsonBody; got != want { t.Errorf("got %q; want %q", got, want) } -} +} \ No newline at end of file diff --git a/examples/internal/proto/examplepb/response_body_service.proto b/examples/internal/proto/examplepb/response_body_service.proto index 2a04e786e95..a1081d55713 100644 --- a/examples/internal/proto/examplepb/response_body_service.proto +++ b/examples/internal/proto/examplepb/response_body_service.proto @@ -55,4 +55,11 @@ service ResponseBodyService { response_body : "values" }; } + + rpc GetResponseBodyStream(ResponseBodyIn) returns (stream ResponseBodyOut) { + option (google.api.http) = { + get : "/responsebody/stream/{data}" + response_body : "response" + }; + } } diff --git a/examples/internal/server/responsebody.go b/examples/internal/server/responsebody.go index 8df32ede5fa..803d5d102c0 100644 --- a/examples/internal/server/responsebody.go +++ b/examples/internal/server/responsebody.go @@ -42,3 +42,11 @@ func (s *responseBodyServer) ListResponseStrings(ctx context.Context, req *examp Values: []string{"hello", req.Data}, }, nil } + +func (s *responseBodyServer) GetResponseBodyStream(req *examples.ResponseBodyIn, stream examples.ResponseBodyService_GetResponseBodyStreamServer) error { + return stream.Send(&examples.ResponseBodyOut{ + Response: &examples.ResponseBodyOut_Response{ + Data: req.Data, + }, + }) +} diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template.go b/protoc-gen-grpc-gateway/internal/gengateway/template.go index 1d3d3ca8f19..912fc53b7cb 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template.go @@ -667,7 +667,14 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Client(ctx context.Context, return } {{if $m.GetServerStreaming}} + {{ if $b.ResponseBody }} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { + res, err := resp.Recv() + return response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{res}, err + }, mux.GetForwardResponseOptions()...) + {{ else }} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + {{end}} {{else}} {{ if $b.ResponseBody }} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{resp}, mux.GetForwardResponseOptions()...) diff --git a/runtime/handler.go b/runtime/handler.go index b894da86bf8..65a305e16c1 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -61,7 +61,18 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal return } - buf, err := marshaler.Marshal(streamChunk(ctx, resp, mux.streamErrorHandler)) + var buf []byte + switch { + case resp == nil: + buf, err = marshaler.Marshal(errorChunk(streamError(ctx, mux.streamErrorHandler, errEmptyResponse))) + default: + if rb, ok := resp.(responseBody); ok { + buf, err = marshaler.Marshal(rb.XXX_ResponseBody()) + } else { + buf, err = marshaler.Marshal(map[string]proto.Message{"result": resp}) + } + } + if err != nil { grpclog.Infof("Failed to marshal response chunk: %v", err) handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) @@ -184,15 +195,6 @@ func handleForwardResponseStreamError(ctx context.Context, wroteHeader bool, mar } } -// streamChunk returns a chunk in a response stream for the given result. The -// given errHandler is used to render an error chunk if result is nil. -func streamChunk(ctx context.Context, result proto.Message, errHandler StreamErrorHandlerFunc) map[string]proto.Message { - if result == nil { - return errorChunk(streamError(ctx, errHandler, errEmptyResponse)) - } - return map[string]proto.Message{"result": result} -} - // streamError returns the payload for the final message in a response stream // that represents the given err. func streamError(ctx context.Context, errHandler StreamErrorHandlerFunc, err error) *StreamError { diff --git a/runtime/handler_test.go b/runtime/handler_test.go index 912cb3acfa5..61006484163 100644 --- a/runtime/handler_test.go +++ b/runtime/handler_test.go @@ -17,15 +17,26 @@ import ( "google.golang.org/grpc/status" ) +type fakeReponseBodyWrapper struct { + proto.Message +} + +// XXX_ResponseBody returns id of SimpleMessage +func (r fakeReponseBodyWrapper) XXX_ResponseBody() interface{} { + resp := r.Message.(*pb.SimpleMessage) + return resp.Id +} + func TestForwardResponseStream(t *testing.T) { type msg struct { pb proto.Message err error } tests := []struct { - name string - msgs []msg - statusCode int + name string + msgs []msg + statusCode int + responseBody bool }{{ name: "encoding", msgs: []msg{ @@ -47,6 +58,22 @@ func TestForwardResponseStream(t *testing.T) { {nil, grpc.Errorf(codes.OutOfRange, "400")}, }, statusCode: http.StatusOK, + }, { + name: "response body stream case", + msgs: []msg{ + {fakeReponseBodyWrapper{&pb.SimpleMessage{Id: "One"}}, nil}, + {fakeReponseBodyWrapper{&pb.SimpleMessage{Id: "Two"}}, nil}, + }, + responseBody: true, + statusCode: http.StatusOK, + }, { + name: "response body stream error case", + msgs: []msg{ + {fakeReponseBodyWrapper{&pb.SimpleMessage{Id: "One"}}, nil}, + {nil, grpc.Errorf(codes.OutOfRange, "400")}, + }, + responseBody: true, + statusCode: http.StatusOK, }} newTestRecv := func(t *testing.T, msgs []msg) func() (proto.Message, error) { @@ -113,7 +140,21 @@ func TestForwardResponseStream(t *testing.T) { return } - b, err := marshaler.Marshal(map[string]proto.Message{"result": msg.pb}) + + var b []byte + + if tt.responseBody { + // responseBody interface is in runtime package and test is in runtime_test package. hence can't use responseBody direclty + // So type casting to fakeReponseBodyWrapper struct to verify the data. + rb, ok := msg.pb.(fakeReponseBodyWrapper) + if !ok { + t.Errorf("stream responseBody failed %v", err) + } + b, err = marshaler.Marshal(rb.XXX_ResponseBody()) + } else { + b, err = marshaler.Marshal(map[string]proto.Message{"result": msg.pb}) + } + if err != nil { t.Errorf("marshaler.Marshal() failed %v", err) } From b0b45c522e4ee37477b9202a7a2673e00d90d4dc Mon Sep 17 00:00:00 2001 From: Anil Dasari Date: Thu, 9 Apr 2020 12:02:24 -0700 Subject: [PATCH 550/552] bazel sync files --- .../internal/clients/responsebody/BUILD.bazel | 2 + .../clients/responsebody/api/swagger.yaml | 75 ++++++++++ .../responsebody/api_response_body_service.go | 99 ++++++++++++++ .../docs/ResponseBodyServiceApi.md | 27 ++++ .../responsebody/docs/RuntimeStreamError.md | 14 ++ .../StreamResultOfExamplepbResponseBodyOut.md | 11 ++ .../model_runtime_stream_error.go | 18 +++ ...m_result_of_examplepb_response_body_out.go | 15 ++ .../examplepb/response_body_service.pb.go | 128 +++++++++++++----- .../examplepb/response_body_service.pb.gw.go | 78 +++++++++++ .../response_body_service.swagger.json | 64 +++++++++ 11 files changed, 500 insertions(+), 31 deletions(-) create mode 100644 examples/internal/clients/responsebody/docs/RuntimeStreamError.md create mode 100644 examples/internal/clients/responsebody/docs/StreamResultOfExamplepbResponseBodyOut.md create mode 100644 examples/internal/clients/responsebody/model_runtime_stream_error.go create mode 100644 examples/internal/clients/responsebody/model_stream_result_of_examplepb_response_body_out.go diff --git a/examples/internal/clients/responsebody/BUILD.bazel b/examples/internal/clients/responsebody/BUILD.bazel index 4b5a31badea..9acc3d60a14 100644 --- a/examples/internal/clients/responsebody/BUILD.bazel +++ b/examples/internal/clients/responsebody/BUILD.bazel @@ -14,6 +14,8 @@ go_library( "model_protobuf_any.go", "model_response_response_type.go", "model_runtime_error.go", + "model_runtime_stream_error.go", + "model_stream_result_of_examplepb_response_body_out.go", "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/clients/responsebody", diff --git a/examples/internal/clients/responsebody/api/swagger.yaml b/examples/internal/clients/responsebody/api/swagger.yaml index 4a3e595dcce..9a8fd0ea52a 100644 --- a/examples/internal/clients/responsebody/api/swagger.yaml +++ b/examples/internal/clients/responsebody/api/swagger.yaml @@ -30,6 +30,32 @@ paths: description: "An unexpected error response" schema: $ref: "#/definitions/runtimeError" + /responsebody/stream/{data}: + get: + tags: + - "ResponseBodyService" + operationId: "ResponseBodyService_GetResponseBodyStream" + parameters: + - name: "data" + in: "path" + required: true + type: "string" + x-exportParamName: "Data" + responses: + 200: + description: "(streaming responses)" + schema: + type: "object" + properties: + result: + $ref: "#/definitions/examplepbResponseBodyOutResponse" + error: + $ref: "#/definitions/runtimeStreamError" + title: "Stream result of examplepbResponseBodyOut" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /responsebody/{data}: get: tags: @@ -175,6 +201,9 @@ definitions: \ custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\ \n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n\ \ \"value\": \"1.212s\"\n }" + example: + value: "value" + type_url: "type_url" runtimeError: type: "object" properties: @@ -189,3 +218,49 @@ definitions: type: "array" items: $ref: "#/definitions/protobufAny" + runtimeStreamError: + type: "object" + properties: + grpc_code: + type: "integer" + format: "int32" + http_code: + type: "integer" + format: "int32" + message: + type: "string" + http_status: + type: "string" + details: + type: "array" + items: + $ref: "#/definitions/protobufAny" + example: + http_code: 6 + http_status: "http_status" + details: + - value: "value" + type_url: "type_url" + - value: "value" + type_url: "type_url" + message: "message" + grpc_code: 0 + Stream result of examplepbResponseBodyOut: + properties: + result: + $ref: "#/definitions/examplepbResponseBodyOutResponse" + error: + $ref: "#/definitions/runtimeStreamError" + example: + result: + data: "data" + error: + http_code: 6 + http_status: "http_status" + details: + - value: "value" + type_url: "type_url" + - value: "value" + type_url: "type_url" + message: "message" + grpc_code: 0 diff --git a/examples/internal/clients/responsebody/api_response_body_service.go b/examples/internal/clients/responsebody/api_response_body_service.go index 4a4e2d411a8..968077eb532 100644 --- a/examples/internal/clients/responsebody/api_response_body_service.go +++ b/examples/internal/clients/responsebody/api_response_body_service.go @@ -124,6 +124,105 @@ func (a *ResponseBodyServiceApiService) ResponseBodyServiceGetResponseBody(ctx c return localVarReturnValue, localVarHttpResponse, nil } +/* +ResponseBodyServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param data + +@return StreamResultOfExamplepbResponseBodyOut +*/ +func (a *ResponseBodyServiceApiService) ResponseBodyServiceGetResponseBodyStream(ctx context.Context, data string) (StreamResultOfExamplepbResponseBodyOut, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue StreamResultOfExamplepbResponseBodyOut + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/responsebody/stream/{data}" + localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v StreamResultOfExamplepbResponseBodyOut + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + /* ResponseBodyServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). diff --git a/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md b/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md index 480b621c095..852b6c4aaf0 100644 --- a/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md +++ b/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md @@ -5,6 +5,7 @@ All URIs are relative to *https://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- [**ResponseBodyServiceGetResponseBody**](ResponseBodyServiceApi.md#ResponseBodyServiceGetResponseBody) | **Get** /responsebody/{data} | +[**ResponseBodyServiceGetResponseBodyStream**](ResponseBodyServiceApi.md#ResponseBodyServiceGetResponseBodyStream) | **Get** /responsebody/stream/{data} | [**ResponseBodyServiceListResponseBodies**](ResponseBodyServiceApi.md#ResponseBodyServiceListResponseBodies) | **Get** /responsebodies/{data} | [**ResponseBodyServiceListResponseStrings**](ResponseBodyServiceApi.md#ResponseBodyServiceListResponseStrings) | **Get** /responsestrings/{data} | @@ -35,6 +36,32 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **ResponseBodyServiceGetResponseBodyStream** +> StreamResultOfExamplepbResponseBodyOut ResponseBodyServiceGetResponseBodyStream(ctx, data) + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **data** | **string**| | + +### Return type + +[**StreamResultOfExamplepbResponseBodyOut**](Stream result of examplepbResponseBodyOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **ResponseBodyServiceListResponseBodies** > []ExamplepbRepeatedResponseBodyOutResponse ResponseBodyServiceListResponseBodies(ctx, data) diff --git a/examples/internal/clients/responsebody/docs/RuntimeStreamError.md b/examples/internal/clients/responsebody/docs/RuntimeStreamError.md new file mode 100644 index 00000000000..efea01ae5cc --- /dev/null +++ b/examples/internal/clients/responsebody/docs/RuntimeStreamError.md @@ -0,0 +1,14 @@ +# RuntimeStreamError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**GrpcCode** | **int32** | | [optional] [default to null] +**HttpCode** | **int32** | | [optional] [default to null] +**Message** | **string** | | [optional] [default to null] +**HttpStatus** | **string** | | [optional] [default to null] +**Details** | [**[]ProtobufAny**](protobufAny.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/internal/clients/responsebody/docs/StreamResultOfExamplepbResponseBodyOut.md b/examples/internal/clients/responsebody/docs/StreamResultOfExamplepbResponseBodyOut.md new file mode 100644 index 00000000000..8cf8014022a --- /dev/null +++ b/examples/internal/clients/responsebody/docs/StreamResultOfExamplepbResponseBodyOut.md @@ -0,0 +1,11 @@ +# StreamResultOfExamplepbResponseBodyOut + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Result** | [***ExamplepbResponseBodyOutResponse**](examplepbResponseBodyOutResponse.md) | | [optional] [default to null] +**Error_** | [***RuntimeStreamError**](runtimeStreamError.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/internal/clients/responsebody/model_runtime_stream_error.go b/examples/internal/clients/responsebody/model_runtime_stream_error.go new file mode 100644 index 00000000000..d6f45d3c3be --- /dev/null +++ b/examples/internal/clients/responsebody/model_runtime_stream_error.go @@ -0,0 +1,18 @@ +/* + * examples/internal/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package responsebody + +type RuntimeStreamError struct { + GrpcCode int32 `json:"grpc_code,omitempty"` + HttpCode int32 `json:"http_code,omitempty"` + Message string `json:"message,omitempty"` + HttpStatus string `json:"http_status,omitempty"` + Details []ProtobufAny `json:"details,omitempty"` +} diff --git a/examples/internal/clients/responsebody/model_stream_result_of_examplepb_response_body_out.go b/examples/internal/clients/responsebody/model_stream_result_of_examplepb_response_body_out.go new file mode 100644 index 00000000000..4fc188ba216 --- /dev/null +++ b/examples/internal/clients/responsebody/model_stream_result_of_examplepb_response_body_out.go @@ -0,0 +1,15 @@ +/* + * examples/internal/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package responsebody + +type StreamResultOfExamplepbResponseBodyOut struct { + Result *ExamplepbResponseBodyOutResponse `json:"result,omitempty"` + Error_ *RuntimeStreamError `json:"error,omitempty"` +} diff --git a/examples/internal/proto/examplepb/response_body_service.pb.go b/examples/internal/proto/examplepb/response_body_service.pb.go index 9bfa2cb7932..1d7bb328396 100644 --- a/examples/internal/proto/examplepb/response_body_service.pb.go +++ b/examples/internal/proto/examplepb/response_body_service.pb.go @@ -313,36 +313,38 @@ func init() { } var fileDescriptor_272b2870183bbe20 = []byte{ - // 451 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0xd4, 0xcf, 0x6a, 0xd4, 0x40, - 0x1c, 0x07, 0x70, 0x27, 0xbb, 0xd6, 0xee, 0x44, 0xda, 0x65, 0x2a, 0x6d, 0x58, 0x44, 0xe2, 0x20, - 0x1a, 0x2f, 0x09, 0xc6, 0x8b, 0x1e, 0x3c, 0x34, 0x17, 0xa9, 0xca, 0x16, 0x52, 0xa5,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xb2, 0xfd, 0x17, 0x7e, 0x7b, 0x39, 0xbd, 0xd1, 0xf0, - 0xaf, 0x92, 0x2d, 0xcb, 0xd7, 0xcb, 0x9d, 0xce, 0xdf, 0x36, 0x51, 0xe2, 0x3e, 0x9d, 0xd8, 0xb4, - 0x6c, 0xa5, 0xf9, 0x04, 0xdd, 0xfe, 0x11, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x10, 0x29, 0xfa, 0x0b, - 0x05, 0x00, 0x00, + // 482 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x94, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xd9, 0xa4, 0x84, 0x66, 0x82, 0xda, 0x68, 0x0a, 0x6d, 0x14, 0x10, 0x32, 0x16, 0xa2, + 0xe6, 0x80, 0x0d, 0xe1, 0x02, 0x07, 0x0e, 0xcd, 0x05, 0x15, 0x50, 0x2a, 0x39, 0xa0, 0x4a, 0x1c, + 0xa8, 0x36, 0xcd, 0x60, 0x59, 0xa4, 0xbb, 0x2b, 0xef, 0xb6, 0x60, 0x21, 0x2e, 0x7d, 0x03, 0xc4, + 0x7b, 0x70, 0xe4, 0x00, 0xe2, 0x29, 0x78, 0x05, 0x1e, 0x04, 0xc5, 0xb1, 0x57, 0x6e, 0x6a, 0x21, + 0x68, 0x91, 0x72, 0xf2, 0xee, 0xec, 0xea, 0x9f, 0x4f, 0xfb, 0xff, 0x63, 0x78, 0x4c, 0xef, 0xf9, + 0x81, 0x9a, 0x90, 0x0e, 0x62, 0x61, 0x28, 0x11, 0x7c, 0x12, 0xa8, 0x44, 0x1a, 0x19, 0xe4, 0x75, + 0x35, 0x0a, 0x12, 0xd2, 0x4a, 0x0a, 0x4d, 0x7b, 0x23, 0x39, 0x4e, 0xf7, 0x34, 0x25, 0x47, 0xf1, + 0x3e, 0xf9, 0xd9, 0x2d, 0xf4, 0xa2, 0x44, 0xed,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x0e, 0x8d, 0x23, 0x3e, + 0x39, 0x24, 0xdd, 0x61, 0x4e, 0xdd, 0x6b, 0x86, 0xf9, 0xae, 0x77, 0xdc, 0x80, 0xb5, 0x32, 0xcd, + 0x70, 0x96, 0x47, 0xfc, 0xc2, 0x60, 0xf5, 0x09, 0x99, 0xf2, 0x11, 0x3e, 0x3c, 0x5b, 0x12, 0xb6, + 0x45, 0xf7, 0xd1, 0x99, 0x33, 0xe4, 0xde, 0x3e, 0xfe, 0xf9, 0xeb, 0x73, 0xcd, 0xc1, 0x2b, 0x76, + 0x70, 0xa6, 0x73, 0x13, 0x7c, 0x98, 0x1a, 0xf1, 0x71, 0x64, 0x4d, 0xc3, 0xef, 0x0c, 0xf0, 0x79, + 0xac, 0xcb, 0xc4, 0x31, 0xe9, 0x73, 0x30, 0x6f, 0x9d, 0xdb, 0x56, 0xd7, 0xcb, 0xd8, 0x5d, 0x5c, + 0x2f, 0xb3, 0xc7, 0xa4, 0x2b, 0xe9, 0xd7, 0xca, 0xf4, 0x85, 0x6d, 0x0b, 0xc1, 0xcf, 0x9b, 0xbb, + 0x9b, 0x19, 0xfe, 0x4d, 0xdc, 0xb0, 0xf8, 0x7a, 0x76, 0x52, 0xf0, 0xe7, 0x21, 0xc2, 0x1f, 0x0c, + 0xae, 0xce, 0x85, 0x65, 0x68, 0x12, 0xe2, 0x07, 0x8b, 0x89, 0xcc, 0xdd, 0x8c, 0x7b, 0x13, 0xaf, + 0x9d, 0x8c, 0x8c, 0xce, 0x90, 0x4e, 0xbd, 0xfd, 0x3d, 0xd6, 0x6f, 0xbd, 0x6a, 0x5a, 0xb5, 0x51, + 0x23, 0xfb, 0x85, 0x3e, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x16, 0xc0, 0x87, 0xdb, 0xcb, 0x05, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -360,6 +362,7 @@ type ResponseBodyServiceClient interface { GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) ListResponseBodies(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseBodyOut, error) ListResponseStrings(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseStrings, error) + GetResponseBodyStream(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (ResponseBodyService_GetResponseBodyStreamClient, error) } type responseBodyServiceClient struct { @@ -397,11 +400,44 @@ func (c *responseBodyServiceClient) ListResponseStrings(ctx context.Context, in return out, nil } +func (c *responseBodyServiceClient) GetResponseBodyStream(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (ResponseBodyService_GetResponseBodyStreamClient, error) { + stream, err := c.cc.NewStream(ctx, &_ResponseBodyService_serviceDesc.Streams[0], "/grpc.gateway.examples.internal.examplepb.ResponseBodyService/GetResponseBodyStream", opts...) + if err != nil { + return nil, err + } + x := &responseBodyServiceGetResponseBodyStreamClient{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 ResponseBodyService_GetResponseBodyStreamClient interface { + Recv() (*ResponseBodyOut, error) + grpc.ClientStream +} + +type responseBodyServiceGetResponseBodyStreamClient struct { + grpc.ClientStream +} + +func (x *responseBodyServiceGetResponseBodyStreamClient) Recv() (*ResponseBodyOut, error) { + m := new(ResponseBodyOut) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // ResponseBodyServiceServer is the server API for ResponseBodyService service. type ResponseBodyServiceServer interface { GetResponseBody(context.Context, *ResponseBodyIn) (*ResponseBodyOut, error) ListResponseBodies(context.Context, *ResponseBodyIn) (*RepeatedResponseBodyOut, error) ListResponseStrings(context.Context, *ResponseBodyIn) (*RepeatedResponseStrings, error) + GetResponseBodyStream(*ResponseBodyIn, ResponseBodyService_GetResponseBodyStreamServer) error } // UnimplementedResponseBodyServiceServer can be embedded to have forward compatible implementations. @@ -417,6 +453,9 @@ func (*UnimplementedResponseBodyServiceServer) ListResponseBodies(ctx context.Co func (*UnimplementedResponseBodyServiceServer) ListResponseStrings(ctx context.Context, req *ResponseBodyIn) (*RepeatedResponseStrings, error) { return nil, status.Errorf(codes.Unimplemented, "method ListResponseStrings not implemented") } +func (*UnimplementedResponseBodyServiceServer) GetResponseBodyStream(req *ResponseBodyIn, srv ResponseBodyService_GetResponseBodyStreamServer) error { + return status.Errorf(codes.Unimplemented, "method GetResponseBodyStream not implemented") +} func RegisterResponseBodyServiceServer(s *grpc.Server, srv ResponseBodyServiceServer) { s.RegisterService(&_ResponseBodyService_serviceDesc, srv) @@ -476,6 +515,27 @@ func _ResponseBodyService_ListResponseStrings_Handler(srv interface{}, ctx conte return interceptor(ctx, in, info, handler) } +func _ResponseBodyService_GetResponseBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ResponseBodyIn) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ResponseBodyServiceServer).GetResponseBodyStream(m, &responseBodyServiceGetResponseBodyStreamServer{stream}) +} + +type ResponseBodyService_GetResponseBodyStreamServer interface { + Send(*ResponseBodyOut) error + grpc.ServerStream +} + +type responseBodyServiceGetResponseBodyStreamServer struct { + grpc.ServerStream +} + +func (x *responseBodyServiceGetResponseBodyStreamServer) Send(m *ResponseBodyOut) error { + return x.ServerStream.SendMsg(m) +} + var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.examplepb.ResponseBodyService", HandlerType: (*ResponseBodyServiceServer)(nil), @@ -493,6 +553,12 @@ var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ Handler: _ResponseBodyService_ListResponseStrings_Handler, }, }, - Streams: []grpc.StreamDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "GetResponseBodyStream", + Handler: _ResponseBodyService_GetResponseBodyStream_Handler, + ServerStreams: true, + }, + }, Metadata: "examples/internal/proto/examplepb/response_body_service.proto", } diff --git a/examples/internal/proto/examplepb/response_body_service.pb.gw.go b/examples/internal/proto/examplepb/response_body_service.pb.gw.go index 558cd0617cf..e07cf396798 100644 --- a/examples/internal/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/internal/proto/examplepb/response_body_service.pb.gw.go @@ -193,6 +193,41 @@ func local_request_ResponseBodyService_ListResponseStrings_0(ctx context.Context } +func request_ResponseBodyService_GetResponseBodyStream_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (ResponseBodyService_GetResponseBodyStreamClient, runtime.ServerMetadata, error) { + var protoReq ResponseBodyIn + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["data"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") + } + + protoReq.Data, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) + } + + stream, err := client.GetResponseBodyStream(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 + +} + // RegisterResponseBodyServiceHandlerServer registers the http handlers for service ResponseBodyService to "mux". // UnaryRPC :call ResponseBodyServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -258,6 +293,13 @@ func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime. }) + mux.Handle("GET", pattern_ResponseBodyService_GetResponseBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + }) + return nil } @@ -359,6 +401,29 @@ func RegisterResponseBodyServiceHandlerClient(ctx context.Context, mux *runtime. }) + mux.Handle("GET", pattern_ResponseBodyService_GetResponseBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ResponseBodyService_GetResponseBodyStream_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ResponseBodyService_GetResponseBodyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { + res, err := resp.Recv() + return response_ResponseBodyService_GetResponseBodyStream_0{res}, err + }, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -389,12 +454,23 @@ func (m response_ResponseBodyService_ListResponseStrings_0) XXX_ResponseBody() i return response.Values } +type response_ResponseBodyService_GetResponseBodyStream_0 struct { + proto.Message +} + +func (m response_ResponseBodyService_GetResponseBodyStream_0) XXX_ResponseBody() interface{} { + response := m.Message.(*ResponseBodyOut) + return response.Response +} + var ( pattern_ResponseBodyService_GetResponseBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebody", "data"}, "", runtime.AssumeColonVerbOpt(true))) pattern_ResponseBodyService_ListResponseBodies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebodies", "data"}, "", runtime.AssumeColonVerbOpt(true))) pattern_ResponseBodyService_ListResponseStrings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsestrings", "data"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_ResponseBodyService_GetResponseBodyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"responsebody", "stream", "data"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -403,4 +479,6 @@ var ( forward_ResponseBodyService_ListResponseBodies_0 = runtime.ForwardResponseMessage forward_ResponseBodyService_ListResponseStrings_0 = runtime.ForwardResponseMessage + + forward_ResponseBodyService_GetResponseBodyStream_0 = runtime.ForwardResponseStream ) diff --git a/examples/internal/proto/examplepb/response_body_service.swagger.json b/examples/internal/proto/examplepb/response_body_service.swagger.json index 11143187def..1fad10c2042 100644 --- a/examples/internal/proto/examplepb/response_body_service.swagger.json +++ b/examples/internal/proto/examplepb/response_body_service.swagger.json @@ -44,6 +44,45 @@ ] } }, + "/responsebody/stream/{data}": { + "get": { + "operationId": "ResponseBodyService_GetResponseBodyStream", + "responses": { + "200": { + "description": "(streaming responses)", + "schema": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/examplepbResponseBodyOutResponse" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of examplepbResponseBodyOut" + } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "data", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ResponseBodyService" + ] + } + }, "/responsebody/{data}": { "get": { "operationId": "ResponseBodyService_GetResponseBody", @@ -203,6 +242,31 @@ } } } + }, + "runtimeStreamError": { + "type": "object", + "properties": { + "grpc_code": { + "type": "integer", + "format": "int32" + }, + "http_code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "http_status": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } } } } From c3e2c96a8c356a53636cdc9051b56ced9a35e846 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Wed, 6 Nov 2019 14:22:23 +0000 Subject: [PATCH 551/552] Revert "Fix templateToSwaggerPath generates invalid path" This reverts commit 69669120b0e010b88291cd9d24761297c2a17582. This commit was causing panics for some valid paths. --- protoc-gen-swagger/genswagger/template.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 77c99feac55..55c7303eac4 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -731,7 +731,7 @@ func isResourceName(prefix string) bool { return field == "parent" || field == "name" } -func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry, requestResponseRefs, customRefs refMap, msgs []*descriptor.Message) error { +func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry, requestResponseRefs, customRefs refMap) error { // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. for svcIdx, svc := range services { for methIdx, meth := range svc.Methods { @@ -806,7 +806,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } parameterString := parameter.String() if reg.GetUseJSONNamesForFields() { - parameterString = lowerCamelCase(parameterString, meth.RequestType.Fields, msgs) + parameterString = lowerCamelCase(parameterString) } parameters = append(parameters, swaggerParameterObject{ Name: parameterString, From a99c6d5c18b0ce9e752bfc78ecea29fe47a64ebd Mon Sep 17 00:00:00 2001 From: Anil Dasari Date: Mon, 13 Apr 2020 09:15:42 -0700 Subject: [PATCH 552/552] rever merge with master --- .../internal/clients/responsebody/BUILD.bazel | 2 + .../clients/responsebody/api/swagger.yaml | 75 ++++++++++ .../responsebody/api_response_body_service.go | 99 ++++++++++++++ .../docs/ResponseBodyServiceApi.md | 27 ++++ .../responsebody/docs/RuntimeStreamError.md | 14 ++ .../StreamResultOfExamplepbResponseBodyOut.md | 11 ++ .../model_runtime_stream_error.go | 18 +++ ...m_result_of_examplepb_response_body_out.go | 15 ++ .../internal/integration/integration_test.go | 66 +++++---- .../examplepb/response_body_service.pb.go | 128 +++++++++++++----- .../examplepb/response_body_service.pb.gw.go | 78 +++++++++++ .../examplepb/response_body_service.proto | 7 + .../response_body_service.swagger.json | 64 +++++++++ examples/internal/server/responsebody.go | 8 ++ .../internal/gengateway/template.go | 7 + protoc-gen-swagger/genswagger/template.go | 4 +- runtime/handler.go | 22 +-- runtime/handler_test.go | 49 ++++++- 18 files changed, 624 insertions(+), 70 deletions(-) create mode 100644 examples/internal/clients/responsebody/docs/RuntimeStreamError.md create mode 100644 examples/internal/clients/responsebody/docs/StreamResultOfExamplepbResponseBodyOut.md create mode 100644 examples/internal/clients/responsebody/model_runtime_stream_error.go create mode 100644 examples/internal/clients/responsebody/model_stream_result_of_examplepb_response_body_out.go diff --git a/examples/internal/clients/responsebody/BUILD.bazel b/examples/internal/clients/responsebody/BUILD.bazel index 4b5a31badea..9acc3d60a14 100644 --- a/examples/internal/clients/responsebody/BUILD.bazel +++ b/examples/internal/clients/responsebody/BUILD.bazel @@ -14,6 +14,8 @@ go_library( "model_protobuf_any.go", "model_response_response_type.go", "model_runtime_error.go", + "model_runtime_stream_error.go", + "model_stream_result_of_examplepb_response_body_out.go", "response.go", ], importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/internal/clients/responsebody", diff --git a/examples/internal/clients/responsebody/api/swagger.yaml b/examples/internal/clients/responsebody/api/swagger.yaml index 4a3e595dcce..9a8fd0ea52a 100644 --- a/examples/internal/clients/responsebody/api/swagger.yaml +++ b/examples/internal/clients/responsebody/api/swagger.yaml @@ -30,6 +30,32 @@ paths: description: "An unexpected error response" schema: $ref: "#/definitions/runtimeError" + /responsebody/stream/{data}: + get: + tags: + - "ResponseBodyService" + operationId: "ResponseBodyService_GetResponseBodyStream" + parameters: + - name: "data" + in: "path" + required: true + type: "string" + x-exportParamName: "Data" + responses: + 200: + description: "(streaming responses)" + schema: + type: "object" + properties: + result: + $ref: "#/definitions/examplepbResponseBodyOutResponse" + error: + $ref: "#/definitions/runtimeStreamError" + title: "Stream result of examplepbResponseBodyOut" + default: + description: "An unexpected error response" + schema: + $ref: "#/definitions/runtimeError" /responsebody/{data}: get: tags: @@ -175,6 +201,9 @@ definitions: \ custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\ \n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n\ \ \"value\": \"1.212s\"\n }" + example: + value: "value" + type_url: "type_url" runtimeError: type: "object" properties: @@ -189,3 +218,49 @@ definitions: type: "array" items: $ref: "#/definitions/protobufAny" + runtimeStreamError: + type: "object" + properties: + grpc_code: + type: "integer" + format: "int32" + http_code: + type: "integer" + format: "int32" + message: + type: "string" + http_status: + type: "string" + details: + type: "array" + items: + $ref: "#/definitions/protobufAny" + example: + http_code: 6 + http_status: "http_status" + details: + - value: "value" + type_url: "type_url" + - value: "value" + type_url: "type_url" + message: "message" + grpc_code: 0 + Stream result of examplepbResponseBodyOut: + properties: + result: + $ref: "#/definitions/examplepbResponseBodyOutResponse" + error: + $ref: "#/definitions/runtimeStreamError" + example: + result: + data: "data" + error: + http_code: 6 + http_status: "http_status" + details: + - value: "value" + type_url: "type_url" + - value: "value" + type_url: "type_url" + message: "message" + grpc_code: 0 diff --git a/examples/internal/clients/responsebody/api_response_body_service.go b/examples/internal/clients/responsebody/api_response_body_service.go index 4a4e2d411a8..968077eb532 100644 --- a/examples/internal/clients/responsebody/api_response_body_service.go +++ b/examples/internal/clients/responsebody/api_response_body_service.go @@ -124,6 +124,105 @@ func (a *ResponseBodyServiceApiService) ResponseBodyServiceGetResponseBody(ctx c return localVarReturnValue, localVarHttpResponse, nil } +/* +ResponseBodyServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param data + +@return StreamResultOfExamplepbResponseBodyOut +*/ +func (a *ResponseBodyServiceApiService) ResponseBodyServiceGetResponseBodyStream(ctx context.Context, data string) (StreamResultOfExamplepbResponseBodyOut, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue StreamResultOfExamplepbResponseBodyOut + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/responsebody/stream/{data}" + localVarPath = strings.Replace(localVarPath, "{"+"data"+"}", fmt.Sprintf("%v", data), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v StreamResultOfExamplepbResponseBodyOut + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RuntimeError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + /* ResponseBodyServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). diff --git a/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md b/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md index 480b621c095..852b6c4aaf0 100644 --- a/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md +++ b/examples/internal/clients/responsebody/docs/ResponseBodyServiceApi.md @@ -5,6 +5,7 @@ All URIs are relative to *https://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- [**ResponseBodyServiceGetResponseBody**](ResponseBodyServiceApi.md#ResponseBodyServiceGetResponseBody) | **Get** /responsebody/{data} | +[**ResponseBodyServiceGetResponseBodyStream**](ResponseBodyServiceApi.md#ResponseBodyServiceGetResponseBodyStream) | **Get** /responsebody/stream/{data} | [**ResponseBodyServiceListResponseBodies**](ResponseBodyServiceApi.md#ResponseBodyServiceListResponseBodies) | **Get** /responsebodies/{data} | [**ResponseBodyServiceListResponseStrings**](ResponseBodyServiceApi.md#ResponseBodyServiceListResponseStrings) | **Get** /responsestrings/{data} | @@ -35,6 +36,32 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **ResponseBodyServiceGetResponseBodyStream** +> StreamResultOfExamplepbResponseBodyOut ResponseBodyServiceGetResponseBodyStream(ctx, data) + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **data** | **string**| | + +### Return type + +[**StreamResultOfExamplepbResponseBodyOut**](Stream result of examplepbResponseBodyOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **ResponseBodyServiceListResponseBodies** > []ExamplepbRepeatedResponseBodyOutResponse ResponseBodyServiceListResponseBodies(ctx, data) diff --git a/examples/internal/clients/responsebody/docs/RuntimeStreamError.md b/examples/internal/clients/responsebody/docs/RuntimeStreamError.md new file mode 100644 index 00000000000..efea01ae5cc --- /dev/null +++ b/examples/internal/clients/responsebody/docs/RuntimeStreamError.md @@ -0,0 +1,14 @@ +# RuntimeStreamError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**GrpcCode** | **int32** | | [optional] [default to null] +**HttpCode** | **int32** | | [optional] [default to null] +**Message** | **string** | | [optional] [default to null] +**HttpStatus** | **string** | | [optional] [default to null] +**Details** | [**[]ProtobufAny**](protobufAny.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/internal/clients/responsebody/docs/StreamResultOfExamplepbResponseBodyOut.md b/examples/internal/clients/responsebody/docs/StreamResultOfExamplepbResponseBodyOut.md new file mode 100644 index 00000000000..8cf8014022a --- /dev/null +++ b/examples/internal/clients/responsebody/docs/StreamResultOfExamplepbResponseBodyOut.md @@ -0,0 +1,11 @@ +# StreamResultOfExamplepbResponseBodyOut + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Result** | [***ExamplepbResponseBodyOutResponse**](examplepbResponseBodyOutResponse.md) | | [optional] [default to null] +**Error_** | [***RuntimeStreamError**](runtimeStreamError.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/internal/clients/responsebody/model_runtime_stream_error.go b/examples/internal/clients/responsebody/model_runtime_stream_error.go new file mode 100644 index 00000000000..d6f45d3c3be --- /dev/null +++ b/examples/internal/clients/responsebody/model_runtime_stream_error.go @@ -0,0 +1,18 @@ +/* + * examples/internal/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package responsebody + +type RuntimeStreamError struct { + GrpcCode int32 `json:"grpc_code,omitempty"` + HttpCode int32 `json:"http_code,omitempty"` + Message string `json:"message,omitempty"` + HttpStatus string `json:"http_status,omitempty"` + Details []ProtobufAny `json:"details,omitempty"` +} diff --git a/examples/internal/clients/responsebody/model_stream_result_of_examplepb_response_body_out.go b/examples/internal/clients/responsebody/model_stream_result_of_examplepb_response_body_out.go new file mode 100644 index 00000000000..4fc188ba216 --- /dev/null +++ b/examples/internal/clients/responsebody/model_stream_result_of_examplepb_response_body_out.go @@ -0,0 +1,15 @@ +/* + * examples/internal/proto/examplepb/response_body_service.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package responsebody + +type StreamResultOfExamplepbResponseBodyOut struct { + Result *ExamplepbResponseBodyOutResponse `json:"result,omitempty"` + Error_ *RuntimeStreamError `json:"error,omitempty"` +} diff --git a/examples/internal/integration/integration_test.go b/examples/internal/integration/integration_test.go index 2c569270538..a044315295a 100644 --- a/examples/internal/integration/integration_test.go +++ b/examples/internal/integration/integration_test.go @@ -1476,26 +1476,46 @@ func TestResponseBody(t *testing.T) { } func testResponseBody(t *testing.T, port int) { - apiURL := fmt.Sprintf("http://localhost:%d/responsebody/foo", port) - resp, err := http.Get(apiURL) - if err != nil { - t.Errorf("http.Get(%q) failed with %v; want success", apiURL, err) - return - } - defer resp.Body.Close() - buf, err := ioutil.ReadAll(resp.Body) - if err != nil { - t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) - return - } + tests := []struct { + name string + url string + wantStatus int + wantResponse string + }{{ + name: "unary case", + url: "http://localhost:%d/responsebody/foo", + wantStatus: http.StatusOK, + wantResponse: `{"data":"foo"}`, + }, { + name: "stream case", + url: "http://localhost:%d/responsebody/stream/foo", + wantStatus: http.StatusOK, + wantResponse: `{"data":"foo"}`, + }} + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + apiURL := fmt.Sprintf("http://localhost:%d/responsebody/foo", port) + resp, err := http.Get(apiURL) + if err != nil { + t.Fatalf("http.Get(%q) failed with %v; want success", apiURL, err) + } - if got, want := resp.StatusCode, http.StatusOK; got != want { - t.Errorf("resp.StatusCode = %d; want %d", got, want) - t.Logf("%s", buf) - } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatalf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) + } - if got, want := string(buf), `{"data":"foo"}`; got != want { - t.Errorf("response = %q; want %q", got, want) + if got, want := resp.StatusCode, tt.wantStatus; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + if got, want := string(buf), tt.wantResponse; got != want { + t.Errorf("response = %q; want %q", got, want) + } + }) } } @@ -1526,20 +1546,20 @@ func testResponseBodies(t *testing.T, port int) { func testResponseStrings(t *testing.T, port int) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + + port = 8087 // Run Secondary server with different marshalling ch := make(chan error) go func() { - if err := runGateway(ctx, ":8081", runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{EnumsAsInts: false, EmitDefaults: true})); err != nil { + if err := runGateway(ctx, fmt.Sprintf(":%d", port), runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{EnumsAsInts: false, EmitDefaults: true})); err != nil { ch <- fmt.Errorf("cannot run gateway service: %v", err) } }() - if err := waitForGateway(ctx, 8081); err != nil { + if err := waitForGateway(ctx, uint16(port)); err != nil { t.Fatalf("waitForGateway(ctx, 8081) failed with %v; want success", err) } - port = 8081 - for i, spec := range []struct { endpoint string expectedCode int @@ -1780,4 +1800,4 @@ func testNonStandardNames(t *testing.T, port int, method string, jsonBody string if got, want := string(body), jsonBody; got != want { t.Errorf("got %q; want %q", got, want) } -} +} \ No newline at end of file diff --git a/examples/internal/proto/examplepb/response_body_service.pb.go b/examples/internal/proto/examplepb/response_body_service.pb.go index 9bfa2cb7932..1d7bb328396 100644 --- a/examples/internal/proto/examplepb/response_body_service.pb.go +++ b/examples/internal/proto/examplepb/response_body_service.pb.go @@ -313,36 +313,38 @@ func init() { } var fileDescriptor_272b2870183bbe20 = []byte{ - // 451 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0xd4, 0xcf, 0x6a, 0xd4, 0x40, - 0x1c, 0x07, 0x70, 0x27, 0xbb, 0xd6, 0xee, 0x44, 0xda, 0x65, 0x2a, 0x6d, 0x58, 0x44, 0xe2, 0x20, - 0x1a, 0x2f, 0x09, 0xc6, 0x8b, 0x1e, 0x3c, 0x34, 0x17, 0xa9, 0xca, 0x16, 0x52, 0xa5, 0xe0, 0xc1, - 0x32, 0x69, 0x7e, 0x86, 0xc1, 0x38, 0x33, 0x64, 0xa6, 0xd5, 0x20, 0x5e, 0x7c, 0x03, 0xf1, 0x3d, - 0x3c, 0x7a, 0xd0, 0x9b, 0xaf, 0xe0, 0x2b, 0xf8, 0x20, 0xb2, 0xd9, 0x64, 0x88, 0x35, 0x88, 0xb6, - 0x82, 0xa7, 0x9d, 0x7f, 0x7c, 0xe7, 0xc3, 0xfe, 0x7e, 0x13, 0x7c, 0x0f, 0x5e, 0xb3, 0x97, 0xaa, -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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x94, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xd9, 0xa4, 0x84, 0x66, 0x82, 0xda, 0x68, 0x0a, 0x6d, 0x14, 0x10, 0x32, 0x16, 0xa2, + 0xe6, 0x80, 0x0d, 0xe1, 0x02, 0x07, 0x0e, 0xcd, 0x05, 0x15, 0x50, 0x2a, 0x39, 0xa0, 0x4a, 0x1c, + 0xa8, 0x36, 0xcd, 0x60, 0x59, 0xa4, 0xbb, 0x2b, 0xef, 0xb6, 0x60, 0x21, 0x2e, 0x7d, 0x03, 0xc4, + 0x7b, 0x70, 0xe4, 0x00, 0xe2, 0x29, 0x78, 0x05, 0x1e, 0x04, 0xc5, 0xb1, 0x57, 0x6e, 0x6a, 0x21, + 0x68, 0x91, 0x72, 0xf2, 0xee, 0xec, 0xea, 0x9f, 0x4f, 0xfb, 0xff, 0x63, 0x78, 0x4c, 0xef, 0xf9, + 0x81, 0x9a, 0x90, 0x0e, 0x62, 0x61, 0x28, 0x11, 0x7c, 0x12, 0xa8, 0x44, 0x1a, 0x19, 0xe4, 0x75, + 0x35, 0x0a, 0x12, 0xd2, 0x4a, 0x0a, 0x4d, 0x7b, 0x23, 0x39, 0x4e, 0xf7, 0x34, 0x25, 0x47, 0xf1, + 0x3e, 0xf9, 0xd9, 0x2d, 0xf4, 0xa2, 0x44, 0xed, 0xfb, 0x11, 0x37, 0xf4, 0x8e, 0xa7, 0x7e, 0xa1, + 0xe5, 0x17, 0x5a, 0xbe, 0x55, 0xe9, 0x5e, 0x8f, 0xa4, 0x8c, 0x26, 0x14, 0x70, 0x15, 0x07, 0x5c, + 0x08, 0x69, 0xb8, 0x89, 0xa5, 0xd0, 0x33, 0x1d, 0xf7, 0x16, 0xac, 0x84, 0x79, 0x9b, 0xbe, 0x1c, + 0xa7, 0xdb, 0x02, 0x11, 0x96, 0xc6, 0xdc, 0xf0, 0x0e, 0x73, 0x98, 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76, + 0x70, 0xa6, 0x73, 0x13, 0x7c, 0x98, 0x1a, 0xf1, 0x71, 0x64, 0x4d, 0xc3, 0xef, 0x0c, 0xf0, 0x79, + 0xac, 0xcb, 0xc4, 0x31, 0xe9, 0x73, 0x30, 0x6f, 0x9d, 0xdb, 0x56, 0xd7, 0xcb, 0xd8, 0x5d, 0x5c, + 0x2f, 0xb3, 0xc7, 0xa4, 0x2b, 0xe9, 0xd7, 0xca, 0xf4, 0x85, 0x6d, 0x0b, 0xc1, 0xcf, 0x9b, 0xbb, + 0x9b, 0x19, 0xfe, 0x4d, 0xdc, 0xb0, 0xf8, 0x7a, 0x76, 0x52, 0xf0, 0xe7, 0x21, 0xc2, 0x1f, 0x0c, + 0xae, 0xce, 0x85, 0x65, 0x68, 0x12, 0xe2, 0x07, 0x8b, 0x89, 0xcc, 0xdd, 0x8c, 0x7b, 0x13, 0xaf, + 0x9d, 0x8c, 0x8c, 0xce, 0x90, 0x4e, 0xbd, 0xfd, 0x3d, 0xd6, 0x6f, 0xbd, 0x6a, 0x5a, 0xb5, 0x51, + 0x23, 0xfb, 0x85, 0x3e, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x16, 0xc0, 0x87, 0xdb, 0xcb, 0x05, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -360,6 +362,7 @@ type ResponseBodyServiceClient interface { GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) ListResponseBodies(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseBodyOut, error) ListResponseStrings(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseStrings, error) + GetResponseBodyStream(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (ResponseBodyService_GetResponseBodyStreamClient, error) } type responseBodyServiceClient struct { @@ -397,11 +400,44 @@ func (c *responseBodyServiceClient) ListResponseStrings(ctx context.Context, in return out, nil } +func (c *responseBodyServiceClient) GetResponseBodyStream(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (ResponseBodyService_GetResponseBodyStreamClient, error) { + stream, err := c.cc.NewStream(ctx, &_ResponseBodyService_serviceDesc.Streams[0], "/grpc.gateway.examples.internal.examplepb.ResponseBodyService/GetResponseBodyStream", opts...) + if err != nil { + return nil, err + } + x := &responseBodyServiceGetResponseBodyStreamClient{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 ResponseBodyService_GetResponseBodyStreamClient interface { + Recv() (*ResponseBodyOut, error) + grpc.ClientStream +} + +type responseBodyServiceGetResponseBodyStreamClient struct { + grpc.ClientStream +} + +func (x *responseBodyServiceGetResponseBodyStreamClient) Recv() (*ResponseBodyOut, error) { + m := new(ResponseBodyOut) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // ResponseBodyServiceServer is the server API for ResponseBodyService service. type ResponseBodyServiceServer interface { GetResponseBody(context.Context, *ResponseBodyIn) (*ResponseBodyOut, error) ListResponseBodies(context.Context, *ResponseBodyIn) (*RepeatedResponseBodyOut, error) ListResponseStrings(context.Context, *ResponseBodyIn) (*RepeatedResponseStrings, error) + GetResponseBodyStream(*ResponseBodyIn, ResponseBodyService_GetResponseBodyStreamServer) error } // UnimplementedResponseBodyServiceServer can be embedded to have forward compatible implementations. @@ -417,6 +453,9 @@ func (*UnimplementedResponseBodyServiceServer) ListResponseBodies(ctx context.Co func (*UnimplementedResponseBodyServiceServer) ListResponseStrings(ctx context.Context, req *ResponseBodyIn) (*RepeatedResponseStrings, error) { return nil, status.Errorf(codes.Unimplemented, "method ListResponseStrings not implemented") } +func (*UnimplementedResponseBodyServiceServer) GetResponseBodyStream(req *ResponseBodyIn, srv ResponseBodyService_GetResponseBodyStreamServer) error { + return status.Errorf(codes.Unimplemented, "method GetResponseBodyStream not implemented") +} func RegisterResponseBodyServiceServer(s *grpc.Server, srv ResponseBodyServiceServer) { s.RegisterService(&_ResponseBodyService_serviceDesc, srv) @@ -476,6 +515,27 @@ func _ResponseBodyService_ListResponseStrings_Handler(srv interface{}, ctx conte return interceptor(ctx, in, info, handler) } +func _ResponseBodyService_GetResponseBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ResponseBodyIn) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ResponseBodyServiceServer).GetResponseBodyStream(m, &responseBodyServiceGetResponseBodyStreamServer{stream}) +} + +type ResponseBodyService_GetResponseBodyStreamServer interface { + Send(*ResponseBodyOut) error + grpc.ServerStream +} + +type responseBodyServiceGetResponseBodyStreamServer struct { + grpc.ServerStream +} + +func (x *responseBodyServiceGetResponseBodyStreamServer) Send(m *ResponseBodyOut) error { + return x.ServerStream.SendMsg(m) +} + var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ ServiceName: "grpc.gateway.examples.internal.examplepb.ResponseBodyService", HandlerType: (*ResponseBodyServiceServer)(nil), @@ -493,6 +553,12 @@ var _ResponseBodyService_serviceDesc = grpc.ServiceDesc{ Handler: _ResponseBodyService_ListResponseStrings_Handler, }, }, - Streams: []grpc.StreamDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "GetResponseBodyStream", + Handler: _ResponseBodyService_GetResponseBodyStream_Handler, + ServerStreams: true, + }, + }, Metadata: "examples/internal/proto/examplepb/response_body_service.proto", } diff --git a/examples/internal/proto/examplepb/response_body_service.pb.gw.go b/examples/internal/proto/examplepb/response_body_service.pb.gw.go index 558cd0617cf..e07cf396798 100644 --- a/examples/internal/proto/examplepb/response_body_service.pb.gw.go +++ b/examples/internal/proto/examplepb/response_body_service.pb.gw.go @@ -193,6 +193,41 @@ func local_request_ResponseBodyService_ListResponseStrings_0(ctx context.Context } +func request_ResponseBodyService_GetResponseBodyStream_0(ctx context.Context, marshaler runtime.Marshaler, client ResponseBodyServiceClient, req *http.Request, pathParams map[string]string) (ResponseBodyService_GetResponseBodyStreamClient, runtime.ServerMetadata, error) { + var protoReq ResponseBodyIn + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["data"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data") + } + + protoReq.Data, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data", err) + } + + stream, err := client.GetResponseBodyStream(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 + +} + // RegisterResponseBodyServiceHandlerServer registers the http handlers for service ResponseBodyService to "mux". // UnaryRPC :call ResponseBodyServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -258,6 +293,13 @@ func RegisterResponseBodyServiceHandlerServer(ctx context.Context, mux *runtime. }) + mux.Handle("GET", pattern_ResponseBodyService_GetResponseBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + }) + return nil } @@ -359,6 +401,29 @@ func RegisterResponseBodyServiceHandlerClient(ctx context.Context, mux *runtime. }) + mux.Handle("GET", pattern_ResponseBodyService_GetResponseBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ResponseBodyService_GetResponseBodyStream_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ResponseBodyService_GetResponseBodyStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { + res, err := resp.Recv() + return response_ResponseBodyService_GetResponseBodyStream_0{res}, err + }, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -389,12 +454,23 @@ func (m response_ResponseBodyService_ListResponseStrings_0) XXX_ResponseBody() i return response.Values } +type response_ResponseBodyService_GetResponseBodyStream_0 struct { + proto.Message +} + +func (m response_ResponseBodyService_GetResponseBodyStream_0) XXX_ResponseBody() interface{} { + response := m.Message.(*ResponseBodyOut) + return response.Response +} + var ( pattern_ResponseBodyService_GetResponseBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebody", "data"}, "", runtime.AssumeColonVerbOpt(true))) pattern_ResponseBodyService_ListResponseBodies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsebodies", "data"}, "", runtime.AssumeColonVerbOpt(true))) pattern_ResponseBodyService_ListResponseStrings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"responsestrings", "data"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_ResponseBodyService_GetResponseBodyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"responsebody", "stream", "data"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -403,4 +479,6 @@ var ( forward_ResponseBodyService_ListResponseBodies_0 = runtime.ForwardResponseMessage forward_ResponseBodyService_ListResponseStrings_0 = runtime.ForwardResponseMessage + + forward_ResponseBodyService_GetResponseBodyStream_0 = runtime.ForwardResponseStream ) diff --git a/examples/internal/proto/examplepb/response_body_service.proto b/examples/internal/proto/examplepb/response_body_service.proto index 2a04e786e95..a1081d55713 100644 --- a/examples/internal/proto/examplepb/response_body_service.proto +++ b/examples/internal/proto/examplepb/response_body_service.proto @@ -55,4 +55,11 @@ service ResponseBodyService { response_body : "values" }; } + + rpc GetResponseBodyStream(ResponseBodyIn) returns (stream ResponseBodyOut) { + option (google.api.http) = { + get : "/responsebody/stream/{data}" + response_body : "response" + }; + } } diff --git a/examples/internal/proto/examplepb/response_body_service.swagger.json b/examples/internal/proto/examplepb/response_body_service.swagger.json index 11143187def..1fad10c2042 100644 --- a/examples/internal/proto/examplepb/response_body_service.swagger.json +++ b/examples/internal/proto/examplepb/response_body_service.swagger.json @@ -44,6 +44,45 @@ ] } }, + "/responsebody/stream/{data}": { + "get": { + "operationId": "ResponseBodyService_GetResponseBodyStream", + "responses": { + "200": { + "description": "(streaming responses)", + "schema": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/examplepbResponseBodyOutResponse" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of examplepbResponseBodyOut" + } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "data", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ResponseBodyService" + ] + } + }, "/responsebody/{data}": { "get": { "operationId": "ResponseBodyService_GetResponseBody", @@ -203,6 +242,31 @@ } } } + }, + "runtimeStreamError": { + "type": "object", + "properties": { + "grpc_code": { + "type": "integer", + "format": "int32" + }, + "http_code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "http_status": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } } } } diff --git a/examples/internal/server/responsebody.go b/examples/internal/server/responsebody.go index 8df32ede5fa..803d5d102c0 100644 --- a/examples/internal/server/responsebody.go +++ b/examples/internal/server/responsebody.go @@ -42,3 +42,11 @@ func (s *responseBodyServer) ListResponseStrings(ctx context.Context, req *examp Values: []string{"hello", req.Data}, }, nil } + +func (s *responseBodyServer) GetResponseBodyStream(req *examples.ResponseBodyIn, stream examples.ResponseBodyService_GetResponseBodyStreamServer) error { + return stream.Send(&examples.ResponseBodyOut{ + Response: &examples.ResponseBodyOut_Response{ + Data: req.Data, + }, + }) +} diff --git a/protoc-gen-grpc-gateway/internal/gengateway/template.go b/protoc-gen-grpc-gateway/internal/gengateway/template.go index 1d3d3ca8f19..912fc53b7cb 100644 --- a/protoc-gen-grpc-gateway/internal/gengateway/template.go +++ b/protoc-gen-grpc-gateway/internal/gengateway/template.go @@ -667,7 +667,14 @@ func Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Client(ctx context.Context, return } {{if $m.GetServerStreaming}} + {{ if $b.ResponseBody }} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { + res, err := resp.Recv() + return response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{res}, err + }, mux.GetForwardResponseOptions()...) + {{ else }} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + {{end}} {{else}} {{ if $b.ResponseBody }} forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, mux, outboundMarshaler, w, req, response_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}{resp}, mux.GetForwardResponseOptions()...) diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 55c7303eac4..77c99feac55 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -731,7 +731,7 @@ func isResourceName(prefix string) bool { return field == "parent" || field == "name" } -func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry, requestResponseRefs, customRefs refMap) error { +func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry, requestResponseRefs, customRefs refMap, msgs []*descriptor.Message) error { // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. for svcIdx, svc := range services { for methIdx, meth := range svc.Methods { @@ -806,7 +806,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re } parameterString := parameter.String() if reg.GetUseJSONNamesForFields() { - parameterString = lowerCamelCase(parameterString) + parameterString = lowerCamelCase(parameterString, meth.RequestType.Fields, msgs) } parameters = append(parameters, swaggerParameterObject{ Name: parameterString, diff --git a/runtime/handler.go b/runtime/handler.go index b894da86bf8..65a305e16c1 100644 --- a/runtime/handler.go +++ b/runtime/handler.go @@ -61,7 +61,18 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal return } - buf, err := marshaler.Marshal(streamChunk(ctx, resp, mux.streamErrorHandler)) + var buf []byte + switch { + case resp == nil: + buf, err = marshaler.Marshal(errorChunk(streamError(ctx, mux.streamErrorHandler, errEmptyResponse))) + default: + if rb, ok := resp.(responseBody); ok { + buf, err = marshaler.Marshal(rb.XXX_ResponseBody()) + } else { + buf, err = marshaler.Marshal(map[string]proto.Message{"result": resp}) + } + } + if err != nil { grpclog.Infof("Failed to marshal response chunk: %v", err) handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) @@ -184,15 +195,6 @@ func handleForwardResponseStreamError(ctx context.Context, wroteHeader bool, mar } } -// streamChunk returns a chunk in a response stream for the given result. The -// given errHandler is used to render an error chunk if result is nil. -func streamChunk(ctx context.Context, result proto.Message, errHandler StreamErrorHandlerFunc) map[string]proto.Message { - if result == nil { - return errorChunk(streamError(ctx, errHandler, errEmptyResponse)) - } - return map[string]proto.Message{"result": result} -} - // streamError returns the payload for the final message in a response stream // that represents the given err. func streamError(ctx context.Context, errHandler StreamErrorHandlerFunc, err error) *StreamError { diff --git a/runtime/handler_test.go b/runtime/handler_test.go index 912cb3acfa5..61006484163 100644 --- a/runtime/handler_test.go +++ b/runtime/handler_test.go @@ -17,15 +17,26 @@ import ( "google.golang.org/grpc/status" ) +type fakeReponseBodyWrapper struct { + proto.Message +} + +// XXX_ResponseBody returns id of SimpleMessage +func (r fakeReponseBodyWrapper) XXX_ResponseBody() interface{} { + resp := r.Message.(*pb.SimpleMessage) + return resp.Id +} + func TestForwardResponseStream(t *testing.T) { type msg struct { pb proto.Message err error } tests := []struct { - name string - msgs []msg - statusCode int + name string + msgs []msg + statusCode int + responseBody bool }{{ name: "encoding", msgs: []msg{ @@ -47,6 +58,22 @@ func TestForwardResponseStream(t *testing.T) { {nil, grpc.Errorf(codes.OutOfRange, "400")}, }, statusCode: http.StatusOK, + }, { + name: "response body stream case", + msgs: []msg{ + {fakeReponseBodyWrapper{&pb.SimpleMessage{Id: "One"}}, nil}, + {fakeReponseBodyWrapper{&pb.SimpleMessage{Id: "Two"}}, nil}, + }, + responseBody: true, + statusCode: http.StatusOK, + }, { + name: "response body stream error case", + msgs: []msg{ + {fakeReponseBodyWrapper{&pb.SimpleMessage{Id: "One"}}, nil}, + {nil, grpc.Errorf(codes.OutOfRange, "400")}, + }, + responseBody: true, + statusCode: http.StatusOK, }} newTestRecv := func(t *testing.T, msgs []msg) func() (proto.Message, error) { @@ -113,7 +140,21 @@ func TestForwardResponseStream(t *testing.T) { return } - b, err := marshaler.Marshal(map[string]proto.Message{"result": msg.pb}) + + var b []byte + + if tt.responseBody { + // responseBody interface is in runtime package and test is in runtime_test package. hence can't use responseBody direclty + // So type casting to fakeReponseBodyWrapper struct to verify the data. + rb, ok := msg.pb.(fakeReponseBodyWrapper) + if !ok { + t.Errorf("stream responseBody failed %v", err) + } + b, err = marshaler.Marshal(rb.XXX_ResponseBody()) + } else { + b, err = marshaler.Marshal(map[string]proto.Message{"result": msg.pb}) + } + if err != nil { t.Errorf("marshaler.Marshal() failed %v", err) }