我尝试使用 json 模式,这里有一个简单的例子。我正在使用该网站: http: //www.jsonschemavalidator.net/
架构:
{
'Foods':
{
'type': 'array',
'items':
{
'GoodFoods': { 'type':'string' },
'NastyFoods': { 'type':'string' },
'BlendFoods': { 'type': 'string' }
},
'required': ['BlendFoods'],
}
}
输入 JSON:
{
"Foods":
[
{
"GoodFoods": "Pasta",
"NastyFoods": true,
}
]
}
这里的想法是它应该抱怨“BlendFoods”属性丢失并且 NastyFoods 是布尔值而不是字符串。但相反,它说“未发现错误。JSON 验证架构”。那不是我想要的。
我对此进行了很多尝试,但无法弄清楚我在架构中做错了什么,有什么想法吗?
最好的问候罗布