Date format in green-tick example is not in ISO8601 format
LurkingKiwi opened this issue · 4 comments
On the page
http://json-schema.org/understanding-json-schema/about.html
in the green box under the line "However, the second example passes:"
the "birthday" property has the value "22-02-1732".
This is supposed to match
"birthday": { "type": "string", "format": "date" },
which AFAICS requires an ISO8601 yyyy-mm-dd format.
The string also differs from that first used.
This is because format is an annotation keyword by default.
Have a read of http://json-schema.org/draft/2019-09/json-schema-validation.html#format
Support for format as an assertion is NOT REQUIRED, nor should it be expected by default.
Schemas MAY use a Dialect which requires support of the Format Vocabulary.
An implementation MAY provide support for Format by default, but MUST allow users to turn it off.
This may seem a little strange but this is how it has been for a long time, and we haven't had the terminology to describe the situation till now. It remains this way because properly defining format and a number of formats and how their validation must work, is really really hard. So we left it up to each implementation for now.
I agree, it's not clear in that opening example. Maybe it's not the best place to use format, but you have learnt something as a result.
/remind me to close this issue in 30 days if no reply.
@Relequestual set a reminder for Oct 18th 2020
Fixed by #147