Closed anakrish closed 4 days ago
I must admit, I'm a bit confused by this one. I can confirm that the reference implementation returns
{
"allow": 5
}
however I can't quite follow the logic. The body of the if
resolves to true
, so the value of allow
should be undefined. Is the idea that the else value gets used because the resulting value of the rule would otherwise be undefined, even though a preceding query resolved to true?
One could say that the value
is part of the query
as seen by the following rego. The value x
resolves to the local variable in the query instead of the rule x
with same name.
package test
x := 5
y := x { x := 6 }
In the original example the query did not resolve to true rather it evaluated to undefined.
The following rego
incorrectly evaluates to
{"expressions":[{"test":{}}]}