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
Related issue: #25 (in chinese).
Use case:
const obj = {test: null}; parameter.validate({ test: { type: "integer", required: false } }, obj);
The above code will give the error should be an integer even if the required: false rule is defined.
should be an integer
Where is the problem: https://github.com/node-modules/parameter/blob/master/index.js, row 61 to 63
var has = obj.hasOwnProperty(key); if (!has) {
This condition should be replaced with:
var rule = formatRule(rules[key]); var value = obj[key]; if (value == undefined) { if (rule.required) { /* push required error */ } continue; }
The text was updated successfully, but these errors were encountered:
I also have the problem.
const rule = { transferDate: {type: 'string', required: false, allowEmpty: true}
let someDate = {transferDate: '2018-07-02'}
I want to set the transferDate to null. but it throw the error.
{ message: 'should be a string', code: 'invalid', field: 'transferDate' }
Sorry, something went wrong.
同样的问题+1
No branches or pull requests
Related issue: #25 (in chinese).
Use case:
The above code will give the error
should be an integer
even if the required: false rule is defined.Where is the problem:
https://github.com/node-modules/parameter/blob/master/index.js, row 61 to 63
This condition should be replaced with:
The text was updated successfully, but these errors were encountered: