jsonschema期望allOf的类型为';对象';或';布尔值';
我正在使用pypijsonschema来验证我的测试模式 以下是test_schema.json的内容:jsonschema期望allOf的类型为';对象';或';布尔值';,json,schema,python-jsonschema,Json,Schema,Python Jsonschema,我正在使用pypijsonschema来验证我的测试模式 以下是test_schema.json的内容: { "$schema": "https://json-schema.org/draft/2020-12/schema#", "title": "Single IV Run JSON Schema", "description": "Schema for single IV
{
"$schema": "https://json-schema.org/draft/2020-12/schema#",
"title": "Single IV Run JSON Schema",
"description": "Schema for single IV run sequence",
"type": "object",
"properties": {
"allOf": [
{ "$ref": "/schemas/test/dut.json"},
{
"properties": {
"IV": {"$ref": "/schemas/test/iv.json"}
}
}
]
},
"required": ["IV"]
}
使用jsonschema.Draft7Validator.check_schema(test_schema),我收到以下错误,尽管我从中复制了常规模式结构:
回溯(最近一次呼叫最后一次):
文件“C:/Users/william.su/workspace/speedit_sandbox/schema_parser.py”,第129行,在
Draft7Validator.check_架构(架构)
文件“C:\Users\william.su\Miniconda3\lib\site packages\jsonschema\validators.py”,第294行,在check\u模式中
引发异常.SchemaError.create_from(错误)
jsonschema.exceptions.SchemaError:[{'$ref':'/schemas/test/dut.json'},{'properties':{'IV':{'$ref':'/schemas/test/IV.json'}]不是'object','boolean'类型
Traceback (most recent call last):
File "C:/Users/william.su/workspaces/speedit_sandbox/schema_parser.py", line 129, in <module>
Draft7Validator.check_schema(schema)
File "C:\Users\william.su\Miniconda3\lib\site-packages\jsonschema\validators.py", line 294, in check_schema
raise exceptions.SchemaError.create_from(error)
jsonschema.exceptions.SchemaError: [{'$ref': '/schemas/test/dut.json'}, {'properties': {'IV': {'$ref': '/schemas/test/iv.json'}}}] is not of type 'object', 'boolean'