Repository navigation
Conversation
6 of 8 tasks
With ?fields=, PartialResponseFilter builds the pruned response with objectMapper.valueToTree(entity). Jackson strips the trailing zeros of each BigDecimal while it builds the tree (JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES), so 500.000000 was written as 5E+2 and 1000 as 1E+3, while the unfiltered response writes them as they are. The filter now uses its own copy of the ObjectMapper with that feature disabled. Responses without fields= never reach this code, and the shared mapper is unchanged. PartialResponseFilterTest asserts the exact pruned text for BigDecimals at different scales and depths, next to Long, Integer and Double values.
Aana123
force-pushed
the
FINERACT-3392-partial-response-bigdecimal
branch
from
December 5, 2026 08:16
bc3881a to
6e4def7
Compare
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.
Fixes FINERACT-3392.
With
?fields=, every endpoint using@PartialResponseParameters(FINERACT-3188) wroteBigDecimalvalues in scientific notation:GET /groups/1/accountsreturns"originalLoan":5000.000000, but?fields=loanAccountsreturned"originalLoan":5E+3.PartialResponseFilterbuilds the pruned response withobjectMapper.valueToTree(entity), and by default Jackson strips the trailing zeros of eachBigDecimalwhen it builds a tree (JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES).The filter now uses its own copy of the
ObjectMapperwith that feature disabled:fields=return before any tree is built, so they can't change.Long,IntegerandDoublevalues are not affected (covered by the new test).Affected endpoints are listed in the ticket (group/center accounts, GLIM/GSIM accounts, office transactions, loan collaterals, centers). None of them is in a release yet. #7186 (the loan reassignment template) uses the same filter and benefits as well.
Testing
PartialResponseFilterTest: two new tests, both failing before the fix.aPrunedResponseKeepsTheScaleOfItsBigDecimalsAtEveryDepthasserts the exact pruned text forBigDecimals at scale 6 and 0, top-level, nested and in a list, next toLong,IntegerandDouble.aResponseWithNothingToPruneIsWrittenAsTheUnfilteredOnerequires a filtered response that prunes nothing to be identical to the unfiltered one.SecurityApiGsonEquivalenceTest,ClientDataJsonFormatTest,JacksonWireFormatCharacterizationTest, spotless and checkstyle pass./groups/1/accounts?fields=loanAccountsnow returns"originalLoan":5000.000000, byte-identical to the unfilteredloanAccounts;fields=bogusstill returns 400.Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.