我试图用这个Avro的shcemaAvro的模式格式异常 - “记录” 是不使用的Avro工具定义的名称
{
"namespace": "nothing",
"name": "myAvroSchema",
"type": "record",
"fields": [
{
"name": "checkInCustomerReference",
"type": "string"
},
{
"name": "customerContacts",
"type": "record",
"fields": [
{
"name": "customerEmail",
"type": "array",
"items": {
"type": "record",
"name": "customerEmail_element",
"fields": [
{
"name": "emailAddress",
"type": "string"
},
{
"name": "typeOfEmail",
"type": "string"
}
]
}
},
{
"name": "customerPhone",
"type": "array",
"items": {
"type": "record",
"name": "customerPhone_element",
"fields": [
{
"name": "fullContactNumber",
"type": "string"
},
{
"name": "ISDCode",
"type": "string"
}
]
}
},
{
"name": "DonotAskIndicator",
"type": "record",
"fields": [
{
"name": "donotAskDetails",
"type": "string"
}
]
}
]
},
{
"name": "somethingElseToCheck",
"type": "string"
}
]
}
要生成和Avro的文件:
avro-tools fromjson --schema-file myAvroSchema.avsc myJson.json > myAvroData.avro
不过,我收到以下错误消息:在线程“主要” org.apache.avro.SchemaParseException
例外: “记录”是不是去罚款的名字。 “customerContacts” 字段的类型必须是定义的名称或{“type”:...}表达式。
谁能告诉我为什么记录没有被识别为一个定义的名称?