Hello. I am currently using Avro IDL (1.10.1). I have experience using the import command within the IDL, to resue common records. I always do the import like this:
// common.avdl file
@namespace("my.namespace.avro")
protocol CommonProtocol {
record Common {
string uuid;
}
}
// specific.avdl file
@namespace("my.namespace.avro")
protocol SpecificProtocol {
import idl "common.avdl";
record Specific {
Common common;
}
}
So, to access the uuid from the Specific.java
→ specific.getCommon().getUuid() (One-level deep)
Question:
Is there a way to inherit ROOT LEVEL values into a schema?
For example, I would like Specific to have a root level, uuid.
// specific.avdl file
@namespace("my.namespace.avro")
protocol SpecificProtocol {
record Specific {
String uuid; --> But I would like this to come from an inherited file
}
}
Why?
I am making many protocols and I’d like to enforce that certain value are present at the ROOT of all schemas; they are important and highly used values in the message. The way I am doing it, anything I inherit is always buried one-level deep in another class. Because of this, many are opting to simply copy/paste all root elements into multiple schemas; and just skip using the import approach in this case.
Thanks for any advice.