diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index ae0f419bf2d..b54389da3a8 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -65,7 +65,10 @@ func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0, 0, 0} } +// Intentionaly complicated message type to cover much features of Protobuf. +// NEXT ID: 26 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"` @@ -120,6 +123,13 @@ func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { return nil } +func (m *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested { + if m != nil { + return m.SingleNested + } + return nil +} + func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { if m != nil { return m.Nested @@ -279,6 +289,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 { @@ -440,6 +451,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 { @@ -452,6 +472,7 @@ 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) { @@ -639,6 +660,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), @@ -667,6 +706,10 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "Echo", Handler: _ABitOfEverythingService_Echo_Handler, }, + { + MethodName: "DeepPathEcho", + Handler: _ABitOfEverythingService_DeepPathEcho_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -689,75 +732,78 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ } var fileDescriptor1 = []byte{ - // 1110 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x57, 0x5f, 0x6f, 0x1b, 0x45, - 0x10, 0xef, 0xd9, 0x8e, 0x6b, 0xef, 0xc5, 0x8e, 0xb3, 0x69, 0x53, 0x63, 0x40, 0x49, 0x8f, 0x16, - 0x82, 0xa9, 0xee, 0xda, 0x0b, 0x02, 0x14, 0x09, 0xa4, 0x9a, 0x18, 0x8a, 0x94, 0x26, 0xe2, 0xd2, - 0x06, 0x29, 0x12, 0xb2, 0xce, 0xf6, 0xc6, 0x3d, 0xc5, 0x77, 0x7b, 0xba, 0x3f, 0xa6, 0x96, 0x95, - 0x3e, 0x54, 0x3c, 0x20, 0xf1, 0x80, 0x04, 0x1f, 0x80, 0x67, 0x90, 0xe0, 0x8b, 0xf4, 0x05, 0x89, - 0xaf, 0xc0, 0x07, 0x61, 0x6e, 0xf7, 0xee, 0xba, 0xe7, 0x44, 0xd8, 0x38, 0xa8, 0xbc, 0xdd, 0xce, - 0xfe, 0xf6, 0x37, 0xbf, 0x99, 0xd9, 0x99, 0xb5, 0xd1, 0x1d, 0xf2, 0xd4, 0xb4, 0xdd, 0x21, 0xf1, - 0xb5, 0xf8, 0xc3, 0xed, 0x6a, 0x66, 0xa7, 0x6b, 0x05, 0x1d, 0x7a, 0xd2, 0x21, 0x23, 0xe2, 0x8d, - 0x83, 0x27, 0x96, 0x33, 0x50, 0x5d, 0x8f, 0x06, 0x14, 0xdf, 0x1e, 0x10, 0x67, 0x40, 0xd5, 0x81, - 0xe7, 0xf6, 0xd4, 0x81, 0x19, 0x90, 0x6f, 0xcc, 0xb1, 0x9a, 0x10, 0xa8, 0x29, 0x41, 0xe3, 0x8d, - 0x01, 0xa5, 0x83, 0x21, 0xd1, 0x4c, 0xd7, 0xd2, 0x4c, 0xc7, 0xa1, 0x81, 0x19, 0x58, 0xd4, 0xf1, - 0x39, 0x49, 0xa3, 0x91, 0xba, 0xf4, 0xc3, 0xae, 0x66, 0x13, 0xdf, 0x37, 0x07, 0x24, 0xde, 0x7b, - 0x5d, 0xdc, 0xd3, 0xb3, 0x9b, 0xca, 0x1f, 0x15, 0x54, 0xbb, 0xdf, 0xb2, 0x82, 0x83, 0x93, 0x76, - 0x2a, 0x0c, 0x63, 0x54, 0x08, 0x43, 0xab, 0x5f, 0x97, 0x36, 0xa5, 0xad, 0xb2, 0xc1, 0xbe, 0xf1, - 0x11, 0x2a, 0x3a, 0xc4, 0x0f, 0x48, 0xbf, 0x9e, 0xdb, 0xcc, 0x6f, 0xc9, 0xfa, 0x27, 0xea, 0x5c, - 0xba, 0xd5, 0x69, 0x72, 0x75, 0x9f, 0xb1, 0x18, 0x31, 0x1b, 0xde, 0x40, 0xf2, 0xc9, 0x90, 0x9a, - 0x41, 0x67, 0x64, 0x0e, 0x43, 0x52, 0xcf, 0x83, 0xcb, 0x9c, 0x81, 0x98, 0xe9, 0x28, 0xb2, 0xe0, - 0x9b, 0x68, 0xb9, 0x4f, 0xc3, 0xee, 0x90, 0xc4, 0x88, 0x02, 0x20, 0x24, 0x43, 0xe6, 0x36, 0x0e, - 0x01, 0x0e, 0xcb, 0x09, 0x3e, 0x78, 0x3f, 0x46, 0x2c, 0x01, 0x22, 0x6f, 0x20, 0x66, 0x4a, 0x39, - 0x42, 0x11, 0x51, 0x04, 0x44, 0xc1, 0x90, 0x43, 0x01, 0xc2, 0x39, 0xb6, 0xf5, 0x18, 0x71, 0x15, - 0x10, 0x4b, 0x8c, 0x63, 0x5b, 0xe7, 0x80, 0xb7, 0x50, 0xe5, 0xc4, 0x7a, 0x4a, 0xfa, 0x29, 0x49, - 0x09, 0x20, 0x45, 0x63, 0x39, 0x36, 0x66, 0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, - 0xe8, 0x57, 0x12, 0xd1, 0xdc, 0x0d, 0xcc, 0x54, 0x47, 0x0d, 0x7c, 0x57, 0x6a, 0xc9, 0xc7, 0xe5, - 0xb4, 0x72, 0xdd, 0x22, 0xfb, 0x9b, 0xb7, 0xfd, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x49, 0xeb, - 0x23, 0xde, 0x94, 0x0e, 0x00, 0x00, + // 1161 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, 0x6b, 0x8f, 0x7f, 0xe2, 0x4c, 0xda, 0xd4, 0x35, 0xa0, 0xa4, 0x4b, 0x0b, + 0x21, 0x54, 0xbb, 0xd4, 0xa9, 0xf8, 0x89, 0x04, 0xa8, 0x21, 0x86, 0x22, 0xa5, 0x09, 0x6c, 0xda, + 0x20, 0x45, 0x42, 0xd6, 0xda, 0x9e, 0x38, 0xab, 0x78, 0x77, 0x56, 0xfb, 0x13, 0x6a, 0x59, 0xe9, + 0x45, 0xc5, 0x05, 0x12, 0x17, 0x95, 0xe0, 0x01, 0xb8, 0x06, 0x09, 0xee, 0x78, 0x00, 0xae, 0xb9, + 0xe4, 0x15, 0x78, 0x10, 0xce, 0xcc, 0xec, 0x6e, 0x66, 0x9d, 0x08, 0x1b, 0xa7, 0x0a, 0x57, 0xde, + 0x39, 0xf3, 0xed, 0x77, 0xbe, 0x73, 0xce, 0x9c, 0x33, 0x6b, 0x74, 0x97, 0x3c, 0x35, 0x6d, 0xb7, + 0x4f, 0x7c, 0x3d, 0x7a, 0x70, 0xdb, 0xba, 0xd9, 0x6a, 0x5b, 0x41, 0x8b, 0x1e, 0xb4, 0xc8, 0x31, + 0xf1, 0x06, 0xc1, 0xa1, 0xe5, 0xf4, 0x34, 0xd7, 0xa3, 0x01, 0xc5, 0x77, 0x7a, 0xc4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x23, 0x94, 0x11, 0x39, 0x40, 0xcc, 0x18, 0xc5, 0x50, 0x82, 0x08, 0x8e, + 0xb5, 0x46, 0x84, 0xb8, 0x0a, 0x88, 0x59, 0xce, 0xb1, 0xd6, 0x10, 0x80, 0xd7, 0x51, 0xf9, 0xc0, + 0x7a, 0x4a, 0xba, 0x09, 0x49, 0x1e, 0x20, 0x39, 0xa3, 0x14, 0x19, 0xd3, 0xa0, 0x84, 0xa7, 0x00, + 0xa0, 0xab, 0x11, 0x28, 0x66, 0x7a, 0x0d, 0xa1, 0x36, 0xa5, 0xfd, 0x08, 0x81, 0x00, 0x91, 0x37, + 0x0a, 0xcc, 0x92, 0x88, 0xf5, 0x03, 0x0f, 0x52, 0x15, 0x01, 0x8a, 0xbc, 0x0a, 0x45, 0x61, 0x4b, + 0xc5, 0x93, 0x78, 0x29, 0x03, 0xa4, 0x2c, 0xe2, 0x89, 0x9d, 0x7c, 0x89, 0x10, 0x71, 0x42, 0x3b, + 0x02, 0x54, 0x00, 0x50, 0x69, 0x34, 0x26, 0xac, 0xd9, 0x76, 0x68, 0x13, 0xcf, 0xea, 0x34, 0xe1, + 0x7d, 0xa3, 0xc0, 0x58, 0x04, 0xe5, 0x1d, 0x54, 0xf1, 0xd3, 0xd1, 0xcd, 0x01, 0xed, 0x9c, 0x51, + 0xf6, 0x53, 0xe1, 0x25, 0xb0, 0x24, 0x53, 0x55, 0x80, 0x55, 0x63, 0x98, 0x54, 0x13, 0x5f, 0x8e, + 0x61, 0x1e, 0x40, 0xf3, 0x10, 0xa6, 0x14, 0x43, 0x04, 0x49, 0x78, 0x30, 0x40, 0xb0, 0x80, 0xc4, + 0x2c, 0x0d, 0x74, 0xdd, 0x23, 0x2e, 0x81, 0x58, 0xba, 0xad, 0x54, 0xd6, 0x16, 0xe0, 0x94, 0x16, + 0x8c, 0x85, 0x78, 0x73, 0x57, 0xca, 0xde, 0x1e, 0x2a, 0x52, 0x87, 0xb0, 0x86, 0xb7, 0xdd, 0x60, +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, 0x11, 0xaf, 0x76, + 0xb8, 0xb0, 0xaf, 0xf1, 0xdd, 0x71, 0xc2, 0x08, 0xa8, 0xd1, 0x87, 0x62, 0x9c, 0xec, 0xdf, 0x54, + 0xab, 0xfa, 0x71, 0x23, 0xc1, 0xb3, 0xbd, 0x75, 0x71, 0xb9, 0xec, 0x63, 0x7c, 0x66, 0x8b, 0x9d, + 0xcd, 0x3c, 0x6b, 0xe8, 0x4b, 0x89, 0x68, 0xe2, 0x06, 0xe6, 0xaa, 0x59, 0x03, 0xc3, 0xd9, 0xfc, + 0x43, 0x41, 0x25, 0xf6, 0xb9, 0xf1, 0x85, 0x19, 0x1c, 0x72, 0x95, 0x97, 0x3f, 0x21, 0x3f, 0xe6, + 0xba, 0x3f, 0x50, 0xef, 0x8f, 0x3d, 0x22, 0xa9, 0x3f, 0xb3, 0x1a, 0xfb, 0x3c, 0x63, 0x67, 0x76, + 0xa3, 0xb8, 0x5f, 0x48, 0xe8, 0xdb, 0x39, 0xfe, 0x7f, 0x78, 0xed, 0x9f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xaf, 0xf0, 0x18, 0xd2, 0xbd, 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 5c07e4c0782..c847259d107 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -459,6 +459,37 @@ func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, marshaler r } +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 + + if err := marshaler.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) { @@ -753,6 +784,30 @@ 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()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + resp, md, err := request_ABitOfEverythingService_DeepPathEcho_0(runtime.AnnotateContext(ctx, req), inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_DeepPathEcho_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -778,6 +833,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 ( @@ -802,4 +859,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 12f95322dbb..e38653f98be 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -6,6 +6,8 @@ import "google/api/annotations.proto"; import "examples/sub/message.proto"; import "examples/sub2/message.proto"; +// Intentionaly complicated message type to cover much features of Protobuf. +// NEXT ID: 26 message ABitOfEverything { message Nested { string name = 1; @@ -16,6 +18,7 @@ message ABitOfEverything { } DeepEnum ok = 3; } + Nested single_nested = 25; string uuid = 1; repeated Nested nested = 2; @@ -112,4 +115,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.proto b/examples/examplepb/streamless_everything.proto index 33458b28aab..aa4145584ff 100644 --- a/examples/examplepb/streamless_everything.proto +++ b/examples/examplepb/streamless_everything.proto @@ -5,6 +5,8 @@ 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: 26 message ABitOfEverything { message Nested { string name = 1; @@ -15,6 +17,7 @@ message ABitOfEverything { } DeepEnum ok = 3; } + Nested single_nested = 25; string uuid = 1; repeated Nested nested = 2; @@ -115,4 +118,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 dde159dc540..ee537412037 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", @@ -443,6 +477,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 412763e1e9f..c5dff687e76 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -284,7 +284,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}") }