Avro Schema Использование ссылок в союзах?

Я пытаюсь использовать ссылки в схеме Avro для генерации POJO (используя avro-tools), но в итоге получаю no type ошибка

Ошибка полного стека:

Исключение в потоке "main" org.apache.avro.SchemaParseException: Нет типа: {"name":"userPreferences","namespace":"BLAH","fields":["BLAH.singlePreference","BLAH.multiPreference"]} в org.apache.avro.Schema.getRequiredText(Schema.java:1373) в org.apache.avro.Schema.parse(Schema.java:1232) в org.apache.avro.Schema.parse (Schema.java):1340) в org.apache.avro.Schema$Parser.parse(Schema.java:1032) в org.apache.avro.Schema$Parser.parse(Schema.java:997) в org.apache.avro.tool.SpecificCompilerTool.run(SpecificCompilerTool.java:92) в org.apache.avro.tool.Main.run(Main.java:87) в org.apache.avro.tool.Main.main(Main.java:76)

Пример файла avsc:

[
    {
        "name": "singlePreference", "type": "record",
        "namespace": "BLAH",
        "fields": [
            {"name": "answerId", "type": "string"},
            {"name": "id", "type": "string"},
            {"name": "dateCreated", "type": "string"},
            {"name": "lastUpdated", "type": "string"}
        ]
    },
    {
        "name": "multiPreference",
        "namespace": "BLAH", 
        "type": "array",
        "items": "BLAH.singlePreference"
    },
    {
        "name": "userPreferences",
        "namespace": "BLAH",
        "fields": ["BLAH.singlePreference", "BLAH.multiPreference"]
    }
]

мой userPreferences поле имеет тип union и может содержать singlePreferences, или же mutliPreferences (который в основном массив singlePreferences)

Что я могу сделать, чтобы сделать userPreference союза одиноких и multiPreferences?

0 ответов

Другие вопросы по тегам