Skip to main content

evaluate_condition

Function evaluate_condition 

Source
pub fn evaluate_condition(
    expr: &Value,
    ctx: &ConditionContext,
) -> SignatifResult<bool>
Expand description

Evaluate one condition expression against a context.

Supported operators (JSON Logic subset): {">=": [a, b]}, >, <=, <, {"==": [a, b]}, !=, {"and": [...]}, {"or": [...]}, {"!": expr}, {"!!": expr}, {"var": "dotted.path"}. Numbers compare numerically; mixed number/string compares equal only on identical string forms; anything else compares by Value equality.

§Errors

Encoding errors for malformed expressions (unknown operator, bad arity, non-string var path). Malformed expressions are errors, not false — a condition that cannot be evaluated fails closed.