File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
13
13
isUnionType ,
14
14
isInputObjectType ,
15
15
isWrappingType ,
16
+ getNamedType ,
16
17
} from './definition' ;
17
18
import type {
18
19
GraphQLType ,
@@ -22,7 +23,11 @@ import type {
22
23
GraphQLInterfaceType ,
23
24
} from './definition' ;
24
25
import type { SchemaDefinitionNode } from '../language/ast' ;
25
- import { GraphQLDirective , specifiedDirectives } from './directives' ;
26
+ import {
27
+ GraphQLDirective ,
28
+ isDirective ,
29
+ specifiedDirectives ,
30
+ } from './directives' ;
26
31
import type { GraphQLError } from '../error/GraphQLError' ;
27
32
import { __Schema } from './introspection' ;
28
33
import find from '../jsutils/find' ;
@@ -121,6 +126,10 @@ export class GraphQLSchema {
121
126
initialTypes = initialTypes . concat ( types ) ;
122
127
}
123
128
129
+ initialTypes = initialTypes . concat (
130
+ ...this . _directives . map ( directive => getDirectiveArgTypes ( directive ) ) ,
131
+ ) ;
132
+
124
133
this . _typeMap = initialTypes . reduce (
125
134
typeMapReducer ,
126
135
( Object . create ( null ) : TypeMap ) ,
@@ -269,3 +278,10 @@ function typeMapReducer(map: TypeMap, type: ?GraphQLType): TypeMap {
269
278
270
279
return reducedMap ;
271
280
}
281
+
282
+ function getDirectiveArgTypes ( directive : GraphQLDirective ) {
283
+ if ( ! isDirective ( directive ) ) {
284
+ return [ ] ;
285
+ }
286
+ return directive . args . map ( arg => getNamedType ( arg . type ) ) ;
287
+ }
You can’t perform that action at this time.
0 commit comments