Skip to content

Change: addRule removes previous rule with same name if that exists#441

Open
PawelStroinski wants to merge 1 commit intoKnockout-Contrib:masterfrom
PawelStroinski:master
Open

Change: addRule removes previous rule with same name if that exists#441
PawelStroinski wants to merge 1 commit intoKnockout-Contrib:masterfrom
PawelStroinski:master

Conversation

@PawelStroinski
Copy link

Please see unit test. Unfortunately this is breaking change.

@crissdev
Copy link
Member

@PawelStroinski I think if you augment the rule object with a replace option and change addRule and addAnnonymousRule methods, this won't be a breaking change anymore. The starting point for this would be addExtender in this case. This would allow rules like the following to be defined:

var obsv = ko.observable().extend({required: true});
obsv.extend({required: {replace: true, params: false}});

{replace: true} would tell the API to replace the rule. Since I don't see similar functionality documented anywhere this shouldn't be considered a breaking change.

Other thoughts, anyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants