schema-registry icon indicating copy to clipboard operation
schema-registry copied to clipboard

Issues with registering nested schemas in schema registry

Open FredrikAnderson opened this issue 5 months ago • 0 comments

Having issue to register many nested schemas (avro) in confluent registry using confluent-registry java-based client library.

Wanted schema structure to be registered:

Part -> depending on Date schema -> depending on ItemType schema ItemType schema -> depending on Date schema

Wanting to register this using code and confluent library:

            <groupId>io.confluent</groupId>
            <artifactId>kafka-schema-registry-client</artifactId>

Have designed a RegisterConfluentSchemaBuilder class for supporting this purpose. Have tried two different concepts for trying to register schema(s). Please have a look at line RegisterConfluentSchemaBuilder.java line 112 for configuring / selecting which choice to try.

Using registryclient gives exception: // Gives: Caused by: org.apache.avro.SchemaParseException: Undefined name: "test.Date"

Using AvroSchema class gives exception: // Gives: Caused by: org.apache.avro.SchemaParseException: Can't redefine: test.Date

Please advice of there are other better supported way of registering nested schemas like above real-world scenario schema design.

Hope code is self-explained. Compile and run using maven; mvn clean package will give you the error(s) depending on config mentioned above.

confluent-schema-nested-issue.zip

FredrikAnderson avatar Jul 16 '25 12:07 FredrikAnderson