使用引用验证Json模式

时间:2018-08-13 06:45:10

标签: json swagger

是否有任何可用于验证swagger spec json的swagger库。例如,我将以下json作为规范,如何验证此规范?要检查所有引用是否都有效的json一起解析。

{
    "$schema": "http://json-schema.org/draft-04/schema#",

    "definitions": {
    "address": {
      "type": "object",
      "properties": {
        "street_address": { "type": "string" },
        "city":           { "type": "string" },
        "state":          { "type": "string" }
      },
      "required": ["street_address", "city", "state"]
    }
  },

  "type": "object",

  "properties": {
    "billing_address": { "$ref": "#/definitions/address" },
    "shipping_address": { "$ref": "#/definitions/address" }
  }
}

0 个答案:

没有答案