# What is the difference between these two schema validation tests?

**URL:** <https://community.postman.com/t/what-is-the-difference-between-these-two-schema-validation-tests/37877>\
**Category:** Help Hub\
**Tags:** schema, schemavalidation\
**Created:** [August 4, 2022, 10:15am UTC](https://community.postman.com/t/what-is-the-difference-between-these-two-schema-validation-tests/37877 "2022-08-04T10:15:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [August 4, 2022, 10:15am UTC](https://community.postman.com/t/what-is-the-difference-between-these-two-schema-validation-tests/37877/1 "2022-08-04T10:15:27Z")

</div>

After reading about schema validation I came across both of the code snippets below. but I’m not sure I understand the difference between the two. Is anybody able to explain the difference or point me to relevant documentation?

* * *

```auto
pm.test("Validating the GraphQL schema", () => {
    pm.response.to.have.jsonSchema(schema);
});

```

* * *

```auto
let jsonData = pm.response.json();
pm.test('Ensure expected response structure', function () {
    let validation = tv4.validate(jsonData, schema);
    pm.expect(validation).to.be.true;
});

```

* * *

---

<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:** [December 12, 2024, 12:54pm UTC](https://community.postman.com/t/what-is-the-difference-between-these-two-schema-validation-tests/37877/2 "2024-12-12T12:54:14Z")

</div>

Closed on December 12, 2024, 12:54pm UTC

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