Common rules
These rules check that a value is present, or that it is an object. Only required, not_empty and not_empty_list check empty values, all other rules skip them.
LIVR 2.5 adds a rule for conditional presence (required_if), a rule that accepts any value (any), and boolean. required_if and any do not skip empty values.
requiredChecks that the value is present: not missing, not null and not an empty string. Note that 0 and false are valid values.'required'REQUIREDnot_emptyChecks that the value is not an empty string, if the field is passed at all. Unlike required, a missing field is valid.'not_empty'CANNOT_BE_EMPTYnot_empty_listChecks that the value is a list with at least one element.'not_empty_list'CANNOT_BE_EMPTYany_objectChecks that the value is a plain object (a hash, a dictionary). The content of the object is not validated, use nested_object for that.'any_object'FORMAT_ERRORrequired_if2.5Makes the field required when other fields have the given values.{ required_if: { type: 'company' } }REQUIREDany2.5Accepts any JSON value, including objects and lists, and returns it unchanged.'any'no errorsboolean2.5Checks that the value is a boolean, 1, 0, or one of the strings "1", "0", "true" and "false", and returns a real boolean.'boolean'NOT_BOOLEAN