Skip to content

Commit c7d1cf4

Browse files
authored
remove deprecated custom typeInfo arg for validate() (#4187)
1 parent 1bfa115 commit c7d1cf4

File tree

2 files changed

+1
-33
lines changed

2 files changed

+1
-33
lines changed

src/validation/__tests__/validation-test.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type { DirectiveNode } from '../../language/ast.js';
99
import { parse } from '../../language/parser.js';
1010

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

1413
import { validate } from '../validate.js';
1514
import type { ValidationContext } from '../ValidationContext.js';
@@ -53,35 +52,6 @@ describe('Validate: Supports full validation', () => {
5352
]);
5453
});
5554

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

src/validation/validate.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ export function validate(
4242
documentAST: DocumentNode,
4343
rules: ReadonlyArray<ValidationRule> = specifiedRules,
4444
options?: { maxErrors?: number },
45-
46-
/** @deprecated will be removed in 17.0.0 */
47-
typeInfo: TypeInfo = new TypeInfo(schema),
4845
): ReadonlyArray<GraphQLError> {
4946
const maxErrors = options?.maxErrors ?? 100;
5047

@@ -55,6 +52,7 @@ export function validate(
5552
'Too many validation errors, error limit reached. Validation aborted.',
5653
);
5754
const errors: Array<GraphQLError> = [];
55+
const typeInfo = new TypeInfo(schema);
5856
const context = new ValidationContext(
5957
schema,
6058
documentAST,

0 commit comments

Comments
 (0)