I have a JSON and a JSON-schema
JSON:
{
"aaa": "4000-02-01 00:00:00"
}
JSON-schema:
{
"$schema": "http://json-schema.org/draft-04/schema",
"type": "object",
"properties": {
"aaa": {
"type": "string",
"format": "date-time"
}
}, "required": ["aaa"]
}
The JSON gets validated by the JSON-schema. However if I change the field aaa
to "bla" the schema does not notice that it is not a date-time any longer.
Did I miss anything in the schema?
For Python's jsonschema library, specify the format checker when calling validate
:
jsonschema.validate(data, schema, format_checker=jsonschema.FormatChecker())
To validate a date-time format, the strict-rfc3339 package should be installed.
See Validating Formats.