Skip to content

How do I use GraphQLMatcher for file mapping #1333

@noxfate

Description

@noxfate

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

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions