statsig-io / java-server-sdk

An SDK for Java or Kotlin intended for multi-user/server environments
ISC License
7 stars 3 forks source link

feat: add option for get gate with default value #22

Closed liran2000 closed 3 months ago

liran2000 commented 4 months ago

* similar to GO sdk issue

Background In continue of OpenFeature PR, it is a common practice to evaluate a boolean/gate with a default value:

client.getBooleanValue("non-existing", true)

Problem

BooleanEvaluation with default value true cannot fallback to true. On scenarios such as get gate of non-existing gate, statsig returns false without indication of whether it was successful get gate or some error reason. Therefore, the evaluation will be evaluated to false in this case.

Suggested solution

add:

Statsig.checkGateAsync(user, key, boolean fallback);

@xinlili-statsig

weihao-statsig commented 3 months ago

We've added a new API(which will return the evaluation details regarding a gate) for this. Please take a look. https://github.com/statsig-io/java-server-sdk/releases/tag/v1.14.0

liran2000 commented 3 months ago

We've added a new API(which will return the evaluation details regarding a gate) for this. Please take a look. https://github.com/statsig-io/java-server-sdk/releases/tag/v1.14.0

Thanks. The request of fallback was not added exactly as requested, so managed to overcome it via specific reasons check.