Minimum and Maximum
The minimum and maximum constraints restrict the allowed range or size of a
node. Both constraints are inclusive, meaning the boundary values themselves are
considered valid.
Depending on the node type, these constraints apply to numeric values, textual lengths, collection sizes, or structural dimensions.
Type Matrix
The following table summarizes which node types support minimum and maximum
and how the constraint values are interpreted.
Node Type |
S |
Value Type |
Details |
|---|---|---|---|
Integer |
Integer |
Constrains the minimum and maximum allowed integer value. |
|
Boolean |
|||
Float |
Float |
Constrains the minimum and maximum floating-point value.
If any bound is defined, |
|
Text |
Integer |
Constrains the number of Unicode code points (characters). |
|
Date |
Date |
Constrains the earliest and/or latest valid date. |
|
Time |
|||
DateTime |
DateTime |
Constrains the earliest and/or latest valid date-time. |
|
Bytes |
Integer |
Constrains the number of bytes. |
|
TimeDelta |
|||
RegEx |
|||
Value |
|||
ValueList |
Integer |
Constrains the minimum and maximum number of list elements. |
|
ValueMatrix |
ValueList
Integer
|
Constrains the minimum and maximum number of rows and columns. The first integer applies to rows, the second to columns. |
|
Section |
Integer |
Constrains the number of child entries when using |
|
SectionList |
Integer |
Constrains the number of entries in the section list. |
|
SectionWithTexts |
Integer |
Constrains the number of child entries when using |
|
NotValidated |
Rules for Minimum and Maximum
Inclusive Boundaries: Both
minimumandmaximumare inclusive. A value equal to the specified boundary is valid.[server.min_port] type: "integer" minimum: 1 maximum: 65534 [server.max_port] type: "integer" minimum: 1 maximum: 65534
[server] min_port: 1 # VALID: equals minimum max_port: 65534 # VALID: equals maximum
Type-Specific Semantics: The value type of
minimumandmaximummust match the semantic meaning of the node type:For numeric types, the constraint limits the numeric value.
For
text, the integer represents the number of Unicode code points.For
bytes, the integer represents the number of bytes.For lists, sections, and matrices, the integer represents the number of contained entries.
[client.username] type: "text" minimum: 3 # At least 3 characters maximum: 12 # At most 12 characters
Special Values for Floats: If either
minimumormaximumis defined for afloatnode,NaNvalues are not permitted.Likewise,
+Infor-Infare not permitted if they fall outside the specified bounds.[client.ratio] type: "float" minimum: 0.001
[client] ratio: NaN # ERROR: NaN is not allowed when bounds are defined
Matrix Constraints: For
ValueMatrixnodes,minimumandmaximumaccept two integers.The first integer constrains the number of rows, and the second constrains the number of columns.
[app.matrix] type: "ValueMatrix" minimum: 2, 3 # At least 2 rows and 3 columns maximum: 5, 8 # At most 5 rows and 8 columns
Invalid Combinations: If both
minimumandmaximumare defined, validators must verify thatminimum≤maximum.If this condition is violated, the Validation Rules document itself is invalid.
[server.port] type: "integer" minimum: 100 maximum: 10 # ERROR: minimum is greater than maximum
Examples
Numeric Limits
[server.port]
type: "integer"
minimum: 1
maximum: 65534
[server]
port: 8080 # VALID
[server]
port: -1 # ERROR: Must be in the range 1–65534
Text Limits
[client.username]
type: "text"
minimum: 1
maximum: 32
[client]
username: "example" # VALID
[client]
username: "" # ERROR: Must contain at least 1 character