Skip to content

Quarkus Avro extension cannot generate new Schema syntax Idl. #52882

@SDAChess

Description

@SDAChess

Describe the bug

The quarkus-avro extension does not support the named schema IDL syntax introduced in Avro 1.12.0. Files using this syntax fail to compile with a parser error.

Root cause

The quarkus-avro extension uses the deprecated Idl parser, which only supports the protocol syntax. Avro 1.12.0 introduced IdlReader (Deprecation notice) which supports both the traditional protocol syntax and the new named schema syntax (bare namespace + record without a protocol wrapper).

Suggestion

Consider switching from the deprecated Idl parser to IdlReader. Alternatively, it may be worth evaluating whether the quarkus-avro extension should delegate to the avro-maven-plugin for code generation rather than invoking the Avro compiler directly, which would automatically pick up new features and parser improvements from upstream Avro.

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

Given this .avdl file in src/main/avro/:

namespace org.example;

record TestSchema {
    string field;
}

The build fails with:

Quarkus code generation phase has failed: InvocationTargetException:
Failed to compile avro IDL file: .../TestSchema.avdl to Java:
Encountered " <IDENTIFIER> "namespace "" at line 1, column 1.
Was expecting one of:
    "protocol" ...
    "@" ...

The traditional protocol-wrapped syntax works fine:

@namespace("org.example")
protocol TestProtocol {
  record TestSchema {
    string field;
  }
}

Output of uname -a or ver

Linux 6.18.13

Output of java -version

21.0.10

Quarkus version or git rev

3.32.1

Build tool (ie. output of mvnw --version or gradlew --version)

maven

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions