Module: GraphQL::Schema::Resolver::HasPayloadType
- Included in:
 - Mutation, Subscription
 
- Defined in:
 - lib/graphql/schema/resolver/has_payload_type.rb
 
Overview
Adds field(...) helper to resolvers so that they can
generate payload types.
Or, an already-defined one can be attached with payload_type(...).
Instance Method Summary collapse
- 
  
    
      #field_class(new_class = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      #object_class(new_class = nil)  ⇒ Class 
    
    
  
  
  
  
  
  
  
  
  
    
An object class to use for deriving return types.
 - 
  
    
      #payload_type(new_payload_type = nil)  ⇒ Class 
    
    
      (also: #type, #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.
 
Instance Method Details
#field_class(new_class = nil) ⇒ Object
      26 27 28 29 30 31 32  | 
    
      # File 'lib/graphql/schema/resolver/has_payload_type.rb', line 26 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
An object class to use for deriving return types
      37 38 39 40 41 42  | 
    
      # File 'lib/graphql/schema/resolver/has_payload_type.rb', line 37 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
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.
      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  |