Fields are optional but the implicit default for a string is a zero length string, not a null length string. To be honest, either approach seems perfectly reasonable as long as it is documented and any exception is clear and obvious. For my separate implementation I chose to interpret nulls as "meh, not set, ignore it", but... either is fine IMO.
On 3 October 2017 at 19:35, Everton Araujo <[email protected]> wrote: > Hi all, > > I'm facing the situation where a string value is not allowed to be null in > Protobuf 3 using C# (CheckNotNull). > I do not understand it considering that fields are optional by default in > proto3. > Does anyone knows the original reason for this constraint? As far as I > could see, it happens for string and bytearrays. > > Regards, > > Everton > > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- Regards, Marc -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
