We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It seems that in attempts to auto escape the regex for json compatibility the library strips out (or ignores) escaped /
/
Steps to reproduce the behavior:
import S from 'fluent-json-schema'; const cronlike = S.string().pattern( /^((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*)\s?){5,6})$/, ); console.log(cronlike.valueOf()); const cronlikeRegex = RegExp( /^((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*)\s?){5,6})$/, ); console.log(cronlikeRegex);
Forward slashes should also be escaped.
{ '$schema': 'http://json-schema.org/draft-07/schema#', type: 'string', pattern: '^((((\\d+,)+\\d+|(\\d+(\\|-)\\d+)|\\d+|\\*)\\s?){5,6})$/' } /^((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*)\s?){5,6})$/
The text was updated successfully, but these errors were encountered:
Thank you @svile to report this.
Would you like to open a PR to fix it? You can add the test case here: https://github.com/fastify/fluent-json-schema/blob/master/src/StringSchema.test.js#L97
Sorry, something went wrong.
Actually, looks like I'll have some spare time today, so I'll take it.
#121 - replace only the end occurrence of a forward slash along with …
dbcba6c
…any possible flags (#122)
resolved by #122
No branches or pull requests
🐛 Bug Report
It seems that in attempts to auto escape the regex for json compatibility the library strips out (or ignores) escaped
/
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Forward slashes should also be escaped.
Your Environment
The text was updated successfully, but these errors were encountered: