DocsValidators

number_range validator

Coerce to a finite number and bound it between optional min/max.

Format

Coerced with `Number(value)` and rejected if not `Number.isFinite`. Bounds are inclusive numerical comparisons.

Examples

  • min: 0, max: 100 // percentages
  • min: 0 // non-negative quantities
  • min: -273.15 // temperatures

Implementation

Faithful summary of lib/validators.ts. Validators are pure functions and run identically in the worker, the Workbench, and the MCP server.

function validNumberRange(value, params) {
  const n = Number(value)
  if (!Number.isFinite(n)) return fail('number_invalid', 'not a number')
  if (params.min != null && n < params.min) return fail('number_too_small', `< ${params.min}`)
  if (params.max != null && n > params.max) return fail('number_too_large', `> ${params.max}`)
  return OK
}

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: deal_score
    type: number
    validators:
      - type: number_range
        min: 0
        max: 100

Common gotchas

  • Empty string coerces to 0 in JavaScript — but the upstream "empty bypass" rule means blanks skip validation entirely. `"0"` is valid; `""` is skipped.
  • Locale-formatted numbers (`"1,234.56"` or `"1.234,56"`) become NaN. Normalize in your transform.
  • Bounds are inclusive — `min: 0` accepts `0`.

Related templates

  • Opportunitiesopportunities_v1

    Deals in pipeline: amount, stage, probability, close date, owner.

    Fields: probability

Pricing

Validators run on every committed row

Schema-only mode (headers + ≤3 sample rows) is free and unlimited; full-data commits are metered. See plans →