findDeprecatedUsages.js.flow 880 B

123456789101112131415161718192021222324252627282930
  1. // @flow strict
  2. import type { GraphQLError } from '../error/GraphQLError';
  3. import type { DocumentNode } from '../language/ast';
  4. import type { GraphQLSchema } from '../type/schema';
  5. import { validate } from '../validation/validate';
  6. import { NoDeprecatedCustomRule } from '../validation/rules/custom/NoDeprecatedCustomRule';
  7. /**
  8. * A validation rule which reports deprecated usages.
  9. *
  10. * Returns a list of GraphQLError instances describing each deprecated use.
  11. *
  12. * @deprecated Please use `validate` with `NoDeprecatedCustomRule` instead:
  13. *
  14. * ```
  15. * import { validate, NoDeprecatedCustomRule } from 'graphql'
  16. *
  17. * const errors = validate(schema, document, [NoDeprecatedCustomRule])
  18. * ```
  19. */
  20. export function findDeprecatedUsages(
  21. schema: GraphQLSchema,
  22. ast: DocumentNode,
  23. ): $ReadOnlyArray<GraphQLError> {
  24. return validate(schema, ast, [NoDeprecatedCustomRule]);
  25. }