Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions src/validation/__tests__/validation-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type { DirectiveNode } from '../../language/ast.js';
import { parse } from '../../language/parser.js';

import { buildSchema } from '../../utilities/buildASTSchema.js';
import { TypeInfo } from '../../utilities/TypeInfo.js';

import { validate } from '../validate.js';
import type { ValidationContext } from '../ValidationContext.js';
Expand Down Expand Up @@ -53,35 +52,6 @@ describe('Validate: Supports full validation', () => {
]);
});

it('Deprecated: validates using a custom TypeInfo', () => {
// This TypeInfo will never return a valid field.
const typeInfo = new TypeInfo(testSchema, null, () => null);

const doc = parse(`
query {
human {
pets {
... on Cat {
meowsVolume
}
... on Dog {
barkVolume
}
}
}
}
`);

const errors = validate(testSchema, doc, undefined, undefined, typeInfo);
const errorMessages = errors.map((error) => error.message);

expect(errorMessages).to.deep.equal([
'Cannot query field "human" on type "QueryRoot". Did you mean "human"?',
'Cannot query field "meowsVolume" on type "Cat". Did you mean "meowsVolume"?',
'Cannot query field "barkVolume" on type "Dog". Did you mean "barkVolume"?',
]);
});

it('validates using a custom rule', () => {
const schema = buildSchema(`
directive @custom(arg: String) on FIELD
Expand Down
4 changes: 1 addition & 3 deletions src/validation/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ export function validate(
documentAST: DocumentNode,
rules: ReadonlyArray<ValidationRule> = specifiedRules,
options?: { maxErrors?: number },

/** @deprecated will be removed in 17.0.0 */
typeInfo: TypeInfo = new TypeInfo(schema),
): ReadonlyArray<GraphQLError> {
const maxErrors = options?.maxErrors ?? 100;

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