如何在avro模式中创建包含字符串数组的对象?

Yar*_*tys 2 java arrays maven avro

为具有字符串数组的对象创建avro模式的正确方法是什么?

我正在尝试根据官方文档创建具有字符串数组的对象的avro模式?但我得到了错误。

https://avro.apache.org/docs/1.8.1/spec.html

[错误]无法在项目电子邮件上执行目标org.apache.avro:avro-maven-plugin:1.8.2:schema(默认):目标org.apache.avro:avro-maven-plugin的执行默认值:1.8.2 :schema失败:“数组”不是定义的名称。“参数”字段的类型必须是定义的名称或{“ type”:...}表达式。-> [帮助1]

为什么我的架构不正确?

[
  {
    "type": "record",
    "namespace": "com.example",
    "name": "Topic",
    "fields": [
         { "name": "subject", "type": "string" },
         { "name": "parameters", "type": "array", "items": "string" }
    ]    
  }

]
Run Code Online (Sandbox Code Playgroud)

Jef*_*eff 5

认为这应该工作:

{ 
  "name":"parameters",  
  "type": { 
      "type": "array",
      "items": "string"
   } 
} 
Run Code Online (Sandbox Code Playgroud)