Class: GraphQL::Extras::Types::Upload

Inherits:
Schema::Scalar
  • Object
show all
Defined in:
lib/graphql/extras/types.rb

Class Method Summary collapse

Class Method Details

.coerce_input(value, context) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/graphql/extras/types.rb', line 55

def self.coerce_input(value, context)
  return nil if value.nil?

  uploads = context.fetch(:uploads) {
    raise "Expected context to include a hash of uploads."
  }

  uploads.fetch(value) do
    raise GraphQL::CoercionError, "No upload named `#{value}` provided."
  end
end