GraphQL Request generator
Utility class to generate GraphQL queries or mutations to be tested or used with an API client
The GraphQLRequest interface
Classes are using an array of GraphQLRequest
objects, structured as following
;;
GraphQLGenerator
The GraphQLGenerator
class will do all of the syntax checking and values-compliance based on passed params. For example
Not providing user
inside fragmentValues
object will throw a ValidationError
Generation
Consider the following input
;
Query Generator
With a GraphqlQueryGenerator
class, will produce the following output
; // queryquery$id:String
Mutation Generator
With a GraphqlMutationGenerator
class, will produce the following output
; // mutationmutation$id:String
Linting
ESLint has been implemented in this repo, you can run it by using
npm run lint
Tests
Tests have been written using Jest
and ts-jest
, you can run them by using
npm run test