Multiple
The multiple constraint requires a node’s value—or its size—to be evenly
divisible by a given number n. In mathematical terms, validation succeeds if:
value mod n == 0
This constraint applies not only to numeric values, but also to:
the length of text values,
the size of byte sequences,
the number of elements in lists or matrices, and
the number of child nodes in sections.
Negative values are supported and evaluated using the same rule.
Type Matrix
The following table summarizes how multiple is interpreted for each node type.
Node Type |
S |
Value Type |
Details |
|---|---|---|---|
Integer |
Integer |
Valid only if |
|
Boolean |
|||
Float |
Float |
Valid only if |
|
Text |
Integer |
The text length (in Unicode code points) must be a multiple of |
|
Date |
|||
Time |
|||
DateTime |
|||
Bytes |
Integer |
The number of bytes must be a multiple of |
|
TimeDelta |
|||
RegEx |
|||
Value |
|||
ValueList |
Integer |
The number of list elements must be a multiple of |
|
ValueMatrix |
ValueList
Integer
|
Both dimensions must be multiples of |
|
Section |
Integer |
The number of child nodes (when using |
|
SectionList |
Integer |
The number of list entries must be a multiple of |
|
SectionWithTexts |
Integer |
The number of child nodes (when using |
|
NotValidated |
Rules for Multiple
Modulo Rule: Validation must test whether
value mod n == 0.For example,
multiple: 8allows the values 0, ±8, ±16, and so on.Negative Values: Negative values must be handled consistently. Validation succeeds if the absolute value is divisible by
n.For example,
-16is valid formultiple: 8.Floating-Point Precision: For floating-point values, validators must use a platform-consistent tolerance when testing for zero remainder.
This ensures that values such as
0.9validate correctly withmultiple: 0.1despite binary rounding differences.Length-Based Evaluation: For text values, byte sequences, lists, matrices, and sections, the constraint applies to the length or size of the node—not to its contents.
Examples
Numeric Constraint
[app.buffer_size]
type: "integer"
multiple: 1024
[app]
buffer_size: 4096
[app]
buffer_size: 2000 # ERROR: Not a multiple of 1024
Length-Based Constraint
[app.key_block]
type: "bytes"
multiple: 16
[app]
key_block: <00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f>
[app]
key_block: <00 01 02 03 04 05 06 07 08> # ERROR: Length not a multiple of 16