Add rule to schema?
I have a schema that has 3 fields, "a", "b" and "c". At least one of them has to be not null. Is there a way to add a rule to the schema instead of to a field?, I could create a rule and apply it to each of the 3 but I think that a rule to the schema itself could be better.
Your rules are executed in the context of the object under test, so in a custom rule you can access other fields for validation that involves multiple fields simultaneously.
Sure, but the idea is that the rule is for the schema instead of for a field, in this caseI have to add the rule to each field and the concept is that the error is not for a particular field, but for the schema itself. I know that I can make it work how you said, but the concept is different.
You could add the rule to just one of the fields, since you need the rule to run once, not three times.
Yes you are right, but having a feature that lets you add a rule to the schema I think that could be better for this case.