Docs · Validators
phone validator
Lightweight pattern check for phone-like strings. No country logic.
Reference
Format
Matches `/^[+]?[\d\s().-]{7,20}$/`. Optional leading `+`, then 7–20 chars of digits, spaces, parens, dots, or hyphens.
Examples
- +41 79 123 45 67
- (415) 555-2671
- +1.415.555.2671
How it runs
Implementation
Faithful summary of lib/validators.ts. Validators are pure functions and run identically in the worker, the Workbench, and the MCP server.
function validPhone(value) {
// Lightweight check. Production swaps libphonenumber-js behind the same shape.
return /^[+]?[\d\s().-]{7,20}$/.test(value)
? OK
: fail('phone_invalid', 'not a valid phone')
}Config
Use in a template
Validators attach to a field on a custom template. The cascade runs them after mapping but before commit; failures surface in the per-row validation report.
fields:
- column: phone
type: phone
validators:
- type: phoneWatch out
Common gotchas
- No country detection. `0000000` passes — only shape and length are checked.
- No E.164 normalisation. If you commit to FHIR, normalise first or downstream consumers see whatever the source had.
- Total length cap is 20 characters; extensions like `x123` push some legitimate corporate numbers past the limit.
- Opt-in `strict: true` swaps the regex for libphonenumber-js (min build). E.164 numbers that the library accepts pass; syntactically-similar invalids (e.g. `+411234`) fail. Pair with `countries: [CH, DE]` to lock to specific ISO-3166 codes — non-matching countries return `phone_country`. Default behavior is unchanged.
Catalogue
Related templates
- Patient demographics
patient_demographics_v1Patient identity. Emits FHIR Patient.
Fields:
phone - Leads
leads_v1Sales leads: contact, source, status, and creation metadata.
Fields:
phone - Contacts
contacts_v1People at named accounts: identity, contact details, role, decision-maker flag.
Fields:
phone - Customers
customers_v1Repeat e-commerce buyers: identity, contact, default shipping, lifetime stats.
Fields:
phone - Candidates
candidates_v1Recruiting pipeline: applicant contact, role, and stage.
Fields:
phone
Pricing
Validators run on every committed row
Validators add no AI cost — they are pure functions. Every map bills a small flat per-map fee from your prepaid token wallet ($10 minimum, shared across our suite); only columns that reach the metered LLM layer, plus any-to-any convert and reshape, bill real AI tokens. See pricing →
Explore
Other validators
Back to the documentation index or browse the template catalogue.
Ready when you are
Validate every row — before it lands.
Attach checksum-strict validators to any field, and gate risky commits with the requires_hitl flag. One key runs the whole cascade.