@@ -32,6 +32,7 @@ import type { GraphQLDirective } from './directives.js';
3232import  {  isDirective ,  specifiedDirectives  }  from  './directives.js' ; 
3333import  { 
3434  __Schema , 
35+   DirectiveMetaFieldDef , 
3536  SchemaMetaFieldDef , 
3637  TypeMetaFieldDef , 
3738  TypeNameMetaFieldDef , 
@@ -340,13 +341,14 @@ export class GraphQLSchema {
340341  /** 
341342   * This method looks up the field on the given type definition. 
342343   * It has special casing for the three introspection fields, `__schema`, 
343-    * `__type` and `__typename`. 
344+    * `__type`, `__directive`  and `__typename`. 
344345   * 
345346   * `__typename` is special because it can always be queried as a field, even 
346347   * in situations where no other fields are allowed, like on a Union. 
347348   * 
348-    * `__schema` and `__type` could get automatically added to the query type, 
349-    * but that would require mutating type definitions, which would cause issues. 
349+    * `__schema`, `__type`, and `__directive` could get automatically added to the 
350+    * query type, but that would require mutating type definitions, which would 
351+    * cause issues. 
350352   */ 
351353  getField ( 
352354    parentType : GraphQLCompositeType , 
@@ -361,6 +363,10 @@ export class GraphQLSchema {
361363        return  this . getQueryType ( )  ===  parentType 
362364          ? TypeMetaFieldDef 
363365          : undefined ; 
366+       case  DirectiveMetaFieldDef . name :
367+         return  this . getQueryType ( )  ===  parentType 
368+           ? DirectiveMetaFieldDef 
369+           : undefined ; 
364370      case  TypeNameMetaFieldDef . name :
365371        return  TypeNameMetaFieldDef ; 
366372    } 
0 commit comments