Timothy Dimo created AVRO-3655:
----------------------------------

             Summary: Avro Tools idl2schemata does not check for duplicate enum 
or record names
                 Key: AVRO-3655
                 URL: https://issues.apache.org/jira/browse/AVRO-3655
             Project: Apache Avro
          Issue Type: Bug
          Components: tools
    Affects Versions: 1.11.1, 1.10.2
            Reporter: Timothy Dimo
         Attachments: image-2022-10-25-16-27-54-778.png

When creating an Avro IDL file, if the developer adds multiple enumerations 
and/or records with the same name, no error or warning is shown when generating 
the AVSC file via the *avro-tools* +idl2schemata+ operation. For example, given 
the following AVDL file...
{code:java}
@namespace("yournamespace") 
protocol ExampleSchema
{ 
   enum typeCode{AA,BB,CC,DD} 
   enum typeCode{ZZ,YY,XX,VV}   
   record name{ typeCode typeCode; } 
   record address{ typeCode typeCode; } 
   record address{ string someName; } 
   record message{ address address; name name; } 
}{code}
...the generated AVSC will show (I'm having some trouble with the formatting 
here so I'll include an image and the text):

!image-2022-10-25-16-27-54-778.png|width=382,height=585!

 

 
{code:java}
{  "type" : "record",  "name" : "message",  "namespace" : "yournamespace",  
"fields" : [ {    "name" : "address",    "type" : {      "type" : "record",     
 "name" : "address",      "fields" : [ {        "name" : "someName",        
"type" : "string"      } ]    }  }, {    "name" : "name",    "type" : {      
"type" : "record",      "name" : "name",      "fields" : [ {        "name" : 
"typeCode",        "type" : {          "type" : "enum",          "name" : 
"typeCode",          "symbols" : [ "ZZ", "YY", "XX", "VV" ]        }      } ]   
 }  } ]}
 {code}
Here, the first enumeration is ignored, as is the first definition of address.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to