Sha256: cf05ff5cb260279c978e21a93087376382fac31aa9d16ee7b06a9245836a39c1
Contents?: true
Size: 569 Bytes
Versions: 15
Compression:
Stored size: 569 Bytes
Contents
module Grape module Validations require 'grape/validations/validators/multiple_params_base' class AtLeastOneOfValidator < MultipleParamsBase def validate!(params) super if scope_requires_params && no_exclusive_params_are_present raise Grape::Exceptions::Validation, params: all_keys, message: message(:at_least_one) end params end private def no_exclusive_params_are_present scoped_params.any? { |resource_params| keys_in_common(resource_params).empty? } end end end end
Version data entries
15 entries across 15 versions & 1 rubygems