From 3496c59603fc2be339eccb87e8904c64f064e6de Mon Sep 17 00:00:00 2001 From: martinandert Date: Tue, 21 Jul 2015 11:30:45 +0200 Subject: [PATCH] fix directive inspection according to spec --- src/type/__tests__/introspection.js | 30 ++++++++++++++++++++--------- src/type/__tests__/printer.js | 6 +++--- src/type/introspection.js | 6 +++--- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/type/__tests__/introspection.js b/src/type/__tests__/introspection.js index db66d16ecf..095354eab6 100644 --- a/src/type/__tests__/introspection.js +++ b/src/type/__tests__/introspection.js @@ -651,9 +651,13 @@ describe('Introspection', () => { name: 'onOperation', args: [], type: { - kind: 'SCALAR', - name: 'Boolean', - ofType: null, + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, }, isDeprecated: false, deprecationReason: null @@ -662,9 +666,13 @@ describe('Introspection', () => { name: 'onFragment', args: [], type: { - kind: 'SCALAR', - name: 'Boolean', - ofType: null, + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, }, isDeprecated: false, deprecationReason: null @@ -673,9 +681,13 @@ describe('Introspection', () => { name: 'onField', args: [], type: { - kind: 'SCALAR', - name: 'Boolean', - ofType: null, + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, }, isDeprecated: false, deprecationReason: null diff --git a/src/type/__tests__/printer.js b/src/type/__tests__/printer.js index a70e6cc1bb..20e4c04fbd 100644 --- a/src/type/__tests__/printer.js +++ b/src/type/__tests__/printer.js @@ -508,9 +508,9 @@ type __Directive { name: String! description: String args: [__InputValue!]! - onOperation: Boolean - onFragment: Boolean - onField: Boolean + onOperation: Boolean! + onFragment: Boolean! + onField: Boolean! } type __EnumValue { diff --git a/src/type/introspection.js b/src/type/introspection.js index f3745e251c..44daa37b44 100644 --- a/src/type/introspection.js +++ b/src/type/introspection.js @@ -67,9 +67,9 @@ var __Directive = new GraphQLObjectType({ new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))), resolve: directive => directive.args || [] }, - onOperation: { type: GraphQLBoolean }, - onFragment: { type: GraphQLBoolean }, - onField: { type: GraphQLBoolean }, + onOperation: { type: new GraphQLNonNull(GraphQLBoolean) }, + onFragment: { type: new GraphQLNonNull(GraphQLBoolean) }, + onField: { type: new GraphQLNonNull(GraphQLBoolean) }, }), });