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

Extend the IDL syntax to serve as a .avsc equivalent as well

    XMLWordPrintableJSON

Details

    Description

      The Avro IDL format is not widely adopted, as it yields a protocol (most people use schemas only). To remedy this, I propose to extend the IDL syntax.

      Future IDL files will have two options:

      1. Use the existing syntax to define a protocol
        Parsing such a file yields a protocol and a collection of named schemas (that can also be found in the protocol object)
      2. Use the syntax below to define a schema
        Parsing such a file yields a collection of named schemas and optionally a "main schema", which can be a named or an anonymous schema.

      Proposed syntax:

      // Optional: the default namespace for the whole file (defaults to the null namespace if omitted)
      // (in the existing syntax, the namespace of the protocol has the same function)
      namespace my.name.space;
      
      // Optional: a main schema to parse the file as a .avsc equivalent
      schema array<Message>;
      
      // Below here are imports and named schemas in any order
      
      /* Import rules for the new syntax:
      - the namespace of the imported named types is determined by the imported file
        (same as for the existing syntax)
      - when importing idl or protocol files, only the named schemas are imported
        (as this syntax supports only these)
      */
      import idl "common.avdl";
      
      /**
       * A message to communicate.
       */
      record Message {
        array<Header> headers;
        string? title = null; // Idea: add null as default value, unless there's an explicit default value
        string message;
        timestamp_ms sendTime;
      }
      

       

      Attachments

        Issue Links

          Activity

            People

              opwvhk Oscar Westra van Holthe - Kind
              opwvhk Oscar Westra van Holthe - Kind
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m