Ruby on rails JSON架构验证失败&引用;该属性不包含必需的属性";
下面是我的json模式的部分版本。我目前正在使用Ruby on rails JSON架构验证失败&引用;该属性不包含必需的属性";,ruby-on-rails,json,rspec,jsonschema,Ruby On Rails,Json,Rspec,Jsonschema,下面是我的json模式的部分版本。我目前正在使用json模式Gem来验证以下(部分)模式: 针对以下(部分)json: 在严格模式下进行验证时,它会声明“属性“#/botSettings/welcomessage”不包含必需的“image”属性,但是我只将必需的属性设置为“body”。那么我在这里错过了什么 你没有遗漏任何东西。标准JSON模式验证器应该认为您的JSON有效。验证失败可能是验证器中的错误、验证器中的一些非标准行为(检查配置),或者它没有按照您认为的模式进行验证(缓存问题) {
json模式
Gem来验证以下(部分)模式:
针对以下(部分)json:
在严格模式下进行验证时,它会声明“属性“#/botSettings/welcomessage”不包含必需的“image”属性,但是我只将必需的属性设置为“body”。那么我在这里错过了什么 你没有遗漏任何东西。标准JSON模式验证器应该认为您的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" }
}
}
}
}
{
"botSettings": {
"welcomeMessage": {
"title": "Welcome to the bot",
"body": "This is the body right here"
}
}
}