From aa43054d3415cc29c8a610dea6aa04df5f42e5f9 Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Wed, 30 Jun 2021 15:30:16 +0300 Subject: [PATCH] enhance(delegate): skip validation by default and add validateRequest option to enable --- .changeset/pink-glasses-move.md | 5 +++++ packages/delegate/src/delegateToSchema.ts | 2 +- packages/delegate/src/types.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/pink-glasses-move.md diff --git a/.changeset/pink-glasses-move.md b/.changeset/pink-glasses-move.md new file mode 100644 index 00000000000..c725407a8de --- /dev/null +++ b/.changeset/pink-glasses-move.md @@ -0,0 +1,5 @@ +--- +'@graphql-tools/delegate': major +--- + +BREAKING CHANGE: validations are skipped by default, use validateRequest: true to reenable diff --git a/packages/delegate/src/delegateToSchema.ts b/packages/delegate/src/delegateToSchema.ts index 440bcc7fcfe..2c1d4896f80 100644 --- a/packages/delegate/src/delegateToSchema.ts +++ b/packages/delegate/src/delegateToSchema.ts @@ -97,7 +97,7 @@ export function delegateRequest, TArgs = any>( const processedRequest = transformer.transformRequest(options.request); - if (!options.skipValidation) { + if (options.validateRequest) { validateRequest(delegationContext, processedRequest.document); } diff --git a/packages/delegate/src/types.ts b/packages/delegate/src/types.ts index f793ea6c19b..cc2a614414d 100644 --- a/packages/delegate/src/types.ts +++ b/packages/delegate/src/types.ts @@ -78,7 +78,7 @@ export interface IDelegateToSchemaOptions, TArgs rootValue?: Record; transforms?: Array>; transformedSchema?: GraphQLSchema; - skipValidation?: boolean; + validateRequest?: boolean; skipTypeMerging?: boolean; binding?: DelegationBinding; }