Validation Rules

Be aware that all standard rules just skip checking empty values.
So, empty string will pass next validation - "first_name: { min_length: [10] }". We have special rules "required" and "not_empty" to check that value is present.
This allows us to use the same rules for not required fields.

first_name: { min_length: [10] } # name is optional. We will check length only if "first_name" was passed
first_name: [ 'required', { min_length: [10] } ] # check that the name is present and validate length
Standard rules that should be supported by every implementation:
  • Common Rules
    • required
    • not_empty
    • not_empty_list
    • any_object
  • String Rules
    • string
    • eq
    • one_of
    • max_length
    • min_length
    • length_between
    • length_equal
    • like
  • Numeric Rules
    • integer
    • positive_integer
    • decimal
    • positive_decimal
    • max_number
    • min_number
    • number_between
  • Special Rules
    • email
    • url
    • iso_date
    • equal_to_field
  • Metarules
    • nested_object
    • list_of
    • list_of_objects
    • list_of_different_objects
    • or
  • Modifiers (previously - "Filter rules")
    • trim
    • to_lc
    • to_uc
    • remove
    • leave_only
    • default

results matching ""

    No results matching ""