Closed
Description
Hi,
I'm struggling with validating "date" type. According to specifications it should be in format YYYY-MM-DD
(4 digits - 2 digits - 2 digits) but this jsonschema validator is ok with YYYY-M-D
.
Example schema snippet:
"d": {
"type": "string",
"format": "date"
}
If I test it in https://www.jsonschemavalidator.net/ it properly throws error: String '2000-1-01' does not validate against format 'date'.
I don't think that is expected behaviour.
See live demo here: https://repl.it/@TomasPalider/QueasyDrabServerapplication
I came up with workaround by combination date and regex but I don't like it since schema validation should be strict.
"d": {
"type": "string",
"format": "date",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
}