-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[typescript-resolvers] Fix interfaces not handling nested correctly #9962
Conversation
🦋 Changeset detectedLatest commit: 4ea1da4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
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 |
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-codegen/visitor-plugin-common |
5.1.1-alpha-20240509105210-4ea1da44bcbd1282abf3a9b6578d6c267619b98b |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-document-nodes |
4.0.7-alpha-20240509105210-4ea1da44bcbd1282abf3a9b6578d6c267619b98b |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/gql-tag-operations |
4.0.7-alpha-20240509105210-4ea1da44bcbd1282abf3a9b6578d6c267619b98b |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-operations |
4.2.1-alpha-20240509105210-4ea1da44bcbd1282abf3a9b6578d6c267619b98b |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-resolvers |
4.0.7-alpha-20240509105210-4ea1da44bcbd1282abf3a9b6578d6c267619b98b |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typed-document-node |
5.0.7-alpha-20240509105210-4ea1da44bcbd1282abf3a9b6578d6c267619b98b |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript |
4.0.7-alpha-20240509105210-4ea1da44bcbd1282abf3a9b6578d6c267619b98b |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/client-preset |
4.2.6-alpha-20240509105210-4ea1da44bcbd1282abf3a9b6578d6c267619b98b |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/graphql-modules-preset |
4.0.7-alpha-20240509105210-4ea1da44bcbd1282abf3a9b6578d6c267619b98b |
npm ↗︎ unpkg ↗︎ |
💻 Website PreviewThe latest changes are available as preview in: https://bb42a566.graphql-code-generator.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤩
Description
This PR fixes an issue where self-referencing and nested interfaces are not using resolver types correctly.
Interface is an abstract type like union. So, we need to reference the
ResolversInterfaceTypes
whenever there's a object type with a field with type interface or an array of interfaces.Otherwise, the wrapping object type would just refer to the base generated type, causing mappers for the interface to be ignored.
Related eddeee888/graphql-code-generator-plugins#266
Note that this bug has been here for awhile. I can observe that in this PR to rebase tests. So at least it's been around before
ResolversInterfaceTypes
implementationExample
Given this schema:
And this mapper:
Before
After
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration