簡體   English   中英

轉換JSON模式格式

[英]Convert JSON Schema Format

我有這樣的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"
    ]
}

是否有轉換器將上述格式轉換為這種格式? 我只是不想手動執行,這可能容易出錯。

我沒有使用過它,所以我不能親自擔保它,但是有轉換工具。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM