Skip to main content

Validation Rules List

The following rules are the builtin validation rules in Warlock:

  • array: Checks if the input is an array.
  • arrayOf: Checks if the input is an array of the given type.
  • boolean: Checks if the input is a boolean.
  • confirmed: Checks if the input is confirmed with another input.
  • date: Checks if the input is a valid date.
  • exists: Checks if the input exists in the database.
  • email: Checks if the input is a valid email.
  • file: Checks if the input is a file.
  • float: Checks if the input is a float number.
  • image: Checks if the input is an image.
  • in: Checks if the input is one of the given values.
  • int: Checks if the input is an integer.
  • length: Checks if the input length is equal to the given value.
  • localized: Checks if the input is an array of objects, each object has localeCode and text properties.
  • maxLength: Checks if the input length is less than or equal to the given value.
  • max: Checks if the input is less than or equal to the given value.
  • minLength: Checks if the input length is greater than or equal to the given value.
  • min: Checks if the input is greater than or equal to the given value.
  • missingIf: The field under validation must be missing or empty if the another field is equal to the given value.
  • number: Checks if the input is a number.
  • object: Checks if the input is an object.
  • pattern: Checks if the input matches the given pattern.
  • required: Checks if the input is not empty.
  • requiredIf: The field under validation must be present and not empty if the another field is equal to the given value.
  • requiredIfEmpty: The field under validation must be present and not empty if the another field is empty.
  • requiredWith: The field under validation must be present and not empty only if any of the other specified fields are present and not empty.
  • requiredWithAll: The field under validation must be present and not empty only if all of the other specified fields are present and not empty.
  • scalar: Checks if the input is a string, number or boolean.
  • string: Checks if the input is a string.
  • stringify: Checks if the input is a string or a number.
  • unique: Checks if the input is unique in the database.
  • uploadable: Checks if the input's value is a hash of Uploaded File
  • url: Checks if the input is a valid URL.

Create Your Own Validation Rule

To create a new rule, please head to this page.