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, NaN is disallowed. If a bound excludes positive or negative infinity, +Inf or -Inf is disallowed accordingly.

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 vr_any.

SectionList

Integer

Constrains the number of entries in the section list.

SectionWithTexts

Integer

Constrains the number of child entries when using vr_any.

NotValidated

Rules for Minimum and Maximum

  1. Inclusive Boundaries: Both minimum and maximum are 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
    
  2. Type-Specific Semantics: The value type of minimum and maximum must 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
    
  3. Special Values for Floats: If either minimum or maximum is defined for a float node, NaN values are not permitted.

    Likewise, +Inf or -Inf are 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
    
  4. Matrix Constraints: For ValueMatrix nodes, minimum and maximum accept 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
    
  5. Invalid Combinations: If both minimum and maximum are defined, validators must verify that minimummaximum.

    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