This message was deleted.
# introduce-yourself
s
This message was deleted.
🙌 1
o
Hi, welcome! Do you plan to use an existing GraphQL extension for WireMock?
k
Thanks for warm welcome @Oleg Nenashev Apologies if I sound Naive. we have wiremock server sertup in project and based on my research online wiremock does support GraphQL similarly as for Rest API requests (answer from thread I found : https://stackoverflow.com/questions/75640205/does-wiremock-support-mocking-graphql-apis) So we are planning use the same way and there is the sample request I have build for success and error scenario For success scenario mapping(worked till I put negative scenario):
Copy code
"url": "/graphql",
"method": "POST",
"bodyPatterns": [
  {
    "matchesJsonPath": "$.query",
    "contains": "query organisation($orgId: ID!) { organisation(organisationId: $orgId) { id name kvkNumber journeyTypeConfigurations { journeyType { id icon name } journeyReferenceType consumerRole infoMediationTemplateConfiguration { id type name } } } }"
  },
  {
    "matchesJsonPath" : "$[?(@.variables.size() == 1)]"
  },
  {
    "matchesJsonPath": {
      "expression": "$.variables",
      "equalToJson": "{ \"orgId\": \"36df60f7-033a-444f-846e-a7cde0fb3947\" }"
    }
  }
Negative scenario bodypattern:
Copy code
"url": "/graphql",
"method": "POST",
"bodyPatterns": [
  {
    "matchesJsonPath": "$.query",
    "contains": "query organisation($orgId: ID!) { organisation(organisationId: $orgId) { id name kvkNumber journeyTypeConfigurations { journeyType { id icon name } journeyReferenceType consumerRole infoMediationTemplateConfiguration { id type name } } } }"
  },
  {
    "matchesJsonPath" : "$[?(@.variables.size() == 1)]"
  },
  {
    "matchesJsonPath": "$.variables.orgId",
    "doesNotEqual": "36df60f7-033a-444f-846e-a7cde0fb3947"
  }
]
Now I am not getting why even when I pass correct value that matches for success scenario I get response from negative mapping only. I am not sure if I answered your question correctly or not, but this is where we have used GraphQL mapping, along side documentation https://wiremock.org/docs/request-matching/ for request matching let me know if I need to modify any places