Shorthand Syntax
The verbose DSL is readable but heavy for simple rules. Shorthand cuts the ceremony — symbolic operators, dotted property paths, and -> for the outcome — while producing the exact same Rule / RuleSet model. There are no evaluator changes; shorthand and verbose rules can live side by side in the same policy.
At A Glance
Section titled “At A Glance”Verbose:
A **applicant** gets manual_review
if the __risk_score__ of the **applicant** is greater than 72.Shorthand:
if applicant.risk_score > 72 -> manual_review.Both produce the same outcome manual_review against the same data.
Interactive Example
Anatomy
Section titled “Anatomy”[label:] if <condition> [and|or <condition> ...] -> <outcome>.label:(optional) — names the rule, same role as the verboselabel.prefix.ifintroduces the condition.<condition>is a property comparison, list/string/unary check, or$labelreference.and/orchain conditions.-> <outcome>declares the outcome and ends with a period.
Conditions
Section titled “Conditions”Comparison
Section titled “Comparison”| Operator | Meaning |
|---|---|
== | equal |
!= | not equal |
> | greater than |
< | less than |
>= | greater than or equal |
<= | less than or equal |
if user.role == "admin" -> access.Interactive Example
And / Or
Section titled “And / Or”Interactive Example
Interactive Example
Lists — in / not in
Section titled “Lists — in / not in”Membership against a literal list of values.
Interactive Example
Interactive Example
Nested properties
Section titled “Nested properties”Property paths are dot-delimited and can drill arbitrarily deep.
Interactive Example
exists
Section titled “exists”Property is present and non-null.
Interactive Example
is null
Section titled “is null”Property is null or missing — both forms satisfy is null.
Interactive Example
between
Section titled “between”Numeric range, inclusive on both ends.
Interactive Example
contains
Section titled “contains”On a list, checks membership:
Interactive Example
On a string, contains requires full equality — it is not a substring match. For substring matching, use a verbose rule with the appropriate string operator.
Labels and References
Section titled “Labels and References”Prefix a shorthand rule with label: to name it:
risk_check: if applicant.risk_score > 72 -> manual_review.Dot-notation labels work just like in the verbose syntax:
risk.check: if applicant.risk_score > 72 -> manual_review.Reference a labeled rule with $label (or not $label to invert):
Interactive Example
Interactive Example
Multi-line Rules
Section titled “Multi-line Rules”A shorthand rule can span multiple lines for readability:
Interactive Example
Mixing Shorthand and Verbose
Section titled “Mixing Shorthand and Verbose”Shorthand and verbose rules coexist in the same rule set, and either can reference the other.
The Golden Rule constraint
Section titled “The Golden Rule constraint”Every policy needs exactly one golden rule — the top-level rule that nothing else references. Every other rule must be reachable from it via a label or selector reference. This applies whether the rules are shorthand, verbose, or a mix.
The example below fails to parse because both rules are top-level — neither references the other:
if applicant.risk_score > 72 -> manual_review.
A **applicant** gets approved
if the __income__ of the **applicant** is greater than 50000.Parse error: Multiple global rules found: 'manual_review', 'approved'.There should be only one golden rule that is not referenced by other rules.A working mix
Section titled “A working mix”Label the supporting rule and reference it from the golden rule:
Interactive Example
Here approved is the golden rule, and risk (shorthand, labeled) is reachable through the verbose §risk passes reference. The reverse also works — a shorthand golden rule can reference a verbose rule via $label.
Limitations
Section titled “Limitations”Shorthand favours the common case. The following are verbose-only:
- Arithmetic on the LHS —
if user.age + 1 > 18 -> ok.does not parse. Use the verbose math expression syntax instead. - Math functions (
floor of,ceil of,round of,abs of) — verbose-only. @labelvalue references — verbose-only.- Quantifiers and selectors over collections — use the verbose
every/anyforms.
If you need any of these in a rule, write that rule in verbose form. You can still mix it with shorthand rules in the same policy.
Operator Cheat Sheet
Section titled “Operator Cheat Sheet”| Shorthand | Verbose equivalent |
|---|---|
x == y | is equal to |
x != y | is not equal to |
x > y | is greater than |
x < y | is less than |
x >= y | is greater than or equal to |
x <= y | is less than or equal to |
x in [...] | is in |
x not in [...] | is not in |
x between a and b | is between |
x contains y | contains |
x exists | exists |
x is null | is null |
$label | §label passes |
not $label | §label fails |
-> | rule outcome (gets, is, etc.) |