Closed ekzobrain closed 4 months ago
Hi @ekzobrain thanks for raising this. Can you prepare an example in runkit to help fast track investigation?
This is supported by the regexp
keyword in the ajv-keywords
project.
https://ajv.js.org/packages/ajv-keywords.html#regexp
What version of Ajv you are you using? latest
What problem do you want to solve? Missing support for new 'v' regexp flag (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_class#v-mode_character_class). Now regexp, that fail to compile, break validator totally. An exception is not descriptive, it's hard to find the location of a failing pattern keyword.
What do you think is the correct solution to problem? Add optional support for new 'v' regexp flag. Catch regexp initialization exceptions and log descriptive errors to console including invalid regexp itself. For example: "pattern 'xxx' at failed to compile with 'u' flag: . Check regexp validity or try changing compilation flag".
Will you be able to implement it? Yes, but need to discuss new option for enabling 'v' flag.