diff --git a/Makefile b/Makefile index 14f1d673442..4dea64d059c 100644 --- a/Makefile +++ b/Makefile @@ -77,7 +77,7 @@ EXAMPLES=examples/proto/examplepb/echo_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/sub/message.proto examples/proto/sub2/message.proto +EXAMPLE_DEPS=examples/proto/pathenum/path_enum.proto examples/proto/sub/message.proto examples/proto/sub2/message.proto EXAMPLE_DEPSRCS=$(EXAMPLE_DEPS:.proto=.pb.go) EXAMPLE_CLIENT_DIR=examples/clients @@ -182,7 +182,7 @@ $(RESPONSE_BODY_EXAMPLE_SRCS): $(RESPONSE_BODY_EXAMPLE_SPEC) $(EXAMPLE_CLIENT_DIR)/responsebody/git_push.sh \ $(EXAMPLE_CLIENT_DIR)/responsebody/.travis.yml -examples: $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_DEPSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) +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 diff --git a/examples/browser/a_bit_of_everything_service.spec.js b/examples/browser/a_bit_of_everything_service.spec.js index edcbebe11d6..7172b806fdf 100644 --- a/examples/browser/a_bit_of_everything_service.spec.js +++ b/examples/browser/a_bit_of_everything_service.spec.js @@ -34,6 +34,9 @@ describe('ABitOfEverythingService', function() { sint32_value: 2147483647, sint64_value: "4611686018427387903", nonConventionalNameValue: "camelCase", + enum_value: "ONE", + path_enum_value: "DEF", + nested_path_enum_value: "JKL", }; beforeEach(function(done) { @@ -72,6 +75,9 @@ describe('ABitOfEverythingService', function() { sint32_value: 2147483647, sint64_value: "4611686018427387903", nonConventionalNameValue: "camelCase", + enum_value: "ONE", + path_enum_value: "DEF", + nested_path_enum_value: "JKL", nested: [ { name: "bar", amount: 10 }, diff --git a/examples/clients/abe/BUILD.bazel b/examples/clients/abe/BUILD.bazel index fad5b661901..f70ac9305bb 100644 --- a/examples/clients/abe/BUILD.bazel +++ b/examples/clients/abe/BUILD.bazel @@ -13,13 +13,21 @@ go_library( "configuration.go", "echo_rpc_api.go", "echo_service_api.go", + "enum_helper.go", "examplepb_a_bit_of_everything.go", "examplepb_body.go", "examplepb_numeric_enum.go", + "message_path_enum_nested_path_enum.go", "nested_deep_enum.go", + "pathenum_path_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"], + 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" + ], ) 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 f07085ef4a0..9e426740f2d 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -57,13 +57,16 @@ func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythin * @param sint32Value * @param sint64Value * @param nonConventionalNameValue + * @param enumValue + * @param pathEnumValue + * @param nestedPathEnumValue * @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) { +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) { 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 := 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 = 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) @@ -79,6 +82,9 @@ func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float 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) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -530,6 +536,8 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb * @param bytesValue * @param uint32Value * @param enumValue - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param pathEnumValue + * @param nestedPathEnumValue * @param sfixed32Value * @param sfixed64Value * @param sint32Value @@ -541,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 *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, 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) { +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) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables @@ -573,6 +581,8 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName strin 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, "")) diff --git a/examples/clients/abe/enum_helper.go b/examples/clients/abe/enum_helper.go new file mode 100644 index 00000000000..df9e20fb66e --- /dev/null +++ b/examples/clients/abe/enum_helper.go @@ -0,0 +1,46 @@ +package abe + +import ( + pbexamplepb "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb" + pbpathenum "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum" + "github.com/grpc-ecosystem/grpc-gateway/runtime" +) + +// String returns a string representation of "NumericEnum" +func (e ExamplepbNumericEnum) String() string { + return pbexamplepb.NumericEnum_ONE.String() +} + +// UnmarshalJSON does a no-op unmarshal to ExamplepbNumericEnum. +// It just validates that the input is sane. +func (e ExamplepbNumericEnum) UnmarshalJSON(b []byte) error { + return unmarshalJSONEnum(b, pbexamplepb.NumericEnum_value) +} + +// String returns a string representation of "MessagePathEnum" +func (e MessagePathEnumNestedPathEnum) String() string { + return pbpathenum.MessagePathEnum_JKL.String() +} + +// UnmarshalJSON does a no-op unmarshal to MessagePathEnumNestedPathEnum. +// It just validates that the input is sane. +func (e MessagePathEnumNestedPathEnum) UnmarshalJSON(b []byte) error { + return unmarshalJSONEnum(b, pbpathenum.MessagePathEnum_NestedPathEnum_value) +} + +// String returns a string representation of "PathEnum" +func (e PathenumPathEnum) String() string { + return pbpathenum.PathEnum_DEF.String() +} + +// UnmarshalJSON does a no-op unmarshal to PathenumPathEnum. +// It just validates that the input is sane. +func (e PathenumPathEnum) UnmarshalJSON(b []byte) error { + return unmarshalJSONEnum(b, pbpathenum.PathEnum_value) +} + +func unmarshalJSONEnum(b []byte, enumValMap map[string]int32) error { + val := string(b[1 : len(b)-1]) + _, err := runtime.Enum(val, enumValMap) + return err +} diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go index a20c5c0db30..f413637e1ca 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -47,6 +47,10 @@ type ExamplepbABitOfEverything struct { 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"` diff --git a/examples/clients/abe/message_path_enum_nested_path_enum.go b/examples/clients/abe/message_path_enum_nested_path_enum.go new file mode 100644 index 00000000000..a6d9a579f6c --- /dev/null +++ b/examples/clients/abe/message_path_enum_nested_path_enum.go @@ -0,0 +1,14 @@ +/* + * 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/pathenum_path_enum.go b/examples/clients/abe/pathenum_path_enum.go new file mode 100644 index 00000000000..76e4f87650d --- /dev/null +++ b/examples/clients/abe/pathenum_path_enum.go @@ -0,0 +1,14 @@ +/* + * 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/integration/BUILD.bazel b/examples/integration/BUILD.bazel index c603d01e14f..80e0df6227e 100644 --- a/examples/integration/BUILD.bazel +++ b/examples/integration/BUILD.bazel @@ -14,6 +14,7 @@ go_test( "//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", "//runtime:go_default_library", diff --git a/examples/integration/client_test.go b/examples/integration/client_test.go index b49a2f31fff..bbcfed59cb2 100644 --- a/examples/integration/client_test.go +++ b/examples/integration/client_test.go @@ -73,6 +73,9 @@ func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { Sint32Value: 2147483647, Sint64Value: "4611686018427387903", NonConventionalNameValue: "camelCase", + EnumValue: abe.ExamplepbNumericEnum{}, + PathEnumValue: abe.PathenumPathEnum{}, + NestedPathEnumValue: abe.MessagePathEnumNestedPathEnum{}, } resp, _, err := cl.Create( want.FloatValue, @@ -90,6 +93,9 @@ func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue, + want.EnumValue.String(), + want.PathEnumValue.String(), + want.NestedPathEnumValue.String(), ) if err != nil { t.Errorf("cl.Create(%#v) failed with %v; want success", want, err) @@ -123,6 +129,9 @@ func testABEClientCreateBody(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { Sint32Value: 2147483647, Sint64Value: "4611686018427387903", NonConventionalNameValue: "camelCase", + EnumValue: abe.ExamplepbNumericEnum{}, + PathEnumValue: abe.PathenumPathEnum{}, + NestedPathEnumValue: abe.MessagePathEnumNestedPathEnum{}, Nested: []abe.ABitOfEverythingNested{ { diff --git a/examples/integration/integration_test.go b/examples/integration/integration_test.go index de4e8bb0ad8..518c9c9baab 100644 --- a/examples/integration/integration_test.go +++ b/examples/integration/integration_test.go @@ -18,6 +18,7 @@ import ( "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" "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc/codes" @@ -284,8 +285,11 @@ func testABECreate(t *testing.T, port int) { Sint32Value: 2147483647, Sint64Value: 4611686018427387903, NonConventionalNameValue: "camelCase", + EnumValue: gw.NumericEnum_ZERO, + PathEnumValue: pathenum.PathEnum_DEF, + NestedPathEnumValue: pathenum.MessagePathEnum_JKL, } - 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) + 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) resp, err := http.Post(url, "application/json", strings.NewReader("{}")) if err != nil { @@ -335,6 +339,9 @@ func testABECreateBody(t *testing.T, port int) { Sint32Value: 2147483647, Sint64Value: 4611686018427387903, NonConventionalNameValue: "camelCase", + EnumValue: gw.NumericEnum_ONE, + PathEnumValue: pathenum.PathEnum_ABC, + NestedPathEnumValue: pathenum.MessagePathEnum_GHI, Nested: []*gw.ABitOfEverything_Nested{ { @@ -429,6 +436,9 @@ func testABEBulkCreate(t *testing.T, port int) { Sint32Value: 2147483647, Sint64Value: 4611686018427387903, NonConventionalNameValue: "camelCase", + EnumValue: gw.NumericEnum_ONE, + PathEnumValue: pathenum.PathEnum_ABC, + NestedPathEnumValue: pathenum.MessagePathEnum_GHI, Nested: []*gw.ABitOfEverything_Nested{ { diff --git a/examples/proto/examplepb/BUILD.bazel b/examples/proto/examplepb/BUILD.bazel index 09b77d200ab..7ec13fbe279 100644 --- a/examples/proto/examplepb/BUILD.bazel +++ b/examples/proto/examplepb/BUILD.bazel @@ -23,6 +23,7 @@ proto_library( "response_body_service.proto", ], deps = [ + "//examples/proto/pathenum:pathenum_proto", "//examples/proto/sub:sub_proto", "//examples/proto/sub2:sub2_proto", "//protoc-gen-swagger/options:options_proto", @@ -43,6 +44,7 @@ go_proto_library( importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/examplepb", proto = ":examplepb_proto", deps = [ + "//examples/proto/pathenum:go_default_library", "//examples/proto/sub:go_default_library", "//examples/proto/sub2:go_default_library", "//protoc-gen-swagger/options:go_default_library", diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 9e6c25ac895..bc210b5e9a8 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -9,6 +9,7 @@ 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" @@ -53,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_364bd45bb659fb85, []int{0} + return fileDescriptor_a_bit_of_everything_70e21b42d3c87ea8, []int{0} } // DeepEnum is one or zero. @@ -79,32 +80,34 @@ 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_364bd45bb659fb85, []int{0, 0, 0} + return fileDescriptor_a_bit_of_everything_70e21b42d3c87ea8, []int{0, 0, 0} } // 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"` - 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"` - 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"` + 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.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 @@ -125,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_364bd45bb659fb85, []int{0} + return fileDescriptor_a_bit_of_everything_70e21b42d3c87ea8, []int{0} } func (m *ABitOfEverything) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything.Unmarshal(m, b) @@ -250,6 +253,20 @@ func (m *ABitOfEverything) GetEnumValue() NumericEnum { return NumericEnum_ZERO } +func (m *ABitOfEverything) GetPathEnumValue() pathenum.PathEnum { + if m != nil { + return m.PathEnumValue + } + return pathenum.PathEnum_ABC +} + +func (m *ABitOfEverything) GetNestedPathEnumValue() pathenum.MessagePathEnum_NestedPathEnum { + if m != nil { + return m.NestedPathEnumValue + } + return pathenum.MessagePathEnum_GHI +} + func (m *ABitOfEverything) GetSfixed32Value() int32 { if m != nil { return m.Sfixed32Value @@ -449,7 +466,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_364bd45bb659fb85, []int{0, 0} + return fileDescriptor_a_bit_of_everything_70e21b42d3c87ea8, []int{0, 0} } func (m *ABitOfEverything_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ABitOfEverything_Nested.Unmarshal(m, b) @@ -501,7 +518,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_364bd45bb659fb85, []int{1} + return fileDescriptor_a_bit_of_everything_70e21b42d3c87ea8, []int{1} } func (m *Body) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Body.Unmarshal(m, b) @@ -540,7 +557,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_364bd45bb659fb85, []int{2} + return fileDescriptor_a_bit_of_everything_70e21b42d3c87ea8, []int{2} } func (m *MessageWithBody) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithBody.Unmarshal(m, b) @@ -1203,151 +1220,156 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_364bd45bb659fb85) -} - -var fileDescriptor_a_bit_of_everything_364bd45bb659fb85 = []byte{ - // 2266 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcb, 0x73, 0x1b, 0x49, - 0x19, 0xf7, 0x48, 0xb2, 0x62, 0x7f, 0x7e, 0xc9, 0xed, 0x6c, 0xe2, 0x68, 0xbd, 0xeb, 0x8e, 0x36, - 0xcb, 0x6a, 0xbd, 0xab, 0x19, 0x5b, 0x31, 0x5b, 0x89, 0x29, 0x58, 0x64, 0x5b, 0x9b, 0x78, 0xb3, - 0xeb, 0x38, 0x93, 0x6c, 0x48, 0x85, 0x04, 0x57, 0x4b, 0xd3, 0x92, 0x26, 0xd1, 0x4c, 0x0f, 0xd3, - 0x3d, 0xb6, 0x85, 0x31, 0xcf, 0x2a, 0x28, 0xe0, 0x40, 0x95, 0xb9, 0x71, 0xd8, 0x0b,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, 0xff, 0x69, 0x92, 0x48, 0xf9, 0x47, 0x19, 0x00, 0x00, + proto.RegisterFile("examples/proto/examplepb/a_bit_of_everything.proto", fileDescriptor_a_bit_of_everything_70e21b42d3c87ea8) +} + +var fileDescriptor_a_bit_of_everything_70e21b42d3c87ea8 = []byte{ + // 2351 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4d, 0x6f, 0x1b, 0xc7, + 0xf9, 0xd7, 0x92, 0x14, 0x2d, 0x3d, 0x7a, 0xa3, 0x46, 0x8e, 0x2c, 0x33, 0x4a, 0x34, 0x66, 0x9c, + 0x7f, 0x18, 0x25, 0xdc, 0x95, 0x68, 0xfd, 0x03, 0x5b, 0x45, 0x93, 0x52, 0x2f, 0xb1, 0x15, 0x27, + 0xb2, 0xbc, 0x76, 0x5c, 0xc3, 0xb5, 0x2b, 0x0c, 0xc9, 0x21, 0xb9, 0x36, 0x77, 0x67, 0xbb, 0x33, + 0x2b, 0x89, 0x65, 0xd9, 0x57, 0xa0, 0x45, 0xdb, 0x43, 0x01, 0xf5, 0xd6, 0x43, 0xcf, 0xfd, 0x02, + 0x3d, 0xf5, 0x50, 0xf4, 0x90, 0x5e, 0x72, 0x6b, 0x81, 0x1c, 0x5a, 0xa0, 0x97, 0xb6, 0x40, 0xfb, + 0x2d, 0x8a, 0x99, 0xdd, 0xa5, 0x96, 0x94, 0x58, 0x99, 0x76, 0x91, 0x8b, 0xb4, 0x33, 0xf3, 0x9b, + 0xdf, 0xf3, 0xcc, 0xf3, 0x36, 0xcf, 0x10, 0x8a, 0xf4, 0x88, 0xd8, 0x6e, 0x93, 0x72, 0xc3, 0xf5, + 0x98, 0x60, 0x46, 0x38, 0x74, 0xcb, 0x06, 0xd9, 0x2f, 0x5b, 0x62, 0x9f, 0xd5, 0xf6, 0xe9, 0x01, + 0xf5, 0x5a, 0xa2, 0x61, 0x39, 0x75, 0x5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, 0x3f, 0xbe, 0x71, 0xff, + 0xb8, 0x74, 0xf7, 0xfb, 0x9a, 0xf6, 0x33, 0xed, 0xf6, 0x37, 0x48, 0xa1, 0x56, 0x2a, 0x7c, 0xb8, + 0x52, 0xb8, 0xf1, 0xa4, 0x7d, 0xbd, 0x53, 0x88, 0x0f, 0xd7, 0x86, 0x19, 0xae, 0x16, 0x3b, 0xa6, + 0x92, 0x80, 0xf6, 0x20, 0x1d, 0x9e, 0x20, 0x81, 0x93, 0x2f, 0x75, 0x82, 0x90, 0x07, 0x2d, 0xc1, + 0x44, 0xad, 0xc9, 0x88, 0xd8, 0x3f, 0x20, 0x4d, 0x9f, 0x2e, 0x24, 0xb1, 0x96, 0x4f, 0x98, 0xa0, + 0xa6, 0x1e, 0xc8, 0x19, 0x74, 0x05, 0x26, 0xab, 0xcc, 0x2f, 0x37, 0x69, 0x88, 0x48, 0x61, 0x2d, + 0xaf, 0x99, 0x13, 0xc1, 0x5c, 0x00, 0x59, 0x82, 0x09, 0xcb, 0x11, 0xef, 0xad, 0x85, 0x88, 0x51, + 0xac, 0xe5, 0x93, 0x26, 0xa8, 0xa9, 0x2e, 0x87, 0x1f, 0x47, 0xa4, 0xb1, 0x96, 0x4f, 0x99, 0x13, + 0x7e, 0x0c, 0x12, 0x70, 0x5c, 0x2b, 0x86, 0x88, 0x0b, 0x58, 0xcb, 0x8f, 0x2a, 0x8e, 0x6b, 0xc5, + 0x00, 0xf0, 0x06, 0x4c, 0xd5, 0xac, 0x23, 0x5a, 0xed, 0x92, 0x8c, 0x61, 0x2d, 0x9f, 0x36, 0x27, + 0xc3, 0xc9, 0x5e, 0x50, 0x97, 0x67, 0x1c, 0x6b, 0xf9, 0x0b, 0x21, 0x28, 0x62, 0x7a, 0x0d, 0xa0, + 0xcc, 0x58, 0x33, 0x44, 0x00, 0xd6, 0xf2, 0x63, 0xe6, 0xb8, 0x9c, 0xe9, 0x2a, 0xcb, 0x85, 0x67, + 0x39, 0xf5, 0x10, 0x30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, 0x13, 0x00, 0x00, 0xff, 0xff, 0x32, 0x75, 0x62, 0xe4, 0x6f, 0x1a, 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 999eead1237..1805eb4e96c 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.gw.go @@ -14,6 +14,7 @@ import ( "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/runtime" @@ -32,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}, 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}} + 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}} ) 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) { @@ -41,6 +42,7 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run var ( val string + e int32 ok bool err error _ = err @@ -211,6 +213,45 @@ func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler run return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonConventionalNameValue", err) } + val, ok = pathParams["enum_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "enum_value") + } + + 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", err) + } + + protoReq.EnumValue = NumericEnum(e) + + val, ok = pathParams["path_enum_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path_enum_value") + } + + 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_enum_value", err) + } + + protoReq.PathEnumValue = pathenum.PathEnum(e) + + val, ok = pathParams["nested_path_enum_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nested_path_enum_value") + } + + 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", "nested_path_enum_value", err) + } + + protoReq.NestedPathEnumValue = pathenum.MessagePathEnum_NestedPathEnum(e) + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Create_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -978,7 +1019,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}, []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"}, "")) + 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_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 29ef445d5f7..257d32cefd0 100644 --- a/examples/proto/examplepb/a_bit_of_everything.proto +++ b/examples/proto/examplepb/a_bit_of_everything.proto @@ -5,6 +5,7 @@ package grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/duration.proto"; +import "examples/proto/pathenum/path_enum.proto"; import "examples/proto/sub/message.proto"; import "examples/proto/sub2/message.proto"; import "google/protobuf/timestamp.proto"; @@ -170,6 +171,8 @@ message ABitOfEverything { bytes bytes_value = 29; uint32 uint32_value = 13; NumericEnum enum_value = 14; + pathenum.PathEnum path_enum_value = 30; + pathenum.MessagePathEnum.NestedPathEnum nested_path_enum_value = 31; sfixed32 sfixed32_value = 15; sfixed64 sfixed64_value = 16; sint32 sint32_value = 17; @@ -226,9 +229,8 @@ service ABitOfEverythingService { // // This API creates a new ABitOfEverything 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}" + 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}" }; } 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 4e33b7ea27f..ad7797aa66b 100644 --- a/examples/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/proto/examplepb/a_bit_of_everything.swagger.json @@ -265,6 +265,28 @@ ], "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", @@ -347,7 +369,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}": { + "/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}": { "post": { "summary": "Create a new ABitOfEverything", "description": "This API creates a new ABitOfEverything", @@ -479,6 +501,36 @@ "in": "path", "required": true, "type": "string" + }, + { + "name": "enum_value", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + }, + { + "name": "path_enum_value", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "ABC", + "DEF" + ] + }, + { + "name": "nested_path_enum_value", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "GHI", + "JKL" + ] } ], "tags": [ @@ -985,6 +1037,14 @@ }, "description": "Nested is nested type." }, + "MessagePathEnumNestedPathEnum": { + "type": "string", + "enum": [ + "GHI", + "JKL" + ], + "default": "GHI" + }, "NestedDeepEnum": { "type": "string", "enum": [ @@ -1057,6 +1117,12 @@ "enum_value": { "$ref": "#/definitions/examplepbNumericEnum" }, + "path_enum_value": { + "$ref": "#/definitions/pathenumPathEnum" + }, + "nested_path_enum_value": { + "$ref": "#/definitions/MessagePathEnumNestedPathEnum" + }, "sfixed32_value": { "type": "integer", "format": "int32" @@ -1145,6 +1211,14 @@ "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" + }, "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/proto/pathenum/BUILD.bazel b/examples/proto/pathenum/BUILD.bazel new file mode 100644 index 00000000000..26b3efc1921 --- /dev/null +++ b/examples/proto/pathenum/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 = "pathenum_proto", + srcs = ["path_enum.proto"], +) + +go_proto_library( + name = "pathenum_go_proto", + importpath = "github.com/grpc-ecosystem/grpc-gateway/examples/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", +) diff --git a/examples/proto/pathenum/path_enum.pb.go b/examples/proto/pathenum/path_enum.pb.go new file mode 100644 index 00000000000..6de95037484 --- /dev/null +++ b/examples/proto/pathenum/path_enum.pb.go @@ -0,0 +1,120 @@ +// 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" + +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. +// 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 PathEnum int32 + +const ( + PathEnum_ABC PathEnum = 0 + PathEnum_DEF PathEnum = 1 +) + +var PathEnum_name = map[int32]string{ + 0: "ABC", + 1: "DEF", +} +var PathEnum_value = map[string]int32{ + "ABC": 0, + "DEF": 1, +} + +func (x PathEnum) String() string { + return proto.EnumName(PathEnum_name, int32(x)) +} +func (PathEnum) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_path_enum_f14abf5268452f40, []int{0} +} + +type MessagePathEnum_NestedPathEnum int32 + +const ( + MessagePathEnum_GHI MessagePathEnum_NestedPathEnum = 0 + MessagePathEnum_JKL MessagePathEnum_NestedPathEnum = 1 +) + +var MessagePathEnum_NestedPathEnum_name = map[int32]string{ + 0: "GHI", + 1: "JKL", +} +var MessagePathEnum_NestedPathEnum_value = map[string]int32{ + "GHI": 0, + "JKL": 1, +} + +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} +} + +type MessagePathEnum struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +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} +} +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_Size() int { + return xxx_messageInfo_MessagePathEnum.Size(m) +} +func (m *MessagePathEnum) XXX_DiscardUnknown() { + xxx_messageInfo_MessagePathEnum.DiscardUnknown(m) +} + +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) +} + +func init() { + proto.RegisterFile("examples/proto/pathenum/path_enum.proto", fileDescriptor_path_enum_f14abf5268452f40) +} + +var fileDescriptor_path_enum_f14abf5268452f40 = []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, +} diff --git a/examples/proto/pathenum/path_enum.proto b/examples/proto/pathenum/path_enum.proto new file mode 100644 index 00000000000..5c926ff7132 --- /dev/null +++ b/examples/proto/pathenum/path_enum.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +option go_package = "github.com/grpc-ecosystem/grpc-gateway/examples/proto/pathenum"; +package grpc.gateway.examples.pathenum; + +enum PathEnum { + ABC = 0; + DEF = 1; +} + +message MessagePathEnum { + enum NestedPathEnum { + GHI = 0; + JKL = 1; + } +} diff --git a/protoc-gen-grpc-gateway/descriptor/types.go b/protoc-gen-grpc-gateway/descriptor/types.go index 1a6e1cce527..319e58727e6 100644 --- a/protoc-gen-grpc-gateway/descriptor/types.go +++ b/protoc-gen-grpc-gateway/descriptor/types.go @@ -121,6 +121,25 @@ func (e *Enum) FQEN() string { return strings.Join(components, ".") } +// GoType returns a go type name for the enum type. +// It prefixes the type name with the package alias if +// its belonging package is not "currentPackage". +func (e *Enum) GoType(currentPackage string) string { + var components []string + components = append(components, e.Outers...) + components = append(components, e.GetName()) + + name := strings.Join(components, "_") + if e.File.GoPkg.Path == currentPackage { + return name + } + pkg := e.File.GoPkg.Name + if alias := e.File.GoPkg.Alias; alias != "" { + pkg = alias + } + return fmt.Sprintf("%s.%s", pkg, name) +} + // Service wraps descriptor.ServiceDescriptorProto for richer features. type Service struct { // File is the file where this service is defined. @@ -338,10 +357,9 @@ var ( descriptor.FieldDescriptorProto_TYPE_STRING: "runtime.String", // FieldDescriptorProto_TYPE_GROUP // FieldDescriptorProto_TYPE_MESSAGE - descriptor.FieldDescriptorProto_TYPE_BYTES: "runtime.Bytes", - descriptor.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32", - // FieldDescriptorProto_TYPE_ENUM - // TODO(yugui) Handle Enum + descriptor.FieldDescriptorProto_TYPE_BYTES: "runtime.Bytes", + descriptor.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32", + descriptor.FieldDescriptorProto_TYPE_ENUM: "runtime.Enum", descriptor.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32", descriptor.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64", descriptor.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32", @@ -362,9 +380,8 @@ var ( // FieldDescriptorProto_TYPE_MESSAGE // FieldDescriptorProto_TYPE_BYTES // TODO(yugui) Handle bytes - descriptor.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32P", - // FieldDescriptorProto_TYPE_ENUM - // TODO(yugui) Handle Enum + descriptor.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32P", + descriptor.FieldDescriptorProto_TYPE_ENUM: "runtime.EnumP", descriptor.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32P", descriptor.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64P", descriptor.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32P", diff --git a/protoc-gen-grpc-gateway/gengateway/BUILD.bazel b/protoc-gen-grpc-gateway/gengateway/BUILD.bazel index 517909b5046..3ab955c1fea 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/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", ], diff --git a/protoc-gen-grpc-gateway/gengateway/generator.go b/protoc-gen-grpc-gateway/gengateway/generator.go index a5ed4ede518..a619fae399e 100644 --- a/protoc-gen-grpc-gateway/gengateway/generator.go +++ b/protoc-gen-grpc-gateway/gengateway/generator.go @@ -127,6 +127,7 @@ func (g *generator) generate(file *descriptor.File) (string, error) { } for _, svc := range file.Services { for _, m := range svc.Methods { + imports = append(imports, g.addEnumPathParamImports(file, m, pkgSeen)...) pkg := m.RequestType.File.GoPkg if len(m.Bindings) == 0 || pkg == file.GoPkg || pkgSeen[pkg.Path] { @@ -142,5 +143,25 @@ func (g *generator) generate(file *descriptor.File) (string, error) { UseRequestContext: g.useRequestContext, RegisterFuncSuffix: g.registerFuncSuffix, } - return applyTemplate(params) + return applyTemplate(params, g.reg) +} + +// addEnumPathParamImports handles adding import of enum path parameter go packages +func (g *generator) addEnumPathParamImports(file *descriptor.File, m *descriptor.Method, pkgSeen map[string]bool) []descriptor.GoPackage { + var imports []descriptor.GoPackage + for _, b := range m.Bindings { + for _, p := range b.PathParams { + e, err := g.reg.LookupEnum("", p.Target.GetTypeName()) + if err != nil { + continue + } + pkg := e.File.GoPkg + if pkg == file.GoPkg || pkgSeen[pkg.Path] { + continue + } + pkgSeen[pkg.Path] = true + imports = append(imports, pkg) + } + } + return imports } diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 42c42c3ccaf..7d3aa2f2b4d 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" + pbdescriptor "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/utilities" ) @@ -20,6 +21,7 @@ type param struct { type binding struct { *descriptor.Binding + Registry *descriptor.Registry } // HasQueryParam determines if the binding needs parameters in query string. @@ -54,6 +56,25 @@ func (b binding) QueryParamFilter() queryParamFilter { return queryParamFilter{utilities.NewDoubleArray(seqs)} } +// HasEnumPathParam returns true if the path parameter slice contains a parameter that maps to an enum proto field, if not false is returned. +func (b binding) HasEnumPathParam() bool { + for _, p := range b.PathParams { + if p.Target.GetType() == pbdescriptor.FieldDescriptorProto_TYPE_ENUM { + return true + } + } + return false +} + +// LookupEnum looks up a enum type by path parameter. +func (b binding) LookupEnum(p descriptor.Parameter) *descriptor.Enum { + e, err := b.Registry.LookupEnum("", p.Target.GetTypeName()) + if err != nil { + return nil + } + return e +} + // 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 @@ -74,7 +95,7 @@ type trailerParams struct { RegisterFuncSuffix string } -func applyTemplate(p param) (string, error) { +func applyTemplate(p param, reg *descriptor.Registry) (string, error) { w := bytes.NewBuffer(nil) if err := headerTemplate.Execute(w, p); err != nil { return "", err @@ -90,7 +111,7 @@ func applyTemplate(p param) (string, error) { meth.Name = &methName for _, b := range meth.Bindings { methodWithBindingsSeen = true - if err := handlerTemplate.Execute(w, binding{Binding: b}); err != nil { + if err := handlerTemplate.Execute(w, binding{Binding: b, Registry: reg}); err != nil { return "", err } } @@ -217,23 +238,33 @@ var ( {{if .PathParams}} var ( val string +{{- if .HasEnumPathParam}} + e 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 }} +{{if $param.IsNestedProto3}} err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) +{{else if $enum}} + e, err = {{$param.ConvertFuncExpr}}(val, {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}_value) {{else}} {{$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) } +{{if $enum}} + {{$param.AssignableExpr "protoReq"}} = {{$enum.GoType $param.Target.Message.File.GoPkg.Path}}(e) +{{end}} {{end}} {{end}} {{if .HasQueryParam}} diff --git a/protoc-gen-grpc-gateway/gengateway/template_test.go b/protoc-gen-grpc-gateway/gengateway/template_test.go index d28c943e1d3..3f1313a7ddc 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"}) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler"}, 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"}) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler"}, 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"}) + got, err := applyTemplate(param{File: crossLinkFixture(&file), RegisterFuncSuffix: "Handler"}, descriptor.NewRegistry()) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) return diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index 3f82a52a7a5..a377f33e692 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -583,6 +583,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re for _, parameter := range b.PathParams { var paramType, paramFormat, desc string + var enumNames []string switch pt := parameter.Target.GetType(); pt { case pbdescriptor.FieldDescriptorProto_TYPE_GROUP, pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE: if descriptor.IsWellKnownType(parameter.Target.GetTypeName()) { @@ -594,8 +595,13 @@ 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 = fullyQualifiedNameToSwaggerName(parameter.Target.GetTypeName(), reg) + paramType = "string" paramFormat = "" + enum, err := reg.LookupEnum("", parameter.Target.GetTypeName()) + if err != nil { + return err + } + enumNames = listEnumNames(enum) default: var ok bool paramType, paramFormat, ok = primitiveSchema(pt) @@ -616,6 +622,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re // Parameters in gRPC-Gateway can only be strings? Type: paramType, Format: paramFormat, + Enum: enumNames, }) } // Now check if there is a body parameter diff --git a/runtime/convert.go b/runtime/convert.go index 903ae23407b..5000ff19064 100644 --- a/runtime/convert.go +++ b/runtime/convert.go @@ -2,6 +2,7 @@ package runtime import ( "encoding/base64" + "fmt" "strconv" "github.com/golang/protobuf/jsonpb" @@ -85,3 +86,23 @@ func Duration(val string) (*duration.Duration, error) { err := jsonpb.UnmarshalString(val, r) return r, err } + +// Enum converts the given string into an int32 that should be type casted into the +// correct enum proto type. +func Enum(val string, enumValMap map[string]int32) (int32, error) { + e, ok := enumValMap[val] + if ok { + return e, nil + } + + i, err := Int32(val) + if err != nil { + return 0, fmt.Errorf("%s is not valid", val) + } + for _, v := range enumValMap { + if v == i { + return i, nil + } + } + return 0, fmt.Errorf("%s is not valid", val) +}