Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gql-generator

CLI tool that generates graphql queries and mutations placeholders from graphql schema file.


how does it work

This CLI tool takes in a graphql schema as input and generates every query and mutation with input params with type placeholders and output types.

The queries and mutations are generated into two folders [query, mutation] and for each query/mutation a .gql file is created

gql-generator has three inputs:

  • input: path to graphql schema file
  • output: path to output folders to
  • depth: how deep to generate the type

example

we have the following schema file:

input CreateUserInput {
  firstName: String!
}

type Mutation {
  createUser(input: CreateUserInput!): User!
}

type Query {
  users: [User!]!
}

type User {
  id: String!
  username: String!
}

the output will be:

query/users.gql

query {
  users {
    id
    username
  }
}

mutation/createUser.gql

mutation {
  createUser (
    input: {
      firstName: String!
    }
  ) {
    id
    username
  }
}

How to Use

# install
npm install -g @lagunahealth/gql-generator

# see the usage
gql-generator --help

gql-generator --input ./schema.gql --output ./ --depth 6

About

CLI tool that transforms graphql schema file to all possible queries and mutations

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages