Allow ignoring absent properties
shrralis opened this issue · 2 comments
shrralis commented
Is there a way to avoid io.mcarle.konvert.processor.exceptions.PropertyMappingNotExistingException: No property for...
?
In my case, there's an Entity with a property with a default value:
data class Entity(
...
var something: Boolean = false,
...
)
and a DTO without the field:
data class DTO(
...
// no `something` field
...
)
Is there a way to respect the default value declared in the Entity
constructor?
Having smth like @Konvert(mappings = [Mapping(target = "something", constant = "false")])
seems really redundant
mcarleio commented
Thanks for raising this issue! I am sure it once was possible.
I fixed it and added a unit test, so that it stays like this :)
mcarleio commented
Funny thing: I have just stumbled over my own documentation 😆
* * Your source does not have the information for a target with default value
* ```kotlin
* @KonvertTo(CarToRepair::class, mappings=[
* Mapping(target="defect", ignore=true)
* ])
* class Car
* class CarToRepair(val defect: Boolean = true)
* ```
So it was working as expected, I just forgot about that :/