I think we can mainly use `array`, I write a new style. this style can be compatible with the old rules.
[ "AND", -- optional ["arg_name","==","yaml"], [ "OR", ["arg_name","==","json"], ["arg_weight",">",10] ] ] On Wed, Nov 25, 2020 at 2:58 PM Zexuan Luo <spacewan...@apache.org> wrote: > Currently we support a DSL to match routes with variables: > > ``` > [ > ["arg_name","==","json"], > ["arg_weight",">",10], > ["arg_weight","!",">",15] > ] > ``` > > is evaluated to `ngx.var.arg_name == "json" and ngx.var.arg_weight > 10 > and not ngx.var.arg_weight > 15`. > > It would be better if the DSL can support `or` relation and nested > expressions. > > What about a syntax like: > ``` > { > "or": [ <- the `or` can be other logical operators, like `and`, > `!or`, `!and` > ["arg_name","==","json"], > ["arg_weight",">",10], > ["arg_weight","!",">",15] > ] > } > ``` > (means `ngx.var.arg_name == "json" or ngx.var.arg_weight > 10 or not > ngx.var.arg_weight > 15` ) > and > ``` > { > "!and": { > "and": [ > ["arg_name","==","yaml"] > ], > "or": [ > ["arg_name","==","json"], > ["arg_weight",">",10], > ["arg_weight","!",">",15] > ] > } > } > ``` > (means `not (ngx.var.arg_name == "yaml" and (ngx.var.arg_name == "json" or > ngx.var.arg_weight > 10 or not ngx.var.arg_weight > 15))` ) > -- *MembPhis* My GitHub: https://github.com/membphis Apache APISIX: https://github.com/apache/apisix