From d9b55f12fbfcf5ed61e9b41cf47c60bebc99aa5f Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Mon, 25 Sep 2023 11:38:50 -0400 Subject: [PATCH] Revert "fix(preset/near-operation-file): accept skipDocumentsValidation config parameter. Closes #214 (#383)" This reverts commit 9a692da461f7f682c16333d2926c0c9174bc11f4. --- .changeset/thirty-books-explode.md | 12 ------ .../presets/near-operation-file/src/index.ts | 5 +-- .../tests/near-operation-file.spec.ts | 40 +------------------ 3 files changed, 2 insertions(+), 55 deletions(-) delete mode 100644 .changeset/thirty-books-explode.md diff --git a/.changeset/thirty-books-explode.md b/.changeset/thirty-books-explode.md deleted file mode 100644 index f2c470e6f..000000000 --- a/.changeset/thirty-books-explode.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -'@graphql-codegen/near-operation-file-preset': major ---- - -accept skipDocumentsValidation config parameter - -‼️ ‼️ ‼️ Please note ‼️ ‼️ ‼️: - -This is a breaking change since previous versions skips all documents validation -and this could raise validation errors while generating types. - - diff --git a/packages/presets/near-operation-file/src/index.ts b/packages/presets/near-operation-file/src/index.ts index 6ec181004..c9dd7729a 100644 --- a/packages/presets/near-operation-file/src/index.ts +++ b/packages/presets/near-operation-file/src/index.ts @@ -350,10 +350,7 @@ export const preset: Types.OutputPreset = { config, schema: options.schema, schemaAst: schemaObject, - skipDocumentsValidation: - typeof options.skipDocumentsValidation === 'undefined' - ? { skipDuplicateValidation: true } - : options.skipDocumentsValidation, + skipDocumentsValidation: true, }); } diff --git a/packages/presets/near-operation-file/tests/near-operation-file.spec.ts b/packages/presets/near-operation-file/tests/near-operation-file.spec.ts index e239b0169..e2b5f50f3 100644 --- a/packages/presets/near-operation-file/tests/near-operation-file.spec.ts +++ b/packages/presets/near-operation-file/tests/near-operation-file.spec.ts @@ -699,45 +699,7 @@ describe('near-operation-file preset', () => { pluginMap: {}, }); - expect(result[0].skipDocumentsValidation).toEqual({ skipDuplicateValidation: true }); - }); - - it('Should allow to customize the skip documents validation', async () => { - const result = await executePreset({ - baseOutputDir: './src/', - config: {}, - presetConfig: { - baseTypesPath: 'types.ts', - }, - schema: schemaDocumentNode, - schemaAst: schemaNode, - documents: testDocuments, - plugins: [], - pluginMap: {}, - skipDocumentsValidation: { - skipValidationAgainstSchema: true, - }, - }); - - expect(result[0].skipDocumentsValidation).toEqual({ skipValidationAgainstSchema: true }); - }); - - it('Should allow to opt-out skipping documents validation', async () => { - const result = await executePreset({ - baseOutputDir: './src/', - config: {}, - presetConfig: { - baseTypesPath: 'types.ts', - }, - schema: schemaDocumentNode, - schemaAst: schemaNode, - documents: testDocuments, - plugins: [], - pluginMap: {}, - skipDocumentsValidation: false, - }); - - expect(result[0].skipDocumentsValidation).toBe(false); + expect(result[0].skipDocumentsValidation).toBeTruthy(); }); it('Should allow to customize output extension', async () => {