lib/grape/validations/validators/base.rb in grape-1.0.1 vs lib/grape/validations/validators/base.rb in grape-1.0.2
- old
+ new
@@ -36,9 +36,10 @@
# @return [void]
def validate!(params)
attributes = AttributesIterator.new(self, @scope, params)
array_errors = []
attributes.each do |resource_params, attr_name|
+ next if !@scope.required? && resource_params.empty?
next unless @required || (resource_params.respond_to?(:key?) && resource_params.key?(attr_name))
next unless @scope.meets_dependency?(resource_params, params)
begin
validate_param!(attr_name, resource_params)