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

Add a rule-group id property to rule objects #239

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

carlschroedl
Copy link

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.

@carlschroedl
Copy link
Author

I wanted to add that I named this new field 'constraintGroupId' because it is consistent with the terminology I use in ValidatedViewModel's documentation and API. It will work just as well with a more generic name like 'ruleGroupId', 'groupId', etc.

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.

1 participant