SchemasArtifactsShared schemas
Defs & RulesLast updated on
Last updated on
Typed computed values and validation rules
Defs and Rules enable conditional behavior and validation in forms and bundles.
- Defs define typed computed values that can be referenced in field/annex conditions (
visible,required) - Rules define form-level validation constraints evaluated at fill time
DefsSection
A mapping of named typed expressions keyed by camelCase identifier.
Each entry specifies a type and value. For scalar types the value is a string expression; for composite types (money, address, etc.) the value is an object with component expressions.
[key]: Expression
A typed computed value entry. Key must be camelCase (starts with lowercase letter)
RulesSection
A mapping of form-level validation rules keyed by camelCase identifier. Rules are evaluated at fill time.
[key]: ValidationRule
A validation rule entry. Key must be camelCase (starts with lowercase letter)
CondExpr
A conditional expression used in include, required, and visible fields.
type CondExpr = boolean | stringWhen a string is provided, it can reference:
- Named defs from the
defssection - Field values using
fields.<fieldName> - Comparison operators (
==,!=,>,<,>=,<=) - Logical operators (
&&,||,!)
Examples
kind: form
name: loan-application
defs:
isEmployed:
type: boolean
value: "fields.employmentStatus == 'employed'"
needsCoSigner:
type: boolean
value: "fields.creditScore < 650"
showIncomeFields:
type: boolean
value: "isEmployed"
rules:
creditScoreRange:
expr: "creditScore >= 300 and creditScore <= 850"
message: "Credit score must be between 300 and 850"
incomeRequired:
expr: "not isEmployed or monthlyIncome > 0"
message: "Monthly income is required for employed applicants"
severity: error
fields:
employmentStatus:
type: enum
label: Employment Status
enum: ["employed", "self-employed", "unemployed", "retired"]
creditScore:
type: number
label: Credit Score
min: 300
max: 850
employer:
type: text
label: Employer Name
visible: showIncomeFields
required: showIncomeFields
monthlyIncome:
type: money
label: Monthly Income
visible: showIncomeFields
required: showIncomeFields
coSignerName:
type: person
label: Co-Signer
visible: needsCoSigner
required: needsCoSigner