class GraphQL::NonNullType
Given a non-null type, you can always get the underlying type with {#unwrap}.
(If a value isn’t provided, {Query::VariableValidationError} will be raised).
end
argument :values, types.String.to_non_null_type
# or
argument :values, !types.String
# …
field :newNames do
@example A field which requires a string input
For input types, it says that the incoming value must be provided by the query.
(If the application fails to return a value, {InvalidNullError} will be raised.)
field :items, ItemType.to_non_null_type
# or
field :items, !ItemType
@example A field which always returns an error
For return types, it says that the returned value will always be present.
or {BaseType#to_non_null_type} (‘InnerType.to_non_null_type`)
Non-null types can be created with `!` (`InnerType!`)
A non-null type modifies another type.
def coerce_input(value)
def coerce_input(value) of_type.coerce_input(value) end
def coerce_result(value)
def coerce_result(value) of_type.coerce_result(value) end
def initialize(of_type:)
def initialize(of_type:) @of_type = of_type end
def kind
def kind GraphQL::TypeKinds::NON_NULL end
def to_s
def to_s "#{of_type.to_s}!" end
def valid_input?(value, warden)
def valid_input?(value, warden) validate_input(value, warden).valid? end
def validate_input(value, warden)
def validate_input(value, warden) if value.nil? result = GraphQL::Query::InputValidationResult.new result.add_problem("Expected value to not be null") result else of_type.validate_input(value, warden) end end