wiremock / wiremock/WireMock.Net

How do I use GraphQLMatcher for file mapping

Open
#1,333 5 comments 0 reactions 1 assignee View on GitHub

@StefH is already working on this.

Since Jul 18, 2025.

question
Dominant language
C#
Stars
1.7k
Forks
240
Avg merge
5d 12h
Merged PRs (30d)
2

Description

Hi, I want to ask question about GraphQLMatcher and how to use them.

I've been trying to use them in both format, both on C# and Json Mapping but found no success. Basically, I don't understand the feature in overall.

Do I have to provided schema first ? then start mocking the query? and how would that look like especially in Json Mapping. To clarify my use case, let's say I have this as my schema for entire application.

var TestSchema = @"
  type Query {
   greeting:String
   students:[Student]
   studentById(id:ID!):Student
  }

  type Student {
   id:ID!
   firstName:String
   lastName:String
   fullName:String 
  }";

How do I match with query for /graphql with and stub the response

query MyNewQuery($studentId: Int!) {
    studentById(id: $studentId) {
        fullName
    }
}

Currently, my work around is to use JsonPartialMatcher but proven to not effective and I really want to try this feature.

I can help PR to update the docs once I can understand how its work. Thanks in advance

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.