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()
>>> x.my_string = "abcd"
>>> 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 ??
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;
}