decisionSpec

@ApiStatus.Experimental
fun decisionSpec(block: DecisionSpecScope.() -> Unit): DecisionSpec

Builds a decision spec with a Kotlin receiver DSL. The block declares questions on DecisionSpecScope and runs once. The spec is built once, after the block returns, so later calls on a leaked question builder cannot change it.

val triage = decisionSpec {
proposition("is_urgent") {
asking("Does this convey urgency?")
}
choice("department") {
asking("Which team should handle this?")
option("billing", "Payments, invoicing, refunds")
option("technical", "Bugs, outages, integrations")
}
}

Return

the built spec

Parameters

block

declares the spec's questions

Throws

if no question is declared, two questions share a name, or a declared question's definition is invalid