我有以下代码:
from jsonschema import validate
schema_data = {
"type" : "object",
"properties" : {
"price" : {"type" : "number"},
"name" : {"type" : "string"},
"additional" : {"type" : "number"},
},
"required": ["price", "name", "additional"],
"additionalProperties": False
}
json_data = {"name" : "Eggs", "price" : 34.99, "new": 90}
这应该给我一个错误
required
additionalProperties
作为
additional
json_data
和
new
中不存在
schema_data
.
.
我需要一些额外的安装吗?我有以下配置:
Python 2.7.12,
jsonschema==3.0.1
attrs==19.1.0
six==1.12.0
pyrsistent==0.14.11