Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OnlyOneExistsRule

Validation rule that check that at exactly one of the object properties is not null.

see

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

Hierarchy

  • OnlyOneExistsRule

Implements

Index

Constructors

Methods

Constructors

constructor

Methods

validate

Generated using TypeDoc