Krupa Mashruwala
09/05/2023, 1:25 PM{
"matchesJsonPath" : "$[?(@.variables.size() == 1)]"
},
{
"matchesJsonPath": "$.variables.orgId",
"doesNotEqual": "36df60f7-033a-444f-846e-a7cde0fb3947"
}
and for Positive match I was able to successfully match it with jsonEquals. as follows:
{
"matchesJsonPath" : "$[?(@.variables.size() == 1)]"
},
{
"matchesJsonPath": {
"expression": "$.variables",
"equalToJson": "{ \"orgId\": \"36df60f7-033a-444f-846e-a7cde0fb3947\" }"
}
}
but after placing mapping of negative match it directly get response of negative match even if my value for orgID matches to uuid 36df60f7-033a-444f-846e-a7cde0fb3947
Is there anything wrong I am doing? please guideOleg Nenashev
09/05/2023, 4:19 PMnot()
matcher that can chain equalToJson
()Aaron
09/05/2023, 7:40 PM...
{
"matchesJsonPath": "$[?(@.variables.size() == 1)]"
},
{
"matchesJsonPath": {
"expression": "$.variables.orgId",
"doesNotMatch": "36df60f7-033a-444f-846e-a7cde0fb3947"
}
}
...
should also work! Tested it out on 2.35.0 (oops not on 3.0.2 yet 🙃 )
Here’s the whole mapping I used:
{
"mappings": [
{
"request": {
"url": "/test",
"bodyPatterns": [
{
"matchesJsonPath": "$[?(@.variables.size() == 1)]"
},
{
"matchesJsonPath": {
"expression": "$.variables.orgId",
"doesNotMatch": "36df60f7-033a-444f-846e-a7cde0fb3947"
}
}
]
},
"response": {
"status": 200,
"body": "Does not match!"
}
},
{
"request": {
"url": "/test",
"bodyPatterns": [
{
"matchesJsonPath": "$[?(@.variables.size() == 1)]"
},
{
"matchesJsonPath": {
"expression": "$.variables",
"equalToJson": "{ \"orgId\": \"36df60f7-033a-444f-846e-a7cde0fb3947\" }"
}
}
]
},
"response": {
"status": 200,
"body": "Does match!"
}
}
]
}
And the request body I sent:
{
"variables": {
"orgId": "36df60f7-033a-444f-846e-a7cde0fb3947"
}
}
Krupa Mashruwala
09/06/2023, 5:18 AMOleg Nenashev
09/06/2023, 8:25 AMKrupa Mashruwala
09/06/2023, 11:11 AMAaron
09/06/2023, 1:46 PM