From ed71811ace083be61c575609e361c629ed7c1740 Mon Sep 17 00:00:00 2001 From: Ben Greenberg Date: Mon, 23 Dec 2024 16:33:17 +0000 Subject: [PATCH] Passthrough client-preset config values for output (#10155) Passthrough the `onlyOperationTypes` and `onlyEnumTypes` configuration options which enables consumers to opt into avoiding generating redundant types from the schema that they haven't requested in documents. --- .changeset/swift-wasps-beam.md | 5 +++++ packages/presets/client/src/index.ts | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/swift-wasps-beam.md diff --git a/.changeset/swift-wasps-beam.md b/.changeset/swift-wasps-beam.md new file mode 100644 index 00000000000..0eca2b3404a --- /dev/null +++ b/.changeset/swift-wasps-beam.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/client-preset': minor +--- + +client-preset generated output is configurable with onlyOperationTypes and onlyEnumTypes diff --git a/packages/presets/client/src/index.ts b/packages/presets/client/src/index.ts index 5b71409fc78..920a13a5f08 100644 --- a/packages/presets/client/src/index.ts +++ b/packages/presets/client/src/index.ts @@ -134,6 +134,8 @@ export const preset: Types.OutputPreset = { avoidOptionals: options.config.avoidOptionals, documentMode: options.config.documentMode, skipTypeNameForRoot: options.config.skipTypeNameForRoot, + onlyOperationTypes: options.config.onlyOperationTypes, + onlyEnumTypes: options.config.onlyEnumTypes, }; const visitor = new ClientSideBaseVisitor(options.schemaAst!, [], options.config, options.config);