Closed miquelalvarado closed 7 months ago
Hi @miquelalvarado thanks for your feedback. We will get back to you soon.
Hi @miquelalvarado we would request you to use our decide api which is available in our latest release.
public func decide(key: String, options: [OptimizelyDecideOption]? = nil) -> OptimizelyDecision
This will return an object to you with appropriate reasons if the flag key is invalid.
Hi @miquelalvarado I am going to close the issue. If you have any concerns, then please feel free to contact us.
Description
Right now we have not an easy way to know if a feature flag key is invalid (not present in the datafile). In the case of the
activate
method signature we can see that it can throw and one of its possible exceptions isexperimentKeyInvalid
which serves exactly to that purpose but for experiments. My suggestion is to provide with the very same functionality but for feature flags.Right now we can workaround it by doing
optimizelyClient.getOptimizelyConfig().featuresMap[feature.rawValue]
but it can be VERY slow asgetOptimizelyConfig
parses all the information each time is called.I could do a PR if you want.
Benefits
Would be a fast way for clients to provide with default values for feature flags even when those are not yet created in optimizely.
Detail
No response
Examples
No response
Risks/Downsides
The only downside is that by doing it throwable we will force any client integrating the sdk to modify their current implementation to handle any possible exception but on the other hand we would normalize both experiments and feature flags APIs.