I am trying to filter response and i would like to accept multiple matches. Found that jsonPath has "in" operator to match value on the left side with array elements on the right. String concatenation is working in jsonPath query strings, but how can I add array?
* def my_array = ["a","b"]
* def resp = karate.jsonPath(response, "$.content[?(@.smthing in my_array)]" )
As a workaround i can use regexp instead of array. But it is just to much effort.... :(
* queryString = ""
* def func = function(x){queryString += x +"|";}
* karate.forEach(my_array,func)
* def trunc = function( ) { queryString = queryString.substring(0, queryString.length()-1) }
* trunc()
* def resp = karate.jsonPath(response, "$.content[?(@.smthing =~ /'+queryString +'/)]" )