Skip to content

Replace moshi with kotlinx-serialization#152

Closed
agologan wants to merge 2 commits intoYelp:masterfrom
agologan:kt-serialization
Closed

Replace moshi with kotlinx-serialization#152
agologan wants to merge 2 commits intoYelp:masterfrom
agologan:kt-serialization

Conversation

@agologan
Copy link
Copy Markdown
Contributor

@agologan agologan commented Jul 21, 2021

This PR extends on #136. There's still work to be so external input is more then welcome:

Changes that should be discussed:

  • replaced ZonedDateTime with Instant from kotlinx-datetime - while this logically correct it does reduce all datetime representations to Zulu timezone
  • replaced number from BigDecimal to double - there is no official kmp support for BigDecimal which is not great because double is an approximation
  • replaced object with JsonObject - while using Json* classes is more type-safe it does modify the API heavily

As you can see most problems are around unsupported types which we could support via the Java classes but would still require some serialization changes maybe via contextual serialization?

The last problematic point is regarding nullability. While deserialization works as expected serialization implicitly omits null values. As far as I can tell these could be added back if the integrator passes in encodeDefaults: true on the JsonConfiguration. The x-nullable vendor extension just states null as a valid value and doesn't imply the client should explicitly send null to define a property as missing so maybe this is not actually a problem.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 21, 2021

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.90%. Comparing base (b2f2c2f) to head (2b0a77f).
⚠️ Report is 19 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #152      +/-   ##
============================================
- Coverage     71.95%   71.90%   -0.05%     
  Complexity      139      139              
============================================
  Files            11       11              
  Lines           574      573       -1     
  Branches         75       75              
============================================
- Hits            413      412       -1     
  Misses          118      118              
  Partials         43       43              

☔ 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.

@agologan agologan closed this by deleting the head repository Apr 22, 2026
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.

1 participant