Closed XeniaSiskaki closed 4 years ago
I'm using the patterProperties to validate some keys but it's not validating as expected. It seems to successfully validate all keys even if they are invalid.
patterProperties
I have the following snippet to reproduce the issue:
const schema = { type: 'object', patternProperties: { '^[a-zA-Z](\\w*[a-zA-Z0-9])?$': { type: 'array', items: { type: 'string' } } }, additionalProperties: false }; // prints empty string console.log(validate({ '1e_2ds': ['a'] }, schema).errors.toString());
According to the patternProperties regex the string shouldn't be allowed to start with a numeric.
patternProperties
regex101 seems to also agree
Seems like I messed up the schema, closing for now
I'm using the
patterProperties
to validate some keys but it's not validating as expected. It seems to successfully validate all keys even if they are invalid.I have the following snippet to reproduce the issue:
According to the
patternProperties
regex the string shouldn't be allowed to start with a numeric.regex101 seems to also agree