【发布时间】:2021-02-02 14:02:13
【问题描述】:
我想检查“obj”是否包含至少一个值“test”。但是“obj”中的键是随机的。
json:
{
"title": "doc",
"obj": {
"xxxx-random": "test",
"zzzz-random": "wol"
}
}
我的想法是使用 oneOf,但它没有按我的预期工作:
架构 Json:
{
"properties": {
"title": {
"type": "string"
},
"obj": {
"type": "object",
"oneOf": [
{
"contains": {
"properties": {
"type": "string",
"desc":"test"
}
}
}
]
}
}
}
【问题讨论】:
-
contains仅适用于数组。
标签: json jsonschema json-schema-validator