Expand description
Request/response variable resolution and condition expressions.
The featherbit analogue of APISIX’s ctx.var + lua-resty-expr: plugins
resolve named variables against the Context (uri, arg_<name>,
http_<header>, …), interpolate $var / ${var} templates, and
evaluate condition expressions written in APISIX’s triple-array form:
vars:
- ["arg_name", "==", "jack"]
- ["http_user_agent", "~~", "Mozilla.+"]Rules in a top-level list are ANDed. A rule is [subject, op, value],
the negated [subject, "!", op, value], or unary [subject, "present"|"absent"|"is_null"].
Nested logic uses ["AND", rule...], ["OR", rule...], and ["NOT", rule-or-group]
(NOT is a featherbit extension over APISIX’s dialect). Subjects are var
names or JSONPath queries over JSON bodies: $.user.name (request body),
request_body:$..., response_body:$... — multi-node matches use
ANY-semantics. Operators: ==, ~=, >, >=, <, <=, ~~ (regex),
~* (case-insensitive regex), in, has, ipmatch, present,
absent, is_null (JSONPath only), contains.
Modules§
- catalog
- Machine-readable catalog of every variable
super::resolvesupports — the single source the Admin API (GET /api/vars), the UI autocomplete, and the var legend consume. Guarded against drift from the resolver bytest_catalog_matches_resolver, which parsesresolve()’s source. - jsonpath
- JSONPath subjects for condition expressions:
$.user.name(request body),request_body:$...,response_body:$.... Paths are compiled at config load (RFC 9535 via serde_json_path); malformed paths fail policy compilation, not requests. - template
- Universal
{{namespace.path}}template engine.
Structs§
- Eval
State 🔒 - Per-evaluation state: the context plus lazily-parsed JSON bodies, so a multi-rule expression parses each body at most once per eval.
- Expr
- A compiled condition expression in APISIX’s triple-array form.
Enums§
- Node 🔒
- Op 🔒
- Subject 🔒
- What a rule’s condition is evaluated against: a flat named var, or a JSONPath query over a request/response body.
Functions§
- cookie_
value 🔒 - eval_
node 🔒 - Evaluates a node left-to-right with short-circuiting. Absent vars
evaluate as empty string (absent address for
ipmatch), and a JSONPath subject over an empty or unparsable body matches zero nodes. - eval_op 🔒
- eval_
op_ 🔒json - ANY-match: the rule holds if at least one matched node passes.
Present/Absent/IsNullare match-set operators, evaluated over the whole node set rather than per-node. - eval_
op_ 🔒json_ node - hex_val 🔒
- interpolate
- Interpolates
$varand${var}references in a template. - json_
scalar_ 🔒eq - Native scalar equality: string↔string, number↔number, bool↔bool. null, arrays, and objects never equal a scalar config value.
- message_
str 🔒 - node_
references_ 🔒response_ body - Whether evaluating
nodereadscontext.response.body. - parse_
node 🔒 - post_
arg 🔒 - query_
string 🔒 - resolve
- Resolves a variable name against the context.
- scalar_
str 🔒 - Stringifies a scalar config value the way the legacy parser did (String as-is, Number/Bool via to_string). None for null/array/object.
- split_
remote_ 🔒addr - Splits
ip:port, tolerating bare IPs and bracketed IPv6. - urldecode 🔒