Alexey Raga created AVRO-3671:
---------------------------------

             Summary: Codegen: int and enum values within Unions are 
indistinguishable
                 Key: AVRO-3671
                 URL: https://issues.apache.org/jira/browse/AVRO-3671
             Project: Apache Avro
          Issue Type: Bug
          Components: csharp
    Affects Versions: 1.11.1
            Reporter: Alexey Raga


When there is a schema that contains an enum:
{code:java}
{ 
  "type": "enum", 
  "name": "Suit", 
  "symbols": ["SPADES", "HEARTS", "DIAMONDS", "CLUBS"] 
} {code}
and a field of this union type (allowed by the specification):
{code:java}
"type": [ "null", "int", "Suit" ]{code}
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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to