Method: GraphQL::Schema::Resolver::HasPayloadType#payload_type

Defined in:
lib/graphql/schema/resolver/has_payload_type.rb

#payload_type(new_payload_type = nil) ⇒ Class Also known as: type_expr

Call this method to get the derived return type of the mutation, or use it as a configuration method to assign a return type instead of generating one.

Parameters:

  • new_payload_type (Class, nil) (defaults to: nil)

    If a type definition class is provided, it will be used as the return type of the mutation field

Returns:

  • (Class)

    The object type which this mutation returns.



16
17
18
19
20
21
# File 'lib/graphql/schema/resolver/has_payload_type.rb', line 16

def payload_type(new_payload_type = nil)
  if new_payload_type
    @payload_type = new_payload_type
  end
  @payload_type ||= generate_payload_type
end