Hi All, I'm trying to use wiremock 3.9.1 standalon...
# help
z
Hi All, I'm trying to use wiremock 3.9.1 standalone matchesJsonSchema to specify that the request body must match the json schema defined in a file. I putted my schema.json in the __files directory and I created a mapping JSON file that uses matchesJsonSchema to validate the request body:
Copy code
{
  "request": {
    "method": "POST",
    "url": "/your-endpoint"
  },
  "response": {
    "status": 200,
    "bodyFileName": "response.json",
    "headers": {
      "Content-Type": "application/json"
    },
    "bodyPatterns": [
      {
        "matchesJsonSchema": {
          "schema": "schema.json"
        }
      }
    ]
  }
}
Is it possibile to achieve this goal? Thanks!
r
matchesJsonSchema expects the schema to be inline in the stub json unfortunately. also, your bodyPatterns field needs to be in the request field not the response field