Skip to content

Commit 4ef33b4

Browse files
committed
Update regex concerns for subschema application
Move the main text into core, and just reference it from validation.
1 parent e96236d commit 4ef33b4

File tree

2 files changed

+51
-33
lines changed

2 files changed

+51
-33
lines changed

jsonschema-core.xml

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,39 @@
539539
</t>
540540
</section>
541541

542+
<section title="Regular Expressions" anchor="regex">
543+
<t>
544+
Keywords MAY use regular expressions to express constraints, or constrain
545+
the instance value to be a regular expression.
546+
These regular expressions SHOULD be valid according to the
547+
<xref target="ecma262">ECMA 262</xref> regular expression dialect.
548+
</t>
549+
<t>
550+
Furthermore, given the high disparity in regular expression constructs support,
551+
schema authors SHOULD limit themselves to the following regular expression
552+
tokens:
553+
554+
<list>
555+
<t>individual Unicode characters, as defined by the <xref
556+
target="RFC7159">JSON specification</xref>;</t>
557+
<t>simple character classes ([abc]), range character classes ([a-z]);</t>
558+
<t>complemented character classes ([^abc], [^a-z]);</t>
559+
<t>simple quantifiers: "+" (one or more), "*" (zero or more), "?" (zero or
560+
one), and their lazy versions ("+?", "*?", "??");</t>
561+
<t>range quantifiers: "{x}" (exactly x occurrences), "{x,y}" (at least x, at
562+
most y, occurrences), {x,} (x occurrences or more), and their lazy
563+
versions;</t>
564+
<t>the beginning-of-input ("^") and end-of-input ("$") anchors;</t>
565+
<t>simple grouping ("(...)") and alternation ("|").</t>
566+
</list>
567+
</t>
568+
<t>
569+
Finally, implementations MUST NOT take regular expressions to be
570+
anchored, neither at the beginning nor at the end. This means, for instance,
571+
the pattern "es" matches "expression".
572+
</t>
573+
</section>
574+
542575
<section title="Extending JSON Schema">
543576
<t>
544577
Additional schema keywords and schema vocabularies MAY be defined
@@ -1506,8 +1539,9 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
15061539
</t>
15071540
<t>
15081541
Interoperability considerations: See Sections
1509-
<xref target="language" format="counter"></xref> and
1510-
<xref target="integers" format="counter"></xref> above.
1542+
<xref target="language" format="counter"></xref>,
1543+
<xref target="integers" format="counter"></xref>, and
1544+
<xref target="regex" format="counter"></xref>above.
15111545
</t>
15121546
<t>
15131547
Fragment identifier considerations: See Section
@@ -1549,8 +1583,9 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
15491583
</t>
15501584
<t>
15511585
Interoperability considerations: See Sections
1552-
<xref target="language" format="counter"></xref> and
1553-
<xref target="integers" format="counter"></xref> above.
1586+
<xref target="language" format="counter"></xref>,
1587+
<xref target="integers" format="counter"></xref>, and
1588+
<xref target="regex" format="counter"></xref>above.
15541589
</t>
15551590
<t>
15561591
Fragment identifier considerations: See Section
@@ -1571,6 +1606,14 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
15711606
&RFC6901;
15721607
&RFC7159;
15731608
&ldp;
1609+
<reference anchor="ecma262"
1610+
target="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf">
1611+
<front>
1612+
<title>ECMA 262 specification</title>
1613+
<author/>
1614+
<date/>
1615+
</front>
1616+
</reference>
15741617
</references>
15751618

15761619
<references title="Informative References">

jsonschema-validation.xml

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -173,35 +173,10 @@
173173

174174
<section title="Regular Expressions" anchor="regexInterop">
175175
<t>
176-
Two validation keywords, "pattern" and "patternProperties", use regular
177-
expressions to express constraints, and the "regex" value for the
178-
"format" keyword constrains the instance value to be a regular expression.
179-
These regular expressions SHOULD be valid according to the
180-
<xref target="ecma262">ECMA 262</xref> regular expression dialect.
181-
</t>
182-
<t>
183-
Furthermore, given the high disparity in regular expression constructs support,
184-
schema authors SHOULD limit themselves to the following regular expression
185-
tokens:
186-
187-
<list>
188-
<t>individual Unicode characters, as defined by the <xref
189-
target="RFC7159">JSON specification</xref>;</t>
190-
<t>simple character classes ([abc]), range character classes ([a-z]);</t>
191-
<t>complemented character classes ([^abc], [^a-z]);</t>
192-
<t>simple quantifiers: "+" (one or more), "*" (zero or more), "?" (zero or
193-
one), and their lazy versions ("+?", "*?", "??");</t>
194-
<t>range quantifiers: "{x}" (exactly x occurrences), "{x,y}" (at least x, at
195-
most y, occurrences), {x,} (x occurrences or more), and their lazy
196-
versions;</t>
197-
<t>the beginning-of-input ("^") and end-of-input ("$") anchors;</t>
198-
<t>simple grouping ("(...)") and alternation ("|").</t>
199-
</list>
200-
</t>
201-
<t>
202-
Finally, implementations MUST NOT take regular expressions to be
203-
anchored, neither at the beginning nor at the end. This means, for instance,
204-
the pattern "es" matches "expression".
176+
Keywords that use regular expressions, or constrain the instance value
177+
to be a regular expression, are subject to the interoperability
178+
considerations for regular expressions in the
179+
<xref target="json-schema">JSON Schema Core</xref> specification.
205180
</t>
206181
</section>
207182

0 commit comments

Comments
 (0)