You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today you must assign values requiring evaluation to local variables before using them in with modifiers. For example, the following is not allowed:
foo = {"bar": 1}; data.foo with input as foo.bar
The easiest way to handle this would be to rewrite the with modifiers early in compilation the same way we do for rule heads, comprehension terms, etc.
So, for example, the query above would become:
foo = {"bar": 1}; __local0__ = foo.bar; data.foo with input as __local0__
The text was updated successfully, but these errors were encountered:
These changes update the compiler to rewrite with modifiers to allow
refs or other terms that require evaluation as values. For example,
before this change, the following would not be allowed:
allow with input as data.test.some_test_input
Because the with value (data.test.some_test_input) requires evaluation.
After this change, the expression will be rewritten so that the with
value is bound to a variable earlier in the query and then substituted
with a variable.
This change will make tests cleaner as users will not have to bind
inputs to variables explicitly inside their test cases.
Fixesopen-policy-agent#701
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
These changes update the compiler to rewrite with modifiers to allow
refs or other terms that require evaluation as values. For example,
before this change, the following would not be allowed:
allow with input as data.test.some_test_input
Because the with value (data.test.some_test_input) requires evaluation.
After this change, the expression will be rewritten so that the with
value is bound to a variable earlier in the query and then substituted
with a variable.
This change will make tests cleaner as users will not have to bind
inputs to variables explicitly inside their test cases.
Fixes#701
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
Today you must assign values requiring evaluation to local variables before using them in
with
modifiers. For example, the following is not allowed:The easiest way to handle this would be to rewrite the with modifiers early in compilation the same way we do for rule heads, comprehension terms, etc.
So, for example, the query above would become:
The text was updated successfully, but these errors were encountered: