Repository navigation
fix: Send trait values with their JSON types - #90
Merged
Merged
Conversation
Contributor
Author
|
@themis-blindfold review |
Contributor
Author
|
@themis-blindfold review |
⚖️ Themis review: ✅ Ship itTrait values now retain their JSON primitive types on identity POSTs, fixing typed segment comparisons without changing the public SDK API. Serializer-level and request-body coverage exercise strings, integers, doubles, and booleans; the completed build and unit-test checks passed.
📝 Walkthrough
🧪 How to verify
Product take: Solid compatibility fix for applications using numeric or boolean trait targeting. It restores expected segment behaviour without expanding the SDK surface. 🧭 Assumptions & unverified claimsNo unverified assumptions or claims. Typed traits can finally stop cosplaying as strings · reviewed at 57a1eb1 |
khvn26
approved these changes
Oct 21, 2026
talissoncosta
approved these changes
Oct 21, 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.
Trait values are sent to Flagsmith as strings:
TraitSerializerwritestrait_valueastraitValue.toString(). SoTrait("age", 30)andTrait("verified", true)are stored as"30"and"true", which breaks segment rules that compare numbers or booleans.This is a regression of #43 ("allow non string trait types"), introduced by #63 when the custom serializer was added to exclude
transient.TraitSerializernow serialises the value as-is, so strings, integers, doubles and booleans keep their JSON type, matching the other Flagsmith SDKs.Behaviour change: traits set from this SDK will be persisted with their types instead of as strings. This is a fix (patch release); the public API is unchanged.
Known limit:
nulltrait values (which Flagsmith treats as deleting the trait) are still not supported.Trait.traitValueis non-null, and the SDK's Gson drops nulls, so supporting them would need a public API change. That's left for a separate PR.Found by the Flagsmith SDK behavioural spec (#89).