jazzband / jazzband/jsonmodels

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

Open
#102 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
343
Forks
50
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.