I've created an interface type, like:
module UserErrorType
include Types::BaseInterface
definition_methods do
def resolve_type(object, _ctx)
...
end
end
end
And a query that looks like:
query {
thing {
errors {
code
message
... on SomeDerivedType {
blah
}
}
}
}
When I run this locally everything works fine, I'm able to resolve my derived types and get into the resolve_type
method.
When I run in rspec:
describe UserErrorType, type: :graphql_object do
subject { execute(query, context) }
end
I get the following error:
GraphQL::RequiredImplementationMissingError: schema contains Interfaces or Unions, so you must define a
resolve_type -> (obj, ctx) { ... }
function
From my understanding of the error message it wants me to put the resolve_type
method directly on the Schema
object though I should be able to define it in the definition_methods
directly in the interface as above.