我不确定JSON Schema“description”字段的用途是什么。该字段是否可作为评论的空间?该字段是否作为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
}
}
}
答案 0 :(得分:16)
根据JSON-Schema规范(http://json-schema.org/latest/json-schema-validation.html#anchor98),“描述”(和“标题”)字段的目的是用一个用户界面装饰该信息,该信息与该用户界面产生的数据有关。标题最好是简短的,而描述将提供有关此模式描述的实例目的的解释。
答案 1 :(得分:1)
如果id不够,可能还需要一些额外的解释,以增强有关特定条目的知识。当然,它不会影响代码本身的行为