From 05d28054c4e8f4a8d15225a01ca28b826172f665 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Fri, 8 Sep 2017 08:56:50 -0700 Subject: [PATCH 1/3] Restore "regex" to the list of formats. Addresses #392. It's come up several times that removing this format did not make sense and was quite possibly an accident. The "regex" format was actually still in use in the meta-schema for "pattern". I've added it to "patternProperties" as well using "propertyNames". Regular expressions are a fundamental programming tool, and play a part in JSON Schema's specification. It seems incorrect to not offer semantic documentation / optional validation of them. --- jsonschema-validation.xml | 9 +++++++++ schema.json | 1 + 2 files changed, 10 insertions(+) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 8c90bdb2..f8ad6ef3 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -896,6 +896,15 @@ RFC 6901, section 5 +
+ + This attribute applies to string instances. + + + A regular expression, which SHOULD be valid according to the + ECMA 262 regular expression dialect. + +
diff --git a/schema.json b/schema.json index e5b848e7..859baf8a 100644 --- a/schema.json +++ b/schema.json @@ -118,6 +118,7 @@ "patternProperties": { "type": "object", "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, "default": {} }, "dependencies": { From 9d4c91406b33af614304b914f38fe52baa202398 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Fri, 8 Sep 2017 12:04:42 -0700 Subject: [PATCH 2/3] Update regex considerations for format. Interoperability considerations for regular expressions have their own section. This change updates that section to make a note of the "regex" value for "format" as well as the keywords that use regular expressions. It also makes reference to that section within the "regex" format definition to establish minimum support. --- jsonschema-validation.xml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index f8ad6ef3..0ff72282 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -129,12 +129,13 @@ -
+
Two validation keywords, "pattern" and "patternProperties", use regular - expressions to express constraints. These regular expressions SHOULD - be valid according to the ECMA 262 regular - expression dialect. + expressions to express constraints, and the "regex" value for the + "format" keyword constrains the instance value to be a regular expression. + These regular expressions SHOULD be valid according to the + ECMA 262 regular expression dialect. Furthermore, given the high disparity in regular expression constructs support, @@ -904,6 +905,11 @@ A regular expression, which SHOULD be valid according to the ECMA 262 regular expression dialect. + + Implementations that validate formats MUST accept at least the subset of + ECMA 262 defined in the Regular Expressions + section of this specification, and SHOULD accept all validECMA 262 expressions. +
From 7f0a33ca47901d738b29b0186b72cad5437f9ac8 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Fri, 8 Sep 2017 12:16:11 -0700 Subject: [PATCH 3/3] Fix typo. --- jsonschema-validation.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 0ff72282..0b04c77e 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -908,7 +908,7 @@ Implementations that validate formats MUST accept at least the subset of ECMA 262 defined in the Regular Expressions - section of this specification, and SHOULD accept all validECMA 262 expressions. + section of this specification, and SHOULD accept all valid ECMA 262 expressions.