On 03/11/2011 10:28 AM, Scott Carey wrote:
> You need an array of JSON objects in the avsc file, something like:
An .avsc file can only contain a single top-level JSON object, not an
array. So, if you wanted to define this in an .avsc file then you'd
need to use a nested definition, like:
------------
{
"namespace": "def.note.pad",
"type": "record",
"name": "Page",
"doc": "Object definition of a Page composed of alphabet",
"fields": [
{
"name": "letter",
"type": {
"type": "enum",
"namespace": "def.al.pha.bet",
"name": "KnownLetters",
"doc": "Specifies known types of letters",
"symbols": ["A", "B", "C", "D", "E"]
}
}
]
}
-------------
Or you can use a .avpr file to define dependent types, like:
-------------
{ "protocol": "Foo",
"namespace": "def.al.pha.bet",
"types": [
{
"type": "enum",
"name": "KnownLetters",
"doc": "Specifies known types of letters",
"symbols": ["A", "B", "C", "D", "E"]
},
{
"namespace": "def.note.pad",
"type": "record",
"name": "Page",
"doc": "Object definition of a Page composed of alphabet",
"fields": [
{"name": "letter", "type": "KnownLetters"}
]
}
]
}
------------
Doug