Could someone tell me JSON Schema Validation for accepting date of YYYY-MM-DD
format alone?
My sample JSON:
{"data1" : "foo", "date" :"2016-11-24"}
JSON Schema already have defined format for date, time, datetime, email, hostname, IP address. You can prefer this easier and recommended method rather than writing your own regex.
"date": {
"type": "string",
"format": "date"
}
Date and time format names are derived from RFC 3339, section 5.6 [RFC3339].
Reference: http://json-schema.org/latest/json-schema-validation.html#rfc.section.7.3