fix(openfeature): handle JSONObject/JSONArray in objectToValue#65
Merged
fix(openfeature): handle JSONObject/JSONArray in objectToValue#65
Conversation
Object variant values arrive from RemoteFlagsProvider and the local evaluator as org.json.JSONObject / JSONArray (the core SDK's public SelectedVariant<T> shape). The OpenFeature provider's objectToValue had no branches for these types, so they fell through to new Value(toString()) and surfaced as a plain String Value instead of a Structure. Callers of getObjectEvaluation got a non-null Value whose asStructure() was null, breaking spec-compliant OpenFeature usage. This adds JSONObject, JSONArray, and JSONObject.NULL handling in objectToValue. Purely additive: no core SDK changes, no signature changes, no impact on direct SelectedVariant consumers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tylerjroach
approved these changes
Apr 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Response by The Claudefather:
Summary
RemoteFlagsProviderstores object variant values asorg.json.JSONObjectinsideSelectedVariant. That shape is public API and we don't want to change it (existing users may depend on it).objectToValuetranslator had branches forMap,List,Object[], primitives, andString— but noJSONObject/JSONArraybranches. JSON objects fell through tonew Value(obj.toString()), producing a String Value instead of aStructureValue.client.getObjectDetails(...)on an object flag returned a plain-string Value;value.asStructure()was null, breaking spec-compliant OpenFeature usage.Fix
Add
JSONObject/JSONArray/JSONObject.NULLhandling inMixpanelProvider.objectToValue. Purely additive — no core SDK changes, no signature changes.🤖 Generated with Claude Code