使用对象的键验证属性值是否存在 [英] Validating that a property value exists withing the keys of an object
本文介绍了使用对象的键验证属性值是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
智者,
我已经有了一个有效的JSON模式(v0.7)来验证我的数据。这是一个有效的JSON示例:
{
"people": [
{ "id": 1, "name": "bob" },
...
]
}
现在我需要在其中添加一串字符串:
{
"people": [
{ "id": 1, "name": "bob", "appears_in": "long_string_id_1" },
{ "id": 2, "name": "ann", "appears_in": "long_string_id_1" }
...
],
"long_strings": {
"long_string_id_1": "blah blah blah.....",
...
}
}
我需要的是:
- 键
appears_in
的值必须是long_strings
对象的键 - (可选)
long_strings
对象的键必须用作appears_in
键的On中的值
Property dependencies不错,但似乎不能满足我的需求。
有什么想法吗?
和this question不是重复的,因为我事先不知道这些值。
推荐答案
抱歉。您不能在JSON模式中这样做。您不能引用架构中的数据。
这篇关于使用对象的键验证属性值是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文