diff --git a/packages/handlers/json-schema/src/index.ts b/packages/handlers/json-schema/src/index.ts index 772c34988bf92..188834b6653a7 100644 --- a/packages/handlers/json-schema/src/index.ts +++ b/packages/handlers/json-schema/src/index.ts @@ -86,6 +86,7 @@ export default class JsonSchemaHandler implements MeshHandler { return getGraphQLSchemaFromBundle(bundle, { cwd: this.baseDir, logger: this.logger, + fetch: this.fetchFn, endpoint: this.config.endpoint, operationHeaders: this.config.operationHeaders, queryParams: this.config.queryParams, diff --git a/packages/loaders/json-schema/src/bundle.ts b/packages/loaders/json-schema/src/bundle.ts index f773fe5ed9e99..74ccaf10bf42d 100644 --- a/packages/loaders/json-schema/src/bundle.ts +++ b/packages/loaders/json-schema/src/bundle.ts @@ -1,7 +1,7 @@ import { referenceJSONSchema, JSONSchemaObject, dereferenceObject } from 'json-machete'; import { DefaultLogger } from '@graphql-mesh/utils'; import { getDereferencedJSONSchemaFromOperations } from './getDereferencedJSONSchemaFromOperations.js'; -import { Logger } from '@graphql-mesh/types'; +import { Logger, MeshFetch } from '@graphql-mesh/types'; import { JSONSchemaOperationConfig, OperationHeadersConfiguration } from './types.js'; import { fetch as crossUndiciFetch } from '@whatwg-node/fetch'; import { GraphQLSchema } from 'graphql'; @@ -73,6 +73,7 @@ export async function createBundle( export interface JSONSchemaLoaderBundleToGraphQLSchemaOptions { cwd?: string; logger?: Logger; + fetch?: MeshFetch; endpoint?: string; operationHeaders?: OperationHeadersConfiguration; queryParams?: Record; @@ -94,6 +95,7 @@ export async function getGraphQLSchemaFromBundle( { cwd = process.cwd(), logger = new DefaultLogger(name), + fetch = crossUndiciFetch, endpoint: overwrittenBaseUrl, operationHeaders: additionalOperationHeaders = {}, queryParams,