Json架构"不在"枚举类型?

Fra*_*čik 5 validation schema json jsonschema

我想使用oneOf只有xyType属性值不同的模式.我想要两个:一个xyType设置为"1",另一个设置xyType任何其他值.可以使用json模式完成吗?

"oneOf": [
    {
        "properties": {
            "xyType": "enum": ["1"],
            "whatever" : "string"
        },
        "type": "object"
    },
    {
        "properties": {
            "xyType": "enum": [], /// NOT "1"?
            "whatever" : "string"
        },
        "type": "object"
    }
]
Run Code Online (Sandbox Code Playgroud)

clo*_*eet 12

有一个not运算符和enum关键字,你可以一起使用它们,比如

{
    "not": {
        "enum": ["1"]
    }
}
Run Code Online (Sandbox Code Playgroud)