Method: GraphQL::Schema#execute
- Defined in:
- lib/graphql/schema.rb
#execute(query_str = nil, **kwargs) ⇒ Hash
Execute a query on itself. Raises an error if the schema definition is invalid.
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/graphql/schema.rb', line 261 def execute(query_str = nil, **kwargs) if query_str kwargs[:query] = query_str end # Some of the query context _should_ be passed to the multiplex, too multiplex_context = if (ctx = kwargs[:context]) { backtrace: ctx[:backtrace], tracers: ctx[:tracers], } else {} end # Since we're running one query, don't run a multiplex-level complexity analyzer all_results = multiplex([kwargs], max_complexity: nil, context: multiplex_context) all_results[0] end |