我们可以在 Confluent Platform Schema Registry 中使用 "oneOf" 吗?

Can we use "oneOf" in Confluent Platform Schema Registry?

我有一个用户余额变化的用例。我想将所有用户余额事件放在 1 个主题中。但是由于推荐奖金、获胜奖金、提款、存款等多个事件,用户余额正在发生变化。这可以通过像这样的嵌套记录来实现:

{
"name": "userBalance",
"type": "record",
"fields": [
       {
            "name": "cashDeposit",
            "type": 
                   {
                        "type" : "record",
                        "name" : "userCashDeposit",
                        "fields" : [
                            {"name": "id", "type": "long"},
                            {"name": "amount", "type": "float"}
                        ]
                    }
        },
        {
            "name": "cashWithdraw",
            "type": {
                        "type" : "record",
                        "name" : "userCashWithdraw",
                        "fields" : [
                            {"name": "id", "type": "long"},
                            {"name": "amount", "type": "float"}
                        ]
                    }
        }
    ]
}

但是这使得所有嵌套记录都按要求进行,而我想严格执行这些事件中的任何 事件中的任何一个 严格遵守该事件的记录. Avro 模式支持 "oneOf" 但我找不到 oneOf 在任何地方用于 Confluent Schema Registry 用例。有什么使用方法吗?

这可行:

{
"name": "userBalance",
"type": "record",
"fields": [
       {
            "name": "userBalance",
            "type": [
                   {
                        "type" : "record",
                        "name" : "userCashDeposit",
                        "fields" : [
                            {"name": "id", "type": "long"},
                            {"name": "amount", "type": "float"}
                        ]
                    },
                    {
                         "type" : "record",
                        "name" : "userCashWithdraw",
                        "fields" : [
                            {"name": "id", "type": "long"},
                            {"name": "amount", "type": "float"}
                        ]
                     }
             ]
        }
    ]
}