From 6ee50e4a5bb9cfc28a2a8021fe24920591fd1d9b Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 3 Jan 2025 23:17:28 +1100 Subject: [PATCH] Fix load schema pointer type --- .changeset/famous-spiders-call.md | 5 +++++ packages/graphql-codegen-cli/src/config.ts | 2 +- packages/graphql-codegen-cli/src/load.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/famous-spiders-call.md diff --git a/.changeset/famous-spiders-call.md b/.changeset/famous-spiders-call.md new file mode 100644 index 00000000000..90dbe64c89d --- /dev/null +++ b/.changeset/famous-spiders-call.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/cli': patch +--- + +Fix schema pointers type to allow an array of pointers diff --git a/packages/graphql-codegen-cli/src/config.ts b/packages/graphql-codegen-cli/src/config.ts index 519d88c922a..514afd1afb5 100644 --- a/packages/graphql-codegen-cli/src/config.ts +++ b/packages/graphql-codegen-cli/src/config.ts @@ -422,7 +422,7 @@ export class CodegenContext { return this._pluginContext; } - async loadSchema(pointer: Types.Schema): Promise { + async loadSchema(pointer: Types.Schema | Types.Schema[]): Promise { const config = this.getConfig(defaultSchemaLoadOptions); if (this._graphqlConfig) { // TODO: SchemaWithLoader won't work here diff --git a/packages/graphql-codegen-cli/src/load.ts b/packages/graphql-codegen-cli/src/load.ts index dd24b13ad1c..213330ee076 100644 --- a/packages/graphql-codegen-cli/src/load.ts +++ b/packages/graphql-codegen-cli/src/load.ts @@ -28,7 +28,7 @@ export const defaultDocumentsLoadOptions = { }; export async function loadSchema( - schemaPointers: UnnormalizedTypeDefPointer, + schemaPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], config: Types.Config ): Promise { try {