Skip to main content

CommonCriterias <S>

Type parameters

  • S

Hierarchy

Index

Methods

and

  • and(keys: string[], options?: Options): S
  • Map a list of field names that must be defined alongside this field.

custom

  • Set a callback to run custom validation logic.

deprecate

  • deprecate(message: string): S
  • Set a message to log when this field is present.

only

  • Mark that this field can ONLY use a value that matches the default value.

optional

  • Require this field to NOT be explicitly defined.

or

  • or(keys: string[], options?: Options): S
  • Map a list of field names that must have at least 1 defined.

required

  • Require this field to be explicitly defined.

transform

  • Transform a value before it’s passed to the next criteria.

when

  • Validate with another schema when a condition is met.

xor

  • xor(keys: string[], options?: Options): S
  • Map a list of field names that must not be defined alongside this field.