Skip to content

jsontransformer: All numbers as numbers#1557

Merged
kingthorin merged 1 commit intodatafaker-net:mainfrom
kingthorin:issue-1556
May 20, 2025
Merged

jsontransformer: All numbers as numbers#1557
kingthorin merged 1 commit intodatafaker-net:mainfrom
kingthorin:issue-1556

Conversation

@kingthorin
Copy link
Copy Markdown
Collaborator

Fixes #1556

@what-the-diff
Copy link
Copy Markdown

what-the-diff bot commented May 20, 2025

PR Summary

  • Simplified the JSON Transformation process
    The modification in JsonTransformer.java simplifies the way in which numeric values are converted into strings while transforming them into a JSON format. The process no longer has to perform extra steps for specific number types like Double and BigDecimal, increasing the efficiency of the process.

  • Added Testing for JSON Transformation
    A new test class, JsonTransformerTest.java, has been added. Its goal is to ensure that the updated transformation logic works correctly for Double and BigDecimal numbers. This safeguards the accuracy and reliability of the transformation process, ensuring the output JSON is as expected.

@asolntsev
Copy link
Copy Markdown
Collaborator

@kingthorin Few tests are failing:

14:22:59.922 [ERROR] Failures: 
14:22:59.922 [ERROR]   JsonTest.outputArrayJsonTestForJsonTransformer:185 
expected: "[{"number": "123.123"},{"number": "123.123"}]"
 but was: "[{"number": 123.123},{"number": 123.123}]"
14:22:59.922 [ERROR]   JsonTest.outputWithoutCommaForJsonTransformer:195 
expected: "[{"number": "123.123"}{"number": "123.123"}]"
 but was: "[{"number": 123.123}{"number": 123.123}]"
14:22:59.922 [ERROR]   JsonTest.simpleJsonTestForJsonTransformer:175 
expected: "{"number": "123.123"}"
 but was: "{"number": 123.123}"
14:22:59.922 [ERROR] Tests run: 19310, Failures: 3, Errors: 0, Skipped: 0

Copy link
Copy Markdown
Collaborator

@asolntsev asolntsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(except the failing tests)

@asolntsev asolntsev added this to the 2.4.4 milestone May 20, 2025
@asolntsev asolntsev added the bug Something isn't working label May 20, 2025
@kingthorin
Copy link
Copy Markdown
Collaborator Author

Working on the failures now.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 20, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.50%. Comparing base (71fd588) to head (dc9b044).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1557      +/-   ##
============================================
+ Coverage     92.45%   92.50%   +0.04%     
  Complexity     3309     3309              
============================================
  Files           329      329              
  Lines          6509     6507       -2     
  Branches        634      632       -2     
============================================
+ Hits           6018     6019       +1     
+ Misses          338      336       -2     
+ Partials        153      152       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kingthorin kingthorin merged commit a7a5c59 into datafaker-net:main May 20, 2025
13 checks passed
@kingthorin kingthorin deleted the issue-1556 branch May 20, 2025 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

double value forced to be treated as string

3 participants