Which version are you using? Originally proto3 always dropped unknown
fields during parsing, but we recently switched back to the proto2 behavior
of preserving unknown fields. As long as you use version 3.5.0 or higher
then the unknown fields will be preserved.

On Thu, Aug 2, 2018 at 10:46 PM Asta <antonellotart...@gmail.com> wrote:

> I have seen:
> https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.coded_stream
> but I was not able to modify an existing bytestream and the ReadString is
> not able to understand the string length.
>
> Il giorno venerdì 3 agosto 2018 07:44:50 UTC+2, Asta ha scritto:
>>
>> Let's say I have compiled an application (Receiver) with the following
>> proto file:
>>
>> syntax = "proto3";
>> message Control {
>>   bytes version = 1;
>>   uint32 id = 2;
>>   bytes color = 3;
>> }
>>
>> and I have another application (Transmitter) which initially has the same
>> proto file but after an update a new field is added like:
>>
>> syntax = "proto3";
>> message Control {
>>   bytes name = 1;
>>   uint32 id = 2;
>>   bytes color = 3;
>>   uint32 color_id = 4;
>> }
>>
>> I have seen that if the Receiver app tries to parse the proto, change
>> some data and then serialize it back the added fields coming from the
>> Transmitter app are removed.
>>
>> I need a way to change the id field directly accessing to the raw bytes
>> without having to parse/serialize the proto. Is it possible ?
>>
>> This is needed because I have some "header" fields in the Control message
>> that I know that will never be changed but others that can be added/changed
>> in the same proto of trasmitter app due to app update.
>>
>> Thanks in advance
>> Asta
>>
>>
>> --
> 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