Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GGYaX opened this issue Oct 2, 2024 · 0 comments
Open

Comments

@GGYaX
Copy link

GGYaX commented Oct 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant