From 0e80e322df0018fc001eb358e56733c99838e23f Mon Sep 17 00:00:00 2001 From: Yukinari Toyota Date: Thu, 25 Feb 2016 22:46:39 +0900 Subject: [PATCH 1/2] add camelCase field example --- examples/examplepb/a_bit_of_everything.pb.go | 122 +++++++++--------- .../examplepb/a_bit_of_everything.pb.gw.go | 15 ++- examples/examplepb/a_bit_of_everything.proto | 3 +- .../examplepb/streamless_everything.proto | 3 +- .../streamless_everything.swagger.json | 13 +- examples/integration_test.go | 91 ++++++------- 6 files changed, 138 insertions(+), 109 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 76d0340c415..9853450ee99 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -84,6 +84,7 @@ 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"` + CamelCaseValue string `protobuf:"bytes,20,opt,name=camelCase_value,json=camelCaseValue" json:"camelCase_value,omitempty"` } func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } @@ -525,64 +526,65 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ } var fileDescriptor1 = []byte{ - // 933 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, 0x1b, 0x8f, 0x37, 0x69, 0x3a, 0x15, 0xb0, 0x44, 0xa0, 0xdd, 0x9a, 0x16, - 0x42, 0xa8, 0xec, 0xad, 0x83, 0x40, 0xaa, 0x04, 0x52, 0x43, 0x03, 0x42, 0x5a, 0x76, 0x85, 0x97, - 0x16, 0x29, 0x12, 0x8a, 0x9c, 0x78, 0xe2, 0x5a, 0xeb, 0x78, 0x2c, 0xff, 0x84, 0x46, 0x51, 0x6e, - 0xb8, 0x42, 0x42, 0x02, 0x09, 0x1e, 0x00, 0x09, 0xae, 0x40, 0x82, 0x17, 0xe1, 0x92, 0x57, 0xe0, - 0x41, 0x38, 0x9e, 0xb1, 0x5d, 0x3b, 0x54, 0x24, 0x4d, 0xa5, 0x72, 0xe7, 0x99, 0xf9, 0xe6, 0x3b, - 0xdf, 0x39, 0xe7, 0x9b, 0x93, 0xa0, 0x5b, 0xe4, 0x91, 0x39, 0xf3, 0x5d, 0x12, 0x6a, 0xe9, 0x87, - 0x3f, 0xd6, 0xcc, 0xd1, 0xd8, 0x89, 0x46, 0x74, 0x3a, 0x22, 0x73, 0x12, 0x2c, 0xa2, 0x87, 0x8e, - 0x67, 0xab, 0x7e, 0x40, 0x23, 0x8a, 0x6f, 0xda, 0xc4, 0xb3, 0xa9, 0x6a, 0x07, 0xfe, 0x44, 0xb5, - 0xcd, 0x88, 0x7c, 0x65, 0x2e, 0xd4, 0x8c, 0x40, 0xcd, 0x09, 0xda, 0xaf, 0xda, 0x94, 0xda, 0x2e, - 0xd1, 0x4c, 0xdf, 0xd1, 0x4c, 0xcf, 0xa3, 0x91, 0x19, 0x39, 0xd4, 0x0b, 0x39, 0x49, 0xbb, 0x9d, - 0x87, 0x0c, 0xe3, 0xb1, 0x36, 0x23, 0x61, 0x68, 0xda, 0x84, 0x9f, 0x29, 0x3f, 0xef, 0xa3, 0xd6, - 0xdd, 0xbe, 0x13, 0x9d, 0x4f, 0x07, 0x79, 0x6c, 0x8c, 0x51, 0x2d, 0x8e, 0x1d, 0xeb, 0x50, 0x38, - 0x16, 0x3a, 0x92, 0xc1, 0xbe, 0xf1, 0x03, 0x24, 0x7a, 0x24, 0x8c, 0x88, 0x75, 0x58, 0x39, 0xae, - 0x76, 0x64, 0xfd, 0x03, 0x75, 0x2b, 0x69, 0xea, 0x3a, 0xb9, 0x7a, 0xc6, 0x58, 0x8c, 0x94, 0x0d, - 0x1f, 0x21, 0x79, 0xea, 0x52, 0x33, 0x1a, 0xcd, 0x4d, 0x37, 0x26, 0x87, 0x55, 0x08, 0x59, 0x31, - 0x10, 0xdb, 0x7a, 0x90, 0xec, 0xe0, 0xeb, 0xe8, 0xc0, 0xa2, 0xf1, 0xd8, 0x25, 0x29, 0xa2, 0x06, - 0x08, 0xc1, 0x90, 0xf9, 0x1e, 0x87, 0x00, 0x87, 0xe3, 0x45, 0xef, 0xbe, 0x93, 0x22, 0xf6, 0x00, - 0x51, 0x35, 0x10, 0xdb, 0xca, 0x39, 0xe2, 0x22, 0x42, 0x04, 0x44, 0xcd, 0x90, 0xe3, 0x02, 0x84, - 0x73, 0xf4, 0xf4, 0x14, 0xb1, 0x0f, 0x88, 0x3d, 0xc6, 0xd1, 0xd3, 0x39, 0xe0, 0x75, 0xd4, 0x98, - 0x3a, 0x8f, 0x88, 0x95, 0x93, 0xd4, 0x01, 0x22, 0x1a, 0x07, 0xe9, 0x66, 0x19, 0x94, 0xf3, 0x48, - 0x00, 0xda, 0x4f, 0x41, 0x19, 0xd3, 0x6b, 0x08, 0x8d, 0x29, 0x75, 0x53, 0x04, 0x02, 0x44, 0xdd, - 0x90, 0x92, 0x9d, 0x5c, 0x6c, 0x18, 0x05, 0x50, 0xaa, 0x14, 0x20, 0xb3, 0x2e, 0xc8, 0x7c, 0xaf, - 0x94, 0x4f, 0x1e, 0xa5, 0x01, 0x90, 0x06, 0xcf, 0x27, 0x0b, 0xf2, 0x19, 0x42, 0xc4, 0x8b, 0x67, - 0x29, 0xa0, 0x09, 0x80, 0xa6, 0xae, 0x6f, 0xd9, 0xb3, 0xb3, 0x78, 0x46, 0x02, 0x67, 0x32, 0x80, - 0xfb, 0x86, 0x94, 0xb0, 0x70, 0xca, 0x9b, 0xa8, 0x19, 0x96, 0xb3, 0xbb, 0x02, 0xb4, 0x57, 0x8c, - 0x46, 0x58, 0x4a, 0x2f, 0x87, 0xe5, 0x95, 0x6a, 0x01, 0xac, 0x95, 0xc1, 0x0a, 0x3d, 0x09, 0x8b, - 0x39, 0x5c, 0x05, 0xd0, 0x55, 0x48, 0xb3, 0x90, 0x43, 0x0a, 0xc9, 0x79, 0x30, 0x40, 0x30, 0x87, - 0x64, 0x2c, 0x3a, 0x7a, 0x31, 0x20, 0x3e, 0x81, 0x5c, 0xac, 0x51, 0xa9, 0x6a, 0xd7, 0xc0, 0xa5, - 0x92, 0x71, 0x2d, 0x3b, 0xbc, 0x78, 0x5c, 0xbd, 0xf6, 0x1f, 0x02, 0x12, 0xb9, 0x0b, 0x13, 0xa7, - 0x7b, 0xe6, 0x8c, 0x64, 0x4e, 0x4f, 0xbe, 0xf1, 0x4b, 0x48, 0x34, 0x67, 0x34, 0xf6, 0x22, 0x70, - 0x7a, 0x52, 0xd6, 0x74, 0x85, 0xbf, 0x40, 0x15, 0x7a, 0xc9, 0x0c, 0xda, 0xd4, 0x3f, 0x7e, 0x36, - 0xf7, 0xab, 0xf7, 0x08, 0xf1, 0x59, 0x79, 0x81, 0x52, 0x39, 0x42, 0xf5, 0x6c, 0x8d, 0x25, 0xb4, - 0xf7, 0xd1, 0xdd, 0xd3, 0x8b, 0x41, 0xeb, 0x05, 0x5c, 0x47, 0xb5, 0xcf, 0x8d, 0xfb, 0x83, 0x96, - 0xa0, 0x34, 0xd1, 0xc1, 0x60, 0xe6, 0x47, 0x8b, 0x4f, 0xf9, 0xd3, 0x85, 0x0b, 0xd2, 0x27, 0x56, - 0xba, 0x78, 0xd2, 0x63, 0xed, 0x1e, 0x23, 0xb9, 0xd0, 0xc3, 0x84, 0x69, 0x38, 0x30, 0xce, 0x81, - 0x73, 0x1f, 0x55, 0xcf, 0xcf, 0x80, 0x52, 0xff, 0xae, 0x89, 0x5e, 0x5e, 0x17, 0x77, 0x41, 0x82, - 0xb9, 0x33, 0x21, 0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 0x4f, 0x5e, 0xf4, 0x0a, 0xff, 0x24, 0xa0, 0xda, 0xa9, - 0x13, 0x46, 0x78, 0x97, 0xb2, 0xec, 0x2e, 0xf3, 0x4d, 0x26, 0xf3, 0x3a, 0xde, 0xd4, 0xf8, 0x13, - 0x01, 0xff, 0x0a, 0x75, 0xbc, 0xef, 0x5b, 0xcf, 0xbf, 0xe7, 0xb7, 0x99, 0xc6, 0xb7, 0xdb, 0x5b, - 0x96, 0x32, 0xf1, 0x28, 0x54, 0x53, 0xbc, 0x47, 0x5c, 0x02, 0x5a, 0x9f, 0xbe, 0xe7, 0x3b, 0x89, - 0x4c, 0xfb, 0xdd, 0xdd, 0xb6, 0xdf, 0x7f, 0x42, 0xbf, 0x07, 0x93, 0x87, 0x14, 0xab, 0xff, 0x19, - 0x0d, 0xfe, 0xd1, 0xa9, 0xfc, 0xb7, 0x2d, 0x53, 0xf7, 0x94, 0x78, 0x65, 0xc2, 0x84, 0x7d, 0x89, - 0x6f, 0x6d, 0x12, 0x46, 0x40, 0x8d, 0xb6, 0xe4, 0x13, 0x69, 0xf8, 0x8a, 0xd2, 0xd2, 0xe6, 0x7a, - 0x8e, 0x4f, 0xce, 0xee, 0xec, 0xb1, 0xb3, 0x21, 0xc6, 0xff, 0x3a, 0x4a, 0xea, 0x5d, 0x4f, 0x66, - 0xc2, 0x73, 0xc9, 0x68, 0xeb, 0x19, 0xc0, 0x54, 0x27, 0x33, 0xe0, 0x44, 0xe8, 0xcb, 0x43, 0x29, - 0xef, 0xdc, 0x58, 0x64, 0x7f, 0x8e, 0x7b, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x35, 0xb2, 0xfa, - 0xbd, 0xad, 0x0b, 0x00, 0x00, + // 952 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0x6f, 0x6f, 0xdb, 0x44, + 0x18, 0xc7, 0x49, 0xea, 0xc6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x2b, 0xed, 0x4b, 0x07, 0x8a, + 0xc5, 0xbf, 0xf1, 0x43, 0x24, 0x07, 0x84, 0xc5, 0xc4, 0xd9, 0xad, 0xed, 0xd7, 0x0f, 0x54, 0xf3, + 0x23, 0x7d, 0x25, 0x69, 0xfa, 0x22, 0xb9, 0x7e, 0xca, 0x59, 0xac, 0x8c, 0x0d, 0xef, 0x21, 0x75, + 0xe4, 0x53, 0x3b, 0xee, 0x4f, 0x6c, 0x3f, 0x21, 0xbb, 0x75, 0x70, 0x59, 0xb3, 0x10, 0xbf, 0x7a, + 0x98, 0xde, 0xe0, 0x6b, 0x68, 0xcb, 0xa1, 0xc9, 0xc0, 0x27, 0x19, 0xa2, 0x01, 0x08, 0xc9, 0x52, + 0xc5, 0x9d, 0x80, 0x00, 0x87, 0x17, 0xc4, 0xef, 0xbf, 0x97, 0x21, 0x36, 0x00, 0x51, 0xb7, 0x10, + 0xbf, 0x2a, 0x38, 0x92, 0x32, 0x42, 0x06, 0x44, 0xc3, 0x52, 0x93, 0x12, 0x44, 0x70, 0x1c, 0x99, + 0x19, 0x62, 0x13, 0x10, 0x1b, 0x9c, 0xe3, 0xc8, 0x14, 0x80, 0xb7, 0xd0, 0xf6, 0xc8, 0x7b, 0x4c, + 0x9c, 0x82, 0xa4, 0x09, 0x10, 0xd9, 0xda, 0xca, 0x2e, 0xab, 0xa0, 0x82, 0x47, 0x01, 0xd0, 0x66, + 0x06, 0xca, 0x99, 0xde, 0x44, 0x68, 0x40, 0xa9, 0x9f, 0x21, 0x10, 0x20, 0x9a, 0x96, 0x92, 0xde, + 0x14, 0x62, 0x59, 0x1c, 0x41, 0xaa, 0x32, 0x80, 0xca, 0xab, 0xa0, 0x8a, 0xbb, 0x4a, 0x3c, 0x85, + 0x97, 0x6d, 0x80, 0x6c, 0x8b, 0x78, 0x72, 0x27, 0x9f, 0x23, 0x44, 0x82, 0x64, 0x9c, 0x01, 0x5a, + 0x00, 0x68, 0x99, 0xe6, 0x8a, 0x35, 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, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x3a, 0x25, 0xbf, 0x15, 0xe8, 0x0b, 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 b906c01fc57..b743e4c9740 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -31,7 +31,7 @@ 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}} + 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, "camelCase_value": 14}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 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, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}} ) func request_ABitOfEverythingService_Create_0(ctx context.Context, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -199,6 +199,17 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, client ABitOf return nil, metadata, err } + val, ok = pathParams["camelCase_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "camelCase_value") + } + + protoReq.CamelCaseValue, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Create_0); err != nil { return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) } @@ -714,7 +725,7 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se } 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}, []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"}, "")) + 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}, []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", "camelCase_value"}, "")) 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/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index d458272cf31..dc5bc09dc4b 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -35,6 +35,7 @@ message ABitOfEverything { sint32 sint32_value = 17; sint64 sint64_value = 18; repeated string repeated_string_value = 19; + string camelCase_value = 20; } message EmptyMessage { @@ -53,7 +54,7 @@ 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}" + 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}/{camelCase_value}" }; } rpc CreateBody(ABitOfEverything) returns (ABitOfEverything) { diff --git a/examples/examplepb/streamless_everything.proto b/examples/examplepb/streamless_everything.proto index a6d2145d8ab..ba34885a287 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; + string camelCase_value = 20; } message EmptyMessage { @@ -53,7 +54,7 @@ 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}" + 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}/{camelCase_value}" }; } rpc CreateBody(ABitOfEverything) returns (ABitOfEverything) { diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index 50806ce071a..3a2acd3be69 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -137,7 +137,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}": { + "/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}/{camel}": { "post": { "summary": "ABitOfEverythingService.Create", "operationId": "Create", @@ -247,6 +247,13 @@ "required": true, "type": "integer", "format": "int64" + }, + { + "name": "camelCase_value", + "in": "path", + "required": true, + "type": "string", + "format": "string" } ], "tags": [ @@ -367,6 +374,10 @@ "type": "boolean", "format": "boolean" }, + "camelCase_value": { + "type": "string", + "format": "string" + }, "double_value": { "type": "number", "format": "double" diff --git a/examples/integration_test.go b/examples/integration_test.go index fd3c2ff6300..66662139132 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -161,22 +161,23 @@ func testEchoBody(t *testing.T) { func testABECreate(t *testing.T) { want := gw.ABitOfEverything{ - 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, - } - 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", 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) + 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, + CamelCaseValue: "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.CamelCaseValue) resp, err := http.Post(url, "application/json", strings.NewReader("{}")) if err != nil { @@ -211,20 +212,21 @@ func testABECreate(t *testing.T) { func testABECreateBody(t *testing.T) { want := gw.ABitOfEverything{ - 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, + 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, + CamelCaseValue: "camelCase", Nested: []*gw.ABitOfEverything_Nested{ { @@ -287,20 +289,21 @@ func testABEBulkCreate(t *testing.T) { "foo", "bar", "baz", "qux", "quux", } { want := gw.ABitOfEverything{ - FloatValue: 1.5, - DoubleValue: 2.5, - Int64Value: 4294967296, - Uint64Value: 9223372036854775807, - Int32Value: -2147483648, - Fixed64Value: 9223372036854775807, - Fixed32Value: 4294967295, - BoolValue: true, - StringValue: fmt.Sprintf("strprefix/%s", val), - Uint32Value: 4294967295, - Sfixed32Value: 2147483647, - Sfixed64Value: -4611686018427387904, - Sint32Value: 2147483647, - Sint64Value: 4611686018427387903, + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: 4294967296, + Uint64Value: 9223372036854775807, + Int32Value: -2147483648, + Fixed64Value: 9223372036854775807, + Fixed32Value: 4294967295, + BoolValue: true, + StringValue: fmt.Sprintf("strprefix/%s", val), + Uint32Value: 4294967295, + Sfixed32Value: 2147483647, + Sfixed64Value: -4611686018427387904, + Sint32Value: 2147483647, + Sint64Value: 4611686018427387903, + CamelCaseValue: "camelCase", Nested: []*gw.ABitOfEverything_Nested{ { From bda224a81e693e7e70aac1639c9c7a6e9a76dcd8 Mon Sep 17 00:00:00 2001 From: Yukinari Toyota Date: Thu, 25 Feb 2016 22:48:02 +0900 Subject: [PATCH 2/2] fix camelCase path parameter handling in protoc-gen-swagger --- examples/examplepb/streamless_everything.swagger.json | 2 +- protoc-gen-swagger/genswagger/template.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/streamless_everything.swagger.json index 3a2acd3be69..5a1618cff38 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/streamless_everything.swagger.json @@ -137,7 +137,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}/{camel}": { + "/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}/{camelCase_value}": { "post": { "summary": "ABitOfEverythingService.Create", "operationId": "Create", diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index e987c217ed1..fa71ecdea81 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -295,7 +295,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-zA-Z][a-zA-Z0-9_]*).*}") for index, part := range parts { parts[index] = re.ReplaceAllString(part, "{$1}") }