Skip to content
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

Validators/Regex: Enable exporting regex validator that is not ECMA 262 #102

Open
avrahamshukron opened this issue Jan 8, 2018 · 0 comments

Comments

@avrahamshukron
Copy link
Contributor

Currently the Regex validator will convert any given Python regex to ECMA regex when creating a schema.
While this behavior is indeed the expected one according to the json-schema specification, it can sometimes cause a problem: many libraries, even those recommended by json-shcema, DO NOT support the ECMA regex notation thus failing to validate properly.

It would be very helpful to be able to generate schema that is not ECMA 262.
Of course, the default behavior should stay as is, because it is correct, and in order to keep backward compatibility.

The requested behavior can be legitimized by the fact that the json-schema clearly states:

... These regular expressions SHOULD be valid according to the ECMA 262 [ecma262] regular expression dialect.

And RFC2119, which json-schema conforms to, states that:

SHOULD This word, or the adjective "RECOMMENDED", mean that there
may exist valid reasons in particular circumstances to ignore a
particular item, but the full implications must be understood and
carefully weighed before choosing a different course.

So, it is actually OK to support other notations as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant