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

"IN" Operator Fails When Accessed via "VAR" Operator #36

Open
imanrahmani opened this issue May 7, 2024 · 0 comments
Open

"IN" Operator Fails When Accessed via "VAR" Operator #36

imanrahmani opened this issue May 7, 2024 · 0 comments

Comments

@imanrahmani
Copy link

Problem Statement:

While trying to access a subset array from within a superset array using the "All" operator, I found that the "IN" operator does not function correctly when an array is accessed via the "VAR" operator.

Observed Behavior:
In the rule example below, the "IN" operator fails to correctly validate if all elements of the subset array are contained within the superset array:

Rule:

{ "all": [ {"var": "subset"}, {"in": [{"var": ""}, {"var": "superset"}]} ] }
Data

{ "subset": ["apple", "banana", "orange"], "superset": ["apple", "banana", "orange", "grape", "pear"] }

Expected Outcome:
The evaluation of this rule should yield True, as the subset array is fully included in the superset array.

Actual Outcome:
The rule incorrectly returns False.

Hint / Workaround:
When I specify the array directly within the rule instead of referencing it with the "VAR" operator, the "IN" operator behaves as expected:

Working Rule:
{ "all": [ {"var": "subset"}, {"in": [{"var": ""}, ["apple", "banana", "orange", "grape", "pear"]]} ] }

I suspect there might be a bug in the way the "IN" operator processes references to arrays. Your assistance in identifying and resolving the root cause of this behavior would be greatly appreciated.

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