# Missing constraints in JSON schemas **Category:** [ITS](https://discourse.openehr.org/c/its/41) **Created:** 2025-05-22 00:43 UTC **Views:** 24 **Replies:** 0 **URL:** https://discourse.openehr.org/t/missing-constraints-in-json-schemas/6860 --- ## Post #1 by @pablo Hi all, I just found many missing constraints and raised a ticket in JIRA https://openehr.atlassian.net/browse/SPECITS-81 1. Values for DV_DATE, DV_TIME, DV_DATE_TIME and DV_DURATION should have a specific format and currently those are just strings in the schema (see https://github.com/openEHR/specifications-ITS-JSON/blob/master/components/RM/Release-1.1.0/Data_types/DV_DATE.json#L31), though the format can be enforced with "format": "date" in that case. Note the formats will match this RFC which is a profile of ISO 8601: https://www.rfc-editor.org/rfc/rfc3339.html#section-5.6 2. I have detected that issue while checking an error on a different area: PARTY_RELATIONSHIP.time_validity, which is a DV_INTERVAL, and though I had a badly formatted datetime for the DV_INTERVAL.lower, the validation passed like nothing was wrong. Then I realized, the DV_INTERVAL is missing any checks on the lower and upper attributes, since this validates against anything: ``` "DV_INTERVAL": { "type": "object", "required": [ "lower_unbounded", "upper_unbounded", "lower_included", "upper_included" ], "properties": { "lower": { "type": "object" <<<< }, "upper": { "type": "object" <<<< }, ... ``` Changing that to this will work as expected and give an error if the value is wrong: ``` "properties": { "lower": { "allOf": [ { "required": [ "_type" ], "properties": { "_type": { "type": "string", "enum": [ "DV_DATE", "DV_DATE_TIME", "DV_TIME", "DV_DURATION", "DV_ORDINAL", "DV_PROPORTION", "DV_COUNT", "DV_QUANTITY" ] } } }, { "if": { "properties": { "_type": { "const": "DV_DATE" } }, "required": [ "_type" ] }, "then": { "$ref": "#/definitions/DV_DATE" } }, ... all the other cases here .... ``` Note that validation should be mixed with the format: date/date-time/time/duration in the corresponding DV_XXX.value. I think it's worth to add the constraints, at least I have updated my copies with those and now my the JSON validation in Atomik Server is working way better. --- **Canonical:** https://discourse.openehr.org/t/missing-constraints-in-json-schemas/6860 **Original content:** https://discourse.openehr.org/t/missing-constraints-in-json-schemas/6860