Skip to content

[#3837] Add warning/error for redundant ignoreUnmappedSourceProperties entries#3906

Merged
filiphr merged 4 commits intomapstruct:mainfrom
codeswithritesh:main
Aug 24, 2025
Merged

[#3837] Add warning/error for redundant ignoreUnmappedSourceProperties entries#3906
filiphr merged 4 commits intomapstruct:mainfrom
codeswithritesh:main

Conversation

@codeswithritesh
Copy link
Contributor

@codeswithritesh codeswithritesh commented Jul 27, 2025

Enhancement: warn when mapped properties are listed in ignoreUnmappedSourceProperties (#3837)

…roperties are actually mapped.

Respects unmappedSourcePolicy and includes tests for redundant and valid ignore cases.
@gnuemacscoin
Copy link

Looks good, though the message grammar is a little off. I would rephrase it as "Source %s is mapped despite being listed in ignoreUnknownSourceProperties." or "Source %s is being mapped despite appearing in ignoreUnknownSourceProperties.".

…ion message. Updated the validation message to use clearer and more grammatically correct phrasing, e.g., "Source property 'email' is mapped despite being listed in ignoreUnmappedSourceProperties."
@codeswithritesh
Copy link
Contributor Author

codeswithritesh commented Aug 1, 2025

Thanks for the suggestion, gnuemacscoin! I have updated the validation messages as recommended.

Below are example warning/error messages generated by MapStruct using the format:
"Source %s mapped despite being listed in ignoreUnmappedSourceProperties."

• For a single source property:
"Source property 'email' is mapped despite being listed in ignoreUnmappedSourceProperties."

• For multiple source properties:
"Source properties 'email', 'username' are mapped despite being listed in ignoreUnmappedSourceProperties."

Let me know if you'd prefer a different phrasing.

@filiphr When you have a moment, could you please take a look at this PR? Your feedback would be appreciated.

Copy link
Member

@filiphr filiphr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach looks OK @codeswithritesh. I've left one comment that should be addressed before merging this, we should not need changes in the fullFeaturesTest/pom.xml. We should instead use Erroneous in the name of the mappers, that are producing compile errors, in our tests

@codeswithritesh
Copy link
Contributor Author

Thank you, @filiphr!
Glad to hear the changes look good, and great to see the CI checks have passed.
Let me know if there’s anything else you'd like me to update. Otherwise, I’ll wait for you to proceed with the merge — looking forward to it! 🙂

@codeswithritesh codeswithritesh requested a review from filiphr August 8, 2025 14:15
@filiphr filiphr merged commit fe43563 into mapstruct:main Aug 24, 2025
4 checks passed
@filiphr
Copy link
Member

filiphr commented Aug 24, 2025

Thanks @codeswithritesh, I've merged this

@codeswithritesh
Copy link
Contributor Author

Thank you @filiphr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report properties in ignoreUnmappedSourceProperties that actually do get mapped

3 participants