Skip to content

Commit f2794c3

Browse files
committed
Fix the print-schema script
1 parent 85d93b7 commit f2794c3

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/tools/print-schema/src/index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10-
import { getIntrospectionResult }
11-
from '../../../language/schema/printer';
10+
import { parseSchemaIntoAST }
11+
from '../../../language/schema/';
12+
import { buildASTSchema, introspectionQuery }
13+
from '../../../utilities/';
14+
import { graphql }
15+
from '../../../';
1216

1317
var Promise = require('bluebird');
1418
var parseArgs = require('minimist');
@@ -38,7 +42,9 @@ export async function executeTool() {
3842
}
3943

4044
var body = await fs.readFileAsync(argDict.file, 'utf8');
41-
var result = await getIntrospectionResult(body, argDict.query);
45+
var ast = parseSchemaIntoAST(body);
46+
var astSchema = buildASTSchema(ast, argDict.query, argDict.mutation);
47+
var result = await graphql(astSchema, introspectionQuery);
4248
var out = await JSON.stringify(result, null, 2);
4349
console.log(out);
4450
} catch (error) {
@@ -54,4 +60,8 @@ introspection query result from querying that schema.
5460
Required:
5561
5662
--file <path>: The path to the input schema definition file.
57-
--query <queryType>: The query type (root type) of the schema.`;
63+
--query <queryType>: The query type (root type) of the schema.
64+
65+
Optional:
66+
67+
--mutation <mutationType>: The mutation type (root type) of the schema.`;

0 commit comments

Comments
 (0)