File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
packages/graphql/lib/schema-builder Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { Injectable , Logger , Type } from '@nestjs/common' ;
2
2
import { isEmpty , isFunction } from '@nestjs/common/utils/shared.utils' ;
3
- import { getIntrospectionQuery , graphql , GraphQLSchema } from 'graphql' ;
3
+ import {
4
+ getIntrospectionQuery ,
5
+ graphql ,
6
+ GraphQLError ,
7
+ GraphQLSchema ,
8
+ version as GraphQLPackageVersion ,
9
+ } from 'graphql' ;
4
10
import {
5
11
SCALAR_NAME_METADATA ,
6
12
SCALAR_TYPE_METADATA ,
@@ -69,7 +75,17 @@ export class GraphQLSchemaFactory {
69
75
70
76
if ( ! options . skipCheck ) {
71
77
const introspectionQuery = getIntrospectionQuery ( ) ;
72
- const { errors } = await graphql ( schema , introspectionQuery ) ;
78
+ let errors : readonly GraphQLError [ ] ;
79
+ if ( GraphQLPackageVersion . startsWith ( '15' ) ) {
80
+ const executionResult = await graphql ( schema , introspectionQuery ) ;
81
+ errors = executionResult . errors ;
82
+ } else {
83
+ const executionResult = await graphql ( {
84
+ schema,
85
+ source : introspectionQuery ,
86
+ } ) ;
87
+ errors = executionResult . errors ;
88
+ }
73
89
if ( errors ) {
74
90
throw new SchemaGenerationError ( errors ) ;
75
91
}
You can’t perform that action at this time.
0 commit comments