Skip to content
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

Change ruleSchema type to be the object variant #161

Merged
merged 1 commit into from
Jun 16, 2020

Conversation

shawnmcknight
Copy link
Contributor

I believe there might have been some confusion in my comments in #156 . I had made the comment

As I dig in a bit more here, I am starting to think that the type here shouldn't be ValidationRule but should instead of ValidationRuleObject. It appears to be that the rule.schema passed to the custom validator always gets converted to an object and neither the string variant nor the array variant will ever get passed to the custom checker function.

I think that is the more appropriate type since it appears to me that even if the ValidationRuleName or ValidationRuleObject[] variants are passed in the validator schema, they will be cast to the ValidationRuleObject type when calling the custom function.

This PR changes the type in the custom validator signatures to be passed ValidationRuleObject rather than ValidationRule.

@icebob
Copy link
Owner

icebob commented Jun 16, 2020

Yeah, custom check is called always with the converted rule and not with the original one (string, array)

@icebob icebob merged commit fe6a3a8 into icebob:master Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants