Skip to content

feat: add getFeatureVariableJSON and getAllFeatureVariables apis #375

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

Merged
merged 28 commits into from
May 7, 2020

Conversation

jaeopt
Copy link
Contributor

@jaeopt jaeopt commented May 4, 2020

Summary

  • add new APIs (getFeatureVariableJSON, getAllFeatureVariables)
  • add new notification type (all-feature-variables)

Copy link

@pawels-optimizely pawels-optimizely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, 2 small comments

@@ -671,6 +711,10 @@ public String getFeatureVariableString(@Nonnull String featureKey,
}

Object convertedValue = convertStringToType(variableValue, variableType);
Object notificationValue = convertedValue;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be done in convertStringToType() like the others ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need notification map type different from the return OptimizelyJSON type.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the comment, convertStringToType() is used only for notification listener. You already have a case there for json type, can you return a map there ?

Map<String, Object> valuesMap = new HashMap<String, Object>();
for (FeatureVariable variable : featureFlag.getVariables()) {
String value = variable.getDefaultValue();
if (featureEnabled && variation != null) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we need to check for null variation here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. A good catch.

@jaeopt jaeopt changed the base branch from jae/optimizely-json to master May 5, 2020 20:43
@coveralls
Copy link

coveralls commented May 5, 2020

Pull Request Test Coverage Report for Build 1394

  • 68 of 70 (97.14%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 89.437%

Changes Missing Coverage Covered Lines Changed/Added Lines %
core-api/src/main/java/com/optimizely/ab/Optimizely.java 52 54 96.3%
Totals Coverage Status
Change from base Build 1390: 0.2%
Covered Lines: 3937
Relevant Lines: 4402

💛 - Coveralls

Copy link
Contributor

@mikecdavis mikecdavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple nits on the imports.

Comment on lines 19 to 22
import com.google.gson.JsonElement;
import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
import com.google.gson.stream.JsonWriter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were these imports added?

@@ -18,6 +18,7 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import?

@jaeopt jaeopt closed this May 7, 2020
@jaeopt jaeopt reopened this May 7, 2020
@jaeopt jaeopt merged commit 4c6a834 into master May 7, 2020
@jaeopt jaeopt deleted the jae/json-api branch May 7, 2020 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants