File tree 2 files changed +2
-3
lines changed
lib/grape/validations/validators
spec/grape/validations/validators
2 files changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -39,13 +39,12 @@ def validate(request)
39
39
def validate! ( params )
40
40
attributes = AttributesIterator . new ( self , @scope , params )
41
41
array_errors = [ ]
42
- attributes . each do |resource_params , attr_name , inside_array |
42
+ attributes . each do |resource_params , attr_name |
43
43
next unless @required || ( resource_params . respond_to? ( :key? ) && resource_params . key? ( attr_name ) )
44
44
45
45
begin
46
46
validate_param! ( attr_name , resource_params )
47
47
rescue Grape ::Exceptions ::Validation => e
48
- raise e unless inside_array
49
48
# we collect errors inside array because
50
49
# there may be more than one error per field
51
50
array_errors << e
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ def app
145
145
it 'validates name, company' do
146
146
get '/'
147
147
expect ( last_response . status ) . to eq ( 400 )
148
- expect ( last_response . body ) . to eq ( '{"error":"name is missing"}' )
148
+ expect ( last_response . body ) . to eq ( '{"error":"name is missing, company is missing "}' )
149
149
150
150
get '/' , name : 'Bob'
151
151
expect ( last_response . status ) . to eq ( 400 )
You can’t perform that action at this time.
0 commit comments