The params option mentioned by ThibWeb isn't needed - knockout.validation.js sets this by default to true in the addExtender method:
if (params.message || params.onlyIf) {
return ko.validation.addRule(observable, {
rule: ruleName,
message: params.message,
params: utils.isEmptyVal(params.params) ? true : params.params,
condition: params.onlyIf
});
The Eric Barnard answer was in 2011, presumably before this was defaulted to true.
However, if your code sets any validation defaults, you might be writing an HTML5 required attribute into the HTML, or reading one that is set in the HTML:
ko.validation.configure({
parseInputAttributes: true, //default is false
writeInputAttributes: true //default is false
});
I've found this causes an onlyIf required condition to be effectively ignored, since you are adding an extra required rule which is always applied.