如何使用JAXB支持JSON模式oneOf定义?

时间:2014-10-27 15:55:57

标签: json jaxb jsonschema

我获得了一个使用" oneOf"的JSON模式。如下所示,有没有办法定义XSD来生成JAXB对象,这可以支持这个" oneOf" JSON数据编组和解组的定义?我正在使用杰克逊。

"Source": {
        "description": "Indicates the source.",
        "type": "object",
        "oneOf": [
            {
                "properties": {
                    "Source1": {
                        "description": "Indicates the source 1.",
                        "type": "string"
                    }
                },
                "additionalProperties": false
            },
            {
                "properties": {
                    "Source2": {
                        "description": "Indicates the source 2",
                        "type": "object",
                        "properties": {
                            "field1": {
                                "description": "filed 1 for source 1",
                                "type": "string"
                            },
                            "field2": {
                                "description": "field 2 for source 2",
                                "type": "string"
                            }
                        }
                    }
                },
                "additionalProperties": false
            }
       ]
   } 

0 个答案:

没有答案
相关问题