From 58afa8b1687a6bb40fc4b88ee8197e704d27dccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Br=C3=BCderl?= Date: Sat, 17 Nov 2018 02:24:30 +0100 Subject: [PATCH] add google.api.http Option to more wrapper examples --- examples/proto/examplepb/wrappers.pb.go | 83 ++--- examples/proto/examplepb/wrappers.pb.gw.go | 336 +++++++++++++++++- examples/proto/examplepb/wrappers.proto | 65 +++- .../proto/examplepb/wrappers.swagger.json | 252 ++++++++++++- 4 files changed, 684 insertions(+), 52 deletions(-) diff --git a/examples/proto/examplepb/wrappers.pb.go b/examples/proto/examplepb/wrappers.pb.go index 9aa81e39209..10736791590 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_501ad32c40800fe0, []int{0} + return fileDescriptor_wrappers_3d2e9c7780d635b4, []int{0} } func (m *Wrappers) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Wrappers.Unmarshal(m, b) @@ -535,43 +535,46 @@ var _WrappersService_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/wrappers.proto", fileDescriptor_wrappers_501ad32c40800fe0) -} - -var fileDescriptor_wrappers_501ad32c40800fe0 = []byte{ - // 535 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xdd, 0x6a, 0xd4, 0x40, - 0x14, 0xc7, 0xb3, 0xb5, 0x6e, 0x77, 0x27, 0x4a, 0xf5, 0x28, 0xa2, 0xd3, 0x62, 0x65, 0x6e, 0xfc, - 0xb8, 0x48, 0x70, 0x5b, 0x0a, 0x8a, 0x50, 0x58, 0x3f, 0x40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, 0x77, 0x79, 0x4b, 0xae, 0x35, 0x5d, 0xba, 0xa7, 0x01, - 0x6c, 0xdf, 0x29, 0x26, 0x32, 0x6f, 0xa5, 0x9e, 0x7d, 0x1c, 0xcc, 0x01, 0x14, 0x13, 0xdd, 0x7a, - 0xdd, 0xda, 0x03, 0xe6, 0x09, 0x8a, 0x89, 0xcc, 0x83, 0x77, 0x76, 0xaa, 0x8e, 0x0f, 0x00, 0x75, - 0x09, 0x45, 0x55, 0xe6, 0xc1, 0x1b, 0xb2, 0xdb, 0x94, 0x6c, 0xbd, 0x01, 0x88, 0x6f, 0x28, 0xa2, - 0xb9, 0xdf, 0xe7, 0x78, 0x05, 0x50, 0x27, 0x51, 0x54, 0x5d, 0x2f, 0x69, 0xdf, 0x04, 0xf5, 0x16, - 0x45, 0x55, 0xf7, 0x55, 0x3a, 0x43, 0x01, 0xe6, 0x36, 0x8a, 0x89, 0xcc, 0x83, 0x13, 0xe2, 0x37, - 0xf5, 0x5e, 0xea, 0x7f, 0x76, 0xb8, 0xb5, 0x91, 0x5d, 0xff, 0x4e, 0x7b, 0x7e, 0x67, 0xde, 0xd4, - 0xff, 0x3c, 0x6e, 0x3d, 0x16, 0x0d, 0x6b, 0xf9, 0xf0, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x95, - 0x1e, 0xd7, 0xc7, 0xc0, 0x06, 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, 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d, 0xef, 0xf9, + 0x77, 0x94, 0xa3, 0xe4, 0x85, 0x34, 0xa2, 0xf2, 0x9a, 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, } diff --git a/examples/proto/examplepb/wrappers.pb.gw.go b/examples/proto/examplepb/wrappers.pb.gw.go index 6148e8ce9bb..57d308f4a00 100644 --- a/examples/proto/examplepb/wrappers.pb.gw.go +++ b/examples/proto/examplepb/wrappers.pb.gw.go @@ -13,6 +13,7 @@ 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" @@ -55,6 +56,123 @@ func request_WrappersService_CreateStringValue_0(ctx context.Context, marshaler } +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 + + if err := marshaler.NewDecoder(req.Body).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 + + if err := marshaler.NewDecoder(req.Body).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 + + if err := marshaler.NewDecoder(req.Body).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 + + if err := marshaler.NewDecoder(req.Body).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 + + if err := marshaler.NewDecoder(req.Body).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 + + if err := marshaler.NewDecoder(req.Body).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 + + if err := marshaler.NewDecoder(req.Body).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 + + if err := marshaler.NewDecoder(req.Body).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 + + if err := marshaler.NewDecoder(req.Body).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) { @@ -133,17 +251,233 @@ func RegisterWrappersServiceHandlerClient(ctx context.Context, mux *runtime.Serv }) + 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", "test"}, "")) + 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 5f3614576a1..46b2552a3f7 100644 --- a/examples/proto/examplepb/wrappers.proto +++ b/examples/proto/examplepb/wrappers.proto @@ -28,17 +28,62 @@ service WrappersService { rpc CreateStringValue(google.protobuf.StringValue) returns (google.protobuf.StringValue) { option (google.api.http) = { - post: "/v1/test" + 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 CreateInt32Value(google.protobuf.Int32Value) returns (google.protobuf.Int32Value) {} - rpc CreateInt64Value(google.protobuf.Int64Value) returns (google.protobuf.Int64Value) {} - rpc CreateFloatValue(google.protobuf.FloatValue) returns (google.protobuf.FloatValue) {} - rpc CreateDoubleValue(google.protobuf.DoubleValue) returns (google.protobuf.DoubleValue) {} - rpc CreateBoolValue(google.protobuf.BoolValue) returns (google.protobuf.BoolValue) {} - rpc CreateUInt32Value(google.protobuf.UInt32Value) returns (google.protobuf.UInt32Value) {} - rpc CreateUInt64Value(google.protobuf.UInt64Value) returns (google.protobuf.UInt64Value) {} - rpc CreateBytesValue(google.protobuf.BytesValue) returns (google.protobuf.BytesValue) {} - rpc CreateEmpty(google.protobuf.Empty) returns (google.protobuf.Empty) {} } diff --git a/examples/proto/examplepb/wrappers.swagger.json b/examples/proto/examplepb/wrappers.swagger.json index cb2a3708552..f45b512e1c6 100644 --- a/examples/proto/examplepb/wrappers.swagger.json +++ b/examples/proto/examplepb/wrappers.swagger.json @@ -41,7 +41,201 @@ ] } }, - "/v1/test": { + "/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": { @@ -66,6 +260,62 @@ "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": {