# Tv4.validade is not a function

**URL:** <https://community.postman.com/t/tv4-validade-is-not-a-function/56061>\
**Category:** Help Hub\
**Tags:** tests, tv4, schemavalidation\
**Created:** [December 29, 2023, 11:34pm UTC](https://community.postman.com/t/tv4-validade-is-not-a-function/56061 "2023-12-29T23:34:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spacecraft-astrono12](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@spacecraft-astrono12](https://community.postman.com/u/spacecraft-astrono12)\
**Post date:** [December 29, 2023, 11:34pm UTC](https://community.postman.com/t/tv4-validade-is-not-a-function/56061/1 "2023-12-29T23:34:15Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [December 30, 2023, 10:57am UTC](https://community.postman.com/t/tv4-validade-is-not-a-function/56061/2 "2023-12-30T10:57:54Z")

</div>

Hey @spacecraft-astrono12 👋

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

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

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

```

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [January 29, 2024, 10:58am UTC](https://community.postman.com/t/tv4-validade-is-not-a-function/56061/3 "2024-01-29T10:58:36Z")

</div>

Closed on January 29, 2024, 10:58am UTC

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