Skip to content

Validation Options

Validation options verify field values against configured constraints during data export to prevent invalid data.

Option Supported Types
interval integers, floats and duration
minLen, maxLen - string, path, l10n, backref-n
- all array and map types (compact, multi-column, subtable, tree)
nonzero - all Basic Types
- backref
- >>object, >>minmax, >>wtpool, >>vector, >>tuple
- multi-column minmax, wtpool, vector, tuple, bitflags
- tree minmax, wtpool, vector
whitelist all Basic Types
blacklist all Basic Types
regexp all Basic Types
synclen - not supported in tree-structured data
- arrays and maps (compact, multi-column, subtable)
- >>wtpool, multi-column wtpool
unique integers, string, path, ref, enum, datetime, rgba, and the elements of backref-n
root path
Option Description
interval Numeric range constraint View
minLen, maxLen Minimum and maximum element count View
nonzero Rejection of zero values View
whitelist Allowed-value set, checked against the raw value View
blacklist Rejected-value set, checked against the raw value View
regexp Regular expression, checked against the raw value View
synclen Element count check across a group of containers View
unique Uniqueness check within a container View
root Existence check for a path value View

The interval option constrains a numeric value to a range.

interval=[1,100]
interval=[0,)
interval=(0,1.0) → float
interval=[5s,1m] → duration
  • Square brackets [ ] mean inclusive.
  • Round brackets ( ) mean exclusive.
  • Omit the lower bound when you don’t care about it: [,100].
  • Omit the upper bound when you don’t care about it: [1,).
  • The comma is always required.

See Option Applicability for the types this option supports.

The minLen option enforces a minimum element count. The maxLen option enforces a maximum element count.

minLen=1
maxLen=10

See Option Applicability for the types this option supports.

The nonzero option rejects zero values.

nonzero → equivalent to nonzero=true
nonzero=true

See Option Applicability for the types this option supports.

See Zero Values for more information.

The whitelist option restricts a field to a set of allowed values.

The check runs against the raw value.

whitelist=1,2,3
whitelist=foo,"hello world",bar

Values are comma-separated.

If a value contains && or ,, it must be quoted.

See Option Applicability for the types this option supports.

The blacklist option rejects the specified values.

The check runs against the raw value.

blacklist=0,99
blacklist=admin,root

Same syntax as whitelist.

See Option Applicability for the types this option supports.

The regexp option validates a field with a regular expression.

The check runs against the raw value.

Archmage uses RE2 syntax — see the RE2 syntax reference for details.

regexp=\d+
regexp=`\d+&&\w+`
regexp=`^\d+(?:/\d+)*$`

Quote the pattern if it contains &&.

See Option Applicability for the types this option supports.

The synclen option groups multiple container fields together and requires all of them to have the same element count at export time.

synclen=<group>

Fields in the same group must share the same group name (case-sensitive).

See Option Applicability for the types this option supports.

The unique option ensures that all exported values in a container are distinct.

unique → equivalent to unique=true
unique=true

See Option Applicability for the types this option supports.

When unique is set on a field, Archmage determines the scope by walking up the type tree from the target field to the first array or map ancestor. All values within that container form the checking scope.

Zero values are excluded from the uniqueness check. Two zero values don’t count as a conflict.

The root option sets a root directory for path validation: Archmage joins the root with the stored value and verifies that the file exists.

See the path type for full documentation.