首页 > 解决方案 > 使用对象的键验证属性值是否存在

问题描述

聪明的人群,

我已经有一个有效的 JSON Schema (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.....",
    ...
  }
}

我需要的是:

属性依赖关系很好,但似乎不能满足我的需求。

任何的想法?


而且这个问题不是重复的,因为我事先不知道这些值。

标签: jsonschema

解决方案


对不起。您不能在 JSON 模式中执行此操作。您不能引用架构中的数据。


推荐阅读