@@ -61,11 +61,6 @@ std::vector<Response> ParentResource::BodyValidate(const std::string &cube_name,
6161 for (auto &child : children_) {
6262 const auto &child_name = child->Name ();
6363
64- // TODO: what are the implications of it?
65- if (child->IsKey ()) {
66- continue ;
67- }
68-
6964 // Choices are a special case
7065 if (std::dynamic_pointer_cast<ChoiceResource>(child) != nullptr ) {
7166 choices.push_back (child);
@@ -86,9 +81,18 @@ std::vector<Response> ParentResource::BodyValidate(const std::string &cube_name,
8681 errors.push_back (
8782 {ErrorTag::kInvalidValue , ::strdup (child_name.data ())});
8883 } else {
89- auto child_errors = child->BodyValidate (
90- cube_name, keys, body_copy[child_name], initialization);
84+ std::vector<Response> child_errors;
85+ // if the child is a list, perform the check over all elements
86+ if (auto list = std::dynamic_pointer_cast<ListResource>(child)) {
87+ child_errors = list->BodyValidateMultiple (
88+ cube_name, keys, body_copy[child_name], initialization);
89+ } else {
90+ child_errors = child->BodyValidate (
91+ cube_name, keys, body_copy[child_name], initialization);
92+ }
93+
9194 errors.reserve (errors.size () + child_errors.size ());
95+
9296 // remove current parsed element from the body so that in the
9397 // eventuality of choices, they will operate only on unparsed
9498 // elements. moreover, this is required for detecting unparsed
0 commit comments