# Validating JSON schema ignores the property's format

**URL:** <https://community.postman.com/t/validating-json-schema-ignores-the-propertys-format/30513>\
**Category:** Help Hub\
**Tags:** tests, json, ajv, jsonschema, schemavalidation\
**Created:** [December 8, 2021, 8:13pm UTC](https://community.postman.com/t/validating-json-schema-ignores-the-propertys-format/30513 "2021-12-08T20:13:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigbrdo](https://avatars.discourse-cdn.com/v4/letter/b/e36b37/32.png) [@bigbrdo](https://community.postman.com/u/bigbrdo)\
**Post date:** [December 8, 2021, 8:13pm UTC](https://community.postman.com/t/validating-json-schema-ignores-the-propertys-format/30513/1 "2021-12-08T20:13:29Z")

</div>

Hello everyone!

I recently discovered JSON schema by reading the Postman docs and I would like to incorporate this nifty feature in my tests. I discovered that AJV validatior is built-in in the Postman sandbox so naturally I’m using that one over tv4.  
The problem I encountered is when I write the JSON Schema format for a property, the assertion passes when it should have failed.

This is the property:  
“startDate”: {  
“type”: “string”,  
“format”: “date”  
}

and in my response I get:  
“startDate”: “2021-02-01”

Does the schema validation even validate by format? If not, how can this be enabled?

Screenshots:

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/e/e31bb21390da07db4a1f65115b432aea577e1dfa.png)  
 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/5/518870eb5b5943826d0ece3950620f3824568f33.png)

---

<div class="post-metadata">

**Author:** ![bigbrdo](https://avatars.discourse-cdn.com/v4/letter/b/e36b37/32.png) [@bigbrdo](https://community.postman.com/u/bigbrdo)\
**Post date:** [December 8, 2021, 8:17pm UTC](https://community.postman.com/t/validating-json-schema-ignores-the-propertys-format/30513/2 "2021-12-08T20:17:02Z")

</div>

[JSON Schema Tool](https://jsonschema.net/home)

This is the solution:

You need to paste your expected response to this tool that the kind developers of jsonschema have provided and create a JSON Schema in the right side. Paste the code from the right side in your variable (schema) and pass that variable for validating:

pm.test(“JSON Schema validation”, () =\> {

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

```

});

response is a variable in which we keep the response body:  
let response = pm.response.json();
