Skip to content

Commit 05d2805

Browse files
committed
Restore "regex" to the list of formats.
Addresses json-schema-org#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.
1 parent 0f22800 commit 05d2805

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

jsonschema-validation.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,15 @@
896896
<xref target="RFC6901">RFC 6901, section 5</xref>
897897
</t>
898898
</section>
899+
<section title="regex">
900+
<t>
901+
This attribute applies to string instances.
902+
</t>
903+
<t>
904+
A regular expression, which SHOULD be valid according to the
905+
<xref target="ecma262">ECMA 262</xref> regular expression dialect.
906+
</t>
907+
</section>
899908
</section>
900909
</section>
901910

schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
"patternProperties": {
119119
"type": "object",
120120
"additionalProperties": { "$ref": "#" },
121+
"propertyNames": { "format": "regex" },
121122
"default": {}
122123
},
123124
"dependencies": {

0 commit comments

Comments
 (0)