# Types of datatype available during the schema validation

**URL:** <https://community.postman.com/t/types-of-datatype-available-during-the-schema-validation/18738>\
**Category:** Help Hub\
**Created:** [December 29, 2020, 11:53am UTC](https://community.postman.com/t/types-of-datatype-available-during-the-schema-validation/18738 "2020-12-29T11:53:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aakashjain8693](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@aakashjain8693](https://community.postman.com/u/aakashjain8693)\
**Post date:** [December 29, 2020, 11:53am UTC](https://community.postman.com/t/types-of-datatype-available-during-the-schema-validation/18738/1 "2020-12-29T11:53:48Z")

</div>

Hi Team,  
I am validating the response through Schema. As of now I have used datatypes as below listed:

String,  
Number  
Integer  
Null

Any additional datatypes available?

Reason behind asking here is I want to verify the double/float and date type values too but unfortunately I can verify through string only.

Here is the sample API response:

“expiringRewards”:  
{  
“id”: 120000755487,  
“balance”: “36.46”,  
“currencyCode”: “USD”,  
“expiresOn”: “2020-11-21 02:30:00”  
}

Schema Validation:  
“id”: { “type”: “integer”},  
“balance”: { type: “string” },  
“currencyCode”: { type: “string” },  
“expiresOn”: { type: “string” },

Here I can verify the balance and expiresOn values with string datatype but want to verify much more deeper like balance could be verify through double or float type and expiresOn could be verify through date type.

P.S. Already noted that values are in double quote so by default they will considered as string.

Hope making understating to you guys.

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [December 29, 2020, 12:32pm UTC](https://community.postman.com/t/types-of-datatype-available-during-the-schema-validation/18738/2 "2020-12-29T12:32:17Z")

</div>

Here is the documentation for JSON Schema on data types:

> **[Basic Types - JSON Schema](https://cswr.github.io/JsonSchema/spec/basic_types/)**

---

<div class="post-metadata">

**Author:** ![aakashjain8693](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@aakashjain8693](https://community.postman.com/u/aakashjain8693)\
**Post date:** [December 29, 2020, 1:07pm UTC](https://community.postman.com/t/types-of-datatype-available-during-the-schema-validation/18738/3 "2020-12-29T13:07:33Z")

</div>

Thanks for the documentation, As I can understand there is no such way to accommodate such requirement apart from the regular expression.  
Thanks @allenheltondev for the prompt response.

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [December 29, 2020, 6:05pm UTC](https://community.postman.com/t/types-of-datatype-available-during-the-schema-validation/18738/4 "2020-12-29T18:05:12Z")

</div>

Not for floats, but for date-time you can add a `format` on a string property

> **[string — Understanding JSON Schema 7.0 documentation](https://json-schema.org/understanding-json-schema/reference/string.html#built-in-formats)**

---

<div class="post-metadata">

**Author:** ![aakashjain8693](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@aakashjain8693](https://community.postman.com/u/aakashjain8693)\
**Post date:** [December 30, 2020, 7:09am UTC](https://community.postman.com/t/types-of-datatype-available-during-the-schema-validation/18738/5 "2020-12-30T07:09:26Z")

</div>

Thanks.

Just quick question:  
So I was going through the date and time validation, Had below question.

Lets assume my output value is 2020-12-01 02:00:00.000 where I can’t use directly date and time function since format is different.  
So trying regular expression as  
““pattern”: ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}$”  
but some time ms values comes in 4, 5 or 6 digit so how can I ignore the ms sec in regular expression? or how can I add “|” on the regular expression?

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [December 30, 2020, 1:33pm UTC](https://community.postman.com/t/types-of-datatype-available-during-the-schema-validation/18738/6 "2020-12-30T13:33:49Z")

</div>

If you’re doing schema validation and data comes in not in the expected format (like having extra digits), that should break the validation. That data would be considered invalid.

---

<div class="post-metadata">

**Author:** ![aakashjain8693](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@aakashjain8693](https://community.postman.com/u/aakashjain8693)\
**Post date:** [December 30, 2020, 2:05pm UTC](https://community.postman.com/t/types-of-datatype-available-during-the-schema-validation/18738/7 "2020-12-30T14:05:21Z")

</div>

Business is not worried about mile seconds(ms), Team is okay to exclude ms fields.  
Any suggestion further on ?
