fix: default case class values memoized #1119
Open
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.
Description
This PR closes #1055 and, in the process, updates
zio-json
to the Scala Native0.5.x
series (necessary because this requires multiple PRs to Magnolia and Magnolia is already on the0.5.x
series). The solution does the following things:It provides out-of-the-box support for random generators which are not time-based, as well as support for all classes that extend
java.time.temporal.Temporal
- all of the following:It introduces a
@jsonAlwaysEvaluateDefault
annotation to force evaluation of the default parameter every time json is decoded (especially relevant for timestamp values coming from 3rd party libs, e.g.org.joda.time
).The result is that users can implement the following case class and expect the results for each parameter as described in the comments:
External dependencies
Several external dependencies need to be closed before this will build in Github Actions:
0.5.x
. This can be started once upstream dependencies are upgraded. Publish for Scala native 0.5 zio#8786Thescala-java-time
lib needs to be upgraded to Scala Native0.5.x
. Scala Native 0.5.x cquiroz/scala-java-time#508One PR needs to be merged into the Magnolia Scala2.x
series. [scala2] feat: adding on-demand default evaluation softwaremill/magnolia#533One PR needs to be merged into the Magnolia Scala3.x
series. feat: adding on-demand default evaluation softwaremill/magnolia#534/claim #1055