Skip to content

Fixed sub-type name resolution

Compare
Choose a tag to compare
@Strech Strech released this 23 Sep 19:46
· 99 commits to master since this release
88ffd9a

When you define a complex schema with an array of records (for instance) and you want to re-use a type you created in that array definition you can simply use a name of that record.

{
  "type": "record",
  "name": "Messenger",
  "namespace": "io.confluent",
  "fields": [
    {
      "name": "inbox",
      "type": {
        "type": "array",
        "items": {
          "type": "record",
          "name": "Message",
          "fields": [
            {
              "name": "text",
              "type": "string"
            }
          ]
        }
      }
    },
    {
      "name": "archive",
      "type": {
        "type": "array",
        "items": "io.confluent.Message"
      }
    }
  ]
}

but in Avrora v0.6 it will throw an error because the erlavro schema was stored and used as-is. Meanwhile avro specification allows a record type to be defined once and then be re-used in schema resolution process.

Since version v0.7 resolution of the schema is done through the erlavro build-in mechanism of the schema storage which will take care of all the type names you define in the schema.

Thanks ❤️