Created
April 3, 2019 14:31
-
-
Save josemarluedke/062cec8fa351b88281af3d659d5c84ab to your computer and use it in GitHub Desktop.
Generate a SDL graphql string from a introspection schema result
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { buildClientSchema, printSchema } = require('graphql'); | |
const fs = require('fs'); | |
const introspectionSchemaResult = JSON.parse( | |
fs.readFileSync('./graphql.schema.json') | |
); | |
const graphqlSchemaObj = buildClientSchema(introspectionSchemaResult); | |
const sdlString = printSchema(graphqlSchemaObj); | |
console.log(sdlString); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment