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
I am looking to use cel-java to evaluate if a value is in a list. The problem that I'm running into is the different conversions between the different types. This fails on the Script build line:
check failed: ERROR: <input>:1:5: found no matching overload for '@in' applied to '(int, list(uint))'
| !(3 in rules.repeated_fixed32) ? 'value must be in list' : ''
| ....^
org.projectnessie.cel.tools.ScriptCreateException: check failed: ERROR: <input>:1:5: found no matching overload for '@in' applied to '(int, list(uint))'
| !(3 in rules.repeated_fixed32) ? 'value must be in list' : ''
| ....^
What I am also noticing is that if I change the script to be a unit (intList() test), it still fails due to cel-java interpreting the list type to be int rather than uint. Instead of failing on build time, it incorrectly materializes the uint list as a list of integers, then it cannot find the unit in the list because of the type difference.. From my investigation it seems like this is intentional behavior as we do end up hitting this code path for equality between UintT and IntT.
Here are tests that I am using to demonstrate this behavior:
Note that the type checker is correct, and the underlying problem is that {uint} in {list(uint)} is not evaluating correctly, and always returns false for protobuf repeated uint fields. Though at runtime, {double} in {list(int)} and {uint} in {list(int)} should work in CEL, regardless. So one fix might be to match the expected behavior, though I wonder what these return at runtime:
type(rules.repeated_fixed32) - I would guess list(int) or list(dyn) though it should be list(uint) (list(dyn) would be ok)
type(rules.repeated_fixed32[0]) - I would guess int though it should be uint
I am looking to use cel-java to evaluate if a value is in a list. The problem that I'm running into is the different conversions between the different types. This fails on the Script build line:
What I am also noticing is that if I change the script to be a unit (
intList()
test), it still fails due to cel-java interpreting the list type to beint
rather thanuint
. Instead of failing on build time, it incorrectly materializes theuint
list as a list of integers, then it cannot find theunit
in the list because of the type difference.. From my investigation it seems like this is intentional behavior as we do end up hitting this code path for equality betweenUintT
andIntT
.Here are tests that I am using to demonstrate this behavior:
Thank you for your quick responses!
The text was updated successfully, but these errors were encountered: