File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,20 @@ export function SingleFieldSubscriptionsRule(
26
26
node . selectionSet . selections . slice ( 1 ) ,
27
27
) ,
28
28
) ;
29
+ } else {
30
+ const selection = node . selectionSet . selections [ 0 ] ;
31
+ const fieldName = selection . name . value ;
32
+ // fieldName represents an introspection field if it starts with `__`
33
+ if ( fieldName [ 0 ] === '_' && fieldName [ 1 ] === '_' ) {
34
+ context . reportError (
35
+ new GraphQLError (
36
+ node . name
37
+ ? `Subscription "${ node . name . value } " must not select an introspection top level field.`
38
+ : 'Anonymous Subscription must not select an introspection top level field.' ,
39
+ node . selectionSet . selections ,
40
+ ) ,
41
+ ) ;
42
+ }
29
43
}
30
44
const selection = node . selectionSet . selections [ 0 ] ;
31
45
const fieldName = selection . name . value ;
You can’t perform that action at this time.
0 commit comments