Skip to content

Conversation

eddeee888
Copy link
Collaborator

@eddeee888 eddeee888 commented Dec 16, 2024

Related: #10413, #7020, #10385, #9701

typescript-resolvers & Federation Changes

Related: #10206

Breaking Changes

  • No longer generate UnwrappedObject utility type, as this was used to support the wrong previously generated type.
  • Deprecate onlyResolveTypeForInterfaces because majority of use cases cannot implement resolvers in Interfaces.
  • Deprecate generateInternalResolversIfNeeded.__resolveReference because types do not have __resolveReference if they are not Federation entities or are not resolvable. Users should not have to manually set this option. This option was put in to wait for this major version.
  • Do not generate __isTypeOf for non-implementing-types or non-union-members
  • Do not inline parent types for Federation Entities resolvers anymore. This makes handling mappers and deciding @external, @provides and @key @key scenarios easier

Refactors

Breaking changes

  • Record<PropertyKey, never> is used instead of {} for empty object type in @graphql-codegen/typescript and @graphql-codegen/typescript-resolvers

Client Preset

- [ ] Improve default and forwarded config Will happen after major version update

Copy link

changeset-bot bot commented Dec 16, 2024

🦋 Changeset detected

Latest commit: 45c39af

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

This PR includes changesets to release 18 packages
Name Type
@graphql-codegen/visitor-plugin-common Major
@graphql-codegen/typescript-resolvers Major
@graphql-codegen/plugin-helpers Major
@graphql-codegen/cli Major
@graphql-codegen/testing Major
@graphql-codegen/typed-document-node Major
@graphql-codegen/gql-tag-operations Major
@graphql-codegen/typescript-document-nodes Major
@graphql-codegen/typescript-operations Major
@graphql-codegen/typescript Major
@graphql-codegen/client-preset Major
@graphql-codegen/graphql-modules-preset Major
@graphql-codegen/core Major
@graphql-codegen/add Major
@graphql-codegen/fragment-matcher Major
@graphql-codegen/introspection Major
@graphql-codegen/schema-ast Major
@graphql-codegen/time Major

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

Copy link
Contributor

github-actions bot commented Dec 16, 2024

💻 Website Preview

The latest changes are available as preview in: https://pr-10218.graphql-code-generator.pages.dev

Copy link
Contributor

github-actions bot commented Jan 9, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-codegen/cli 6.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/core 5.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/add 6.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/fragment-matcher 6.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/introspection 5.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/schema-ast 5.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/time 6.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/visitor-plugin-common 6.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-document-nodes 5.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/gql-tag-operations 5.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-operations 5.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-resolvers 5.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/typed-document-node 6.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript 5.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/client-preset 5.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/graphql-modules-preset 5.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/testing 4.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎
@graphql-codegen/plugin-helpers 6.0.0-alpha-20250828102819-45c39afe00df38220d7a137d66ac1b30fdeeed84 npm ↗︎ unpkg ↗︎

