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.

CategoryRules
Stringalpha, alphaNum, ascii, slug, contains, regex, startsWith, endsWith, uuid, passwordStrength
Numericnumeric, integer, min, max, between, boolean, positive, decimalPlaces
Networkip, ipv4, ipv6, email, emailDNS, url, urlActive, urlStrict, phone
Arrayarray, in, notIn, listContains, subset, containsUnique, arrayHasKeys
Datedate, dateFormat, dateBefore, dateAfter, past, future
Lengthlength, lengthBetween, lengthMin, lengthMax
Comparisonrequired, equals, different, accepted
Conditionalnullable, optional, requiredWith, requiredWithout
TypeinstanceOf, creditCard

Rules for validating string content and patterns.

RuleDescription
alphaAlphabetic characters only (Unicode-aware)
alphaNumAlphanumeric characters only (Unicode-aware)
asciiASCII characters only (0x00-0x7F)
slugURL slug format (a-z, 0-9, -, _)
containsString contains substring
regexMatches custom regex pattern
startsWithString starts with prefix(es)
endsWithString ends with suffix(es)
uuidValid UUID format (v1-v5)
passwordStrengthPassword strength validation (1-10 score)

Rules for validating numbers and numeric constraints.

RuleDescription
numericAny numeric value (int, float, numeric string)
integerInteger value with optional strict mode
minValue is at least minimum
maxValue is at most maximum
betweenValue within range [min, max]
booleanBoolean-like values (true, false, 1, 0, ‘1’, ‘0’)
positiveValue is greater than zero
decimalPlacesMaximum decimal places

Rules for validating network addresses and protocols.

RuleDescription
ipValid IP address (v4 or v6)
ipv4Valid IPv4 address only
ipv6Valid IPv6 address only
emailValid email address (RFC 5321)
emailDNSValid email with MX DNS verification
urlValid URL syntax
urlActiveValid URL with DNS verification
urlStrictValid URL with strict validation
phoneValid phone number (12 countries supported)

Rules for validating arrays and collections.

RuleDescription
arrayValue is an array
inValue exists in allowed list
notInValue NOT in disallowed list
listContainsArray contains specific value
subsetAll elements exist in allowed list
containsUniqueArray has only unique values
arrayHasKeysArray contains required keys

Rules for validating dates and times.

RuleDescription
dateValid date (DateTime or parseable string)
dateFormatMatches specific date format
dateBeforeDate is before comparison date
dateAfterDate is after comparison date
pastDate is in the past
futureDate is in the future

Rules for validating string length.

RuleDescription
lengthExact string length
lengthBetweenLength within [min, max]
lengthMinMinimum string length
lengthMaxMaximum string length

Rules for comparing field values.

RuleDescription
requiredField must not be empty/null
equalsField matches another field’s value
differentField differs from another field
acceptedValue is accepted (yes, on, 1, true)

Rules for conditional validation.

RuleDescription
nullableField can be null; null values skip other rules
optionalField validated only if present
requiredWithRequired if other fields are present
requiredWithoutRequired if other fields are absent

Rules for type checking and special formats.

RuleDescription
instanceOfValue is instance of specified class
creditCardValid 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