3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/graphiti_graphql/runner.rb', line 3
def execute(query_string, variables, schema)
query = GraphQL::Query.new(schema, query_string, variables: variables)
definition = query.document.definitions.first
selection = definition.selections.first
is_graphiti = schemas.generated.query_field?(selection.name)
Util.with_gql_context do
if is_graphiti
resource_class = schemas.generated
.resource_for_query_field(selection.name)
run_query(schema, resource_class, selection, query)
else
schemas.graphql.execute query_string,
variables: variables,
context: GraphitiGraphQL.config.get_context
end
end
end
|