class GraphQL::Relay::Mutation
@api deprecated
Attributes
arguments[RW]
description[RW]
fields[RW]
input_fields[RW]
name[RW]
return_fields[RW]
return_interfaces[W]
return_type[W]
Public Class Methods
new()
click to toggle source
# File lib/graphql/relay/mutation.rb, line 32 def initialize GraphQL::Deprecation.warn "GraphQL::Relay::Mutation will be removed from GraphQL-Ruby 2.0, use GraphQL::Schema::RelayClassicMutation instead: https://graphql-ruby.org/mutations/mutation_classes" @fields = {} @arguments = {} @has_generated_return_type = false end
Public Instance Methods
field()
click to toggle source
# File lib/graphql/relay/mutation.rb, line 49 def field @field ||= begin relay_mutation = self field_resolve_proc = @resolve_proc GraphQL::Field.define do type(relay_mutation.return_type) description(relay_mutation.description) argument :input, !relay_mutation.input_type resolve(field_resolve_proc) mutation(relay_mutation) end end end
has_generated_return_type?()
click to toggle source
# File lib/graphql/relay/mutation.rb, line 39 def has_generated_return_type? # Trigger the generation of the return type, if it is dynamically generated: return_type @has_generated_return_type end
input_type()
click to toggle source
# File lib/graphql/relay/mutation.rb, line 84 def input_type @input_type ||= begin relay_mutation = self input_object_type = GraphQL::InputObjectType.define do name("#{relay_mutation.name}Input") description("Autogenerated input type of #{relay_mutation.name}") input_field :clientMutationId, types.String, "A unique identifier for the client performing the mutation." mutation(relay_mutation) end input_fields.each do |name, arg| input_object_type.arguments[name] = arg end input_object_type end end
resolve=(new_resolve_proc)
click to toggle source
# File lib/graphql/relay/mutation.rb, line 45 def resolve=(new_resolve_proc) @resolve_proc = new_resolve_proc end
result_class()
click to toggle source
# File lib/graphql/relay/mutation.rb, line 101 def result_class @result_class ||= Result.define_subclass(self) end
return_interfaces()
click to toggle source
# File lib/graphql/relay/mutation.rb, line 63 def return_interfaces @return_interfaces ||= [] end
return_type()
click to toggle source
# File lib/graphql/relay/mutation.rb, line 67 def return_type @return_type ||= begin @has_generated_return_type = true relay_mutation = self GraphQL::ObjectType.define do name("#{relay_mutation.name}Payload") description("Autogenerated return type of #{relay_mutation.name}") field :clientMutationId, types.String, "A unique identifier for the client performing the mutation.", property: :client_mutation_id interfaces relay_mutation.return_interfaces relay_mutation.return_fields.each do |name, field_obj| field name, field: field_obj end mutation(relay_mutation) end end end