diff --git a/src/index.js b/src/index.js index be7ff547a4..46133b23db 100644 --- a/src/index.js +++ b/src/index.js @@ -385,8 +385,6 @@ export { TypeInfo, // Coerces a JavaScript value to a GraphQL type, or produces errors. coerceInputValue, - // @deprecated use coerceInputValue - will be removed in v15 - coerceValue, // Concatenates multiple AST together. concatAST, // Separates an AST into an AST per Operation. diff --git a/src/utilities/coerceValue.js b/src/utilities/coerceValue.js deleted file mode 100644 index e0ba4a9862..0000000000 --- a/src/utilities/coerceValue.js +++ /dev/null @@ -1,56 +0,0 @@ -// @flow strict - -/* istanbul ignore file */ -import inspect from '../jsutils/inspect'; -import printPathArray from '../jsutils/printPathArray'; -import { type Path, pathToArray } from '../jsutils/Path'; - -import { GraphQLError } from '../error/GraphQLError'; -import { type ASTNode } from '../language/ast'; -import { type GraphQLInputType } from '../type/definition'; - -import { coerceInputValue } from './coerceInputValue'; - -type CoercedValue = {| - +errors: $ReadOnlyArray | void, - +value: mixed, -|}; - -/** - * Deprecated. Use coerceInputValue() directly for richer information. - * - * This function will be removed in v15 - */ -export function coerceValue( - inputValue: mixed, - type: GraphQLInputType, - blameNode?: ASTNode, - path?: Path, -): CoercedValue { - const errors = []; - const value = coerceInputValue( - inputValue, - type, - (errorPath, invalidValue, error) => { - let errorPrefix = 'Invalid value ' + inspect(invalidValue); - const pathArray = [...pathToArray(path), ...errorPath]; - if (pathArray.length > 0) { - errorPrefix += ` at "value${printPathArray(pathArray)}"`; - } - errors.push( - new GraphQLError( - errorPrefix + ': ' + error.message, - blameNode, - undefined, - undefined, - undefined, - error.originalError, - ), - ); - }, - ); - - return errors.length > 0 - ? { errors, value: undefined } - : { errors: undefined, value }; -} diff --git a/src/utilities/index.js b/src/utilities/index.js index c184831d17..02bc9382bc 100644 --- a/src/utilities/index.js +++ b/src/utilities/index.js @@ -83,9 +83,6 @@ export { TypeInfo } from './TypeInfo'; // Coerces a JavaScript value to a GraphQL type, or produces errors. export { coerceInputValue } from './coerceInputValue'; -// @deprecated use coerceInputValue - will be removed in v15. -export { coerceValue } from './coerceValue'; - // Concatenates multiple AST together. export { concatAST } from './concatAST'; diff --git a/tstypes/index.d.ts b/tstypes/index.d.ts index f68a5ebf64..b5c614bcda 100644 --- a/tstypes/index.d.ts +++ b/tstypes/index.d.ts @@ -385,8 +385,6 @@ export { TypeInfo, // Coerces a JavaScript value to a GraphQL type, or produces errors. coerceInputValue, - // @deprecated use coerceInputValue - will be removed in v15 - coerceValue, // Concatenates multiple AST together. concatAST, // Separates an AST into an AST per Operation. diff --git a/tstypes/utilities/coerceValue.d.ts b/tstypes/utilities/coerceValue.d.ts deleted file mode 100644 index f79389eac5..0000000000 --- a/tstypes/utilities/coerceValue.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Path } from '../jsutils/Path'; -import { GraphQLError } from '../error/GraphQLError'; -import { ASTNode } from '../language/ast'; -import { GraphQLInputType } from '../type/definition'; - -interface CoercedValue { - readonly errors: ReadonlyArray | undefined; - readonly value: any; -} - -/** - * Coerces a JavaScript value given a GraphQL Type. - * - * Returns either a value which is valid for the provided type or a list of - * encountered coercion errors. - * - */ -export function coerceValue( - inputValue: any, - type: GraphQLInputType, - blameNode?: ASTNode, - path?: Path, -): CoercedValue; diff --git a/tstypes/utilities/index.d.ts b/tstypes/utilities/index.d.ts index 952c805585..8480b8541a 100644 --- a/tstypes/utilities/index.d.ts +++ b/tstypes/utilities/index.d.ts @@ -80,9 +80,6 @@ export { TypeInfo } from './TypeInfo'; // Coerces a JavaScript value to a GraphQL type, or produces errors. export { coerceInputValue } from './coerceInputValue'; -// Coerces a JavaScript value to a GraphQL type, or produces errors. -export { coerceValue } from './coerceValue'; - // Concatenates multiple AST together. export { concatAST } from './concatAST';