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
Adding field with resolver on a Type causes "Can't determine the return type " error on a different Type #3974
Comments
|
I've worked around this for now by adding a new |
|
Hey, sorry for the trouble! Thanks for the detailed report.
Yep ... and I think this spot is particularly tough, since it's the I think you could get around this by using a string for the type name: module Resolvers
class TodosResolver < GraphQL::Schema::Resolver
- type [Types::TodoType], null: false
+ type "[Types::TodoType]", null: falseI think that would defer the reference to |
|
Perfect! Thanks so much. |
|
@rmosolgo hmm, what if your type looks like this type Types::IssueType.connection_type, null: trueQuoting it won't help in this case |
Want to give that a try? |
|
Thanks, that did the trick! |
Describe the bug
We are using a resolver
Resolvers::TodoResolveron a fieldtodosthat is already present on two types –QueryTypeandWorkType. The resolver declares the type withtype [Types::TodoType], null: false(see code below).When we add a
todosfieldUserTypewith the same resolver, we receive an error with the message: "Can't determine the return type for Work.todos (it hasresolver: Resolvers::TodosResolver, consider configuration atype ...for that class)"Removing the
todosfield fromUserType, or replacing it with a definition that does not include the resolver, does not raise the error.Versions
graphqlversion: 1.13.10rails(or other framework): Rails 6.1.4.4other applicable versions (
graphql-batch, etc)graphql-batch (0.5.0)
promise.rb (0.7.4)
GraphQL schema
Include relevant types and fields (in Ruby is best, in GraphQL IDL is ok). Any custom extensions, etc?
Steps to reproduce
Steps to reproduce the behavior
Expected behavior
No error should be raised. The
todosfield should be available onQueryType,WorkType, andUserTypeActual behavior
Error was raised
Place full backtrace here (if a Ruby exception is involved):
Click to view exception backtrace
Additional context
I notice a slight change in the error message in v2, referencing cyclic conditions, but can't upgrade to 2 yet because of the graphql-batch restriction.
The text was updated successfully, but these errors were encountered: