Add a rule-group id property to rule objects #239
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request permits a rule-group id to be added to rule objects. No other modifications to the rule object are made by this PR so consequently it breaks zero tests. The new rule-group id property allows the identification of groups of rules; if two rule objects have an identical rule-group id, then they are in the same rule-group. If two objects have differing rule-group ids then they are not in the same rule-group.
If we establish unique rule-groups in this way then all of the validation rules pertaining to a rule-group can be added or removed consistently using a single method call. This is precisely what my ValidatedViewModel micro-library aims to do. A summary of the library: if you have numerous instances of a view model on a page and you have different complex validation requirements for different instances, you can add and remove those groups of requirements as needed. If you are curious about the features of ValidatedViewModel, please check out the documentation:
https://github.com/carlschroedl/validatedviewmodel/wiki
A summary of this pull request: support the functionality of ValidatedViewModel at no cost.