Skip to content

Commit eb5cda5

Browse files
committed
Merge pull request #76 from martinandert/fix-directive-introspection-according-to-spec
fix directive inspection according to spec
2 parents 5017759 + 3496c59 commit eb5cda5

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

src/type/__tests__/introspection.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,13 @@ describe('Introspection', () => {
651651
name: 'onOperation',
652652
args: [],
653653
type: {
654-
kind: 'SCALAR',
655-
name: 'Boolean',
656-
ofType: null,
654+
kind: 'NON_NULL',
655+
name: null,
656+
ofType: {
657+
kind: 'SCALAR',
658+
name: 'Boolean',
659+
ofType: null,
660+
},
657661
},
658662
isDeprecated: false,
659663
deprecationReason: null
@@ -662,9 +666,13 @@ describe('Introspection', () => {
662666
name: 'onFragment',
663667
args: [],
664668
type: {
665-
kind: 'SCALAR',
666-
name: 'Boolean',
667-
ofType: null,
669+
kind: 'NON_NULL',
670+
name: null,
671+
ofType: {
672+
kind: 'SCALAR',
673+
name: 'Boolean',
674+
ofType: null,
675+
},
668676
},
669677
isDeprecated: false,
670678
deprecationReason: null
@@ -673,9 +681,13 @@ describe('Introspection', () => {
673681
name: 'onField',
674682
args: [],
675683
type: {
676-
kind: 'SCALAR',
677-
name: 'Boolean',
678-
ofType: null,
684+
kind: 'NON_NULL',
685+
name: null,
686+
ofType: {
687+
kind: 'SCALAR',
688+
name: 'Boolean',
689+
ofType: null,
690+
},
679691
},
680692
isDeprecated: false,
681693
deprecationReason: null

src/type/__tests__/printer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,9 @@ type __Directive {
508508
name: String!
509509
description: String
510510
args: [__InputValue!]!
511-
onOperation: Boolean
512-
onFragment: Boolean
513-
onField: Boolean
511+
onOperation: Boolean!
512+
onFragment: Boolean!
513+
onField: Boolean!
514514
}
515515
516516
type __EnumValue {

src/type/introspection.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ var __Directive = new GraphQLObjectType({
6767
new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))),
6868
resolve: directive => directive.args || []
6969
},
70-
onOperation: { type: GraphQLBoolean },
71-
onFragment: { type: GraphQLBoolean },
72-
onField: { type: GraphQLBoolean },
70+
onOperation: { type: new GraphQLNonNull(GraphQLBoolean) },
71+
onFragment: { type: new GraphQLNonNull(GraphQLBoolean) },
72+
onField: { type: new GraphQLNonNull(GraphQLBoolean) },
7373
}),
7474
});
7575

0 commit comments

Comments
 (0)