@eddeee888 eddeee888 changed the title Federation feature branch Next major version feature branch Jan 28, 2025
@eddeee888 eddeee888 force-pushed the federation-fixes branch 2 times, most recently from fd51b95 to 56fea45 Compare January 29, 2025 09:27
@eddeee888 eddeee888 force-pushed the federation-fixes branch from 6a2bca7 to 30ac893 Compare May 9, 2025 13:40
@eddeee888 eddeee888 self-assigned this Jul 8, 2025
@eddeee888 eddeee888 mentioned this pull request Aug 13, 2025
1 task
eddeee888 and others added 25 commits August 27, 2025 20:25
…face` entities, fix Interface types having non-meta resolver fields (#10221)

* Add __resolveReference for applicable Interfaces

- Deprecate generateInternalResolversIfNeeded.__resolveReference
- Fix tests
- Deprecate onlyResolveTypeForInterfaces
- Add changeset
- Cleanup
- Handle __resolveReference generation in Interface
- Let FieldDefinition decide whether to generate __resolveReference by checking whether parent has resolvable key

* Fix test
…pes (of Interfaces) or Union members (#10283)

* Implement logic to only generate __isTypeOf for implementing types OR union members

* Remove unused types

* Add changeset

* Remove generateInternalResolversIfNeeded

* Fix dev tests

* Refactor to use parsedSchemaMeta
…esolversParentTypes instead of each resolver (#10297)

* Bring reference selection set to ResolversParentTypes

* Put back old types to extractReferenceSelectionSet

* Update tests for TDD

* Handle parent type consistently for __resolveReference and subsequent resolvers

* Update tests
…n marked with @external (#10287)

* Ensure @external does not generate resolver types

- Handle external directive when part or whole type is marked
- Add changeset
- Add test cases for @provides and @external

* Format and minor text updates

* Add comments

* Fix __resolveReference not getting generated

* Fix test with __isTypeOf when not needed

* Fix type cast that results in wrong type

* Revert unncessary changes to FieldDefinitionPrintFn

* Re-format

* Convert to use AST Node instead of GraphQL Type

* Update test template

* Cache field nodes to generate for processed objects

* Put FIXME on base-resolvers-visitor to remove Name method
* Update test setup

* Implement @requires combination

* Add changeset

* Force release alpha

* Fix issue with empty array, set up tests

* Generate FederationReferenceTypes once

* Update tests related to FederationReferenceTypes

* Update dev-tests

* Revert force release

* Update test related to mapper
…ion functions (#10377)

* Remove NameNode override and refactor relevant references

* Simplify federation utils by making functions handle nodes

* Fix lint issue
* Add writeOnPartialSuccess flag to partially write successful generateiong

* Update config name from writeOnPartialSuccess to allowPartialOutputs

* Ensure consistent experience on complete failure, update tests

* Restructure code and comment

* Update website schema

* Update doc
* Drop Node 18 support

* Add changeset
* Drop @graphql-tools/prisma-loader

* Add changeset
* Update tsconfig to Node 20 recommended version

* Make babel allow declare TS field
* Bump dependency-graph to ^1.0.0

* Bump nock to 14.0.0

* Bump debounce to v2 and remove types package

* Bump ESM packages

- chalk
- detect-indent
- log-symbols
- auto-bind

* Revert "Bump ESM packages"

This reverts commit 7b79aaa.

* Migrate jitit to v2

* Bump cosmiconfig to v9

* Add changesets

* Use min. jiti v2.3.0 to handle default import like before
* Bump listr2

* Migrate implementation and update tests for listr2

* Migrate inquirer to inquirer/prompts
* Remove unnecessary resolutions
* Remove deprecated config

- watchConfig
- dedupeFragments
- noGraphQLTag

* Add changesets

* Regen website schema
* Update ts-resolvers to handle {} correctly

* Refactor types

* Update ts-documents to handle {} better

* Add changeset

* Update tests
* Install vitest

* Set up vitest config

* Install tsconfigPaths

* Set up root vite config

* Set up vitest project for typescript-resolvers

* Set up vitest for plugins-helpers and fix ESM test

* Set up client preset vitest project

* Prepare for vitest.setup.ts

* Set up vitest for graphql-modules-preset

* Set up vitest for typescript plugin

* Set up vitest for typed-document-node

* Set up vitest for typescript-operations

* Set up vitest for gql-tag-operations

* Set up vitest in typescript-document-nodes

* Set up vitest for visitor-plugin-common

* Set up vitest for time plugin

* Set up vitest for schema-ast plugin

* Set up vitest for introspection plugin

* Set up vitest for fragment-matcher plugin

* Set up vitest for add

* Set up vitest for graphql-codegen-core

* Install memfs to support fs testing

* Set up test config for cli

* Fix init tests

* Set up vitest for graphql-codegen-testing

* Update linting rules for test files

* Fix cli-* specs

* Handle cwd mocking for CLI command

* Fix cjs vs esm issues in codegen.spec

* Fix config.spec

* Fix watcher.spec and trim down the mocks

* Migrate rest of examples to vitest

* By jest things. Not even jesting 🤡

* Fix cache jest -> vitest

* Fix lint issues and unncessary disables

* Fix vitest spec

* Fix test and generated things in examples

* Fix vitest things
* Bump ESM packages

* Add changeset
* Avoid NameNode and StringValue string conversion

* Add changeset
eddeee888 and others added 2 commits August 27, 2025 21:52
…put meta (#10417)

* Report hasIsTypeOf in meta

* Add changeset

* Revert "Remove CI config used for dev"

This reverts commit 6d2c6e4.
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.

1 participant