cel-python icon indicating copy to clipboard operation
cel-python copied to clipboard

TypeError: 'CELEvalError': iterable operator is not working on null field

Open GGYaX opened this issue 1 year ago • 0 comments

Error: TypeError: 'CELEvalError' object is not iterable

How to reproduce it? For a CEL expression on iterable like .exists, .all, .exist_one, and an input with a null in the given field:

python -m celpy '.non_exist_fields.all(p, true)' <<EOF                                                                                             ✭
{"this": {"from": {"json": 13}}}
EOF

it's the same even it's prefixed with a condition

python -m celpy 'false && .non_exist_fields.all(p, true)' <<EOF                                                                                             ✭
{"this": {"from": {"json": 13}}}
EOF

A workaround is to wrap with a .has and default value: (has(.non_exist_fields) ? .non_exist_fields : []).all(p, true), but it's supposed to work on any nullable field.

cel-python version: 0.1.5 python version: 3.11.4

GGYaX avatar Oct 02 '24 12:10 GGYaX