Oscar Westra van Holthe - Kind created AVRO-3404:
----------------------------------------------------

             Summary: Extend the IDL syntax to serve as a .avsc equivalent as 
well
                 Key: AVRO-3404
                 URL: https://issues.apache.org/jira/browse/AVRO-3404
             Project: Apache Avro
          Issue Type: Improvement
          Components: build, dependencies, java
            Reporter: Oscar Westra van Holthe - Kind
            Assignee: Oscar Westra van Holthe - Kind


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:
 # 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)
 # 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:
{code:none}
// Required: the default namespace for the whole file
// (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;
}
{code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to