@@ -32,15 +32,32 @@ struct Holdout: Codable, ExperimentCore {
32
32
var trafficAllocation : [ TrafficAllocation ]
33
33
var audienceIds : [ String ]
34
34
var audienceConditions : ConditionHolder ?
35
- var includedFlags : [ String ] ?
36
- var excludedFlags : [ String ] ?
35
+ var includedFlags : [ String ]
36
+ var excludedFlags : [ String ]
37
37
38
38
enum CodingKeys : String , CodingKey {
39
39
case id, key, status, layerId, variations, trafficAllocation, audienceIds, audienceConditions, includedFlags, excludedFlags
40
40
}
41
41
42
42
// replace with serialized string representation with audience names when ProjectConfig is ready
43
43
var audiences : String = " "
44
+
45
+
46
+ init ( from decoder: Decoder ) throws {
47
+ let container = try decoder. container ( keyedBy: CodingKeys . self)
48
+
49
+ id = try container. decode ( String . self, forKey: . id)
50
+ key = try container. decode ( String . self, forKey: . key)
51
+ status = try container. decode ( Status . self, forKey: . status)
52
+ layerId = try container. decode ( String . self, forKey: . layerId)
53
+ variations = try container. decode ( [ Variation ] . self, forKey: . variations)
54
+ trafficAllocation = try container. decode ( [ TrafficAllocation ] . self, forKey: . trafficAllocation)
55
+ audienceIds = try container. decode ( [ String ] . self, forKey: . audienceIds)
56
+ audienceConditions = try container. decodeIfPresent ( ConditionHolder . self, forKey: . audienceConditions)
57
+
58
+ includedFlags = try container. decodeIfPresent ( [ String ] . self, forKey: . includedFlags) ?? [ ]
59
+ excludedFlags = try container. decodeIfPresent ( [ String ] . self, forKey: . excludedFlags) ?? [ ]
60
+ }
44
61
}
45
62
46
63
extension Holdout : Equatable {
0 commit comments