Repository navigation
Commit e14fc46
Report a nested Array scope that got no Array under its own name only
An Array scope inside an Array scope is read from each element of the
outer Array. When an element left that param out, or held something
other than an Array there, such as `0`, AttributesIterator yielded the
value as an element of the inner Array. The inner scope's validators
then reported a second error, named with the outer element's index for
the inner Array and a stale index for the outer one:
requires :points, type: Array do
requires :location, type: Array do
requires :id, type: Integer
end
end
{"points": [{"location": [{"id": 1}]},
{"location": [{"id": 1}, {"id": 2}]},
{"location": 0}]}
Before: points[2][location] is invalid,
points[1][location][2][id] is missing,
points[1][location][2][id] is invalid
After: points[2][location] is invalid
The iterator now passes over such a value, as #each already does at
the top for an Array scope that did not get an Array. The scope's own
validators still report it, so these requests answer 400 as before,
with the errors the same scope gives at the root. Five specs had pinned
the extra error and are updated.
Fixes #1998.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 19e5dad commit e14fc46
2 files changed
Lines changed: 43 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
85 | 92 | | |
86 | 93 | | |
87 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
297 | 326 | | |
298 | 327 | | |
299 | 328 | | |
| |||
755 | 784 | | |
756 | 785 | | |
757 | 786 | | |
758 | | - | |
| 787 | + | |
759 | 788 | | |
760 | 789 | | |
761 | 790 | | |
| |||
786 | 815 | | |
787 | 816 | | |
788 | 817 | | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
| 818 | + | |
796 | 819 | | |
797 | 820 | | |
798 | 821 | | |
799 | | - | |
| 822 | + | |
800 | 823 | | |
801 | 824 | | |
802 | 825 | | |
| |||
944 | 967 | | |
945 | 968 | | |
946 | 969 | | |
947 | | - | |
| 970 | + | |
948 | 971 | | |
949 | 972 | | |
950 | 973 | | |
| |||
1085 | 1108 | | |
1086 | 1109 | | |
1087 | 1110 | | |
1088 | | - | |
| 1111 | + | |
1089 | 1112 | | |
1090 | 1113 | | |
1091 | 1114 | | |
| |||
1105 | 1128 | | |
1106 | 1129 | | |
1107 | 1130 | | |
1108 | | - | |
| 1131 | + | |
1109 | 1132 | | |
1110 | 1133 | | |
1111 | 1134 | | |
| |||
0 commit comments