Skip to content

Add config extract all fields to types field names only (same as apollo-tooling), v2#10568

Merged
eddeee888 merged 4 commits intodotansimha:master-nextfrom
ikusakov2:feature/add-config-extractAllFieldsToTypesCompact-impl
Jan 11, 2026
Merged

Add config extract all fields to types field names only (same as apollo-tooling), v2#10568
eddeee888 merged 4 commits intodotansimha:master-nextfrom
ikusakov2:feature/add-config-extractAllFieldsToTypesCompact-impl

Conversation

@ikusakov2
Copy link
Copy Markdown
Contributor

Description

Adding a config option to render type names in Apollo-tooling way (only with field names, not type names)

Related # #10561

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Unit testing

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 9, 2026

🦋 Changeset detected

Latest commit: c9113aa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@graphql-codegen/visitor-plugin-common Minor
@graphql-codegen/typescript-document-nodes Patch
@graphql-codegen/gql-tag-operations Patch
@graphql-codegen/typescript-operations Patch
@graphql-codegen/typescript-resolvers Patch
@graphql-codegen/typed-document-node Patch
@graphql-codegen/typescript Patch
@graphql-codegen/graphql-modules-preset Patch
@graphql-codegen/client-preset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ikusakov2 ikusakov2 changed the base branch from master to master-next January 9, 2026 00:12
Copy link
Copy Markdown
Collaborator

@eddeee888 eddeee888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Thank you!

