AnsweredAssumed Answered

JSON Schema Validation asserion can validate a field which can hold more than 2 types of data i.e Integer/String/Number

Question asked by PratyushMayank on Oct 1, 2018
Latest reply on Oct 8, 2018 by DirkBleyenberg

I am trying to validate a field in payload which could hold either integer or string using the below code but it's not validated in 9.0.0.

{"type": ["string","integer"]}

I found on the below sites it can be done in draft#02

https://tools.ietf.org/html/draft-zyp-json-schema-02#page-7

But,when I am keeping the type as mentioned above in my code then it is accepting both the values at the same it doesn't throw error when I am passing other datatypes such as object ,array, boolean etc in the field.Can anyone help me for the same.Is it doable in draft 2 or not.However,in higher versions I found it is doable.

 

Outcomes