Skip to main content

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

RuleValue TypeDescription
requiredBooleanField must have a non-empty value
minLengthIntegerMinimum character count
maxLengthIntegerMaximum character count
minIntegerMinimum numeric value
maxIntegerMaximum numeric value
patternString (regex)Value must match this regex pattern
minAdvanceHoursIntegerDate must be at least N hours in the future
maxAdvanceDaysIntegerDate 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 TyperequiredminLengthmaxLengthminmaxpatternminAdvanceHoursmaxAdvanceDays
textYesYesYesYes
emailYesYesYesYes
textareaYesYesYesYes
numberYesYesYes
dateYesYesYes
timeYes
selectYes
smartSelectYes
booleanYes
infoYes

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