code: private function validateItem(SaleItemInterface $item)
      {
          foreach ($item->getChildren() as $child) {
              $this->validateItem($child);
          }
  
          if ($item->isCompound()) {
              return;
          }
  
          if (null === $subject = $this->subjectHelper->resolve($item, false)) {
              return;
          }
  
          if (!$subject instanceof StockSubjectInterface) {
              return;
          }
  
          $quantity = $item->getTotalQuantity();
          $availability = $this->availabilityHelper->getAvailability($subject, is_null($item->getParent()));
  
          if ($quantity < $availability->getMinimumQuantity()) {
              $message = $availability->getMinimumMessage();
          } elseif ($quantity > $availability->getMaximumQuantity()) {
              $message = $availability->getMaximumMessage();
          } else {
              return;
          }
  
          if (null !== $item->getParent()) {
              $message = $item->getDesignation() . ' : ' . $message;
          }
  
          throw new ValidationFailedException($message);
      }
docs: Validates the sale item recursively.
  
  @param SaleItemInterface $item
  
  @throws ValidationFailedException