Class: GraphQL::Schema::NonNull
- Defined in:
- lib/graphql/schema/non_null.rb
Overview
Represents a non null type in the schema. Wraps a Member when it is required.
Instance Attribute Summary
Attributes inherited from Wrapper
Instance Method Summary collapse
- 
  
    
      #coerce_input(value, ctx)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
- 
  
    
      #coerce_result(value, ctx)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
- 
  
    
      #description  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    This is for implementing introspection. 
- 
  
    
      #graphql_name  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    This is for introspection, where it’s expected the name will be null.
- 
  
    
      #inspect  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
- 
  
    
      #kind  ⇒ GraphQL::TypeKinds::NON_NULL 
    
    
  
  
  
  
  
  
  
  
  
    
- 
  
    
      #list?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    True if this type wraps a list type. 
- 
  
    
      #non_null?  ⇒ true 
    
    
  
  
  
  
  
  
  
  
  
    
- 
  
    
      #to_graphql  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
- 
  
    
      #to_type_signature  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
- 
  
    
      #validate_input(value, ctx)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Methods included from Member::ValidatesInput
#coerce_isolated_input, #coerce_isolated_result, #valid_input?, #valid_isolated_input?
Methods inherited from Wrapper
Methods included from Member::TypeSystemHelpers
#to_list_type, #to_non_null_type
Methods included from Member::CachedGraphQLDefinition
#deprecated_to_graphql, #graphql_definition, #initialize_copy, #type_class
Constructor Details
This class inherits a constructor from GraphQL::Schema::Wrapper
Instance Method Details
#coerce_input(value, ctx) ⇒ Object
| 55 56 57 58 59 60 61 | # File 'lib/graphql/schema/non_null.rb', line 55 def coerce_input(value, ctx) # `.validate_input` above is used for variables, but this method is used for arguments if value.nil? raise GraphQL::ExecutionError, "`null` is not a valid input for `#{to_type_signature}`, please provide a value for this argument." end of_type.coerce_input(value, ctx) end | 
#coerce_result(value, ctx) ⇒ Object
| 63 64 65 | # File 'lib/graphql/schema/non_null.rb', line 63 def coerce_result(value, ctx) of_type.coerce_result(value, ctx) end | 
#description ⇒ Object
This is for implementing introspection
| 68 69 70 | # File 'lib/graphql/schema/non_null.rb', line 68 def description nil end | 
#graphql_name ⇒ Object
This is for introspection, where it’s expected the name will be null
| 51 52 53 | # File 'lib/graphql/schema/non_null.rb', line 51 def graphql_name nil end | 
#inspect ⇒ Object
| 36 37 38 | # File 'lib/graphql/schema/non_null.rb', line 36 def inspect "#<#{self.class.name} @of_type=#{@of_type.inspect}>" end | 
#kind ⇒ GraphQL::TypeKinds::NON_NULL
| 18 19 20 | # File 'lib/graphql/schema/non_null.rb', line 18 def kind GraphQL::TypeKinds::NON_NULL end | 
#list? ⇒ Boolean
Returns True if this type wraps a list type.
| 28 29 30 | # File 'lib/graphql/schema/non_null.rb', line 28 def list? @of_type.list? end | 
#non_null? ⇒ true
| 23 24 25 | # File 'lib/graphql/schema/non_null.rb', line 23 def non_null? true end | 
#to_graphql ⇒ Object
| 13 14 15 | # File 'lib/graphql/schema/non_null.rb', line 13 def to_graphql @of_type.graphql_definition(silence_deprecation_warning: true).to_non_null_type end | 
#to_type_signature ⇒ Object
| 32 33 34 | # File 'lib/graphql/schema/non_null.rb', line 32 def to_type_signature "#{@of_type.to_type_signature}!" end | 
#validate_input(value, ctx) ⇒ Object
| 40 41 42 43 44 45 46 47 48 | # File 'lib/graphql/schema/non_null.rb', line 40 def validate_input(value, ctx) if value.nil? result = GraphQL::Query::InputValidationResult.new result.add_problem("Expected value to not be null") result else of_type.validate_input(value, ctx) end end |