You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of Ajv you are you using?
Latest: 8.12.0
What problem do you want to solve? pattern prop is ignored if type is number for example
What do you think is the correct solution to problem? pattern should still be used, as for example regex.test(value) works if value is a string or number, it's automatically stringified
Will you be able to implement it?
probably
Code summary
constAjv=require('ajv').default;constajv=newAjv({coerceTypes: true,});constschema={type: 'object',properties: {price: {type: 'number',pattern: '^-?\\d+(\\.\\d{1,2})?$'}}};// this shouldn't be valid, yet it isconsole.log(ajv.validate(schema,{price: '123.005'}),ajv.errors,);
Of course it's possible to add a custom keyword to get it working, but would be great if it works in the core
The text was updated successfully, but these errors were encountered:
What version of Ajv you are you using?
Latest: 8.12.0
What problem do you want to solve?
pattern
prop is ignored if type isnumber
for exampleWhat do you think is the correct solution to problem?
pattern
should still be used, as for exampleregex.test(value)
works if value is a string or number, it's automatically stringifiedWill you be able to implement it?
probably
Code summary
Of course it's possible to add a custom keyword to get it working, but would be great if it works in the core
The text was updated successfully, but these errors were encountered: