-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
From my perspective, I found a bug, because of the inconsistent behaving of ignoreUnmappedSourceProperties.
I defined these classes:
data class Inside(val value : String)
data class InsideDto(val value : String)
data class Problem(val problem : String)
data class ProblemDto(val problem : String)
data class Outside(val inside : Inside, val problem : Problem)
data class OutsideDto(val insideDto : InsideDto, val problem : ProblemDto)
Inside of a Mapper which has this Config:
@MapperConfig(
componentModel = "spring",
unmappedSourcePolicy = ReportingPolicy.ERROR,
unmappedTargetPolicy = ReportingPolicy.ERROR
)
I declared:
@Mapper(config = MapstructConfig::class)
interface Converter {
@BeanMapping(ignoreUnmappedSourceProperties = ["inside"])
fun test(
outside: Outside,
insideDto: InsideDto
): OutsideDto
}
this throws the following error:
error: Ignored unknown source property: "inside". public abstract [placeholder].OutsideDto test(@org.jetbrains.annotations.NotNull
I found a workaround. I just have to add an extra mapper declaration inside of my Converter for the Problem mapping:
fun solution(problem: Problem) : ProblemDto
In this case, everything works. For me, this looks like a bug, because it is not consistent behaviour.
Teka101 and mikrethor