This question has been asked back in 2012 , but I'm looking for new updates.
Are there any serialization formats that support tagged unions (aka sum types)? My requirements are that it has Java and .Net client libs, and it should be "reasonable mature". Performance is not a major concern.
Avro provides partial support, but does not allow nested unions (http://avro.apache.org/docs/1.7.6/spec.html#Unions). Cap'n Proto appears to have better support, but I'm not sure if it is production ready yet. Transit doesn't have direct support, but does provide an extension mechanism that might be able to support tagged unions.
Any other suggestions, or comments on the above choices?
Protocol Buffers version 2.6.0 added support for tagged unions in the form of the oneof
declaration, but it looks like protobuf-net has not been updated recently so I'm guessing it doesn't support this yet.
Cap'n Proto is used in production in a lot of places (e.g. CloudFlare), but it's true that the C# and Java implementations are relatively new.
(Disclosure: I'm the author of Cap'n Proto, and also of most of Google's open source Protobuf code.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With