Closed DoubleBoba closed 10 months ago
Code snippet:
schema = { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "#masterdata/data", "type": "object", "title": "Data Definition", "required": ["d"], "properties": { "d": { "type": "string", "format": "date", "description": "Occurrence date" }, } } data = {'d': ''} import jsonschema jsonschema.validate(data, schema)
Expected behavior: Validation should fail because the date isn't in iso8601 format.
Actual behavior: Document successfully validated.
Environment: Python 3.10.13 (main, Aug 24 2023, 22:36:46) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin jsonschema==4.19.1
Hi. This is correct behavior. See https://python-jsonschema.readthedocs.io/en/stable/faq/#my-schema-specifies-format-validation-why-do-invalid-instances-seem-valid
Code snippet:
Expected behavior: Validation should fail because the date isn't in iso8601 format.
Actual behavior: Document successfully validated.
Environment: Python 3.10.13 (main, Aug 24 2023, 22:36:46) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin jsonschema==4.19.1