作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想用 oneOf
仅在 xyType
的值上不同的模式属性(property)。我想要其中两个:一个是 xyType
设置为 "1"
第二个在哪里xyType
是 任何其他值 .这可以使用 json 模式完成吗?
"oneOf": [
{
"properties": {
"xyType": "enum": ["1"],
"whatever" : "string"
},
"type": "object"
},
{
"properties": {
"xyType": "enum": [], /// NOT "1"?
"whatever" : "string"
},
"type": "object"
}
]
最佳答案
有一个 not
运算符,以及 enum
关键字,你可以一起使用它们,比如
{
"not": {
"enum": ["1"]
}
}
关于Json 架构 "not in"枚举类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31610354/
我是一名优秀的程序员,十分优秀!