Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3655

Avro Tools idl2schemata does not check for duplicate enum or record names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.10.2, 1.11.1
    • None
    • tools
    • None
    • Tested on macOS 12.6

    Description

      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...

      @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; } 
      }

      ...the generated AVSC will show (I'm having some trouble with the formatting here so I'll include an image and the text):

       

       

      {  "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" ]        }      } ]    }  } ]}
       

      Here, the first enumeration is ignored, as is the first definition of address, as provided in the AVDL file.

       

      Attachments

        1. image-2022-10-25-16-27-54-778.png
          143 kB
          Timothy Dimo

        Activity

          People

            Unassigned Unassigned
            Timothy Dimo Timothy Dimo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: