Skip to content

v4.5.0

Latest

Choose a tag to compare

@mcarleio mcarleio released this 25 Mar 23:45
· 5 commits to main since this release

New features

  • New option konvert.enforce-not-null-strategy to define how Konvert handles mapping from nullable to non-nullable field #199 (thanks to @Shanzeee)

    • ASSERTION_OPERATOR (default, deprecated) - uses the !! operator to assert that the source value is not null. Will result in a simple NullPointerException if the source value is null.
    • REQUIRE_NOT_NULL - uses the requireNotNull function to check that the source value is not null. Will throw an IllegalArgumentException with a speaking message if the source value is null.
  • Three new type converters, which handle Array<*> (including primitive arrays like e.g. IntArray) mappings:

    • ArrayToArrayConverter - maps between arrays, e.g. Array<Int> to Array<String>
    • ArrayToIterablesXConverter - maps from an array to an iterable, e.g. Array<Int> to List<String>
    • IterableToArrayConverter - maps from an iterable to an array, e.g. List<Int> to Array<String>

    The following example now works out-of-the-box and generates the appropriate mappings:

    @KonvertTo(UserIdsDto::class)
    class UserIds(val ids: Array<Int>)
    
    @KonvertTo(UserIds::class)
    class UserIdsDto(val ids: List<Int>)

Improvements

  • Updates:

    • Kotlin → 2.3.10
    • KSP → 2.3.5
    • Injectors (Anvil, Dagger, Koin, Spring)
  • Build updates:

    • Gradle → 9.4.1
    • Kotlin Compile Testing → 0.12.1
    • jUnit → 6.0.2