Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public Object evaluate(JsonLogicEvaluator evaluator, JsonLogicArray arguments, O

Object maybeArray = evaluator.evaluate(arguments.get(0), data);

if (maybeArray == null) {
return false;
}

if (!ArrayLike.isEligible(maybeArray)) {
throw new JsonLogicEvaluationException("first argument to all must be a valid array");
}
Expand Down
114 changes: 114 additions & 0 deletions src/test/resources/fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -3711,5 +3711,119 @@
"items": []
},
false
],
[
{
"all": [
{
"var": ""
},
{
"in": [
{
"var": ""
},
["item1","item2","item3"]
]
}
]
},
[],
false
],
[
{
"all": [
{
"var": ""
},
{
"in": [
{
"var": ""
},
["item1","item2","item3"]
]
}
]
},
["item1"],
true
],
[
{
"all": [
{
"var": ""
},
{
"in": [
{
"var": ""
},
["item1","item2","item3"]
]
}
]
},
["item4"],
false
],
[
{
"all": [
{
"var": "item"
},
{
"in": [
{
"var": ""
},
["item1","item2","item3"]
]
}
]
},
{},
false
],
[
{
"all": [
{
"var": "item"
},
{
"in": [
{
"var": ""
},
["item1","item2","item3"]
]
}
]
},
{ "item": ["item1"] },
true
],
[
{
"all": [
{
"var": "item"
},
{
"in": [
{
"var": ""
},
["item1","item2","item3"]
]
}
]
},
{ "item": ["item4"] },
false
]
]