This message was deleted.
# help
s
This message was deleted.
o
Hmm, strange. I suggest filing a github issue, most likely the matcher is not adapted to the JSON matching interface.
t
Hi @Andrew Ripley, this seems to do the trick I think:
Copy code
{
  "request": {
    "method": "POST",
    "urlPath": "/data",
    "bodyPatterns": [
      {
        "or": [
          {
            "matchesJsonPath": {
              "expression": "$.restrictions.size()",
              "or": [
                {
                  "matches": "0"
                },
                {
                  "matches": "1"
                },
                {
                  "matches": "2"
                }
              ]
            }
          },
          {
            "matchesJsonPath": {
              "expression": "$.restrictions",
              "absent": true
            }
          }
        ]
      }
    ]
  },
  "response": {
    "status": 200,
    "body": "\nOK\n"
  }
}
🙌 1
a
@Tom that did the trick!! thank you so much! and happy new year!!
👍 1
@Oleg Nenashev do you still think i should open a github issue for this? Id love to take a crack at helping to solve the issue too!
t
I think you might struggle to get the array size thing working without applying a fix to the upstream JSONPath library, but if you can find a solution we’d be happy to merge it
a
ah good to know. ill poke around 🙂
103 Views