JSON测试错误



JSON文件响应主体:

{
"Concurr": {
"BPhoneNumber": null,
"Agility": 1,
"Email": "abcde@gg.com",
"FirstName": "DIK",
"LastName": "BO",
"PhoneNumber": "03456778",
"PhoneType": "",
"PostalAddress": {
"Address1": "47 ILZ RUE KLI EBRELES",
"Address2": null,
"Address3": null,
"City": "OOL",
"Country": "250",
"Zip": "9760"
},
"PNSCode": ""
},
"DealID": 2,
"ObjID": null,
"OrderM": "IOPL",
"Parts": [],
"Product": {
"ComRef": "IKOL341JKL        ",
"PurchaseDate": "2018-07-12T06:31:13.053",
"SerialNumber": "9501123456",
"TRef": "S51M50X2EU/03"
},
"StNas": [
{
"AppointmentDate": "2018-08-02T10:03:27.8737443+02:00",
"AppointmentRank": null,
"Code": "100",
"Comment": "",
"Parts": []
},
{
"AppointmentDate": "2018-08-02T10:03:27.8737443+02:00",
"AppointmentRank": null,
"Code": "1101",
"Comment": "",
"Parts": []
}
],
"SCode": null,
"VID": 10
}

通过生成架构之后https://jsonschema.net我正在使用这个验证模式

var data = JSON.parse(responseBody);
tests["Valid scehma"] = tv4.validate(data, schema);

这总是在Postman中为我提供错误作为

There was an error in evaluating the test script : Cannot read property 'id' of null

任何人能帮助理解或有任何解决方案,关于是什么导致了这个错误/任何帮助都是感谢

ObjID": null编辑为整数后,问题将重新解决。

最新更新