【问题标题】:Convert JSON Schema Format转换 JSON 模式格式
【发布时间】:2016-02-24 10:56:33
【问题描述】:

我有这样的 json 架构定义:

更新:基本上是它的草稿03格式:http://json-schema.org/draft-03/schema#

{
    "$schema": "http://json-schema.org/draft-03/schema",
    "product": {
        "name": {
            "required": true,
            "type": "string"
        },
        "description": {
            "required": true,
            "type": "string"
        }
    },
    "type": "object"
}

但我需要这种格式(标准 json 模式结构),即草稿 04 格式(http://json-schema.org/draft-04/schema#

{
    "type": "object",
    "properties": {
        "product": {
            "type": "object",
            "required": [
                "name",
                "description"
            ],
            "properties": {
                "name": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                }
            }
        }
    },
    "required": [
        "product"
    ]
}

是否有任何转换器可以将上述格式转换为这种格式?我只是不想手动操作,这可能容易出错。

【问题讨论】:

    标签: javascript json jsonschema


    【解决方案1】:

    我没用过,所以不能亲自担保,但是有转换工具。

    https://github.com/geraintluff/json-schema-compatibility

    【讨论】:

      猜你喜欢
      • 2018-07-17
      • 2019-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多