lib/graphql/schema/loader.rb in graphql-0.19.0 vs lib/graphql/schema/loader.rb in graphql-0.19.1
- old
+ new
@@ -20,17 +20,21 @@
next if type.fetch("name").start_with?("__")
type_object = define_type(type, type_resolver)
types[type_object.name] = type_object
end
- kargs = { :orphan_types => types.values }
+ kargs = { orphan_types: types.values, resolve_type: NullResolveType }
[:query, :mutation, :subscription].each do |root|
type = schema["#{root}Type"]
kargs[root] = types.fetch(type.fetch("name")) if type
end
Schema.define(**kargs)
end
+
+ NullResolveType = -> (obj, ctx) {
+ raise(NotImplementedError, "This schema was loaded from string, so it can't resolve types for objects")
+ }
class << self
private
def resolve_type(types, type)