Validation Options
Validation options verify field values against configured constraints during data export to prevent invalid data.
Option Applicability
Section titled “Option Applicability”| 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 List
Section titled “Option List”| 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 |
interval
Section titled “interval”The interval option constrains a numeric value to a range.
interval=[1,100]interval=[0,)interval=(0,1.0) → floatinterval=[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.
minLen and maxLen
Section titled “minLen and maxLen”The minLen option enforces a minimum element count.
The maxLen option enforces a maximum element count.
minLen=1maxLen=10See Option Applicability for the types this option supports.
nonzero
Section titled “nonzero”The nonzero option rejects zero values.
nonzero → equivalent to nonzero=truenonzero=trueSee Option Applicability for the types this option supports.
See Zero Values for more information.
whitelist
Section titled “whitelist”The whitelist option restricts a field to a set of allowed values.
The check runs against the raw value.
whitelist=1,2,3whitelist=foo,"hello world",barValues are comma-separated.
If a value contains && or ,, it must be quoted.
See Option Applicability for the types this option supports.
blacklist
Section titled “blacklist”The blacklist option rejects the specified values.
The check runs against the raw value.
blacklist=0,99blacklist=admin,rootSame syntax as whitelist.
See Option Applicability for the types this option supports.
regexp
Section titled “regexp”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.
synclen
Section titled “synclen”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.
unique
Section titled “unique”The unique option ensures that all exported values in a container are distinct.
unique → equivalent to unique=trueunique=trueSee Option Applicability for the types this option supports.
Checking Scope
Section titled “Checking Scope”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 Ignored
Section titled “Zero Values Are Ignored”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.