Creates a new validation rule and sets its values
a list of property names where at only one property must exist
Validates a given value against this rule.
a dot notation path to the value.
a schema this rule is called from
a value to be validated.
a list with validation results to add new results.
Generated using TypeDoc
Validation rule that check that at exactly one of the object properties is not null.
IValidationRule
Example
let schema = new Schema() .withRule(new OnlyOneExistsRule("field1", "field2")); schema.validate({ field1: 1, field2: "A" }); // Result: only one of properties field1, field2 must exist schema.validate({ field1: 1 }); // Result: no errors schema.validate({ }); // Result: only one of properties field1, field2 must exist