【问题标题】:Verifying JSON schema for uri and string together?一起验证 uri 和字符串的 JSON 模式?
【发布时间】:2017-04-12 17:52:26
【问题描述】:

我在 JSON 模式下验证两个单独的 JSON 响应,它们是相同的,但只有一个区别是一个返回 'system' 作为 uri 格式的字符串,其他返回纯字符串,这导致我的第二个测试用例失败,因为第二个响应它还查找 uri 格式的字符串。 如何在我的架构中解决这个问题?

{
  "id": "/coding",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "system": {
        "type": "string"
        "format": "uri"
      }
    }
  }
}

【问题讨论】:

    标签: json jsonschema web-api-testing


    【解决方案1】:

    您可以从架构中删除 "format": "uri"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-10
      • 1970-01-01
      • 2020-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多