Skip to content

Rules Overview

Valicomb includes 54 built-in validation rules organized into 9 categories. This page provides a quick reference to all available rules.

Category Rules
String alpha, alphaNum, ascii, slug, contains, regex, startsWith, endsWith, uuid, passwordStrength
Numeric numeric, integer, min, max, between, boolean, positive, decimalPlaces
Network ip, ipv4, ipv6, email, emailDNS, url, urlActive, urlStrict, phone
Array array, in, notIn, listContains, subset, containsUnique, arrayHasKeys
Date date, dateFormat, dateBefore, dateAfter, past, future
Length length, lengthBetween, lengthMin, lengthMax
Comparison required, equals, different, accepted
Conditional nullable, optional, requiredWith, requiredWithout
Type instanceOf, creditCard

Rules for validating string content and patterns.

Rule Description
alpha Alphabetic characters only (Unicode-aware)
alphaNum Alphanumeric characters only (Unicode-aware)
ascii ASCII characters only (0x00-0x7F)
slug URL slug format (a-z, 0-9, -, _)
contains String contains substring
regex Matches custom regex pattern
startsWith String starts with prefix(es)
endsWith String ends with suffix(es)
uuid Valid UUID format (v1-v5)
passwordStrength Password strength validation (1-10 score)

Rules for validating numbers and numeric constraints.

Rule Description
numeric Any numeric value (int, float, numeric string)
integer Integer value with optional strict mode
min Value is at least minimum
max Value is at most maximum
between Value within range [min, max]
boolean Boolean-like values (true, false, 1, 0, ‘1’, ‘0’)
positive Value is greater than zero
decimalPlaces Maximum decimal places

Rules for validating network addresses and protocols.

Rule Description
ip Valid IP address (v4 or v6)
ipv4 Valid IPv4 address only
ipv6 Valid IPv6 address only
email Valid email address (RFC 5321)
emailDNS Valid email with MX DNS verification
url Valid URL syntax
urlActive Valid URL with DNS verification
urlStrict Valid URL with strict validation
phone Valid phone number (12 countries supported)

Rules for validating arrays and collections.

Rule Description
array Value is an array
in Value exists in allowed list
notIn Value NOT in disallowed list
listContains Array contains specific value
subset All elements exist in allowed list
containsUnique Array has only unique values
arrayHasKeys Array contains required keys

Rules for validating dates and times.

Rule Description
date Valid date (DateTime or parseable string)
dateFormat Matches specific date format
dateBefore Date is before comparison date
dateAfter Date is after comparison date
past Date is in the past
future Date is in the future

Rules for validating string length.

Rule Description
length Exact string length
lengthBetween Length within [min, max]
lengthMin Minimum string length
lengthMax Maximum string length

Rules for comparing field values.

Rule Description
required Field must not be empty/null
equals Field matches another field’s value
different Field differs from another field
accepted Value is accepted (yes, on, 1, true)

Rules for conditional validation.

Rule Description
nullable Field can be null; null values skip other rules
optional Field validated only if present
requiredWith Required if other fields are present
requiredWithout Required if other fields are absent

Rules for type checking and special formats.

Rule Description
instanceOf Value is instance of specified class
creditCard Valid credit card (Luhn algorithm)

See Defining Rules for the three ways to define validation rules.

Click on any category above to see detailed documentation for each rule, including:

  • Parameters and their types
  • Usage examples
  • Common use cases
  • Edge cases and behavior notes
  • Default error messages