Skip to content

Commit

Permalink
Fix the print-schema script
Browse files Browse the repository at this point in the history
  • Loading branch information
dschafer committed Aug 3, 2015
1 parent 85d93b7 commit f2794c3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/tools/print-schema/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

import { getIntrospectionResult }
from '../../../language/schema/printer';
import { parseSchemaIntoAST }
from '../../../language/schema/';
import { buildASTSchema, introspectionQuery }
from '../../../utilities/';
import { graphql }
from '../../../';

var Promise = require('bluebird');
var parseArgs = require('minimist');
Expand Down Expand Up @@ -38,7 +42,9 @@ export async function executeTool() {
}

var body = await fs.readFileAsync(argDict.file, 'utf8');
var result = await getIntrospectionResult(body, argDict.query);
var ast = parseSchemaIntoAST(body);
var astSchema = buildASTSchema(ast, argDict.query, argDict.mutation);
var result = await graphql(astSchema, introspectionQuery);
var out = await JSON.stringify(result, null, 2);
console.log(out);
} catch (error) {
Expand All @@ -54,4 +60,8 @@ introspection query result from querying that schema.
Required:
--file <path>: The path to the input schema definition file.
--query <queryType>: The query type (root type) of the schema.`;
--query <queryType>: The query type (root type) of the schema.
Optional:
--mutation <mutationType>: The mutation type (root type) of the schema.`;

0 comments on commit f2794c3

Please sign in to comment.