Skip to content

Restore "regex" to the list of formats. #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions jsonschema-validation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@
</t>
</section>

<section title="Regular expressions">
<section title="Regular expressions" anchor="regexInterop">
<t>
Two validation keywords, "pattern" and "patternProperties", use regular
expressions to express constraints. These regular expressions SHOULD
be valid according to the <xref target="ecma262">ECMA 262</xref> 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
<xref target="ecma262">ECMA 262</xref> regular expression dialect.
</t>
<t>
Furthermore, given the high disparity in regular expression constructs support,
Expand Down Expand Up @@ -896,6 +897,20 @@
<xref target="RFC6901">RFC 6901, section 5</xref>
</t>
</section>
<section title="regex">
<t>
This attribute applies to string instances.
</t>
<t>
A regular expression, which SHOULD be valid according to the
<xref target="ecma262">ECMA 262</xref> regular expression dialect.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall off hand, but I suspect strongly that the original spec made the same mention here that implementations may not be using ECMA regexes (and that this format might actually mean "some regex dialect, so restrict yourself to the common subsets).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Julian, I'd forgotten about that section. I've updated it and made the regex definition reference it.

</t>
<t>
Implementations that validate formats MUST accept at least the subset of
ECMA 262 defined in the <xref target="regexInterop">Regular Expressions</xref>
section of this specification, and SHOULD accept all valid ECMA 262 expressions.
</t>
</section>
</section>
</section>

Expand Down
1 change: 1 addition & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"patternProperties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"propertyNames": { "format": "regex" },
"default": {}
},
"dependencies": {
Expand Down