I would like to know if it is possbile to specify in a json schema that a string is of format date-time and is restricted to a specific interval.
In my case, I need to validate that the year of the submitted date is within the interval 2006 to 2012.
I would like to know if it is possbile to specify in a json schema that a string is of format date-time and is restricted to a specific interval.
In my case, I need to validate that the year of the submitted date is within the interval 2006 to 2012.
The next version of the standard (v5) has the proposed keywords formatMaximum/formatMinimum which would do exactly what you wanted, in an elegant way: they combine with format to provide format-specific min/max.
Currently (with v4), your only option is to create a hack using pattern (e.g. ^20(0[6-9]|1[0-2])). However, this is completely horrible, and best avoided if possible.