ch-robinson / dotnet-avro

An Avro implementation for .NET
https://engineering.chrobinson.com/dotnet-avro/
MIT License
132 stars 49 forks source link

Issue with alias #309

Closed anatoly-kryzhanovsky closed 1 month ago

anatoly-kryzhanovsky commented 1 month ago

precondition: -.net 6 application

i have schema registry with schema with has record with alias

{
  "type": "record",
  "name": "my_entity",
  "namespace": "namespace",  
  "fields": [
    {
      "name": "payload",
      "type": [
        "null",
        {
          "type": "record",
          "name": "my_entity_payload_record",
          "fields": [...],
          "aliases": [
            "my_entity_payload"
          ]
        }
      ]
    }
  ]
}

when i try to serialize message i receive exception Value serialization error with message Sequence contains more than one matching element

then i try to investigate problem i found following:

is library support alias? may be there is some configuration that i should change?

anatoly-kryzhanovsky commented 1 month ago

ok. i investigate source code more and found that in JsonRecordSchemaReaderCase we add schema for each found aliases so if we use alias we have expect that there are multiple keys with same value in Schemas, but JsonUnionSchemaReaderCase use Single operation and faild. sound like bug

dstelljes commented 1 month ago

Thanks for the detailed reproduction! We'll release a fix with 10.3.1 shortly.

anatoly-kryzhanovsky commented 1 month ago

thank you for quick fix!