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

Transform a single .avdl into many .avsc

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.4
    • Fix Version/s: 1.7.5
    • Component/s: None
    • Labels:
      None

      Description

      The syntax of avro IDL is attractive in order to build more readable and thus maintainable avro schemadata, even when not using protocols. However, there is currently no way of extracting the types of a schema (avdl) into multiple independent schemata (avsc). Here is a proposal.

      1. AVRO-1337-1.diff
        6 kB
        Bertrand Dechoux
      2. AVRO-1337-0.diff
        6 kB
        Bertrand Dechoux

        Activity

        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in AvroJava #388 (See https://builds.apache.org/job/AvroJava/388/)
        AVRO-1337. Java: Add a command line tool to generate schema files from a protocol. Contributed by Bertrand Dechoux. (cutting: rev 1511449)

        • /avro/trunk/CHANGES.txt
        • /avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/IdlToSchemataTool.java
        • /avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java
        • /avro/trunk/lang/java/tools/src/test/idl
        • /avro/trunk/lang/java/tools/src/test/idl/protocol.avdl
        • /avro/trunk/lang/java/tools/src/test/java/org/apache/avro/tool/TestIdlToSchemataTool.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in AvroJava #388 (See https://builds.apache.org/job/AvroJava/388/ ) AVRO-1337 . Java: Add a command line tool to generate schema files from a protocol. Contributed by Bertrand Dechoux. (cutting: rev 1511449) /avro/trunk/CHANGES.txt /avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/IdlToSchemataTool.java /avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java /avro/trunk/lang/java/tools/src/test/idl /avro/trunk/lang/java/tools/src/test/idl/protocol.avdl /avro/trunk/lang/java/tools/src/test/java/org/apache/avro/tool/TestIdlToSchemataTool.java
        Hide
        cutting Doug Cutting added a comment -

        I committed this. Thanks, Bertrand!

        Show
        cutting Doug Cutting added a comment - I committed this. Thanks, Bertrand!
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1511449 from Doug Cutting in branch 'avro/trunk'
        [ https://svn.apache.org/r1511449 ]

        AVRO-1337. Java: Add a command line tool to generate schema files from a protocol. Contributed by Bertrand Dechoux.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1511449 from Doug Cutting in branch 'avro/trunk' [ https://svn.apache.org/r1511449 ] AVRO-1337 . Java: Add a command line tool to generate schema files from a protocol. Contributed by Bertrand Dechoux.
        Hide
        bdechoux Bertrand Dechoux added a comment -

        See attachment for updated patch.

        Show
        bdechoux Bertrand Dechoux added a comment - See attachment for updated patch.
        Hide
        bdechoux Bertrand Dechoux added a comment -

        Thanks, I didn't see your answer.

        • I really didn't know how to name it. I wanted something simple to type/remember. I will use idl2schemata then.
        • I forgot to update Main.java. I will do it too.
        • I know about indentations and tried to respect the format rules. I will check again.

        Thanks for the feedback.

        Show
        bdechoux Bertrand Dechoux added a comment - Thanks, I didn't see your answer. I really didn't know how to name it. I wanted something simple to type/remember. I will use idl2schemata then. I forgot to update Main.java. I will do it too. I know about indentations and tried to respect the format rules. I will check again. Thanks for the feedback.
        Hide
        cutting Doug Cutting added a comment -

        Generally looks good to me.

        A few minor things:

        • the tool might be better named idl2schemata or avdl2avsc
        • we should update Main.java, adding this tool there
        • indentation should be consistently two spaces per level, with <80 column lines

        Thanks!

        Show
        cutting Doug Cutting added a comment - Generally looks good to me. A few minor things: the tool might be better named idl2schemata or avdl2avsc we should update Main.java, adding this tool there indentation should be consistently two spaces per level, with <80 column lines Thanks!
        Hide
        bdechoux Bertrand Dechoux added a comment -

        Proposal.
        Limitations :

        • does not handle IO errors because there is no smart Exception strategy here (it fails if it fails)
        • assumes that the name of the type is unique (which might not be the case and that's why namespace exist but it should be a good practice inside a single protocol anyway)
        Show
        bdechoux Bertrand Dechoux added a comment - Proposal. Limitations : does not handle IO errors because there is no smart Exception strategy here (it fails if it fails) assumes that the name of the type is unique (which might not be the case and that's why namespace exist but it should be a good practice inside a single protocol anyway)

          People

          • Assignee:
            bdechoux Bertrand Dechoux
            Reporter:
            bdechoux Bertrand Dechoux
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development