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 () => {