avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Carey <sc...@richrelevance.com>
Subject Re: Declaring array item types inline
Date Mon, 12 Jul 2010 20:59:32 GMT
Yes, you can declare types as they are encountered.


On Jul 12, 2010, at 12:39 PM, David Rosenstrauch wrote:

> Is it possible to declare array item types inline?  i.e., instead of this:
> 
> [
>   {
>     "type": "record",
>     "name": "SubRecord",
>     "fields" : [
>       {"name": "field1", "type": "int"},
>       {"name": "field2", "type": "int"}
>     ]
>   },
>   {
>     "type": "record",
>     "name": "TestRecord",
>     "fields" : [
>       {
>         "name": "SubRecords",
>         "type": {
>           "type": "array",
>           "items": "SubRecord"
>         }
>       }
>     ]
>   }
> ]
> 
> Would it be possible to do something like this:
> 
> {
>   "type": "record",
>   "name": "TestRecord",
>   "fields" : [
>     {
>       "name": "SubRecords",
>       "type": {
>         "type": "array",
>         "items": {
>           "type": "record",
>           "name": "SubRecord",
>           "fields" : [
>             {"name": "field1", "type": "int"},
>             {"name": "field2", "type": "int"}
>           ]
>         }
>       }
>     }
>   ]
> }
> 
> It's quite a bit more clunky to do the former.
> 
> Thanks,
> 
> DR


Mime
View raw message