I have a use case where we define custom user data type like CustomDate, CustomBigDecimal etc, these are there in one avsc file, let say datatype.avsc Now we create another main avro file let say main.avsc which uses this file file
for eg
[{
"namespace": "com.test.avro.generated",
"type": "record",
"name": "Model",
"fields":
[
{
"name" : "CreatedDate",
"value": "CustomDate" //This data type is defined in ref.avsc
}
]
}]
How do I get the schema of main.avsc as I can only specify one file name in parser
Schema schema = new Schema.Parser().parse(mainFile);
How can I specify that it should use ref.avsc to get dependent types?
If were to do it outside application i would have done it as below
java -jar avro-tools-1.9.1.jar compile schema ref.avsc main.avsc output
I same think i want to achieve programatically