Skip to content

Commit 7b92875

Browse files
authored
Remove special case in assertValidName (#1232)
This __configs__ special case for assertValidName is no longer necessary now that we have the allowedLegacyNames mechanism.
1 parent 2986c2d commit 7b92875

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

src/utilities/__tests__/assertValidName-test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,4 @@ describe('assertValidName()', () => {
2323
it('throws for names with invalid characters', () => {
2424
expect(() => assertValidName('>--()-->')).to.throw(/Names must match/);
2525
});
26-
27-
it('does not throw for legacy servers that use __configs__ introspection', () => {
28-
expect(() => assertValidName('__configs__')).not.to.throw();
29-
});
3026
});

src/utilities/assertValidName.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,7 @@ export function isValidNameError(
3232
node?: ASTNode | void,
3333
): GraphQLError | void {
3434
invariant(typeof name === 'string', 'Expected string');
35-
if (
36-
name.length > 1 &&
37-
name[0] === '_' &&
38-
name[1] === '_' &&
39-
// Note: this special case is not part of the spec and exists only to
40-
// support legacy server configurations. Do not rely on this special case
41-
// as it may be removed at any time.
42-
name !== '__configs__'
43-
) {
35+
if (name.length > 1 && name[0] === '_' && name[1] === '_') {
4436
return new GraphQLError(
4537
`Name "${name}" must not begin with "__", which is reserved by ` +
4638
'GraphQL introspection.',

0 commit comments

Comments
 (0)