Thanks for you quick reply Em!  I'm going to read up on 
`ParsePartialFromArray()`. I'm not in control of the data stream and/or 
.proto files, merely integrating a SDK, but good to know about this!

Op donderdag 7 november 2024 om 16:00:19 UTC+1 schreef Em Rauch:

> I think the function `ParsePartialFromArray()` is what you're looking for.
>
> Note that generally you shouldn't rely on this too heavily though; if you 
> serialize such a message and send it to another end point they will be 
> expecting all required fields to be set and may correctly parse fail; the 
> intent of ParsePartial is that if you're going to serialize it back out you 
> should set the required fields first.
>
> Broadly, required fields were removed from proto3 because they cause a lot 
> of problems, including that they very hard to remove a required field when 
> you realize you don't need it; eg you may think `string username` is 
> required today but when you realize you want a `int64 userid` instead it's 
> very hard to make that transition if you marked username as required. You 
> may want to consider migrating your fields off of being marked required as 
> a long term solution.
>
> On Thursday, November 7, 2024 at 9:53:07 AM UTC-5 snoriman wrote:
>
>> Maybe a silly question, but I'm using `ParseFromArray()` and when the 
>> input data is missing some required fields I get a mesage like "Can't 
>> parase message of type <type> because it is missing required fields".
>>
>> It still parses the message which is fine as I don't need the required 
>> data, however how can I I disable the output?
>>
>>
>>

-- 
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 view this discussion visit 
https://groups.google.com/d/msgid/protobuf/dab3da3b-1c02-4ddc-bac7-a3e932a63930n%40googlegroups.com.

Reply via email to