Class: ElasticGraph::GraphQL::Schema::LazyResolverAdapter

Inherits:
Struct
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/elastic_graph/graphql/schema.rb

Overview

Adapter class to allow us to lazily load the resolver instance.

Necessary because the resolver must be provided to ‘GraphQL::Schema.from_definition`, but the resolver logic itself depends upon the loaded schema to know how to resolve. To work around the circular dependency, we build the schema with this lazy adapter, then build the resolver with the schema, and then the lazy resolver lazily loads the resolver.

Instance Method Summary collapse

Instance Method Details

#resolverObject



123
124
125
# File 'lib/elastic_graph/graphql/schema.rb', line 123

def resolver
  @resolver ||= builder.call
end