相关疑难解决方法(0)

如何(如果可能的话)在JSON模式中定义一个数组项属性应该是唯一的?

鉴于以下JSON模式是有可能表明,"名称"属性应是唯一的(即不应该有两个项目具有相同的"名"的"元素"阵列英寸

{
  "root": {
    "type": "object",
    "properties": {
      "elements": {
        "type": "array",
        "minItems": 1,
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "title": "Element Name",
              "minLength": 3,
            },
            "url": {
              "type": "string",
              "title": "Some URL"
            }
          }
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我尝试使用uniqueItems关键字,但它似乎是为简单的值列表而设计的.

json jsonschema

25
推荐指数
3
解决办法
1万
查看次数

标签 统计

json ×1

jsonschema ×1