Skip to content

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

@GGYaX

Description

@GGYaX

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions