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

XSD to Avro Conversion - SchemaParseException: can't redefine roleNotesGroup

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Not A Bug
    • 1.9.2
    • None
    • java
    • None

    Description

      I am working on converting xsd to avro schema
       
      XSD snippet:

       
      <xsd:element name="roleNotesGroup"><xsd:complexType><xsd:sequence><xsd:element name="roleNotesSubGroup" minOccurs="0" maxOccurs="unbounded"><xsd:complexType><xsd:sequence><xsd:element name="roleNotesGroup" minOccurs="0" maxOccurs="unbounded"><xsd:complexType><xsd:sequence><xsd:element name="roleNotes" type="xsd:string" minOccurs="0"><xsd:annotation><xsd:appinfo><source application="CUSTOMER" field="REL.CUSTOMER"/><fieldPiiAttribute value="INDIRECT"/><fieldPiiPurpose value="LEGITIMATE"/><fieldPiiEraseOption value="NO.ACTION"/><fieldPiiAccessibility value="ACCESS PORTABLE"/></xsd:appinfo></xsd:annotation></xsd:element></xsd:sequence><xsd:attribute name="index" type="xsd:integer"/></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="index" type="xsd:integer"/></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="index" type="xsd:integer"/></xsd:complexType></xsd:element>

      I am using
      Schema schema = Schema.createRecord(name, null, null, false);
      to create a avro schema record. In the above xsd roleNotesGroup is a child of roleNotesSubGroup which is a child of roleNotesGroup. I can recursively obtain the avro schema till roleNotesSubGroup which is then converted to list.

       
      List<Schema.Field> is obtained recursively.

      Now the problem is when i try to add the Fields formed to the head element roleNotesGroup using

       
      Schema schema = Schema.createRecord(name, null, null, false);

      schema.setFields(schemaFields);

      I get the following error : SchemaParseException: can't redefine roleNotesGroup

       

      Is there any restriction in avro or avro conversion that the same names should not occur again?

      Attachments

        Activity

          People

            Unassigned Unassigned
            vnikeshh Nikeshh Baskaran
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: