Hi guys. I'm having trouble declaring a record with an array of records in Python.

Declaring an array of records works just fine:

 print parse('{"name": "stuffs", "type": "array", "items": {"name": "whatever", "type": "record", "fields": 
[{"name": "a", "type": "string"}]}}')
{"items": {"fields": [{"type": "string", "name": "a"}], "type": "record", "name": "whatever"}, 
"type": "array"}


But putting that as a field in a record gives me the following:

 print parse('{"name": "outerrecord", "type": "record", "fields": [{"name": "stuffs", "type": "array", "items": {"name": "whatever", 
"type": "record", "fields": [{"name": "a", "type": "string"}]}}]}')
Traceback (most recent call last):
  File "<stdin>", line 1, in<module>
  File "/home/radix/lib/python/avro-1.4.1-py2.6.egg/avro/schema.py", line 708, 
in parse
    return make_avsc_object(json_data, names)
  File "/home/radix/lib/python/avro-1.4.1-py2.6.egg/avro/schema.py", line 664, 
in make_avsc_object
    return RecordSchema(name, namespace, fields, names, type)
  File "/home/radix/lib/python/avro-1.4.1-py2.6.egg/avro/schema.py", line 600, 
in __init__
    field_objects = RecordSchema.make_field_objects(fields, names)
  File "/home/radix/lib/python/avro-1.4.1-py2.6.egg/avro/schema.py", line 568, 
in make_field_objects
    new_field = Field(type, name, has_default, default, order, names)
  File "/home/radix/lib/python/avro-1.4.1-py2.6.egg/avro/schema.py", line 310, 
in __init__
    raise SchemaParseException(fail_msg)
avro.schema.SchemaParseException: Type property "array" not a valid Avro 
schema: Could not make an Avro Schema object from array.


Any help? Is this just a bug in the python implementation? Is my syntax correct?

--
Christopher Armstrong, id Software

Reply via email to