Re: [protobuf] "ParseFromString()" and "JsonStringToMessage()" have inconsistent behavior when parsing an unrecognized enum value.

2017-10-10 Thread Qian Zhang
> > Note that you can use the always_print_enums_as_ints option to work around > this problem: https://github.com/google/protobuf/blob/master/src/google/protobuf/util/json_util.h#L73 > With this option enum value will printed as integers and will be accepted > by JsonStringToMessage. "always_p

Re: [protobuf] "ParseFromString()" and "JsonStringToMessage()" have inconsistent behavior when parsing an unrecognized enum value.

2017-10-10 Thread 'Feng Xiao' via Protocol Buffers
Note that you can use the always_print_enums_as_ints option to work around this problem: https://github.com/google/protobuf/blob/master/src/google/protobuf/util/json_util.h#L73 With this option enum value will printed as integers and will be accepted by JsonStringToMessage. On Tue, Oct 10, 2017 a

Re: [protobuf] "ParseFromString()" and "JsonStringToMessage()" have inconsistent behavior when parsing an unrecognized enum value.

2017-10-10 Thread 'Feng Xiao' via Protocol Buffers
On Tue, Oct 10, 2017 at 12:29 AM, Qian Zhang wrote: > Hi, > > I am using protobuf-3.3.0, and I found when parsing an unrecognized enum > value for an optional enum field, the behaviors of "ParseFromString()" and > "JsonStringToMessage()" are different. "ParseFromString()" will succeed and > the f

[protobuf] "ParseFromString()" and "JsonStringToMessage()" have inconsistent behavior when parsing an unrecognized enum value.

2017-10-10 Thread Qian Zhang
Hi, I am using protobuf-3.3.0, and I found when parsing an unrecognized enum value for an optional enum field, the behaviors of "ParseFromString()" and "JsonStringToMessage()" are different. "ParseFromString()" will succeed and the field's getter method will return the default enum value, but