graphql-auto-query
This project automatically generates GraphQL queries from GraphQL schemas.
schema.graphql -> query.graphql
usage
| | |
---|
USAGE | [option] <path> | |
ARGUMENTS | <path> | url or path of schema.graphql |
OPTIONS | -d, --depth | Output depth levels (default 2) |
| -o, --output | output file path |
CLI
graphql-auto-query http://localhost:3000/graphql
graphql-auto-query http://localhost:3000/graphql -d 3
graphql-auto-query schema/schema.graphql -o query.graphql
graphql-auto-query https://beta.pokeapi.co/graphql/v1beta -o test/output2.graphql -d 1
graphql-auto-query https://graphqlpokemon.favware.tech/v8 -o test/output3.graphql -d 1
library
import fs from "fs";
import { generate } from "graphql-auto-query";
const schema = fs.readFileSync("schema.graphql", "utf-8");
console.log(generate(schema));