Skip to content

Funky value classes unwrap does not work #30

Description

@jerrevanveluw

given:

@JvmInline
value class FirstName private constructor(
override val value: String,
) : Value {
override fun toString() = value

companion object {
    operator fun invoke(s: String) =
        either {
            ensure(s.isNotBlank()) { FirstNameError.Empty }
            FirstName(s.trim())
        }
}

}

and TO:
data class UserDto(
val firstName: String,
)

and FROM:

data class User(
val firstName: FirstName,
)

the function:
fun User.produce(): UserDto = mapper {}

compiles, but is not filled and the test fails: expected: but was:<>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions