mapstruct-idea icon indicating copy to clipboard operation
mapstruct-idea copied to clipboard

Report Non-existing target properties as errors

Open CodeSimcoe opened this issue 1 year ago • 1 comments

When a @Mapping(target = x) is defined where x does not effectively exist, an error shall be reported. Example of code that does should raise an error :

@Mapper
public interface JediMapper {

  @Mapping(target = "wrongField", ignore = true)
  JediDto toDto(Jedi jedi);

  @Mapping(target = "master", ignore = true)
  Jedi fromDto(JediDto jedi);
}

PR proposed : #177

CodeSimcoe avatar Mar 10 '24 18:03 CodeSimcoe

Some things i need to address in the PR :

  • Report only one problem containing all invalid fields instead of one for each field
  • Fix dotted notation, like @Mapping(target = "master.name", ignore = true) for instance

CodeSimcoe avatar Mar 11 '24 19:03 CodeSimcoe