google.protobuf.Any stores the qualified name of the packed message as a 
string. It is only a breaking change if InnerProto was stored in Any, not 
if OuterProto was stored. 

On Thursday, April 20, 2023 at 8:49:17 AM UTC+2 Marc Gravell wrote:

> As long as you aren't using `Any`: then at the binary payload data it 
> won't be visible. Any existing code that uses the generated types will need 
> to be updated, obviously.
>
> On Thu, 20 Apr 2023, 07:00 'Felik' via Protocol Buffers, <
> [email protected]> wrote:
>
>> Hello,
>>
>> I came to understand that the binary serialization only concern of field 
>> identifiying number (hence renaming field and message is backward 
>> compatible).
>>
>> I would like to confirm my understanding if following case is also 
>> backward compatible (I could not find any resource that discuss about this, 
>> or I may have used the incorrect search term for this).
>>
>> Let's say previously I have defined a nested proto definition as follow:
>>
>> message OuterProto {
>>    message InnerProto {
>>       optional bool field_bool = 1;
>>       optional int64 field_int = 2;
>>    }
>>
>>    optional InnerProto field_composed = 1;
>> }
>>
>> Now, I would like to "un-nest" the InnerProto definition by redefining 
>> another duplicate proto in top level as follow:
>>
>> // same exact field numbering & type
>> message NewInnerAsTopLevelProto {
>>       optional bool field_bool = 1;
>>       optional int64 field_int = 2;
>> }
>>
>> Would following modification to message OuterProto be 
>> backward-compatible ?
>>
>> message OuterProto {
>>    message InnerProto {    // unused
>>       optional bool field_bool = 1;
>>       optional int64 field_int = 2;
>>    }
>>
>>    optional NewInnerAsTopLevelProto field_composed = 1;
>> }
>>
>> Any input & insight would be much appreciated. Thank you!
>>
>> -- 
>> 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 on the web visit 
>> https://groups.google.com/d/msgid/protobuf/40a99e57-b80e-4bff-bf41-0622046ec12fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/protobuf/40a99e57-b80e-4bff-bf41-0622046ec12fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/protobuf/082b2195-7cd4-45cd-8658-9024c082214cn%40googlegroups.com.

Reply via email to