Skip to content

Commit 60ba00e

Browse files
committed
Make most Feature fields optional
1 parent 3cafee5 commit 60ba00e

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

FlagsmithClient/src/main/java/com/flagsmith/entities/Flag.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ data class Flag(
99
)
1010

1111
data class Feature(
12-
val id: Long,
1312
val name: String,
14-
@SerializedName(value = "created_date") val createdDate: String,
15-
val description: String,
16-
@SerializedName(value = "initial_value") val initialValue: String,
17-
@SerializedName(value = "default_enabled") val defaultEnabled: Boolean,
18-
val type: String
13+
val id: Long = 0L,
14+
@SerializedName(value = "created_date") val createdDate: String = "",
15+
val description: String = "",
16+
@SerializedName(value = "initial_value") val initialValue: String = "",
17+
@SerializedName(value = "default_enabled") val defaultEnabled: Boolean = false,
18+
val type: String = ""
1919
)

FlagsmithClient/src/test/java/com/flagsmith/FeatureFlagCachingTests.kt

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,14 @@ class FeatureFlagCachingTests {
5151
setupMocks()
5252
val defaultFlags = listOf(
5353
Flag(
54-
feature = Feature(
55-
id = 345345L,
56-
name = "Flag 1",
57-
createdDate = "2023‐07‐07T09:07:16Z",
58-
description = "Flag 1 description",
59-
type = "CONFIG",
60-
defaultEnabled = true,
61-
initialValue = "true"
62-
), enabled = true, featureStateValue = "Vanilla Ice"
54+
feature = Feature(name = "Flag 1"),
55+
enabled = true,
56+
featureStateValue = "Vanilla Ice"
6357
),
6458
Flag(
65-
feature = Feature(
66-
id = 34345L,
67-
name = "Flag 2",
68-
createdDate = "2023‐07‐07T09:07:16Z",
69-
description = "Flag 2 description",
70-
type = "CONFIG",
71-
defaultEnabled = true,
72-
initialValue = "true"
73-
), enabled = true, featureStateValue = "value2"
59+
feature = Feature(name = "Flag 2"),
60+
enabled = true,
61+
featureStateValue = "value2"
7462
),
7563
)
7664

@@ -380,4 +368,4 @@ class FeatureFlagCachingTests {
380368
await untilTrue(hasFinishedGetRequest)
381369
Assert.assertNull("Shouldn't get any data back as we don't have a cache", foundFromCache)
382370
}
383-
}
371+
}

0 commit comments

Comments
 (0)