Docs · Validators
enum validator
Reject any value not in an exact, case-sensitive allow-list.
Reference
Format
Membership test against an explicit `values` array. Comparison is strict equality — case-sensitive, whitespace-sensitive. Normalise upstream (lowercase, trim) if your data is dirty.
Examples
- values: ['male', 'female', 'other', 'unknown']
- values: ['permanent', 'fixed_term', 'apprentice']
- values: ['USD', 'EUR', 'CHF']
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 validEnum(value, params) {
const vs = Array.isArray(params.values) ? params.values : []
return vs.includes(value)
? OK
: fail('enum_invalid', `expected one of ${vs.join(', ')}`)
}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: gender
type: enum
enum_values: [male, female, other, unknown]
validators:
- type: enum
values: [male, female, other, unknown]Watch out
Common gotchas
- Strict equality only — `Male` will fail against `male`. Lowercase in your transform first.
- The validator does not consult `enum_values` on the field; you must pass `values` to the validator separately.
- No partial match, no synonym mapping. Use a transform step for synonyms like `M → male`.
Catalogue
Related templates
No template in the default catalogue ships with enum preconfigured. Use it on a custom template via the YAML snippet above, or via the template editor.
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.