@eddeee888 eddeee888 merged commit e1d4180 into dotansimha:master-next Jan 11, 2026
19 checks passed
eddeee888 pushed a commit that referenced this pull request Jan 20, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Feb 25, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Mar 3, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
ikusakov2 added a commit to ikusakov2/graphql-code-generator that referenced this pull request Mar 4, 2026
…lo-tooling), v2 (dotansimha#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Mar 8, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Mar 8, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Mar 8, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Mar 12, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Mar 19, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Apr 13, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Apr 18, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Apr 19, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Apr 22, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Apr 24, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Apr 27, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 pushed a commit that referenced this pull request Apr 30, 2026
…lo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
eddeee888 added a commit that referenced this pull request Apr 30, 2026
* Add dummy commit to create branch

* Ensure CI runs

* [typescript-operations] Generate `Exact` into target file (#10504)

* Create standalone test

* Add Exact and set up test

* Remove Exact from typescript plugin

* Update tests that switch out Exact

* Update dev tests

* Add changeset

* Update test

* Add InputMaybe Scalars tests

* Fix schema in test

* Fix up examples tests

* Add result enum example

* [typescript-operations] Remove inputmaybe and scalars (#10509)

* [typescript-operations] Remove generation of InputMaybe and Scalars for variables

* Adding support for `config.scalars`, fixing intergation tests

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>

* chore(dependencies): updated changesets for modified dependencies

* [typescript-operations] Extract convertSchemaEnumToDeclarationBlockString and getNodeComment to `visitor-plugin-common` (#10520)

* Extract convertSchemaEnumToDeclarationBlockString and getNodeComment to visitor-plugin-common to re-use in next major version

* Create major breaking changeset for @graphql-codegen/visitor-plugin-common

* Fix naming

* Replace buildEnumValuesBlock method in base-types-visitor with a utility version

* Fix changeset

* Fix import path

* Fix getNodeComment import issue by moving to utils.ts

* [typescript-operations] Generate enums referenced in operation Variables (#10508)

* Collect used enums

* Use enum converter for Enum

* Add changeset

* Add doc

* Update dev tests

* Fix return type issue

* [typescript-operations] Add missing enum tests & fix enum generating logic for standalone approach (#10525)

* Add tests for enum

* Baselin tests

* Ensure correctness of enumValues import

* Split enum tests

* Abstract import printing functions

* Add missing enum tests

* Format to minimise conflict

* Add changeset

* Add generatesOperationTypes config option to generate shared types only (#10529)

* [typescript-operations] Add importSchemaTypesFrom to import user-defined+used input/enum types externally (#10534)

* Draft importSchemaTypesFrom

* Minor test fixes

* Fix test name

* Update dev-tests

* Baseline dev-test for importSchemaTypesFrom

* Implement relative import paths correctly

* Update tests to handle outputDir correctly

* Add test for absolute importSchemaTypesFrom

* Remove unncessary files

* Add test about unused things

* Remove comment

* Add comments

* Add changeset

* [typescript-operations][client-preset] Integrate new typescript-operations with client preset (#10540)

* Do not use typescript and its config in Client Preset

* Fix issue where enumValues are imported even if not used

* Split enum tests for client preset

* Update unit tests

* Update examples

* Generate Incremental utilty type

* Add changeset

* Rebase tests (with errors)

* [typescript-operations] No optional Result fields, unless deferred or conditional (#10548)

* Fix types issues and put comments

* Handle avoidOptionals

* Update integration tests

* Add FIXME to pass test for now

* Add changeset

* Generate input types and output enums into target file (#10527)

* input types, input/output enums are generated to the target files

* cleanup

* better code

* more tests

* cleanup

* better code

* better tests

* bugfixing for inner types and outer enums

* bugfixing after merge

* cleanup

* cleanup

* fix snapshots

* fix type errors in presets/client

* updated tests/examples

* Add standalone.input.spec.ts and update standalone tests to TDD

* Update operations/visitor.ts to satisfy tests

* Revert Client Preset changes

* Add oneOf directive for GraphQL 15

* Update changeset

* Refactor IIFE

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
Co-authored-by: Eddy Nguyen <github@eddeee888.me>

* Remove placeholder and test release 🤞

* Test snapshot release

* [typescript-operations] Fix __typename optionality and nullability (#10552)

* Fix typename optionality and existence at Result root and types

* Update tests

* Update tests

* Stop allowing skipTypename into Client Preset and typescript-operations, and update tests

* Remove dependency on typescript plugin

* Add changeset

* [typescript-operations] Clean up selection set processor that depends on `typescript` plugin (`preResolveTypes: false`) (#10556)

* Remove legacy selection set proccessor that depends on typescript plugin

* Remove obsolete tests

* Improve tests to be explicit

* Adjust config inheritance to reflect usage and type-hint better (#10560)

* Refactor utility function to match practice

* Fix config option inheritance

- addTypename/skipTypename: is only a types-visitor concern. This is moved to types-visitor from base-visitor
- nonOptionalTypename: is a documents-visitor and types-visitor concern. Moved from base-visitor there
- extractAllFieldsToTypes: is a documents-visitor concern. Moved from base-visitor there
- enumPrefix and enumSuffix: need to be in base-visitor as all 3 types of visitors need this to correctly sync the enum type names. This is moved to base visitor
- ignoreEnumValuesFromSchema: is a documents-visitor and types-visitor concern. Moved from base-visitor there.
- globalNamespace: is a documents-visitor concern. Moved from base-visitor there

Other changes:
- documents-visitor no longer extends types-visitor _option types_ as they have two distinct usages now. The types now extend base-visitor types. This is now consistent with documents-visitor extending base-visitor
- Classes now handle config parsing and types at the same level e.g. if typescript-operations plugin parses configOne, then the types for configOne must be in that class, rather than in base-documents-visitor

* Remove references and tests related to skipTypename in operations plugin

* Add changeset

* chore(dependencies): updated changesets for modified dependencies

* Fix issues after rebasing (#10563)

* Fix missing dep

* chore(dependencies): updated changesets for modified dependencies

* Fix dev-tests

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore(dependencies): updated changesets for modified dependencies

* Remove unused utility types and functions (#10564)

* Remove MakeOptional MakeMaybe MakeEmpty and Incremental utitlity types from typescript plugin because they were used for typescript-operations

* Fix unit tests

* Remove deprecated functions

* Add changeset

* Add config extract all fields to types field names only (same as apollo-tooling), v2 (#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>

* Only generate `Exact` utility type if documents have operations (#10571)

* Remove extraneous test setup

* Do not generate Exact utility type of not used

* Add default test case to check that Exact is used for Mutation and Subscription variables

* Update dev-tests

* Add changeset

* Remove extraneous config for Exact test

* Make `unknown` instead of `any` the default scalar type (#10566)

* Make default scalar unknown, instead of any

* Set up defaultScalarType tests

* Add changeset

* Revert unrelated null | undefined changes

* Fix test description

* Add a test case for custom scalar in dev-test

* Decouple `typescript-operations` plugin from `typescript` plugin (#10572)

* Decouple TypeScriptOperationVariablesToObject from typescript plugin

* Add changeset

* Remove typescript plugin dep

* chore(dependencies): updated changesets for modified dependencies

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore(dependencies): updated changesets for modified dependencies

* Add `inputMaybeValue` to allow changing Variables and Input nullable types (#10573)

* Shuffle methods to group things together, cleanup

* Wire up _inputMaybeValue and organise config

* Wire up inputMaybeValue

* Add inputMaybeValue test

* Update tests

* Add changeset

* [typescript-operations] Handle printing "Maybe" types consistently when types are `any` and `unknown` (#10574)

* Use printTypeScriptType to handle printing typescript types consistently, especially for any and unknown

* Update tests

* Add changeset

* Make printTypeScriptMaybeType scope smaller

* Update tests

* [typescript-operations] Fix Input generation when using `importSchemaTypesFrom` (#10575)

* Fix importing issue when using importSchemaTypesFrom

* Add dev-tests for usage with typescript plugin

* Update unit test

* Add changeset

* Bugfix: enums from external fragments were not generated along with operations (#10565)

* integration test

* cleanups

* cleanups2

* fixed a bug with external fragments

* cleanup

* keep generated files, refactored visitorwq

* cleanup

* changeset

* adding missing dependency

* delete temporary files

* cleanup

* cleanups

* Adding back the integration tests + fix them

* merged + fixes

* cleanup

* cleanup

* patching near-operation-file preset

* cleanup

* adding duplicates case to integration tests

* Fixing bug with duplicates generated when using extractAllFieldsToTypesCompact

* cleanup

* prevent running prettier on generated code

* cleanups

* cleanup

* adding unit tests

* update changeset

* cleanups

* try resolving graphql 16 error

* remove unused deps

* remove unused deps

* cleanups

* Revert and apply minimal yarn.lock changes

---------

Co-authored-by: ikusakov <ikusakov@gxnfgqk426.y.yelp>
Co-authored-by: Igor Kusakov <igor@kusakov.com>
Co-authored-by: Eddy Nguyen <github@eddeee888.me>
Co-authored-by: Eddy Nguyen <ch@eddeee888.me>

* Various test, FIXMEs, config fixes (#10577)

* Enable TS test

* Add missing test for globalNamespace

* Ensure dev-test-apollo-tooling is private

* [typescript-operations] Cut down `avoidOptionals` to only support `object`, `inputValue` and `defaultValue` (+ minor drive-by fixes) (#10579)

* Trim down avoidOptionals for client use case

* Add changeset

* Correctly ignore dev-test from changeset

* [typescript-operations] Rename `avoidOptionals.object` to `avoidOptionals.variableValue` to better reflect the target (#10582)

* Rename avoidOptionals.object -> avoidOptionals.variableValue to better reflect the target. Add tests.

* Add default input use cases

* [typescript-operations] Fix external custom scalars not getting imported (#10584)

* Rename scalar test

* Refactor to move position of getEnumsImports to group methods

* Implement handling of external scalars

* Add (wrong) import scalar tests to work against

* Fix importing types wrongly count Scalar as part of types generated into shared type file

* Do not generate scalar imports if not needed

* Add changeset

* Cleanup

* Fix granularity of operation-file

* Improve comments, remove unused prop (#10589)

Co-authored-by: Igor Kusakov <igor@kusakov.com>

* Remove support for directiveArgumentAndInputFieldMappings (#10596)

* [CLI] Set `noSilentErrors: true` by default (#10597)

* Set noSilentErrors: true by default

* Add changeset

* Format tests

* Change generatesOperationTypes to generateOperationTypes for consistency (#10602)

* [typescript-operations] Set `namespacedImportName` default value when `importSchemaTypesFrom` is used (#10603)

* Improve namespacedImportName integration with importSchemaTypesFrom

* Update dev-test

* Update changeset

* [typescript-operations] Change default input ID scalar type (#10604)

* Ensure input and variables use the same input scalars default

* Add changeset

* chore(dependencies): updated changesets for modified dependencies

* Fix lint issue

* Fix unit tests (#10606)

* [client-preset] Update client preset doc and clean up deps (#10608)

* Remove typescript plugin from client-preset as no longer used

* Update client-preset doc

* Add changeset

* chore(dependencies): updated changesets for modified dependencies

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore(dependencies): updated changesets for modified dependencies

* [client-preset] Fix docs for upcoming major release (#10609)

* Fix enumValues doc issue

* fix link issues in client preset doc

* Move nonOptionalTypename and skipTypeNameForRoot together in the doc for ease of read

* chore(dependencies): updated changesets for modified dependencies

* Bring in latest near-operation-file preset (#10621)

* Master next fix native ast detection (#10637)

* Fix isNativeNamedType function

* Add changeset

* Regen dev-tests

* Rename function from collectUsedInputTypes to collectUsedSchemaTypesToGenerate to correctly reflect its functionality (#10640)

* [typescript-operations] Add warning for internal utility types (#10643)

* Add internal utility type warning

* Update snapshots

* Add changeset

* Improve internal type message

* [typescript-operations] Fix `@skip` and `@include` not applying conditional modifiers correctly when used on inline fragment (#10645)

* Migrate skip and include directive tests to a new file

* Add test for aliased field

* Add test for include directive, inline fragment cases

* Refactor selection set to object to reflect current usages

* Standardise type, parsing, fragment directive handling and fix conditional when inline fragment is used

* Add inline fragment skip directive test

* Add changeset

* [typescript-operations] Fix @Skip and @include not applying conditional modifiers correctly when used on fragment spread (#10646)

* Set up TDD

* WIP implement conditional fragmentspread

* Fix empty object detection logic

* Format/cleanup

* Add test for include+skip+defer

* Add changeset

* Fix test

* Add test case (#10647)

* [Major version release] Drop Node 20 tests for normal runs (#10648)

* Drop Node 20 tests for normal runs

* Add changeset

* Drop Node 20 support for watcher tests

* Revert "Drop Node 20 support for watcher tests"

This reverts commit cc52a81.

* Update package deps (#10650)

* Bump ESM packages

- detect-indent v7
- auto-bind v5
- chalk v5
- log-symbols v7
- debounce v3

* Bum all package deps to latest

* chore(dependencies): updated changesets for modified dependencies

* Revert @inquirer/prompts to v7 to be handled later

* chore(dependencies): updated changesets for modified dependencies

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore(dependencies): updated changesets for modified dependencies

* Bump inquirer and improve related tests (#10651)

* Bump inquirer

* chore(dependencies): updated changesets for modified dependencies

* WIP fix test

* Swap bddstd for inquirer/testing

* Fix spec tsconfig to fix ts import issue in tests ESM

* Fix unnecessary Promise

* Update init tests to use @inquirer/testing

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore(dependencies): updated changesets for modified dependencies

* Add ESM changeset

* [client-preset] Make persisted docs default hashing algorithm sha256, and follow recommended format (#10652)

* Update default hash to be sha256 for persisted documents

* Add changeset

* chore(dependencies): updated changesets for modified dependencies

* Update tests

* chore(dependencies): updated changesets for modified dependencies

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* [typescript-operations] Add `declarationKind` support (#10654)

* typescript-operations: Add support for declarationKind option

* Drive-by: add fixme

* Add changeset

* [typesceript-operations] Refactor operations avoidOptionals and declarationKind config (#10655)

* move normalizeAvoidOptionals to visitor-plugin-common

* Make normalizeOperationDeclarationKind similar to normalizeOperationAvoidOptionals

* Fix issue where extractAllFieldsToTypes always causes console to warn

* Fix compilation issues

* [typescript-operations] Fix enumValues not considering namingConvention in certain scenarios (#10656)

* Set up test

* Refactor naming functions to visitor-plugin-common/naming

* Parse EnumValues with applying namingConvention on the schema type and use it for imports

* Ensure converted enum type is used across imports, exports and Result

* Fix enum-values.spec tests

* Update implementation to match expected

* Update enumValues tests

* Ensure correct naming convention being applied to Input, Variables and Result types

* Create a section for enumValues

* add changeset

* [typescript][typescript-resolvers] Fix enumValues not considering namingConvention in certain scenarios (2) (#10657)

* Ensure enumValues is consistent in typescript and typescript-resolvers

* Add a note to default alias import not doing anything

* Add changeset

* chore(dependencies): updated changesets for modified dependencies

* Cleanup after rebase

* feat(cli): use `ESM` by default (#10705)

* feat(cli): use `ESM` by default

* Update graphql-codegen-esm to use esm/bin.js

* Remove master-next CI config

---------

Co-authored-by: Igor Kusakov <ikusakov@yelp.com>
Co-authored-by: Igor Kusakov <igor@kusakov.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ikusakov <ikusakov@gxnfgqk426.y.yelp>
Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants