Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Unmapped source properties error when source is mapped to a nested field of the target object #2781

Copy link
Copy link

Description

@JCCorreale
Issue body actions

An example to reproduce this issue can be found in this repository

The issue is easily reproducible with this simple mapping:

@Mapping(target = "nested", source = "mySource")
MyTarget map(MySource mySource);

Where MyTarget.nested is of type MySource

When unmappedSourcePolicy is set to ReportingPolicy.ERROR, the report produces Unmapped source properties error (or warning in the case of ReportingPolicy.WARN)

The mapping code is generated correctly. For ReportingPolicy.ERROR, the following workaround is necessary in order to get a successful build:

@BeanMapping(ignoreUnmappedSourceProperties = { "field1", "field2" })

Where "field1", "field2" are the fields of MySource

MapStruct version is 1.4.2.Final

Best regards
JC

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.