Method: GraphQL::Query#root_type_for_operation

Defined in:
lib/graphql/query.rb

#root_type_for_operation(op_type) ⇒ Object



383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/graphql/query.rb', line 383

def root_type_for_operation(op_type)
  case op_type
  when "query", nil
    types.query_root # rubocop:disable Development/ContextIsPassedCop
  when "mutation"
    types.mutation_root # rubocop:disable Development/ContextIsPassedCop
  when "subscription"
    types.subscription_root # rubocop:disable Development/ContextIsPassedCop
  else
    raise ArgumentError, "unexpected root type name: #{op_type.inspect}; expected nil, 'query', 'mutation', or 'subscription'"
  end
end