-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: get variation details by variation type #90
Conversation
@cre8ivejp please help me to take a look on this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
I have made some comments, please check them out.
public let variationValue: T | ||
public let reason: Reason | ||
|
||
public enum Reason: String, Codable, Hashable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although it is similar to the ReasonType definition, it is not very desirable to have the same definition in multiple places, so I would like you to consider using it uniformly if possible. Or consider removing the definition if you don't need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is for internal use only. I maintain the same approach like before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep this. The Android SDK has something like this as well. @kakcy
case offVariation = "OFF_VARIATION" | ||
case prerequisite = "PREREQUISITE" | ||
|
||
public static func fromString(value: String) -> Reason { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to have a test for the fromString()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated in d170ebe
@@ -200,6 +238,7 @@ extension BKTClient { | |||
} | |||
} | |||
|
|||
@available(*, deprecated, message: "use stringEvaluationDetails<T> instead") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
@available(*, deprecated, message: "use stringEvaluationDetails<T> instead") | |
@available(*, deprecated, message: "use getVariationDetail<T> instead") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @kakcy ,
getVariationDetail
is for internal use only. It can not be accessed from outside.
But I will remote the <T>
from the stringEvaluationDetails<T>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it to
@available(*, deprecated, message: "use stringVariationDetails(featureId:, defaultValue:) instead")
Co-authored-by: kakcy <43775118+kakcy@users.noreply.github.com>
Co-authored-by: kakcy <43775118+kakcy@users.noreply.github.com>
Co-authored-by: kakcy <43775118+kakcy@users.noreply.github.com>
@kakcy thank you for reviewing. as they are a new requirement bucketeer-io/android-client-sdk#180 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your responses 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I'll merge next week.
9e2ecd9
to
d990311
Compare
hi @cre8ivejp , @kakcy Changes
|
Although this PR seems ready for review. However, I found some edge cases when finalizing the same changes in the Android PR. I will add some new tests to this PR. |
New changes
|
public struct BKTEvaluationDetails<T:Equatable>: Equatable { | ||
public let featureId: String | ||
public let featureVersion: Int | ||
public let userId: String | ||
public let variationId: String | ||
public let variationName: String | ||
public let variationValue: T | ||
public let reason: Reason | ||
|
||
public enum Reason: String, Codable, Hashable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@duyhungtnn, WDYT of adding the BKTEvaluationDetails
to a new file like you did in the Android SDK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good.
I updated 6e761ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Related bucketeer-io/bucketeer#886
Changes
BKTEvaluationDetail<T>
to support getting variation details by variation type.BKTValue
to reference a JSON node valueBKTEvaluation
& the methodsgetEvaluationDetails
,jsonVariation
will be deprecated after this PR.