|
|
-
Re: Does extending union break compatibilityScott Carey 2011-11-04, 01:00
On 11/3/11 4:56 PM, "Neil Davudo" <[EMAIL PROTECTED]> wrote: >I have a record defined as follows > >// version 1 >record SomeRecord >{ > union { null, TypeA } unionOfTypes; >} > >I change the record to the following > >// version 2 >record SomeRecord >{ > union { null, TypeA, TypeB } unionOfTypes; >} > >Does the change break compatibility? Would data encoded using version 1 >of the record definition be decodable using version 2 of the record >definition? Readers with the second schema should be able to read data written with the first schema, provided they use the API properly (both schemas must be provided to the reader, so that it can translate from one to the other). The reverse, reading data written in the latter schema with the first schema, is possible as well provided that the first schema contains a default value so that if the reader encounters a union branch it does not know about, it can substitute the default value. > >TIA > >Neil |