我正在使用json-schema并且只想允许在此文件中声明的属性通过验证.例如,如果用户在其json对象中传递"name"属性,则该模式将失败,因为此处未将"name"列为属性.
是否有一些类似于"必需"的功能只允许列出的属性通过?
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Accounting Resource - Add Item",
"type": "object",
"properties": {
"itemNumber": {
"type":"string",
"minimum": 3
},
"title": {
"type":"string",
"minimum": 5
},
"description": {
"type":"string",
"minimum": 5
}
},
"required": [
"itemNumber",
"title",
"description"
]
}
Run Code Online (Sandbox Code Playgroud)
}