File: upload.rb

package info (click to toggle)
ruby-apollo-upload-server 2.1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 152 kB
  • sloc: ruby: 443; makefile: 6; sh: 4
file content (15 lines) | stat: -rw-r--r-- 373 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

require 'graphql'

module ApolloUploadServer
  class Upload < GraphQL::Schema::Scalar
    graphql_name "Upload"

    def self.coerce_input(value, _ctx)
      return super if value.nil? || value.is_a?(::ApolloUploadServer::Wrappers::UploadedFile)

      raise GraphQL::CoercionError, "#{value.inspect} is not a valid upload"
    end
  end
end