does adding more tables to a union break backward compatibility ?

37 views
Skip to first unread message

Ricardo Quesada

unread,
Dec 7, 2016, 8:15:50 PM12/7/16
to FlatBuffers
Hi, 
I couldn't find it in the documentation, so I ask it here:


Let's say I have a union of three objects:

union AnyObject {Object, SubObject1, subObject2};

and somewhere I have:

objects:[AnyObject]


If in the future I add a new a new table to the union, eg:

union AnyObject {Object, SubObject1, subObject2, subObject3, subObject4};


will it break backwards compatibility ? will older version still be able to parse the newly generated .bin files ?

Thanks!


mikkelfj

unread,
Dec 7, 2016, 8:31:27 PM12/7/16
to FlatBuffers

objects:[AnyObject]

You can't have a vector of unions, unfortunately. You need to wrap the union in table.


If in the future I add a new a new table to the union, eg:

union AnyObject {Object, SubObject1, subObject2, subObject3, subObject4}; 

will it break backwards compatibility ? will older version still be able to parse the newly generated .bin files ?
 
Aside from the above issue, you there is no problem adding a new type to the union. Just observe that the union is limited to 255 members and make sure you add the new members at the end of union otherwise you will mix up the encoded ID of the existing types.

Mikkel

Ricardo Quesada

unread,
Dec 7, 2016, 9:40:58 PM12/7/16
to FlatBuffers

objects:[AnyObject]

You can't have a vector of unions, unfortunately. You need to wrap the union in table.

good to know. thanks 


Aside from the above issue, you there is no problem adding a new type to the union. Just observe that the union is limited to 255 members and make sure you add the new members at the end of union otherwise you will mix up the encoded ID of the existing types.


yay!
 
Reply all
Reply to author
Forward
0 new messages