Tv4.validade is not a function

I’m trying to validate this schema and don’t understand why it failed.

var schema = {
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "nome": {
      "type": "string"
    },
    "idade": {
      "type": "integer"
    },
    "id": {
      "type": "integer"
    },
    "risco": {
      "type": "integer"
    }
  },
  "required": [
    "nome",
    "idade",
    "id",
    "risco"
  ]
}

var jsonData = pm.response.json();

pm.test('Validando a estrutura do body', function() {
    pm.expect(tv4.validade(jsonData, schema)).to.be.true;
})

Error Message –

TypeError: tv4.validade is not a function

Hey @spacecraft-astrono12 :wave:

Looks like you have a typo there. It should be validate not validade.

You could also use this helper to assert against a schema.

pm.response.to.have.jsonSchema(schema)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.