# Avro schema issues

**URL:** <https://forum.confluent.io/t/avro-schema-issues/808>\
**Category:** Schema Registry\
**Created:** [10 February 2021 14:05 UTC](https://forum.confluent.io/t/avro-schema-issues/808 "2021-02-10T14:05:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebjwallace](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/sebjwallace/32/409_2.png) [@sebjwallace](https://forum.confluent.io/u/sebjwallace)\
**Post date:** [10 February 2021 14:05 UTC](https://forum.confluent.io/t/avro-schema-issues/808/1 "2021-02-10T14:05:28Z")

</div>

Hi all! I’ve got a fairly large avsc file that I want to validate (not shown here). I’ve loaded up a local Landoop Schema Registry UI. It works fine for simple schemas, but I face issues when I try to nest records.

What am I doing wrong here?

```
{
    "name": "Test2",
    "namespace": "com.avro",
    "type": "record",
    "fields":[
        {"name": "field1", "type": "string" },
        {
            "name": "test",
            "type": "record",
            "fields": [
                { "name": "field1", "type": "string" }
            ]
        }
    ]
}

```

I get error ‘Either the input schema or one its references is invalid’.  
Then if I try a flat structure:

```
[
{
    "name": "Test",
    "namespace": "com.avro",
    "type": "record",
    "fields": [
        {
            "name": "field1",
            "type": "string" 
        }
    ]
},
{
    "name": "Test2",
    "namespace": "com.avro",
    "type": "record",
    "fields":[
        {"name": "field1", "type": "com.avro.Test" }
    ]
}
]

```

I then get error ‘com.avro.Test is not valid’.

Any help will be much appreciated!

---

<div class="post-metadata">

**Author:** ![sebjwallace](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/sebjwallace/32/409_2.png) [@sebjwallace](https://forum.confluent.io/u/sebjwallace)\
**Post date:** [10 February 2021 14:09 UTC](https://forum.confluent.io/t/avro-schema-issues/808/2 "2021-02-10T14:09:20Z")

</div>

Is there a CLI tool available for validating schemas, ideally with verbose errors?

---

<div class="post-metadata">

**Author:** ![rmoff](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/rmoff/32/3_2.png) [@rmoff](https://forum.confluent.io/u/rmoff)\
**Post date:** [10 February 2021 14:47 UTC](https://forum.confluent.io/t/avro-schema-issues/808/3 "2021-02-10T14:47:10Z")

</div>

Do you get this error with Confluent Schema Registry? I’m not clear from your post where you’re seeing the error, and how to reproduce it.

---

<div class="post-metadata">

**Author:** ![sebjwallace](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/sebjwallace/32/409_2.png) [@sebjwallace](https://forum.confluent.io/u/sebjwallace)\
**Post date:** [10 February 2021 15:03 UTC](https://forum.confluent.io/t/avro-schema-issues/808/4 "2021-02-10T15:03:01Z")

</div>

Hi Robin! Apologies, let me to fill in those details.

I’m using the `landoop/schema-registry-ui:0.9.5` image with `confluentinc/cp-schema-registry:5.5.1` within [Steph’s docker-compose stack](https://github.com/simplesteph/kafka-stack-docker-compose).

 ![image](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/1f414ccad9483977268e2fba6f8b33a1ac1efe54.png)

I thought it might be a UI issue but the network response from the API is a 422 response.

I’ll try avro tools also, see if I can validate if my schema is correctly written that way.

[https://github.com/coderfi/docker-avro-tools](https://github.com/coderfi/docker-avro-tools)

---

<div class="post-metadata">

**Author:** ![riferrei](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/riferrei/32/1848_2.png) [@riferrei](https://forum.confluent.io/u/riferrei)\
**Post date:** [10 February 2021 15:03 UTC](https://forum.confluent.io/t/avro-schema-issues/808/5 "2021-02-10T15:03:29Z")

</div>

Your first example is indeed wrong according to the Avro specification. It should be written using the following design:

```
{
    "name": "Test2",
    "namespace": "com.avro",
    "type": "record",
    "fields":[
        {"name": "field1", "type": "string" },
        {
            "name" : "test",
            "type": [
              {
                 "type": "record",
                 "name": "CustomType",
                 "fields": [
                    { "name": "field1", "type": "string" }
                 ]
              }
            ]
        }
    ]
}

```

FYI your second example is not wrong and compiled successfully using the Avro compiler **v1.10.1**. Perhaps this tool that you are using (Landoop Schema Registry) is not up to date in terms of dependencies.

---

<div class="post-metadata">

**Author:** ![sebjwallace](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/sebjwallace/32/409_2.png) [@sebjwallace](https://forum.confluent.io/u/sebjwallace)\
**Post date:** [10 February 2021 15:06 UTC](https://forum.confluent.io/t/avro-schema-issues/808/6 "2021-02-10T15:06:16Z")

</div>

That’s awesome, it worked! Thank you very much Ricardo! 👍

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [17 February 2021 15:06 UTC](https://forum.confluent.io/t/avro-schema-issues/808/7 "2021-02-17T15:06:42Z")

</div>

Closed on 17 February 2021 15:06 UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
