mapstruct / mapstruct/mapstruct

Mapping config should be transitive

Open
#1,169 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Java
Stars
7.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

In our model we have muliple level of inheritance. For example:
SpecialCustomer extends Customer extends Person.

In our mapping we have one mapper for every inheritence level (PersonMapper, CustomerMapper, SpecialCustomerMapper). To get the mapping config from PersonMapper in CustomMapper we use the config attribut in @Mapper and define a reference from CustomMapper to PersonMapper, thats fine.

But when I try to use the config attribute as well for SpecialCustomMapper and define the referernce to CustomMapper I do not get the configured mapping from Person.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Person, Customer, and SpecialCustomer mapper hierarchy described in the issue, focusing on how @Mapper config references are processed transitively. The work is done when SpecialCustomerMapper receives the mapping configuration from PersonMapper through CustomerMapper, with tests covering the inheritance chain.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.