Skip to content

fix(openfeature): handle JSONObject/JSONArray in objectToValue#65

Merged
msiebert merged 1 commit intomasterfrom
msiebert-openfeature-object-flags
Apr 20, 2026
Merged

fix(openfeature): handle JSONObject/JSONArray in objectToValue#65
msiebert merged 1 commit intomasterfrom
msiebert-openfeature-object-flags

Conversation

@msiebert
Copy link
Copy Markdown
Contributor

Response by The Claudefather:

Summary

  • The core flags SDK's RemoteFlagsProvider stores object variant values as org.json.JSONObject inside SelectedVariant. That shape is public API and we don't want to change it (existing users may depend on it).
  • The OpenFeature provider's objectToValue translator had branches for Map, List, Object[], primitives, and String — but no JSONObject/JSONArray branches. JSON objects fell through to new Value(obj.toString()), producing a String Value instead of a Structure Value.
  • Result: 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.NULL handling in MixpanelProvider.objectToValue. Purely additive — no core SDK changes, no signature changes.

🤖 Generated with Claude Code

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>
@msiebert msiebert requested review from a team and ketanmixpanel April 20, 2026 16:58
@msiebert msiebert self-assigned this Apr 20, 2026
@msiebert msiebert requested a review from tylerjroach April 20, 2026 19:29
@msiebert msiebert merged commit bb6e3b7 into master Apr 20, 2026
11 checks passed
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.

2 participants