Skip to content

Commit 4f8e33b

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

File tree

2 files changed

+51
-33
lines changed

2 files changed

+51
-33
lines changed

Diff for: jsonschema-core.xml

+47-4
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,39 @@
538538
</t>
539539
</section>
540540

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

15751618
<references title="Informative References">

Diff for: jsonschema-validation.xml

+4-29
Original file line numberDiff line numberDiff line change
@@ -172,35 +172,10 @@
172172

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

0 commit comments

Comments
 (0)