I am using Postman and its built-in Json schema validator library (tv4). There are many earlier posts on the same issue and yet I see that only in some cases issue is resolved. Here is my Test Script code:
var data = JSON.parse(responseBody);
console.log("<---data: ", data)
var schema = postman.getGlobalVariable('mySchema')
console.log("<---schema: ", schema)
var result = tv4.validateMultiple(data, schema, false, true);
tests['Schema is valid'] = result['valid'] === true
console.log("<---errors: ", JSON.stringify(result['errors']))
No matter what schema
value I pass, the Test always passes.