I have a message with an enum member. When the value is 0, it is not
printed out or added to json with MessageToJson().
python -m grpc_tools.protoc -I . --python_out=. --grpc_python_out=.
./test_service.proto
>>> import test_service_pb2
>>> x = test_service_pb2.TestMsg()
>>> print (x)
>>> x.my_string = "abcd"
>>> x.my_enum = 1
>>> print (x)
my_string: "abcd"
my_enum: ENUMTYPE_ONE
>>> x.my_enum = 0
>>> print (xxy)
my_string: "abcd"
## what happened to my_enum: ENUMTYPE_ZERO ??
python --version 3.5.2
protobuf 3.1.0
grpcio-1.0.4
test_service.proto:
syntax = "proto3";
service TestService {
rpc TestMethod (TestMsg) returns (TestMsg);
}
message TestMsg {
string my_string = 1;
EnumType my_enum = 2;
}
// -----------------------------
enum EnumType {
ENUMTYPE_ZERO = 0;
ENUMTYPE_ONE = 1;
}
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/6d5a3cfe-bdbf-4106-b755-b7eee1c025ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.