Better Schema Validator Error Messages

I have a test:

pm.test('schema valid', () => {
    const validation = tv4.validate(response, schema);
    if (!validation) {

    pm.expect(validation || tv4.error.message);

I get a failure: schema valid | AssertionError: expected 'Invalid type: null (expected string)' to be true

There are 316 "null"s when I search for the result. How can I make this test give me a better message so I can find where it is failing?

The response is a JSON object with one property “products”. That property is an array of objects.

Hey @joshua,

I would suggest switching over to using the Ajv module instead, it might have the solution you’re looking for, in terms of exposing more valuable error messages.

There have been a number of threads on the forums that have referenced how to do this: