0
當試圖驗證使用http://www.jsonschemavalidator.net/下面的架構,JSONSchema - 錯誤解決方案參考
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://test.com/unified-ingest",
"type": "object",
"definitions" : {
"test-params" : {
"id": "http://test.com/test-params",
"type": "object",
"properties" : {
"operation-type": {
"id" : "http://test.com/test-params/operation-type",
"enum": [ "create", "update" ]
},
"required" : {
"id" : "http://test.com/test-params/required",
"type" : "array",
"items" : {
"type" : "string",
"pattern" : "^[\\w,\\s-\\p{L}\\p{M}]+\\.(jpg|png|xml)$"
}
}
},
"required" : ["operation-type"]
}
},
"properties": {
"root" : {
"id": "http://test.com/unified-ingest/root",
"type": "object",
"properties" : {
"$" : {
"id" : "http://test.com/unified-ingest/root/attributes",
"type" : "object",
"properties" : {
"xmlns:xsi" : {
"type" : "string"
},
"xmlns" : {
"type" : "string"
},
"xsi:schemaLocation" : {
"type" : "string",
"pattern" : "^[a-z]*$"
}
}
},
"test-params" : {
"$ref" : "#/definitions/test-params"
}
},
"required" : ["test-params"]
}
},
"required" : ["root"]
}
我收到以下錯誤時:
Error when resolving schema reference '#/definitions/test-params'. Path 'properties.root.properties.test-params', line 56, position 25.
我不知道是什麼導致這錯誤。我多次嘗試掃描文檔,但對於我的生活,我無法弄清楚什麼是錯的。我甚至嘗試刪除id屬性,認爲它引用了參考文獻,但這也沒有幫助。請幫忙!
完美的作品!謝謝您的幫助。 – user1452030