Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
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:
- 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:
// 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; }