@@ -23,10 +23,18 @@ import type {
2323
2424import  fs  from  'fs' ; 
2525import  path  from  'path' ; 
26- import  { GraphQLSchema ,  extendSchema ,  parse ,  visit }  from  'graphql' ; 
26+ import  { GraphQLSchema ,  Kind ,   extendSchema ,  parse ,  visit }  from  'graphql' ; 
2727import  nullthrows  from  'nullthrows' ; 
2828
29- import  { 
29+ import  { getGraphQLConfig ,  GraphQLConfig ,  GraphQLEndpoint }  from  'graphql-config' ; 
30+ import  { getQueryAndRange }  from  './MessageProcessor' ; 
31+ import  stringToHash  from  './stringToHash' ; 
32+ import  glob  from  'glob' ; 
33+ 
34+ // Maximum files to read when processing GraphQL files. 
35+ const  MAX_READS  =  200 ; 
36+ 
37+ const  { 
3038  DOCUMENT , 
3139  FRAGMENT_DEFINITION , 
3240  OBJECT_TYPE_DEFINITION , 
@@ -42,14 +50,7 @@ import {
4250  ENUM_TYPE_EXTENSION , 
4351  INPUT_OBJECT_TYPE_EXTENSION , 
4452  DIRECTIVE_DEFINITION , 
45- }  from  'graphql/language/kinds' ; 
46- import  { getGraphQLConfig ,  GraphQLConfig ,  GraphQLEndpoint }  from  'graphql-config' ; 
47- import  { getQueryAndRange }  from  './MessageProcessor' ; 
48- import  stringToHash  from  './stringToHash' ; 
49- import  glob  from  'glob' ; 
50- 
51- // Maximum files to read when processing GraphQL files. 
52- const  MAX_READS  =  200 ; 
53+ }  =  Kind ; 
5354
5455export async  function  getGraphQLCache ( 
5556  configDir : Uri , 
@@ -93,7 +94,10 @@ export class GraphQLCache implements GraphQLCacheInterface {
9394    // Return an empty array. 
9495    let  parsedQuery ; 
9596    try  { 
96-       parsedQuery =  parse ( query ) ; 
97+       parsedQuery =  parse ( query ,  { 
98+         allowLegacySDLImplementsInterfaces : true , 
99+         allowLegacySDLEmptyFields : true , 
100+       } ) ; 
97101    }  catch  ( error )  { 
98102      return  [ ] ; 
99103    } 
@@ -193,7 +197,10 @@ export class GraphQLCache implements GraphQLCacheInterface {
193197    // Return an empty array. 
194198    let  parsedQuery ; 
195199    try  { 
196-       parsedQuery =  parse ( query ) ; 
200+       parsedQuery =  parse ( query ,  { 
201+         allowLegacySDLImplementsInterfaces : true , 
202+         allowLegacySDLEmptyFields : true , 
203+       } ) ; 
197204    }  catch  ( error )  { 
198205      return  [ ] ; 
199206    } 
@@ -442,7 +449,13 @@ export class GraphQLCache implements GraphQLCacheInterface {
442449    const  cache  =  this . _fragmentDefinitionsCache . get ( rootDir ) ; 
443450    const  asts  =  contents . map ( ( { query } )  =>  { 
444451      try  { 
445-         return  { ast : parse ( query ) ,  query } ; 
452+         return  { 
453+           ast : parse ( query ,  { 
454+             allowLegacySDLImplementsInterfaces : true , 
455+             allowLegacySDLEmptyFields : true , 
456+           } ) , 
457+           query , 
458+         } ; 
446459      }  catch  ( error )  { 
447460        return  { ast : null ,  query } ; 
448461      } 
@@ -501,7 +514,13 @@ export class GraphQLCache implements GraphQLCacheInterface {
501514    const  cache  =  this . _typeDefinitionsCache . get ( rootDir ) ; 
502515    const  asts  =  contents . map ( ( { query } )  =>  { 
503516      try  { 
504-         return  { ast : parse ( query ) ,  query } ; 
517+         return  { 
518+           ast : parse ( query ,  { 
519+             allowLegacySDLImplementsInterfaces : true , 
520+             allowLegacySDLEmptyFields : true , 
521+           } ) , 
522+           query , 
523+         } ; 
505524      }  catch  ( error )  { 
506525        return  { ast : null ,  query } ; 
507526      } 
@@ -678,7 +697,13 @@ export class GraphQLCache implements GraphQLCacheInterface {
678697    const  customDirectives  =  projectConfig . extensions . customDirectives ; 
679698    if  ( customDirectives  &&  schema )  { 
680699      const  directivesSDL  =  customDirectives . join ( '\n\n' ) ; 
681-       schema  =  extendSchema ( schema ,  parse ( directivesSDL ) ) ; 
700+       schema  =  extendSchema ( 
701+         schema , 
702+         parse ( directivesSDL ,  { 
703+           allowLegacySDLImplementsInterfaces : true , 
704+           allowLegacySDLEmptyFields : true , 
705+         } ) , 
706+       ) ; 
682707    } 
683708
684709    if  ( ! schema )  { 
@@ -850,7 +875,14 @@ export class GraphQLCache implements GraphQLCacheInterface {
850875              return ; 
851876            } 
852877
853-             queries . forEach ( ( { query} )  =>  asts . push ( parse ( query ) ) ) ; 
878+             queries . forEach ( ( { query} )  => 
879+               asts . push ( 
880+                 parse ( query ,  { 
881+                   allowLegacySDLImplementsInterfaces : true , 
882+                   allowLegacySDLEmptyFields : true , 
883+                 } ) , 
884+               ) , 
885+             ) ; 
854886          }  catch  ( _ )  { 
855887            // If query has syntax errors, go ahead and still resolve 
856888            // the filePath and the content, but leave ast empty. 
0 commit comments