ukrbublik / react-awesome-query-builder

User-friendly query builder for React
https://ukrbublik.github.io/react-awesome-query-builder
MIT License
1.97k stars 494 forks source link

JSONLogic "in" operator does not work as expected for list #1076

Closed gquittet closed 3 months ago

gquittet commented 3 months ago

JSONLogic can test if a value is in a list of value

image

But with the actual implementation, the exported JSONLogic looks like this:

{
  "in": [
    [
      "1.1.1.1",
      "2.2.2.2"
    ],
    {
      "var": "ip"
    }
  ]
}

It can't work because it will check that the full array is in the ip variable.

The expected result should be:

{
  "in": [
    {
      "var": "ip"
    },
    [
      "1.1.1.1",
      "2.2.2.2"
    ]
  ]
}

The order [{"var": "example"}, "values"] is good for all operators, except when we want to check if a variable contains a string/array of string

gquittet commented 3 months ago

My bad I use the wrong operator.

I should use "Any in" instead of "contains"

Great library! 🤟