Skip to content

Commit

Permalink
fix error as __ is reserved for introspection
Browse files Browse the repository at this point in the history
graphql "__fake" must not begin with "__", which is reserved by GraphQL introspection.

c.f. graphql/graphql-spec#244
  • Loading branch information
saerdnaer committed Apr 6, 2021
1 parent 981d2a5 commit 3406dab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/utils/src/stub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function createNamedStub(
return new constructor({
name,
fields: {
__fake: {
_fake: {
type: GraphQLString,
},
},
Expand Down Expand Up @@ -67,7 +67,7 @@ export function isNamedStub(type: GraphQLNamedType): boolean {
if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) {
const fields = type.getFields();
const fieldNames = Object.keys(fields);
return fieldNames.length === 1 && fields[fieldNames[0]].name === '__fake';
return fieldNames.length === 1 && fields[fieldNames[0]].name === '_fake';
}

return false;
Expand Down

0 comments on commit 3406dab

Please sign in to comment.