@@ -3,11 +3,12 @@ import {
33 findBreakingChanges ,
44 findDangerousChanges ,
55 GraphQLSchema ,
6- introspectionQuery ,
76 buildClientSchema ,
87 buildSchema ,
98 DangerousChange ,
10- BreakingChange
9+ BreakingChange ,
10+ introspectionFromSchema ,
11+ getIntrospectionQuery
1112} from 'graphql' ;
1213import fs from 'fs' ;
1314import isGlob from 'is-glob' ;
@@ -23,6 +24,7 @@ async function fetchRemoteSchema(
2324 endpoint : string ,
2425 headers ?: Headers
2526) : Promise < GraphQLSchema > {
27+ const introspectionQuery = getIntrospectionQuery ( { descriptions : false } ) ;
2628 const res = await fetch ( endpoint , {
2729 method : 'POST' ,
2830 headers : {
@@ -46,19 +48,23 @@ async function fetchRemoteSchema(
4648}
4749
4850function readLocalSchema ( schemaPath : string ) : GraphQLSchema {
51+ let schemaString : string ;
52+
4953 if ( isGlob ( schemaPath ) ) {
5054 const typesArray = fileLoader ( schemaPath ) ;
5155
5256 if ( typesArray . length === 0 ) {
5357 throw new Error ( `No types found with glob pattern '${ schemaPath } '` ) ;
5458 }
5559
56- const mergedSchema = mergeTypes ( typesArray , { all : true } ) ;
57- return buildSchema ( mergedSchema ) ;
60+ schemaString = mergeTypes ( typesArray , { all : true } ) ;
5861 } else {
59- const schemaString = fs . readFileSync ( schemaPath , 'utf8' ) ;
60- return buildSchema ( schemaString ) ;
62+ schemaString = fs . readFileSync ( schemaPath , 'utf8' ) ;
6163 }
64+
65+ const schema = buildSchema ( schemaString ) ;
66+ const introspection = introspectionFromSchema ( schema , { descriptions : false } )
67+ return buildClientSchema ( introspection ) ;
6268}
6369
6470async function getSchema (
0 commit comments