验证对象键中是否存在 属性 值
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
键 中的值
Property dependencies 很好,但似乎不能满足我的需求。
有什么想法吗?
和不是重复的,因为我事先不知道这些值。
对不起。您不能在 JSON 架构中执行此操作。您不能在架构中引用数据。
智者众,
我已经有一个可用的 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
键 中的值
Property dependencies 很好,但似乎不能满足我的需求。
有什么想法吗?
和
对不起。您不能在 JSON 架构中执行此操作。您不能在架构中引用数据。