Postman测试-TV4.Validateresult TypeError:无法阅读属性' $ ref'不确定的
我正在使用邮递员,我添加了一个测试来验证响应的模式。 架构和响应模式按预期返回,但是在以下代码中的某个地方会遇到错误“ tv4.validateresult typeError:无法读取未定义的属性'$ ref'。
pm.test(tag + ".SCHEMA response matches required schema", function() {
var result = tv4.validateResult(jsonRes, schema.response);
if (!result.valid) {console.log(result);}
pm.expect(result.valid).to.be.true;
});
I am using postman, i have added a test to validate the schema of the response.
The schema and response schema return as expected, but somewhere in the following code i get the error "tv4.validateResult TypeError: Cannot read property '$ref' of undefined".
pm.test(tag + ".SCHEMA response matches required schema", function() {
var result = tv4.validateResult(jsonRes, schema.response);
if (!result.valid) {console.log(result);}
pm.expect(result.valid).to.be.true;
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我切换到了这个小魔术脚本
,它起作用了。不知道为什么,希望有人添加一些澄清
I switched to this little magic script
and it worked. Not sure why, hoping for someone to add some clarification