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

Default resolver for fields that are functions does not work when passing resolvers to mergeSchemas #1061

Closed
chrischen opened this issue Feb 8, 2019 · 4 comments
Labels

Comments

@chrischen
Copy link

chrischen commented Feb 8, 2019

So the default resolver should resolve the field name if it exists, and if the field name is a function, it should call that. However when passing a resolvers to mergeSchemas, the default resolver resolution does not happen for functions.

Expected result
If field is a function, function should be called and the return value of the function is assigned to the field.

Actual result
A type error
Int cannot represent non-integer value: [function fieldB]

This glitch shows the problem: https://glitch.com/edit/#!/intelligent-buckaroo

@chrischen chrischen changed the title Passing resolvers to mergeSchemas prevents default resolution of fields with functions. Default resolver for fields that are functions does not work when passing resolvers to mergeSchemas Feb 8, 2019
@chrischen
Copy link
Author

I managed to fix this issue by putting the resolvers in a makeExecutableSchema call that afterwards gets passed to mergeSchemas, rather than passing resolvers to mergeSchemas.

@yaacovCR
Copy link
Collaborator

yaacovCR commented Jul 1, 2019

This should be fixed in graphql-tools-fork v6.1.2. Let me know if you have any issues.

@kamilkisiela
Copy link
Collaborator

🔈@chrischen

We recently released an alpha version of GraphQL Tools (#1308) that should fix your issue.

Please update graphql-tools to next or run:

npx match-version graphql-tools next

Let us know if it solves your problem, we're counting for your feedback! :)

@yaacovCR yaacovCR mentioned this issue Mar 27, 2020
22 tasks
@yaacovCR
Copy link
Collaborator

Rolled into #1306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants