Validators
60+ validatori organizzati per categoria. La sintassi è "required|email|min:5|max:100".
Sintassi
// Stringa pipe-separated
ValidationService.validate(value, 'required|email|min:5')
// I validatori restituiscono chiavi i18n
// { isValid: false, errors: ['validation.core.required'] }
// { isValid: false, errors: ['validation.core.min|min:5'] }
Categorie
| Categoria | Validatori |
|---|---|
| core | required, min, max, length, between, pattern, enum, range, regex |
| string | alpha, alphanumeric, slug, hex, base64, json |
| numeric | numeric, integer, positive, negative |
| date | date, before, after, time, cronexpression, daterange, seasonaldate, businesshours, minDate, maxDate |
| format | email, url, phone, color, semver, mime, geolocation, vatnumber, version, timestring, language, currency, hexcolor, semantic |
| italian | codicefiscale, partitaiva, codicefiscaleorpartitaiva, cap |
| financial | iban, creditcard, creditcardexpiry, swift, sepamandate, bic, cvv |
| network | ipaddress, macaddress, hostname, uuid, socialsecuritynumber, coordinates, imsi, imei, port, cidr |
| security | username, password, strong, passwordpolicy |
| documents | nationalid, passportnumber, vehicleregistration, driverlicense |
| file | filesize, filetype, filemimetype, sizerange |
| other | isbn, upc, ean, gtin, sku |
| custom | ValidationService.registerValidator() |