-
-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect only explicit mappings but fail on unmapped source fields #3574
Comments
You might be right @thiko. Have a look at #3391 (comment) as well. In the initial implementation of |
Thanks for your response @filiphr ! The desired behavior for
But I dont not really understand how #2560 happend. In his case it was
As long as |
I think that you saw In any case, I believe that perhaps such a breaking change could be added for this. The defined What do you think @Zegveld and @thunderhook? |
Yes I did :-) |
Having I would even go as far as saying that the combination of As a final note, we need to update the reference guide for
In case of a Better would be something in the lines of:
|
Great, I'll look into implementing this
I don't see a big benefit in doing this. If someone does it then it'll be ignored, if they wanted to use
That does make sense. |
@filiphr Nothing more to add, I also agree to revert #2560. 👍 |
Use case
Imagine a PATCH request with several JsonNullable fields.
The mapper should overwrite present fields only:
The
@BeanMapping(ignoreByDefault = true)
is used to ensure that only those fields in the domain object that are set in the Patch-DTO are overwritten. Unfortunately, theunmappedSourcePolicy = ReportingPolicy.ERROR
is ignored in this case.As far as I can see, there is no way to enforce explicit mapping and cause the build to fail if one of the mappings is forgotten. This feature would make the mappings much better maintainable in such situations.
Generated Code
No response
Possible workarounds
No response
MapStruct Version
1.5.3.Final
The text was updated successfully, but these errors were encountered: