Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.11.1
-
None
-
None
Description
When there is a schema that contains an enum:
{ "type": "enum", "name": "Suit", "symbols": ["SPADES", "HEARTS", "DIAMONDS", "CLUBS"] }
and a field of this union type (allowed by the specification):
"type": [ "null", "int", "Suit" ]
The C# code generator generates a value of type "object" for this field (union) as a part of ISpecificRecord.
When deserialising Avro, this field always contains numeric values, even when the value of type "Suit" was set for serialisation.
There seems to be no way in the client code to figure out whether the value is supposed to be "Suit" or "int". Because the property of type "object" always contains "int" values inside.
I strongly suspect that the same problem happens when using unions with multiple enum types, which is explicitly allowed by the specification:
> Unions may not contain more than one schema with the same type, except for the named types record, fixed and enum. > For example, unions containing two array types or two map types are not permitted, but two types with different > names are permitted. (Names permit efficient resolution when reading and writing unions.)