Avrogen strips out logicalType properties when generating C# classes

710 views Asked by At

I'm using apache.avro.tools version 1.11.0 to generate C# types from my avro schema.

Here is a portion of the schema:

"fields": [
  {
    "name": "ShipDate",
    "type": {
      "type": "int",
      "logicalType:": "date"
    }
  }
]

In the C# class the schema property contains ""fields"":[{""name"":""ShipDate"",""type"":""int""}. As you can see the logicalType is missing.

If I compare it to:

{
  "name": "BaseCost",
  "type": {
    "type": "bytes",
    "logicalType": "decimal",
    "precision": 7,
    "scale": 2,
  }
}

The C# class's schema property contains {\"name\":\"BaseCost\",\"type\":{\"type\":\"bytes\",\"logicalType\":\"decimal\",\"precision\":7,\"scale\":2}}.

Why has it swallowed some of the properties?

1

There are 1 answers

0
NickL On

This was user error I'm afraid. The "logicalType:" field name has a semi-colon in it.

I'll give someone bonus points if they can tell me how to prevent errors like this in the future, with an avro-linter or something.