I want my date format to be MM-dd-yyyy, and as you said format=date takes yyyy-MM-dd. so can i create my own custom format=customdate? if yes, then how can it be acheived? here's my requirements and my problems Requirement Store date in MM-dd-yyyy format into my JSON object as type string after validating my JSON object with the JSON schema Problem Getting ErrorType=Format validation error when I try to validate MM-dd-yyyy date with the JSON schema
The Validation Error which I am getting is String '09-09-1966' does not validate against format 'date'.
MY JSON SCHEMA LOOKS LIKE THIS
"title": myjsonschema,
"type": "object",
"properties": {
"birthDate": {
"type": [
"string",
"null"
],
"format": "date",
"pattern": "^(0?[1-9]|1[012])\\-(0?[1-9]|[12][0-9]|3[01])\\-\\d{4}$",
"message": {
"pattern": "This field should be in mm-dd-yyyy format"
}
}
}
MY JSON OBJECT
{"birthday":"09-09-1966"}