zeroSteiner / rule-engine

A lightweight, optionally typed expression language with a custom grammar for matching arbitrary Python objects.
https://zerosteiner.github.io/rule-engine/
BSD 3-Clause "New" or "Revised" License
455 stars 54 forks source link

Comprehension Expression Error #72

Closed zeroSteiner closed 1 year ago

zeroSteiner commented 1 year ago

how can i add any or all condition for a list of dictionaries. something like this $all( [ item['model'] == 'oncology' for item in api_response ])

Originally posted by @MdTabraiz in https://github.com/zeroSteiner/rule-engine/discussions/16#discussioncomment-6624007

when i am doing something like this i am getting the following error: can not map python type 'ComprehensionExpression' to a compatible data type

zeroSteiner commented 1 year ago

Fixed in commit cca88d6. The issue was the expression check to propagate the result_type was too restrictive. I remember seeing this and meaning to fix it but it must have slipped my mind. Anyways, it's fixed now and released in 4.1.0.

MdTabraiz commented 1 year ago

Thanks for the quick action.