Sha256: 8e9e22913b9c808c97d0e989b86883464ab381a6551a15c04c53ffbe87edc25d

Contents?: true

Size: 393 Bytes

Versions: 10

Compression:

Stored size: 393 Bytes

Contents

# frozen_string_literal: true

require 'grape/validations/validators/multiple_params_base'

module Grape
  module Validations
    class AtLeastOneOfValidator < MultipleParamsBase
      def validate_params!(params)
        return unless keys_in_common(params).empty?
        raise Grape::Exceptions::Validation.new(params: all_keys, message: message(:at_least_one))
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
grape-1.5.3 lib/grape/validations/validators/at_least_one_of.rb
grape-1.5.2 lib/grape/validations/validators/at_least_one_of.rb
grape-1.5.1 lib/grape/validations/validators/at_least_one_of.rb
grape-1.5.0 lib/grape/validations/validators/at_least_one_of.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.4.0/lib/grape/validations/validators/at_least_one_of.rb
grape-1.4.0 lib/grape/validations/validators/at_least_one_of.rb
grape-1.3.3 lib/grape/validations/validators/at_least_one_of.rb
grape-1.3.2 lib/grape/validations/validators/at_least_one_of.rb
grape-1.3.1 lib/grape/validations/validators/at_least_one_of.rb
grape-1.3.0 lib/grape/validations/validators/at_least_one_of.rb