"patternProperties" regex not validating properly
XeniaSiskaki opened this issue · 1 comments
XeniaSiskaki commented
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:
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.
XeniaSiskaki commented
Seems like I messed up the schema, closing for now