Module: API::Helpers::GraphqlHelpers

Defined in:
lib/api/helpers/graphql_helpers.rb

Overview

GraphqlHelpers is used by the REST API when it is acting like a client against the graphql API. Helper code for the graphql server implementation should be in app/graphql/ or lib/gitlab/graphql/

Instance Method Summary collapse

Instance Method Details

#run_graphql!(query:, context: {}, transform: nil) ⇒ Object


9
10
11
12
13
14
15
16
17
# File 'lib/api/helpers/graphql_helpers.rb', line 9

def run_graphql!(query:, context: {}, transform: nil)
  result = GitlabSchema.execute(query, context: context)

  if transform
    transform.call(result)
  else
    result
  end
end