-
Notifications
You must be signed in to change notification settings - Fork 28
feat: Added new getFeatureVariableJson and getAllFeatureVariables Apis #251
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
Conversation
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.
Looks good.
variable.delete('subType') | ||
end | ||
end | ||
end |
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.
Rather than putting the same manipulation code here. Can you directly access the two new variables that you have added and modify their type. Just a matter of preference, you may keep it this way.
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 have also noticed that, not sure why it has to be done in both places
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.
@oakbani @pawels-optimizely i changed it to only alter the ones that need to be altered.
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.
are there tests for get_feature_variable_json with notification or I missed it ?
get_all_feature_variables tests look good.
@pawels-optimizely added notification listener tests for get_feature_variable_json |
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.
Can we add a all variables source FEATURE_TEST? I think that would expose a scope problem on your source_info. I am just looking at the PR and haven't loaded into an IDE so correct me if I'm wrong on the source_info scope. But, I still think we should add the test.
|
||
source_string = Optimizely::DecisionService::DECISION_SOURCES['ROLLOUT'] | ||
if decision && decision['source'] == Optimizely::DecisionService::DECISION_SOURCES['FEATURE_TEST'] | ||
source_info = { |
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.
isn't this out of scope?
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.
No. It was decided to add a notification for all-feature-variables later. This is bein added in all the sdks now
feature_flag['variables'].each do |variable| | ||
if variable['type'] == 'string' && variable['subType'] == 'json' | ||
variable['type'] = 'json' | ||
variable.delete('subType') |
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 realize why. I just :(
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.
Yeah i agree. it looks ugly.
'feature', 'test_user', {'browser_type' => 'firefox'}, | ||
feature_enabled: false, | ||
feature_key: 'json_single_variable_feature', | ||
source: 'rollout', |
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.
can you add a feature_test test. so, that you also show the proper values in source_info?
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.
added source info to one of the tests
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.
lgtm
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.
For the source_info, I was more asking why you didn't just do:
source_info = {}
and then set it if the it is a feature test and eliminate source_info || {}
LGTM
Summary
Added new getFeatureVariableJson and getAllFeatureVariables Apis
Test plan
Added Unit tests