簡體   English   中英

如何在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

[錯誤]無法在項目電子郵件上執行目標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" }
    ]    
  }

]

認為這應該工作:

{ 
  "name":"parameters",  
  "type": { 
      "type": "array",
      "items": "string"
   } 
} 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM