Class: ElasticGraph::Apollo::GraphQL::ServiceFieldResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_graph/apollo/graphql/service_field_resolver.rb

Overview

GraphQL resolver for the Apollo ‘Query._service` field.

Instance Method Summary collapse

Constructor Details

#initialize(elasticgraph_graphql:, config:) ⇒ ServiceFieldResolver

Returns a new instance of ServiceFieldResolver.



16
17
18
# File 'lib/elastic_graph/apollo/graphql/service_field_resolver.rb', line 16

def initialize(elasticgraph_graphql:, config:)
  # Nothing to initialize, but needs to be defined to satisfy the resolver interface.
end

Instance Method Details

#resolve(field:, object:, args:, context:) ⇒ Object



20
21
22
# File 'lib/elastic_graph/apollo/graphql/service_field_resolver.rb', line 20

def resolve(field:, object:, args:, context:)
  {"sdl" => service_sdl(context.fetch(:elastic_graph_schema))}
end