Skip to content

Commit

Permalink
fix(specs): consequence is required when saving rules (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#4146

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
  • Loading branch information
algolia-bot and shortcuts committed Nov 26, 2024
1 parent 1183f87 commit 794f152
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Api/SearchClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2041,7 +2041,7 @@ public function saveObject($indexName, $body, $requestOptions = [])
* @param array $rule rule (required)
* - $rule['objectID'] => (string) Unique identifier of a rule object. (required)
* - $rule['conditions'] => (array) Conditions that trigger a rule. Some consequences require specific conditions or don't require any condition. For more information, see [Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions).
* - $rule['consequence'] => (array)
* - $rule['consequence'] => (array) (required)
* - $rule['description'] => (string) Description of the rule's purpose to help you distinguish between different rules.
* - $rule['enabled'] => (bool) Whether the rule is active.
* - $rule['validity'] => (array) Time periods when the rule is active.
Expand Down
7 changes: 5 additions & 2 deletions lib/Model/Search/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ public function listInvalidProperties()
if (!isset($this->container['objectID']) || null === $this->container['objectID']) {
$invalidProperties[] = "'objectID' can't be null";
}
if (!isset($this->container['consequence']) || null === $this->container['consequence']) {
$invalidProperties[] = "'consequence' can't be null";
}

return $invalidProperties;
}
Expand Down Expand Up @@ -250,7 +253,7 @@ public function setConditions($conditions)
/**
* Gets consequence.
*
* @return null|Consequence
* @return Consequence
*/
public function getConsequence()
{
Expand All @@ -260,7 +263,7 @@ public function getConsequence()
/**
* Sets consequence.
*
* @param null|Consequence $consequence consequence
* @param Consequence $consequence consequence
*
* @return self
*/
Expand Down

0 comments on commit 794f152

Please sign in to comment.