@@ -337,7 +337,7 @@ def define_requires_none
337337
338338 get '/required' , items : [ { key : 'hash in array' } ]
339339 expect ( last_response . status ) . to eq ( 400 )
340- expect ( last_response . body ) . to eq ( 'items is invalid, items[key] does not have a valid value' )
340+ expect ( last_response . body ) . to eq ( 'items is invalid, items[0][ key] does not have a valid value' )
341341 end
342342
343343 it 'works when all params match' do
@@ -492,7 +492,7 @@ def validate_param!(attr_name, params)
492492 # NOTE: with body parameters in json or XML or similar this
493493 # should actually fail with: children[parents][name] is missing.
494494 expect ( last_response . status ) . to eq ( 400 )
495- expect ( last_response . body ) . to eq ( 'children[parents] is missing' )
495+ expect ( last_response . body ) . to eq ( 'children[0][ parents] is missing' )
496496 end
497497
498498 it 'safely handles empty arrays and blank parameters' do
@@ -503,7 +503,7 @@ def validate_param!(attr_name, params)
503503 expect ( last_response . body ) . to eq ( 'children is missing' )
504504 get '/within_array' , children : [ name : 'Jay' ]
505505 expect ( last_response . status ) . to eq ( 400 )
506- expect ( last_response . body ) . to eq ( 'children[parents] is missing' )
506+ expect ( last_response . body ) . to eq ( 'children[0][ parents] is missing' )
507507 end
508508
509509 it 'errors when param is not an Array' do
@@ -518,7 +518,7 @@ def validate_param!(attr_name, params)
518518
519519 get '/within_array' , children : [ name : 'Jay' , parents : { name : 'Fred' } ]
520520 expect ( last_response . status ) . to eq ( 400 )
521- expect ( last_response . body ) . to eq ( 'children[parents] is invalid' )
521+ expect ( last_response . body ) . to eq ( 'children[0][ parents] is invalid' )
522522 end
523523 end
524524
@@ -644,15 +644,15 @@ def validate_param!(attr_name, params)
644644 { name : 'Job' , parents : [ { name : 'Joy' } ] }
645645 ]
646646 expect ( last_response . status ) . to eq ( 400 )
647- expect ( last_response . body ) . to eq ( 'children[parents][name] is missing' )
647+ expect ( last_response . body ) . to eq ( 'children[0][ parents][0 ][name] is missing' )
648648 end
649649
650650 it 'safely handles empty arrays and blank parameters' do
651651 put_with_json '/within_array' , children : [ ]
652652 expect ( last_response . status ) . to eq ( 200 )
653653 put_with_json '/within_array' , children : [ name : 'Jay' ]
654654 expect ( last_response . status ) . to eq ( 400 )
655- expect ( last_response . body ) . to eq ( 'children[parents] is missing' )
655+ expect ( last_response . body ) . to eq ( 'children[0][ parents] is missing' )
656656 end
657657 end
658658
@@ -683,7 +683,7 @@ def validate_param!(attr_name, params)
683683 it 'errors when group is present, but required param is not' do
684684 get '/optional_group' , items : [ { not_key : 'foo' } ]
685685 expect ( last_response . status ) . to eq ( 400 )
686- expect ( last_response . body ) . to eq ( 'items[key] is missing' )
686+ expect ( last_response . body ) . to eq ( 'items[0][ key] is missing' )
687687 end
688688
689689 it "errors when param is present but isn't an Array" do
@@ -727,7 +727,7 @@ def validate_param!(attr_name, params)
727727 it 'does internal validations if the outer group is present' do
728728 get '/nested_optional_group' , items : [ { key : 'foo' } ]
729729 expect ( last_response . status ) . to eq ( 400 )
730- expect ( last_response . body ) . to eq ( 'items[required_subitems] is missing' )
730+ expect ( last_response . body ) . to eq ( 'items[0][ required_subitems] is missing' )
731731
732732 get '/nested_optional_group' , items : [ { key : 'foo' , required_subitems : [ { value : 'bar' } ] } ]
733733 expect ( last_response . status ) . to eq ( 200 )
@@ -737,7 +737,7 @@ def validate_param!(attr_name, params)
737737 it 'handles deep nesting' do
738738 get '/nested_optional_group' , items : [ { key : 'foo' , required_subitems : [ { value : 'bar' } ] , optional_subitems : [ { not_value : 'baz' } ] } ]
739739 expect ( last_response . status ) . to eq ( 400 )
740- expect ( last_response . body ) . to eq ( 'items[optional_subitems][value] is missing' )
740+ expect ( last_response . body ) . to eq ( 'items[0][ optional_subitems][0 ][value] is missing' )
741741
742742 get '/nested_optional_group' , items : [ { key : 'foo' , required_subitems : [ { value : 'bar' } ] , optional_subitems : [ { value : 'baz' } ] } ]
743743 expect ( last_response . status ) . to eq ( 200 )
@@ -747,15 +747,15 @@ def validate_param!(attr_name, params)
747747 it 'handles validation within arrays' do
748748 get '/nested_optional_group' , items : [ { key : 'foo' } ]
749749 expect ( last_response . status ) . to eq ( 400 )
750- expect ( last_response . body ) . to eq ( 'items[required_subitems] is missing' )
750+ expect ( last_response . body ) . to eq ( 'items[0][ required_subitems] is missing' )
751751
752752 get '/nested_optional_group' , items : [ { key : 'foo' , required_subitems : [ { value : 'bar' } ] } ]
753753 expect ( last_response . status ) . to eq ( 200 )
754754 expect ( last_response . body ) . to eq ( 'nested optional group works' )
755755
756756 get '/nested_optional_group' , items : [ { key : 'foo' , required_subitems : [ { value : 'bar' } ] , optional_subitems : [ { not_value : 'baz' } ] } ]
757757 expect ( last_response . status ) . to eq ( 400 )
758- expect ( last_response . body ) . to eq ( 'items[optional_subitems][value] is missing' )
758+ expect ( last_response . body ) . to eq ( 'items[0][ optional_subitems][0 ][value] is missing' )
759759 end
760760
761761 it 'adds to declared parameters' do
0 commit comments