-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Here https://github.com/sagold/json-schema-library/blob/main/src/keywords/pattern.ts#L15 u
flag is hardcoded. But nowadays it's better to use v
which introduced more advanced Unicode support (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets). But it is also more strict to redudant character escapes as well. So it is actually nessesary to be able to configure which flags to use. It may be a configuration option which defaults to u
, or may be (which is better imo) a callback that is used to instantiate a regexp with signature like this: (pattern: string): RegExp
Also it is usually required to catch RegExp compilation errors, so that one invalid pattern does not break the whole schema validation. With a callback option users may implement error catching themselves.