Files
zen/core/expression
stefan-gorules 6f1fea89bd fix(engine): typed index-then-field reads and struct-column policy references (#582)
* fix(engine): typed index-then-field reads and struct-column policy references

Refuse typed lowering of `list[n].field` when the list carries a map
projection, so `map(items, #.code)[0].price` reads null like version 1
instead of the source item's field.

Take the shared row path when a column sits above or below a policy
reference field, so references inside struct columns are checked
against their pool like version 1.

* test(engine): build the struct-column reference test from plain string arrays
2026-11-28 19:49:52 +01:00
..
2026-11-17 17:37:10 +01:00
2026-11-27 10:51:31 +01:00
2026-11-19 18:09:09 +01:00

ZEN Expression Language

The expression language of ZEN Engine, the open-source Business Rules Engine (BRE) from GoRules.

License: MIT crates.io

ZEN expressions are readable by business users and fast enough for hot paths: a complete language for conditions, calculations and data transformation, with lexer, parser, compiler, VM, type checking and editor completions included in this crate.

use serde_json::json;
use zen_expression::evaluate_expression;

fn main() {
    let result = evaluate_expression(
        "sum(items) * multiplier",
        json!({ "items": [10, 20, 30], "multiplier": 2 }).into(),
    )
    .unwrap();
    // => 120
}

Reusable expressions compile once via compile_expression and evaluate repeatedly against different contexts.

Resources

License

MIT License