class GraphQL::Schema::NonNull
Represents a non null type in the schema. Wraps a Schema::Member when it is required. See Schema::Member::TypeSystemHelpers#to_non_null_type
Public Instance Methods
Source
# File lib/graphql/schema/non_null.rb, line 65 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
Source
# File lib/graphql/schema/non_null.rb, line 73 def coerce_result(value, ctx) of_type.coerce_result(value, ctx) end
Source
# File lib/graphql/schema/non_null.rb, line 78 def description nil end
This is for implementing introspection
Source
# File lib/graphql/schema/non_null.rb, line 61 def graphql_name nil end
This is for introspection, where itβs expected the name will be null
Source
# File lib/graphql/schema/non_null.rb, line 46 def inspect "#<#{self.class.name} @of_type=#{@of_type.inspect}>" end
# File lib/graphql/schema/non_null.rb, line 18 def kind GraphQL::TypeKinds::NON_NULL end
Returns
-
GraphQL::TypeKinds::NON_NULL
Source
# File lib/graphql/schema/non_null.rb, line 38 def list? @of_type.list? end
Returns
-
Booleanβ True if this type wraps a list type
Source
# File lib/graphql/schema/non_null.rb, line 28 def non_null? true end
Returns
-
true
Source
# File lib/graphql/schema/non_null.rb, line 42 def to_type_signature @type_signature ||= -"#{@of_type.to_type_signature}!" end
# File lib/graphql/schema/non_null.rb, line 50 def validate_input(value, ctx, max_errors: nil) 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, max_errors: max_errors) end end