假設我正在編寫JSON模式。 「類型」是「對象」。在對象的「屬性」中包含名爲「description」的屬性是否合法?我問,因爲「description」是JSON模式中的關鍵字。「description」是JSON模式中對象的有效「屬性」嗎?
例如:在這個例子中,我提出了一個簡單的JSON對象表示葡萄酒年份的模式。我指定了四個屬性:三個必需屬性(房子,年份和葡萄品種)和一個可選屬性,名爲「描述」。
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Wine vintage",
"description": "JSON schema for wine vintages",
"type": "object",
"properties": {
"house": {
"description": "The name of the house that made the wine",
"type": "string"
},
"year": {
"description": "The year in which the wine was made",
"type": "integer"
},
"varieties": {
"description": "The grape varieties used to make the wine",
"type": "array",
"items": {
"type": "string",
"minItems": 1,
"uniqueItems": true
}
}
"description": {
"description": "A description of the wine's taste and character; a tasting note",
"type": "string"
}
},
"required": ["house", "year", "varieties"]
}