@@ -14,7 +14,7 @@ public struct Rule: Codable, JSONEncodable {
14
14
/// For more information, see
15
15
/// [Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions).
16
16
public var conditions : [ SearchCondition ] ?
17
- public var consequence : SearchConsequence ?
17
+ public var consequence : SearchConsequence
18
18
/// Description of the rule's purpose to help you distinguish between different rules.
19
19
public var description : String ?
20
20
/// Whether the rule is active.
@@ -25,7 +25,7 @@ public struct Rule: Codable, JSONEncodable {
25
25
public init (
26
26
objectID: String ,
27
27
conditions: [ SearchCondition ] ? = nil ,
28
- consequence: SearchConsequence ? = nil ,
28
+ consequence: SearchConsequence ,
29
29
description: String ? = nil ,
30
30
enabled: Bool ? = nil ,
31
31
validity: [ SearchTimeRange ] ? = nil
@@ -53,7 +53,7 @@ public struct Rule: Codable, JSONEncodable {
53
53
var container = encoder. container ( keyedBy: CodingKeys . self)
54
54
try container. encode ( self . objectID, forKey: . objectID)
55
55
try container. encodeIfPresent ( self . conditions, forKey: . conditions)
56
- try container. encodeIfPresent ( self . consequence, forKey: . consequence)
56
+ try container. encode ( self . consequence, forKey: . consequence)
57
57
try container. encodeIfPresent ( self . description, forKey: . description)
58
58
try container. encodeIfPresent ( self . enabled, forKey: . enabled)
59
59
try container. encodeIfPresent ( self . validity, forKey: . validity)
@@ -75,7 +75,7 @@ extension Rule: Hashable {
75
75
public func hash( into hasher: inout Hasher ) {
76
76
hasher. combine ( self . objectID. hashValue)
77
77
hasher. combine ( self . conditions? . hashValue)
78
- hasher. combine ( self . consequence? . hashValue)
78
+ hasher. combine ( self . consequence. hashValue)
79
79
hasher. combine ( self . description? . hashValue)
80
80
hasher. combine ( self . enabled? . hashValue)
81
81
hasher. combine ( self . validity? . hashValue)
0 commit comments