softwaremill / magnolia

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

feat: adding on-demand default evaluation #534

Closed Andrapyre closed 1 month ago

Andrapyre commented 1 month 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