-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: make pattern and patternProperties unicode ECMA-262 compliant #145
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, as it solves the problem 👍
Weird that the implementation of hyperjump actually supports ^x-[\\w\\d.\\-_]+$
but proper regex implementation does not 😅
Only had one comment, but guess regex behaves differently in different scenarios 🤷
@@ -9,7 +9,7 @@ | |||
], | |||
"additionalProperties": false, | |||
"patternProperties": { | |||
"^x-[\\w\\d\\.\\-\\_]+$": { | |||
"^x-[\\w\\d\\.\\x2d_]+$": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
Hmmm 🤔
I guess the problem is because it is inside a matching list [...]
🤔
Otherwise I guess we needed to do: "^x\\x2d[\\w\\d\\.\\x2d_]+$": {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you guessed correctly. It is because that -
is inside a list.
It is because it uses an old version of the validator:
The |
If it's not breaking anything and it's actually a bug fix, I think this should be applied to all the files. |
I did push a commit updating the |
Kudos, SonarCloud Quality Gate passed! |
/rtm |
🎉 This PR is included in version 2.13.0-2022-01-release.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
This PR makes the regular expressions found in
pattern
andpatternProperties
fields unicode compliant (according to ECMA-262). It only changes the2.3.0.json
schema but if you consider this should be applied to the rest, I can expand it.It means now the regular expressions are compatible with
u
flag, flag that some JSON Schema parsers use when parsing a JSON Schema document. For example the one from Hyperjump](https://github.com/hyperjump-io/json-schema-validator). See implementation here and [here}(https://github.com/hyperjump-io/json-schema-validator/blob/521818176d71d82344450a40a405fff2029e6bcc/lib/keywords/pattern.js). This is being used by the online tool https://json-schema.hyperjump.io.This is not introducing a BC since the regular expressions didn't change their meaning. You can see each version with each regex explanation on the following links:
Related issue(s)
Based on #128 but fixing the proposed for the
patternProperties
with a proper unicode character.cc @jonaslagoni @fmvilas