Empty filter does not work for empty array
VRRAF opened this issue · 0 comments
VRRAF commented
JSON:
{
"get": {
"tags": [
"voucher"
],
"summary": "",
"testArray1":[],
"testObject1":{},
"operationId": "defineDiscountPercentageVoucherBrief",
"security": [
{
"semi-private": [],
"testObject2":{}
}
]
}
}
Filter : $..[?(@ empty true)]
Options: Option.AS_PATH_LIST
Result:
[
"$['get']['testObject1']",
"$['get']['security'][0]['testObject2']"
]
Expected Result:
[
"$['get']['testArray1']" <-- this is missing
"$['get']['testObject1']",
"$['get']['security'][0]['semi-private']" <-- this is missing
"$['get']['security'][0]['testObject2']"
]
Tested with version 2.4.0. Version > 2.4.0 has an issue with empty collection filter #900
If we provide a filter like this $..[?(@.semi-private empty true)]
then the result will be returned "$['get']['security'][0]"
, but this is the path of the parent node containing the empty array. A way is needed to get the path of the node that has a value empty array.