Method: GraphQL::Schema::Field#owner_type

Defined in:
lib/graphql/schema/field.rb

#owner_typeClass

Returns The GraphQL type this field belongs to. (For fields defined on mutations, it's the payload type).

Returns:

  • (Class)

    The GraphQL type this field belongs to. (For fields defined on mutations, it's the payload type)



74
75
76
77
78
79
80
81
82
# File 'lib/graphql/schema/field.rb', line 74

def owner_type
  @owner_type ||= if owner.nil?
    raise GraphQL::InvariantError, "Field #{original_name.inspect} (graphql name: #{graphql_name.inspect}) has no owner, but all fields should have an owner. How did this happen?!"
  elsif owner < GraphQL::Schema::Mutation
    owner.payload_type
  else
    owner
  end
end