In general you don't need to wrap an unnamed complex type (map, array, union) 
in a record.

Some language APIs might not support these 'naked' types with the same level of 
ease that they support named ones.

Note in your schema below the "name" field -- "mapping" is completely ignored.  
Maps don't have names.

Other 'nameless' schemas are ones with a single intrinsic data type, like:

{ "type": "int" }


On 4/13/11 9:52 AM, "Weishung Chung" 
<[email protected]<mailto:[email protected]>> wrote:

Hello,

I have a question about Avro schema. Does the map type need to be embedded in a 
record? Could I have a schema like this without embedding the map in a record?

{
    "name": "mapping",
    "type": "map",
    "values":{
        "type":"record",
        "name":"hi",
        "fields":[
            {"name":"a","type":"string"},
            {"name":"b","type":"string"}
        ]
    }
}


Thank you

Reply via email to