4

我不确定 JSON Schema“描述”字段的用途是什么。该字段是否用作评论空间?该字段是否用作 ID?

{
    "id": "http://www.noodle.org/entry-schema#",
    "schema": "http://json-schema.org/draft-04/schema#",
    "description": "schema for online courses",
    "type": "object",
    "properties": {
        "institution": {
            "type": "object",
           "$ref" : "#/definitions/institution" 
        },
        "person": {
            "type": "object",
            "items": {
                "type": "object",
                "$ref": "#/definitions/person"
            }   
    "definitions": {        
        "institution": {
            "description": "University",
            "type": "object",
            "properties": {
                "name":{"type":"string"},
                "url":{
                    "format": "uri",
                    "type": "string"
                },
                "descriptionofinstitution":{"type":"string"},
                "location": {
                    "description": "location",
                "type": "string",
                "required": true
                }
        }

}

4

2 回答 2

18

根据 JSON-Schema 规范(http://json-schema.org/latest/json-schema-validation.html#anchor98),“描述”(和“标题”)字段的目的是装饰用户与有关此用户界面生成的数据的信息的界面。标题最好是简短的,而描述将提供有关此模式描述的实例的目的的解释。

于 2013-07-19T13:05:58.493 回答
1

如果id不够的话,可能是一些额外的解释,以增强对特定条目的了解。当然它不会影响代码作为代码本身的行为

于 2013-06-21T15:08:11.897 回答