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
coerce_input(value, ctx)
click to toggle source
# 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)
click to toggle source
# File lib/graphql/schema/non_null.rb, line 63 def coerce_result(value, ctx) of_type.coerce_result(value, ctx) end
description()
click to toggle source
This is for implementing introspection
# File lib/graphql/schema/non_null.rb, line 68 def description nil end
graphql_name()
click to toggle source
This is for introspection, where it's expected the name will be `null`
# File lib/graphql/schema/non_null.rb, line 51 def graphql_name nil end
inspect()
click to toggle source
# File lib/graphql/schema/non_null.rb, line 36 def inspect "#<#{self.class.name} @of_type=#{@of_type.inspect}>" end
kind()
click to toggle source
@return [GraphQL::TypeKinds::NON_NULL]
# File lib/graphql/schema/non_null.rb, line 18 def kind GraphQL::TypeKinds::NON_NULL end
list?()
click to toggle source
@return [Boolean] True if this type wraps a list type
# File lib/graphql/schema/non_null.rb, line 28 def list? @of_type.list? end
non_null?()
click to toggle source
@return [true]
# File lib/graphql/schema/non_null.rb, line 23 def non_null? true end
to_graphql()
click to toggle source
# 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()
click to toggle source
# File lib/graphql/schema/non_null.rb, line 32 def to_type_signature "#{@of_type.to_type_signature}!" end
validate_input(value, ctx, max_errors: nil)
click to toggle source
# File lib/graphql/schema/non_null.rb, line 40 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