Avro : Not an Array Error

532 views
Skip to first unread message

Mark Jayson Gonzaga

unread,
Sep 9, 2021, 2:20:04 PM9/9/21
to Quarkus Development mailing list
Hi Team,

Would like to ask how to resolve this error below.

image.png

Here is my avro schema
{
"name": "MSGEncoding",
"type": "record",
"namespace": "org.soh.gsd.encoding.avro",
"fields": [
{
"name": "document",
"type": {
"name": "document",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "documentType",
"type": "string"
}
]
}
}
]
}
Here is my implementation
return MSGEncoding.newBuilder()
.setDocument(document.newBuilder()
.setId(documentEntity.getId())
.setDocumentType(documentEntity.getDocumentType().name())
.build())
.build();

Here is my pom.xml

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-apicurio-registry-avro</artifactId>
</dependency><dependency>
    <groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
</dependency>

Michał Szynkiewicz

unread,
Sep 9, 2021, 5:38:26 PM9/9/21
to markjayson...@gmail.com, Quarkus Development mailing list
Could you create a reproducer for this issue? I don't really see how avro schema could be attempted to be parsed as an array.

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CADNbDsBqtr9TCc%2BuWfL%2B8bX9i-j6TVpGGKu6Wgf%2B8upkOfxRTA%40mail.gmail.com.

Ladislav Thon

unread,
Sep 10, 2021, 3:33:23 AM9/10/21
to michal.l.s...@gmail.com, markjayson...@gmail.com, Quarkus Development mailing list
I'm no Avro expert, but the schema looks weird to me. There are two things with `"name": "document"`, and the syntax doesn't look right either. I'd naively expect the schema to look like this:

{
  "name": "MSGEncoding",
  "type": "record",
  "namespace": "org.soh.gsd.encoding.avro",
  "fields": [
    {
      "name": "document",
      "type": "record",
      "fields": [
        {
          "name": "id",
          "type": "long"
        },
        {
          "name": "documentType",
          "type": "string"
        }
      ]
    }
  ]
}

LT

čt 9. 9. 2021 v 23:38 odesílatel Michał Szynkiewicz <michal.l.s...@gmail.com> napsal:
Reply all
Reply to author
Forward
0 new messages