Trying to register a schema which references twice the same complex type throws SchemaParseException
See original GitHub issueWe’re using the dynamic schema registration of apicurio, and since the latest upstep, we’re facing the following error from time to time:
org.apache.avro.SchemaParseException: Can't redefine: com.xxx.yyy
Digging a bit deeper in the code, it seems this is a regression introduced in 2.2.2.Final
(2.2.1 was still working). More specific here:
https://github.com/Apicurio/apicurio-registry/blob/a28493615587946eb41b48fd778cf758e6129c71/serdes/avro-serde/src/main/java/io/apicurio/registry/serde/avro/AvroSchemaParser.java#L75
The resolvedReferences
contains duplicates, which makes the schema.toString()
crash.
I created a reproduction unit test. It tries to register the following schema:
{
"namespace": "com.kubetrade.schema.trade",
"type": "record",
"name": "AvroSchemaF",
"fields": [
{
"name": "schemaE1",
"type": "com.kubetrade.schema.trade.AvroSchemaE"
},
{
"name": "schemaE2",
"type": "com.kubetrade.schema.trade.AvroSchemaE"
},
{
"name": "key",
"type": "string"
}
]
}
However I don’t see exactly on how this should be fixed, can somebody assist with that?
Issue Analytics
- State:
- Created a year ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Schema registry is not accepting a type by reference
expression. This is thrown by the schema registry. It will upload with no problems.
Read more >Error Registering Avro Schema | Multiple Schemas In One Topic
Kafka throws this exception due to a compatibility issue since the current schema is not compatible with the earlier schema registered on ...
Read more >[jira] [Commented] (AVRO-2145) Can't generate Javadoc on ...
public static Protocol parse(File file) throws IOException { return parse(Schema. ... Sets the field's type to the schema by name reference.
Read more >kafka-avro-console-producer throwing org.apache.avro ...
I am trying to send a avro message by registering the schema in confluent schema-registry: [appuser@schema-registry bin]$ .
Read more >subject:"Avro schema" - The Mail Archive
Try it out yourself at: https://bolcom.github.io/avro-schema-viewer >> Learn more ... the above under a complex type like a record if I want complex...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm it works fine now in
2.3.0.Final
, thanks for the fix.Ok, I understand now this issue better, thanks for the reproducer. The issue the other PR fixed is actually different. I have created https://github.com/Apicurio/apicurio-registry/pull/2775 that actually solves this issue, thanks!