Skip to content

Commit b4ad128

Browse files
Remove deprecated TypeInfo argument of validate function (#3574)
1 parent 6dda669 commit b4ad128

File tree

2 files changed

+1
-33
lines changed

2 files changed

+1
-33
lines changed

src/validation/__tests__/validation-test.ts

-30
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type { DirectiveNode } from '../../language/ast';
99
import { parse } from '../../language/parser';
1010

1111
import { buildSchema } from '../../utilities/buildASTSchema';
12-
import { TypeInfo } from '../../utilities/TypeInfo';
1312

1413
import { validate } from '../validate';
1514
import type { ValidationContext } from '../ValidationContext';
@@ -58,35 +57,6 @@ describe('Validate: Supports full validation', () => {
5857
]);
5958
});
6059

61-
it('Deprecated: validates using a custom TypeInfo', () => {
62-
// This TypeInfo will never return a valid field.
63-
const typeInfo = new TypeInfo(testSchema, null, () => null);
64-
65-
const doc = parse(`
66-
query {
67-
human {
68-
pets {
69-
... on Cat {
70-
meowsVolume
71-
}
72-
... on Dog {
73-
barkVolume
74-
}
75-
}
76-
}
77-
}
78-
`);
79-
80-
const errors = validate(testSchema, doc, undefined, undefined, typeInfo);
81-
const errorMessages = errors.map((error) => error.message);
82-
83-
expect(errorMessages).to.deep.equal([
84-
'Cannot query field "human" on type "QueryRoot". Did you mean "human"?',
85-
'Cannot query field "meowsVolume" on type "Cat". Did you mean "meowsVolume"?',
86-
'Cannot query field "barkVolume" on type "Dog". Did you mean "barkVolume"?',
87-
]);
88-
});
89-
9060
it('validates using a custom rule', () => {
9161
const schema = buildSchema(`
9262
directive @custom(arg: String) on FIELD

src/validation/validate.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ export function validate(
4040
documentAST: DocumentNode,
4141
rules: ReadonlyArray<ValidationRule> = specifiedRules,
4242
options?: { maxErrors?: number },
43-
44-
/** @deprecated will be removed in 17.0.0 */
45-
typeInfo: TypeInfo = new TypeInfo(schema),
4643
): ReadonlyArray<GraphQLError> {
4744
const maxErrors = options?.maxErrors ?? 100;
4845

@@ -52,6 +49,7 @@ export function validate(
5249

5350
const abortObj = Object.freeze({});
5451
const errors: Array<GraphQLError> = [];
52+
const typeInfo = new TypeInfo(schema);
5553
const context = new ValidationContext(
5654
schema,
5755
documentAST,

0 commit comments

Comments
 (0)