grpcgateway icon indicating copy to clipboard operation
grpcgateway copied to clipboard

Code generated for ENUM types won't compile

Open aakoshh opened this issue 6 years ago • 0 comments

Thanks for putting the effort in the Scala gRPC ecosystem! I was just about to try generating the REST gateway when I ran into the following.

I have something like this as a request type:

message ListMyResourcesRequest {
	string name = 1;
        repeated MyEnum my_enums = 3; 
	enum MyEnum {
		FOO = 0;
		BAR = 1;
	}
}

The code generated for it won't compile as it uses the name of the field instead of the type:

val my_enums = 
  my_enums.valueOf(queryString.parameters().get("myEnums").asScala.head)

It also seems to assume that it's will be a Java enum type, not the case classes generated by the compiler from the proto file.

aakoshh avatar Mar 01 '18 15:03 aakoshh