Class: GraphQL::Schema::Mutation Private
- Extended by:
- GraphQL::Schema::Member::HasFields
- Defined in:
- lib/graphql/schema/mutation.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
This base class accepts configuration for a mutation root field, then it can be hooked up to your mutation root object type.
If you want to customize how this class generates types, in your base class,
override the various generate_*
methods.
Direct Known Subclasses
Constant Summary
Constants included from GraphQL::Schema::Member::GraphQLTypeNames
GraphQL::Schema::Member::GraphQLTypeNames::Boolean, GraphQL::Schema::Member::GraphQLTypeNames::ID, GraphQL::Schema::Member::GraphQLTypeNames::Int
Instance Attribute Summary
Attributes inherited from Resolver
Class Method Summary collapse
-
.field(*args, &block) ⇒ Object
private
Override this method to handle legacy-style usages of
MyMutation.field
. -
.field_class(new_class = nil) ⇒ Object
private
-
.object_class(new_class = nil) ⇒ Class
private
An object class to use for deriving return types.
-
.payload_type(new_payload_type = nil) ⇒ Class
(also: type, type_expr)
private
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.
-
.visible?(context) ⇒ Boolean
private
Methods included from GraphQL::Schema::Member::HasFields
add_default_resolve_module, add_field, extended, field, field_class, fields, global_id_field, included, inherited, own_fields
Methods inherited from Resolver
argument, arguments_loads_as_type, #before_prepare, complexity, extras, field_options, #initialize, null, #resolve, resolve_method, #resolve_with_support
Methods included from GraphQL::Schema::Member::HasArguments
#argument, #argument_class, #arguments, #own_arguments
Methods included from GraphQL::Schema::Member::BaseDSLMethods
#accessible?, #authorized?, #description, #graphql_name, #introspection, #mutation, #name, #overridden_graphql_name, #to_graphql, #visible?
Constructor Details
This class inherits a constructor from GraphQL::Schema::Resolver
Class Method Details
.field(*args, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override this method to handle legacy-style usages of MyMutation.field
66 67 68 69 70 71 72 |
# File 'lib/graphql/schema/mutation.rb', line 66 def field(*args, &block) if args.none? raise ArgumentError, "#{name}.field is used for adding fields to this mutation. Use `mutation: #{name}` to attach this mutation instead." else super end end |
.field_class(new_class = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
99 100 101 102 103 104 105 |
# File 'lib/graphql/schema/mutation.rb', line 99 def field_class(new_class = nil) if new_class @field_class = new_class else @field_class || find_inherited_method(:field_class, GraphQL::Schema::Field) end end |
.object_class(new_class = nil) ⇒ Class
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
An object class to use for deriving return types
92 93 94 95 96 97 |
# File 'lib/graphql/schema/mutation.rb', line 92 def object_class(new_class = nil) if new_class @object_class = new_class end @object_class || (superclass.respond_to?(:object_class) ? superclass.object_class : GraphQL::Schema::Object) end |
.payload_type(new_payload_type = nil) ⇒ Class Also known as: type, type_expr
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
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.
79 80 81 82 83 84 |
# File 'lib/graphql/schema/mutation.rb', line 79 def payload_type(new_payload_type = nil) if new_payload_type @payload_type = new_payload_type end @payload_type ||= generate_payload_type end |
.visible?(context) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
117 118 119 |
# File 'lib/graphql/schema/mutation.rb', line 117 def visible?(context) true end |