Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Exception on type reference #91

Open
c-bik opened this issue Oct 31, 2023 · 1 comment
Open

Exception on type reference #91

c-bik opened this issue Oct 31, 2023 · 1 comment

Comments

@c-bik
Copy link

c-bik commented Oct 31, 2023

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?

@davydog187
Copy link
Member

This looks like a bug @c-bik. Would you be interested in sending a PR?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants