Skip to content
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

Fix: resolve correct data if schema is wrapped #1562

Merged
merged 3 commits into from May 30, 2020

Conversation

ardatan
Copy link
Owner

@ardatan ardatan commented May 29, 2020

If a subschema has the subscription resolvers like below;

{
   Subscription: {
      foo: {
         subscribe: () => someAsyncIteratorReturnsNumber, // not an object with fieldName like { foo: 2 }
         resolve: payload => payload, // << this function gets an object { foo: 2 } if the schema is wrapped, so GraphQL Request fails because returned value here should be a string.
      }
   }
}

So this PR adds additional resolve field to proxy resolvers. It resolves payload[fieldName] by overwriting subschema's resolve method.

@theguild-bot
Copy link
Collaborator

theguild-bot commented May 29, 2020

The latest changes of this PR are available as alpha in npm: 6.0.5-alpha-fb48136.0

Quickly update your package.json by running:

npx match-version @graphql-tools 6.0.5-alpha-fb48136.0

@ardatan ardatan requested a review from yaacovCR May 29, 2020 23:22
@ardatan ardatan merged commit fb48136 into master May 30, 2020
@ardatan ardatan deleted the fix-wrong-proxying-subscriptios branch May 30, 2020 11:07
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.

None yet

2 participants