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

2017-10-17 Thread 'Feng Xiao' via Protocol Buffers
On Tue, Oct 10, 2017 at 8:15 PM, Qian Zhang wrote: > 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

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

2017-10-17 Thread Qian Zhang
Feng, any comments? :-) -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to

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.

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

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()"

[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