Skip to content

Commit

Permalink
Revert removing SegmentKey alias
Browse files Browse the repository at this point in the history
  • Loading branch information
uniumuniu committed Jan 14, 2024
1 parent c576116 commit c890002
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/kotlin/com/featurevisor/sdk/DatafileReader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.featurevisor.types.DatafileContent
import com.featurevisor.types.Feature
import com.featurevisor.types.FeatureKey
import com.featurevisor.types.Segment
import com.featurevisor.types.SegmentKey

class DatafileReader constructor(
datafileJson: DatafileContent,
Expand Down Expand Up @@ -33,7 +34,7 @@ class DatafileReader constructor(
return attributes.find { attribute -> attribute.key == attributeKey }
}

fun getSegment(segmentKey: String): Segment? {
fun getSegment(segmentKey: SegmentKey): Segment? {
return segments.find { segment -> segment.key == segmentKey }
}

Expand Down
8 changes: 5 additions & 3 deletions src/main/kotlin/com/featurevisor/types/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ data class SegmentAssertion(
)

data class TestSegment(
val key: String,
val key: SegmentKey,
val assertions: List<SegmentAssertion>,
)

Expand Down Expand Up @@ -238,10 +238,12 @@ sealed class ConditionValue {
data class DateTimeValue(val value: LocalDate) : ConditionValue()
}

typealias SegmentKey = String

@Serializable
data class Segment(
val archived: Boolean? = null,
val key: String,
val key: SegmentKey,
val conditions: Condition,
)

Expand All @@ -259,7 +261,7 @@ data class NotGroupSegment(

@Serializable(with = GroupSegmentSerializer::class)
sealed class GroupSegment {
data class Plain(val segment: String) : GroupSegment()
data class Plain(val segment: SegmentKey) : GroupSegment()
data class Multiple(val segments: List<GroupSegment>) : GroupSegment()
data class And(val segment: AndGroupSegment) : GroupSegment()
data class Or(val segment: OrGroupSegment) : GroupSegment()
Expand Down

0 comments on commit c890002

Please sign in to comment.