I have two schema file
First is position.avsc
{
"type":"enum", "name": "Position", "namespace": "avro.examples.baseball",
"symbols": ["P", "C", "B1", "B2", "B3", "SS", "LF", "CF", "RF", "DH"]
}
Second is player.avsc
{
"type":"record", "name":"Player", "namespace": "avro.examples.baseball",
"fields": [
{"name": "number", "type": "int"},
{"name": "first_name", "type": "string"},
{"name": "last_name", "type": "string"},
{"name": "position", "type": {"type": "array", "items": "avro.examples.baseball.Position"} }
]
}
I can import these schemas in avdl
@namespace("avro.examples.baseball")
protocol Baseball {
import schema "position.avsc";
import schema "player.avsc";
}
But I want to define above protocol in json and import those schemas in protocol file. This will be helpful for reusability of schema
Avro idl schema can be specified with two type of files
In case of avpr file, we can not import external schema. All required schemas must present in same file.
For avdl , we can import external schemas from avsc file.
I have verified this for avro 1.7.7
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With