Patrick Wolleb created AVRO-3940: ------------------------------------ Summary: Failed to generate Java classes from several .avsc files containing same type Key: AVRO-3940 URL: https://issues.apache.org/jira/browse/AVRO-3940 Project: Apache Avro Issue Type: Bug Components: java Affects Versions: 1.11.3 Reporter: Patrick Wolleb Attachments: avsc-java-generator.zip, programmes-key.avsc, programmes-value.avsc
I am unable to generate Java classes from two .avsc files that both contain an identical record. I get a SchemaParseException: Can't redefine: com.example.domain.Provenance. * schema 1: [^programmes-key.avsc] * schema 2: [^programmes-value.avsc] I am not sure I understand the generator correctly since the the check to throw the exception in this case was recently added for the code generation via an Open API yaml https://issues.apache.org/jira/browse/AVRO-3805 Here the commit in question: [https://github.com/apache/avro/blame/c60e1a0cbf98412b1c65cb2d9029d32077d85574/lang/java/avro/src/main/java/org/apache/avro/Schema.java#L1753] [~clesaec] *Steps to reproduce:* # Download [^avsc-java-generator.zip] # Unzip and change into directory # Run ./gradlew quarkusDev --stacktrace # Observe SchemaParseException in output *Expected:* The generator should accept the same name and overwrite the output.{*}{*} *Result:* {code:java} Caused by: org.apache.avro.SchemaParseException: Can't redefine: com.example.domain.Provenance at org.apache.avro.Schema$Names.put(Schema.java:1604) at org.apache.avro.Schema$Names.add(Schema.java:1598) at org.apache.avro.Schema.parse(Schema.java:1774) at org.apache.avro.Schema.parse(Schema.java:1736) at org.apache.avro.Schema$Parser.parse(Schema.java:1471) at org.apache.avro.Schema$Parser.parse(Schema.java:1433) {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)