Skip to content

Exception on type reference #91

@c-bik

Description

@c-bik

Hi,
In confluent (and perhaps also in other AVRO schema check tools) this following schema passes the validation check.

{
  "type": "record",
  "name": "Level0",
  "namespace": "root.namespace",
  "fields": [
    {
      "name": "Level1",
      "type": {
        "type": "record",
        "name": "Level1",
        "fields": [
          {
            "name": "Lavel2",
            "type": [
              "null",
              {
                "type": "record",
                "name": "Lavel2",
                "fields": [
                  {
                    "name": "Lavel3",
                    "type": {
                      "type": "array",
                      "items": {
                        "type": "record",
                        "name": "Lavel4",
                        "fields": [
                          {
                            "name": "Lavel5",
                            "type": {
                              "type": "enum",
                              "name": "Lavel5",
                              "symbols": [
                                "EnumOption1",
                                "EnumOption2",
                                "EnumOption3",
                                "EnumOptionDefault"
                              ],
                              "default": "EnumOptionDefault"
                            },
                            "default": "EnumOptionDefault"
                          }
                        ]
                      }
                    },
                    "default": []
                  }
                ]
              }
            ]
          },
          {
            "name": "Lavel21",
            "type": [
              "null",
              {
                "type": "record",
                "name": "Lavel21",
                "fields": [
                  {
                    "name": "Lavel31",
                    "type": {
                      "type": "array",
                      "items": {
                        "type": "record",
                        "name": "Lavel41",
                        "fields": [
                          {
                            "name": "Lavel5",
                            "type": "Lavel5",
                            "default": "EnumOption1"
                          }
                        ]
                      }
                    },
                    "default": []
                  }
                ]
              }
            ]
          }
        ]
      }
    }
  ]
}

But AvroEx.decode_schema/1 is throwing the following error.

(MatchError) no match of right hand side value:
{:error, %FunctionClauseError{module: AvroEx.Schema, function: :type_name, arity: 1, kind: nil, args: nil, clauses: nil}}

Am I missing something here, or is this a bug / missing support etc?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions