avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Rosenstrauch <dar...@darose.net>
Subject Re: Declaring array item types inline
Date Mon, 12 Jul 2010 21:04:20 GMT
Yes, apparently so.  I was getting a different parse error, and thought 
this was disallowed.

Sorry for the noise.

DR

On 07/12/2010 04:59 PM, Scott Carey wrote:
> 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