-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
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
Custom defined rule is not called on multiple attributes #9
Comments
Do you also experience this issue when you use |
It happens with validate. I ran into an issue with validateSync in that The issue I described happens with a set of async rules I have (that can Thanks, Glenn
|
Yeah, the |
I did see that :-) The fix is working for me so far. If I run into other issues with it I'll fix them and submit another pull request. |
Resolves issue #9 with same rules with different arguments getting overwritten
@gtarcea Thanks for the PR! |
When I define a custom rule as follows and use it in multiple spots, the rule is only called for one attribute. Here is my example:
schema.defineRule('mustExist', mustExist, true);
schema.defineSchema('Sample', {
project_id: {
type: 'string',
minLength: 1,
mustExist: 'projects'
},
owner: {
type: 'string',
minLength: 1,
mustExist: 'users'
}
}
In this case the mustExist rule will look up the item in the named table to validate it exists. However, when I run schema.validate, the only rule defined for mustExist, has the value 'users' associated with it. Only one instance of the rule and its arguments are being kept.
I have a pull request I'll be submitting that resolves this issue.
The text was updated successfully, but these errors were encountered: