1
以下是我的json模式的部分版本。我目前正在使用json-schema
寶石驗證以下(部分)架構:JSON模式驗證失敗...「該屬性不包含必需屬性」
{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"botSettings": {
"type": "object",
"properties": {
"welcomeMessage": {
"type": "object",
"required": ["body"],
"properties": {
"title": { "type": "string" },
"body": { "type": "string" },
"image": { "#ref": "#/definitions/image" }
}
},
"invalidCommandMessage": { "type": "string" }
}
}
}
}
針對以下(部分)JSON:
{
"botSettings": {
"welcomeMessage": {
"title": "Welcome to the bot",
"body": "This is the body right here"
}
}
}
嚴格模式驗證時,指出「財產「 #/ botSettings/welcomeMessage'沒有包含'image'所需的屬性,但是我只需要設置爲「body」。那麼我在這裏錯過了什麼?