From c072f559ecdd92edf76442f40ce7534f084a2bdf Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Sun, 25 Aug 2019 13:24:48 +0300 Subject: [PATCH] Remove deprecated 'isValidLiteralValue' function --- src/index.js | 2 -- .../__tests__/isValidLiteralValue-test.js | 26 -------------- src/utilities/index.js | 3 -- src/utilities/isValidLiteralValue.js | 35 ------------------- tstypes/index.d.ts | 2 -- tstypes/utilities/index.d.ts | 3 -- tstypes/utilities/isValidLiteralValue.d.ts | 15 -------- 7 files changed, 86 deletions(-) delete mode 100644 src/utilities/__tests__/isValidLiteralValue-test.js delete mode 100644 src/utilities/isValidLiteralValue.js delete mode 100644 tstypes/utilities/isValidLiteralValue.d.ts diff --git a/src/index.js b/src/index.js index 2942fcd5e6..be7ff547a4 100644 --- a/src/index.js +++ b/src/index.js @@ -387,8 +387,6 @@ export { coerceInputValue, // @deprecated use coerceInputValue - will be removed in v15 coerceValue, - // @deprecated use validation - will be removed in v15 - isValidLiteralValue, // Concatenates multiple AST together. concatAST, // Separates an AST into an AST per Operation. diff --git a/src/utilities/__tests__/isValidLiteralValue-test.js b/src/utilities/__tests__/isValidLiteralValue-test.js deleted file mode 100644 index 2447fb1fb9..0000000000 --- a/src/utilities/__tests__/isValidLiteralValue-test.js +++ /dev/null @@ -1,26 +0,0 @@ -// @flow strict - -import { expect } from 'chai'; -import { describe, it } from 'mocha'; - -import { parseValue } from '../../language/parser'; -import { GraphQLInt } from '../../type/scalars'; - -import { isValidLiteralValue } from '../isValidLiteralValue'; - -describe('isValidLiteralValue', () => { - it('Returns no errors for a valid value', () => { - expect(isValidLiteralValue(GraphQLInt, parseValue('123'))).to.deep.equal( - [], - ); - }); - - it('Returns errors for an invalid value', () => { - expect(isValidLiteralValue(GraphQLInt, parseValue('"abc"'))).to.deep.equal([ - { - message: 'Expected type Int, found "abc".', - locations: [{ line: 1, column: 1 }], - }, - ]); - }); -}); diff --git a/src/utilities/index.js b/src/utilities/index.js index f1cfe7b3f1..c184831d17 100644 --- a/src/utilities/index.js +++ b/src/utilities/index.js @@ -86,9 +86,6 @@ export { coerceInputValue } from './coerceInputValue'; // @deprecated use coerceInputValue - will be removed in v15. export { coerceValue } from './coerceValue'; -// @deprecated use validation - will be removed in v15 -export { isValidLiteralValue } from './isValidLiteralValue'; - // Concatenates multiple AST together. export { concatAST } from './concatAST'; diff --git a/src/utilities/isValidLiteralValue.js b/src/utilities/isValidLiteralValue.js deleted file mode 100644 index d0d13d3d90..0000000000 --- a/src/utilities/isValidLiteralValue.js +++ /dev/null @@ -1,35 +0,0 @@ -// @flow strict - -import { type GraphQLError } from '../error/GraphQLError'; - -import { Kind } from '../language/kinds'; -import { type ValueNode } from '../language/ast'; -import { visit, visitWithTypeInfo } from '../language/visitor'; - -import { ValuesOfCorrectType } from '../validation/rules/ValuesOfCorrectType'; -import { ValidationContext } from '../validation/ValidationContext'; - -import { type GraphQLInputType } from '../type/definition'; -import { GraphQLSchema } from '../type/schema'; - -import { TypeInfo } from './TypeInfo'; - -/** - * Utility which determines if a value literal node is valid for an input type. - * - * Deprecated. Rely on validation for documents containing literal values. - * - * This function will be removed in v15 - */ -export function isValidLiteralValue( - type: GraphQLInputType, - valueNode: ValueNode, -): $ReadOnlyArray { - const emptySchema = new GraphQLSchema({}); - const emptyDoc = { kind: Kind.DOCUMENT, definitions: [] }; - const typeInfo = new TypeInfo(emptySchema, undefined, type); - const context = new ValidationContext(emptySchema, emptyDoc, typeInfo); - const visitor = ValuesOfCorrectType(context); - visit(valueNode, visitWithTypeInfo(typeInfo, visitor)); - return context.getErrors(); -} diff --git a/tstypes/index.d.ts b/tstypes/index.d.ts index 3789fc0f3a..f68a5ebf64 100644 --- a/tstypes/index.d.ts +++ b/tstypes/index.d.ts @@ -387,8 +387,6 @@ export { coerceInputValue, // @deprecated use coerceInputValue - will be removed in v15 coerceValue, - // @deprecated use validation - will be removed in v15 - isValidLiteralValue, // Concatenates multiple AST together. concatAST, // Separates an AST into an AST per Operation. diff --git a/tstypes/utilities/index.d.ts b/tstypes/utilities/index.d.ts index ae08e0c917..952c805585 100644 --- a/tstypes/utilities/index.d.ts +++ b/tstypes/utilities/index.d.ts @@ -83,9 +83,6 @@ export { coerceInputValue } from './coerceInputValue'; // Coerces a JavaScript value to a GraphQL type, or produces errors. export { coerceValue } from './coerceValue'; -// @deprecated use validation - will be removed in v15 -export { isValidLiteralValue } from './isValidLiteralValue'; - // Concatenates multiple AST together. export { concatAST } from './concatAST'; diff --git a/tstypes/utilities/isValidLiteralValue.d.ts b/tstypes/utilities/isValidLiteralValue.d.ts deleted file mode 100644 index c0c4eb4cfb..0000000000 --- a/tstypes/utilities/isValidLiteralValue.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { GraphQLError } from '../error/GraphQLError'; -import { ValueNode } from '../language/ast'; -import { GraphQLInputType } from '../type/definition'; - -/** - * Utility which determines if a value literal node is valid for an input type. - * - * Deprecated. Rely on validation for documents containing literal values. - * - * This function will be removed in v15 - */ -export function isValidLiteralValue( - type: GraphQLInputType, - valueNode: ValueNode, -): ReadonlyArray;