softwaremill / magnolia

Easy, fast, transparent generic derivation of typeclass instances
https://softwaremill.com/open-source/
Apache License 2.0
768 stars 117 forks source link

feat: adding on-demand default evaluation #534

Closed Andrapyre closed 6 months ago

Andrapyre commented 6 months ago

Description

Currently, all default values are precompiled. This has led to random generators, such as random UUID.randomUUID() and Instant.now() being memoized (see https://github.com/zio/zio-json/issues/1055). This PR adds an option to evaluate default parameters on-demand. See the accompanying PR for Scala 2 support: https://github.com/softwaremill/magnolia/pull/533