Validation Rules
Validation is optional — fields without a validation block have no constraints. When present, rules are applied both by the LLM (during conversation) and by the backend validator (before persisting).
Structure
fieldDefinitions:
name:
type: text
validation:
required: true
minLength: 2
maxLength: 100
Rules Reference
| Rule | Value Type | Description |
|---|---|---|
required | Boolean | Field must have a non-empty value |
minLength | Integer | Minimum character count |
maxLength | Integer | Maximum character count |
min | Integer | Minimum numeric value |
max | Integer | Maximum numeric value |
pattern | String (regex) | Value must match this regex pattern |
minAdvanceHours | Integer | Date must be at least N hours in the future |
maxAdvanceDays | Integer | Date must be at most N days in the future |
Compatibility Matrix
Not all rules work with all field types. Using an incompatible rule causes a config validation error at startup.
| Field Type | required | minLength | maxLength | min | max | pattern | minAdvanceHours | maxAdvanceDays |
|---|---|---|---|---|---|---|---|---|
text | Yes | Yes | Yes | Yes | ||||
email | Yes | Yes | Yes | Yes | ||||
textarea | Yes | Yes | Yes | Yes | ||||
number | Yes | Yes | Yes | |||||
date | Yes | Yes | Yes | |||||
time | Yes | |||||||
select | Yes | |||||||
smartSelect | Yes | |||||||
boolean | Yes | |||||||
info | Yes |
Examples
Text with length constraints
name:
type: text
validation:
required: true
minLength: 2
maxLength: 100
Number with range
windowCount:
type: number
validation:
min: 1
max: 100
Date with advance booking constraints
preferredDate:
type: date
validation:
required: true
minAdvanceHours: 24 # at least 24 hours from now
maxAdvanceDays: 365 # at most 1 year from now
Text with regex pattern
postalCode:
type: text
validation:
required: true
pattern: '^\d{5}$' # exactly 5 digits
Error Messages
If you use an incompatible rule, you'll see an error at config load time:
Field 'windowCount' of type 'number' cannot use validation rule 'minLength'.
Allowed rules for this type: [required, min, max]
Other validation errors:
"Field 'X' uses invalid validation rule 'Y'"— unrecognized rule name"Validation rule 'min' for field 'X' must have a numeric value"— wrong value type"Pattern validation rule for field 'X' has invalid regex pattern"— malformed regex