From be33bf9a19017a8b6298c9df9bc275f145dfa49b Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Wed, 11 May 2022 15:31:22 +0300 Subject: [PATCH] Remove deprecated `assertValidName` & `isValidNameError` --- .c8rc.json | 1 - src/index.ts | 4 ---- src/utilities/assertValidName.ts | 39 -------------------------------- src/utilities/index.ts | 3 --- 4 files changed, 47 deletions(-) delete mode 100644 src/utilities/assertValidName.ts diff --git a/.c8rc.json b/.c8rc.json index 7d119daeee..498577ab8e 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -7,7 +7,6 @@ "src/jsutils/Maybe.ts", "src/jsutils/ObjMap.ts", "src/jsutils/PromiseOrValue.ts", - "src/utilities/assertValidName.ts", "src/utilities/typedQueryDocumentNode.ts" ], "clean": true, diff --git a/src/index.ts b/src/index.ts index 5bbf0da3a6..476f98d775 100644 --- a/src/index.ts +++ b/src/index.ts @@ -443,10 +443,6 @@ export { isEqualType, isTypeSubTypeOf, doTypesOverlap, - // Asserts a string is a valid GraphQL name. - assertValidName, - // Determine if a string is a valid GraphQL name. - isValidNameError, // Compares two GraphQLSchemas and detects breaking changes. BreakingChangeType, DangerousChangeType, diff --git a/src/utilities/assertValidName.ts b/src/utilities/assertValidName.ts deleted file mode 100644 index 3e66461ae6..0000000000 --- a/src/utilities/assertValidName.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { devAssert } from '../jsutils/devAssert'; - -import { GraphQLError } from '../error/GraphQLError'; - -import { assertName } from '../type/assertName'; - -/* c8 ignore start */ -/** - * Upholds the spec rules about naming. - * @deprecated Please use `assertName` instead. Will be removed in v17 - */ -export function assertValidName(name: string): string { - const error = isValidNameError(name); - if (error) { - throw error; - } - return name; -} - -/** - * Returns an Error if a name is invalid. - * @deprecated Please use `assertName` instead. Will be removed in v17 - */ -export function isValidNameError(name: string): GraphQLError | undefined { - devAssert(typeof name === 'string', 'Expected name to be a string.'); - - if (name.startsWith('__')) { - return new GraphQLError( - `Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`, - ); - } - - try { - assertName(name); - } catch (error) { - return error; - } -} -/* c8 ignore stop */ diff --git a/src/utilities/index.ts b/src/utilities/index.ts index 277bc2d715..d3ccffc917 100644 --- a/src/utilities/index.ts +++ b/src/utilities/index.ts @@ -86,9 +86,6 @@ export { doTypesOverlap, } from './typeComparators'; -// Asserts that a string is a valid GraphQL name -export { assertValidName, isValidNameError } from './assertValidName'; - // Compares two GraphQLSchemas and detects breaking changes. export { BreakingChangeType,