summaryrefslogtreecommitdiff
path: root/lib/api/validations/types/workhorse_file.rb
blob: 18d111f655615aa5227c72fdf89b86d68991aa1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module API
  module Validations
    module Types
      class WorkhorseFile < Virtus::Attribute
        def coerce(input)
          # Processing of multipart file objects
          # is already taken care of by Gitlab::Middleware::Multipart.
          # Nothing to do here.
          input
        end

        def value_coerced?(value)
          value.is_a?(::UploadedFile)
        end
      end
    end
  end
end