Conversation
toSimpleValue fell back to JSONObject.GetString for any non-string value, which only handles string/bool/float/int/uint. *big.Int, *fftypes.FFBigInt and json.Number hit its default case, logged an error and returned "", so the filter was silently built with an empty value (dropped entirely from the serialized JSON due to omitempty). Handle these types explicitly, rendering their full decimal string. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Enrique Lacal <enrique.lacal@kaleido.io>
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.
Problem
toSimpleValueinpkg/ffapi/restfilter_json_builder.goconverts every non-stringvalue viafftypes.JSONObject{"v": v}.GetString("v").GetStringOkonly understandsstring,bool, floats and the built-in int/uint types, so*big.Int,*fftypes.FFBigIntandjson.Numberfall through to itsdefaultcase, which logsInvalid string value '…' for key 'v'and returns"".The result is that
Equal,NotEqual,GreaterThan, …,InandNotInsilently build a filter with an empty value. Becausevalueisomitempty, the serialized query is{"eq":[{"field":"amount"}]}, so a remote API receives a filter with no value at all. This happens even for small values (big.NewInt(42)), so the problem is the type, not the size.Fix
Handle
json.Number,*big.Intand*fftypes.FFBigIntexplicitly intoSimpleValue, rendering the full decimal string. Nil pointers map to""(unchanged behaviour). Everything else still goes through the existingGetStringfallback.Tests
TestQueryBuilderValueTypescovers single-value ops, multi-value ops and the serialized JSON forstring/int/uint64/bool(controls) plus*big.Int(small and uint256 max),*fftypes.FFBigIntandjson.Number. Before this change, the four big-number cases failed withactual: "". They now pass.🤖 Generated with Claude Code