如何在 avro 模式中创建包含字符串数组的对象?
How to create object that contains array of string in avro schema?
使用字符串数组为对象创建 avro 模式的正确方法是什么?
我正在尝试根据官方文档为具有字符串数组的对象创建 avro 模式?但是我得到了错误。
https://avro.apache.org/docs/1.8.1/spec.html
[ERROR] 无法执行目标 org.apache.avro:avro-maven-plugin:1.8.2:schema(默认)项目电子邮件:目标的执行默认值 org.apache.avro:avro-maven- plugin:1.8.2:schema failed: "array" 不是定义的名称。 "parameters" 字段的类型必须是定义的名称或 {"type": ...} 表达式。 -> [帮助 1]
为什么我的架构不正确?
[
{
"type": "record",
"namespace": "com.example",
"name": "Topic",
"fields": [
{ "name": "subject", "type": "string" },
{ "name": "parameters", "type": "array", "items": "string" }
]
}
]
认为这应该可行:
{
"name":"parameters",
"type": {
"type": "array",
"items": "string"
}
}
使用字符串数组为对象创建 avro 模式的正确方法是什么?
我正在尝试根据官方文档为具有字符串数组的对象创建 avro 模式?但是我得到了错误。
https://avro.apache.org/docs/1.8.1/spec.html
[ERROR] 无法执行目标 org.apache.avro:avro-maven-plugin:1.8.2:schema(默认)项目电子邮件:目标的执行默认值 org.apache.avro:avro-maven- plugin:1.8.2:schema failed: "array" 不是定义的名称。 "parameters" 字段的类型必须是定义的名称或 {"type": ...} 表达式。 -> [帮助 1]
为什么我的架构不正确?
[
{
"type": "record",
"namespace": "com.example",
"name": "Topic",
"fields": [
{ "name": "subject", "type": "string" },
{ "name": "parameters", "type": "array", "items": "string" }
]
}
]
认为这应该可行:
{
"name":"parameters",
"type": {
"type": "array",
"items": "string"
}
}