Skip to content

Commit

Permalink
fix: only warn about deprecated introspectSchema once (#5023)
Browse files Browse the repository at this point in the history
* fix: only warn about deprecated `introspectSchema` once

* changeset
  • Loading branch information
SimenB authored Feb 2, 2023
1 parent 58a9882 commit 85659bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-phones-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-tools/wrap': patch
---

Only warn about deprecated `introspectSchema` once
11 changes: 8 additions & 3 deletions packages/wrap/src/introspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ export type SchemaFromExecutorOptions = Partial<IntrospectionOptions> &
Parameters<typeof buildClientSchema>[1] &
ParseOptions;

let hasWarned = false;

export const introspectSchema = function introspectSchema(...args) {
console.warn(
`\`introspectSchema\` is deprecated, and will be removed in the next major. Please use \`schemaFromExecutor\` instead.`
);
if (!hasWarned) {
hasWarned = true;
console.warn(
`\`introspectSchema\` is deprecated, and will be removed in the next major. Please use \`schemaFromExecutor\` instead.`
);
}
return schemaFromExecutor(...(args as Parameters<typeof schemaFromExecutor>));
} as typeof schemaFromExecutor;

Expand Down

0 comments on commit 85659bc

Please sign in to comment.