On Wed, Dec 6, 2017 at 4:39 PM, 'Allen Vicencio' via Protocol Buffers <
protobuf@googlegroups.com> wrote:

> If all my fields in a protobuf are `optional`, will ParseFromArray ever
> return false? I am doing some tests right now, and I am testing two
> scenarios:
>
>
>> Person
>
> optional string name;
>
>
>  Vehicle
>
>  optional int64 wheels;
>
>
> 1. Empty buffer is passed into Person#ParseFromArray. Returns true.
> 2. Instance of Person is serialized into a buffer. Buffer is passed into
> Vehicle#ParseFromArray. Returns true.
>
> Is this expected behavior?
>
Unless you have required fields, protobuf parsing will always return true
as long as the input data is valid proto wire format.


> --
> 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 protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to