@namespace("com.myproject")
protocol EventsProtocol {
record Man {
union { null, int } age;
union { null, string } name;
}
record Events {
string operation;
union { Man , null } man;
string timestamp;
}
}
avdl 多个协议
avsc 单个协议
{
"namespace":"com.myProject",
"type": "record",
"name": "MyEvents",
"doc": "My Events",
"fields": [
{
"name": "date",
"type": "string",
"doc": "date for events"
},
{
"name": "changes",
"type": {
"type": "array",
"items": {
"type": "record",
"name": "Man",
"fields": [
{ "name": "englishName", "type": "string" },
{ "name": "age", "type": "int" }
],
"doc": "Each man contains englishName and age"
}
},
"doc": "Man change list"
}
]
}