Skip to content

Commit a4f1ee5

Browse files
authored
__ is reserved for introspection (#2805)
* fix error as __ is reserved for introspection graphql "__fake" must not begin with "__", which is reserved by GraphQL introspection. c.f. graphql/graphql-spec#244 * run yarn changset
1 parent b5ac44f commit a4f1ee5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/gentle-foxes-look.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-tools/utils': patch
3+
---
4+
5+
\_\_ is reserved for introspection

packages/utils/src/stub.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function createNamedStub(
3939
return new constructor({
4040
name,
4141
fields: {
42-
__fake: {
42+
_fake: {
4343
type: GraphQLString,
4444
},
4545
},
@@ -67,7 +67,7 @@ export function isNamedStub(type: GraphQLNamedType): boolean {
6767
if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) {
6868
const fields = type.getFields();
6969
const fieldNames = Object.keys(fields);
70-
return fieldNames.length === 1 && fields[fieldNames[0]].name === '__fake';
70+
return fieldNames.length === 1 && fields[fieldNames[0]].name === '_fake';
7171
}
7272

7373
return false;

0 commit comments

Comments
 (0)