I tried to register the following schema with maven plugin, but received org.apache.avro.SchemaParseException: Can’t redefine: com.example.items.ChildType error message.
The avro schema file content is
[{
"type": "record",
"namespace": "com.example.items",
"name": "ChildType",
"fields": [ { "name": "childList",
"type": { "type": "array",
"items": {
"name": "Child",
"type": "record",
"fields": [
{"name": "col1", "type": "string" },
{"name": "col2", "type": "string" }
]
}
}
}
]
},
{
"type": "record",
"namespace": "com.example.items",
"name": "Parent",
"fields": [
{ "name": "children", "type": "com.example.items.ChildType" }
]
}
]
The pom.xml contains (relevant part copied)
<plugin>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-maven-plugin</artifactId>
<version>${confluent-avro.version}</version>
<configuration>
<schemaRegistryUrls>
<param>http://localhost:8081</param>
</schemaRegistryUrls>
<subjects>
<!--this tag prefix is the name of the topic-->
<example.loader.t-value>src/main/avro/MultiTypeEvents.uavsc</example.loader.t-value>
<test>src/main/avro/Parent.avsc</test>
</subjects>
<schemaTypes>
<example.loader.t-value>AVRO</example.loader.t-value>
<test>AVRO</test>
</schemaTypes>
<references>
<example.loader.t-value>
<reference>
<name>com.example.items.ChildType</name>
<subject>test</subject>
<version>1</version>
</reference>
<reference>
<name>com.example.items.Parent</name>
<subject>test</subject>
<version>1</version>
</reference>
</example.loader.t-value>
</references>
</configuration>
<goals>
<goal>register</goal>
</goals>
</plugin>
MultiTypeEvents.uavsc content is
[
"com.example.items.ChildType",
"com.example.items.Parent"
]
Could you help me how to successfully register such schema(s)?
Thank you in advance.