code: public function validate()
      {
          $this->required('Bucket');
  
          $count_remove = count($this->remove);
          $count_registers = count($this->registers);
          $count_flags = count($this->flags);
          $count_counters = count($this->counters);
          $count_sets = count($this->sets);
          $count_maps = count($this->maps);
  
          if ($count_remove + $count_registers + $count_flags + $count_counters + $count_sets + $count_maps < 1) {
              throw new Exception('At least one add, remove, or update operation needs to be defined.');
          }
  
          if ($count_remove) {
              $this->required('Location');
              $this->required('Context');
          }
  
          // if we are performing a remove on a nested set, Location and context are required
          if ($count_sets) {
              foreach ($this->sets as $set) {
                  if (count($set->getRemoveAll())) {
                      $this->required('Location');
                      $this->required('Context');
                      break;
                  }
              }
          }
  
  
          // if we are performing a remove, Location and context are required
          if ($count_remove) {
              $this->required('Location');
              $this->required('Context');
          }
      }
docs: {@inheritdoc}