Skip to content

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.

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

Policy Rule
Test Data (JSON)
[label:] if <condition> [and|or <condition> ...] -> <outcome>.
  • label: (optional) — names the rule, same role as the verbose label. prefix.
  • if introduces the condition.
  • <condition> is a property comparison, list/string/unary check, or $label reference.
  • and / or chain conditions.
  • -> <outcome> declares the outcome and ends with a period.
OperatorMeaning
==equal
!=not equal
>greater than
<less than
>=greater than or equal
<=less than or equal
if user.role == "admin" -> access.

Interactive Example

Policy Rule
Test Data (JSON)

Interactive Example

Policy Rule
Test Data (JSON)

Interactive Example

Policy Rule
Test Data (JSON)

Membership against a literal list of values.

Interactive Example

Policy Rule
Test Data (JSON)

Interactive Example

Policy Rule
Test Data (JSON)

Property paths are dot-delimited and can drill arbitrarily deep.

Interactive Example

Policy Rule
Test Data (JSON)

Property is present and non-null.

Interactive Example

Policy Rule
Test Data (JSON)

Property is null or missing — both forms satisfy is null.

Interactive Example

Policy Rule
Test Data (JSON)

Numeric range, inclusive on both ends.

Interactive Example

Policy Rule
Test Data (JSON)

On a list, checks membership:

Interactive Example

Policy Rule
Test Data (JSON)

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.

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

Policy Rule
Test Data (JSON)

Interactive Example

Policy Rule
Test Data (JSON)

A shorthand rule can span multiple lines for readability:

Interactive Example

Policy Rule
Test Data (JSON)

Shorthand and verbose rules coexist in the same rule set, and either can reference the other.

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.

Label the supporting rule and reference it from the golden rule:

Interactive Example

Policy Rule
Test Data (JSON)

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.

Shorthand favours the common case. The following are verbose-only:

  • Arithmetic on the LHSif 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.
  • @label value references — verbose-only.
  • Quantifiers and selectors over collections — use the verbose every / any forms.

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.

ShorthandVerbose equivalent
x == yis equal to
x != yis not equal to
x > yis greater than
x < yis less than
x >= yis greater than or equal to
x <= yis less than or equal to
x in [...]is in
x not in [...]is not in
x between a and bis between
x contains ycontains
x existsexists
x is nullis null
$label§label passes
not $label§label fails
->rule outcome (gets, is, etc.)