On 03/11/2011 04:45 PM, Scott Carey wrote:
> One of the .avsc file I use is an array of 7 top level JSon objects,
> starting with:
>
> [
> {"name": "com.rr.avro.Fixed16", "type": "fixed", "size":16},
> {"name": "com.rr.avro.Fixed4", "type": "fixed", "size":4},
> {"name": "com.rr.avro.Variable", "type": "record", "fields": [
> {"name": "variableId", "type": "int"},
> {"name": "selectedValue", "type": "string"}]
> },
>
> . . .
>
> And it works fine that way with the Java specific compiler. I avoid
> having to define items the first time they are encountered this way.
> Perhaps they won't with other languages?
You're right, this will work with the specific compiler to generate
multiple classes from a single .avsc file. I hadn't realized that! The
schema of the file is a union of the types within the brackets.
I have no idea whether it would work with other Avro compilers, but it
is a valid union schema and should work in all implementations as that.
Doug