Analyzer diagnostics
Mapperly emits several diagnostics:
Rule ID | Severity | Description |
RMG001 | Error | A mapping method has an unsupported signature. |
RMG002 | Error | No accessible parameterless constructor found. |
RMG003 | Warning | No overlapping enum members found. |
RMG004 | Warning | Ignored target property not found. |
RMG005 | Error | Mapping target property not found. |
RMG006 | Error | Mapping source property not found. |
RMG007 | Error | Could not map property. |
RMG008 | Error | Could not create mapping. |
RMG009 | Info | Cannot map to read only property. |
RMG010 | Info | Cannot map from write only property. |
RMG011 | Info | Cannot map to write only property path. |
RMG012 | Info | Mapping source property not found. |
RMG013 | Error | No accessible constructor with mappable arguments found |
RMG014 | Warning | Cannot map to the configured constructor to be used by Mapperly |
RMG015 | Info | Cannot map to init only property path |
RMG016 | Error | Init only property cannot handle target paths |
RMG017 | Warning | An init only property can have one configuration at max |
RMG018 | Error | Partial static mapping method in an instance mapper |
RMG019 | Error | Partial instance mapping method in a static mapper |
RMG020 | Info | Source property is not mapped to any target property |
RMG021 | Warning | Ignored source property not found |
RMG022 | Error | Invalid object factory signature |
RMG023 | Error | Mapping source property for a required target property not found |
RMG024 | Error | The reference handler parameter is not of the correct type |
RMG025 | Error | To use reference handling it needs to be enabled on the mapper attribute |
RMG026 | Info | Cannot map from indexed property |
RMG027 | Warning | A constructor parameter can have one configuration at max |
RMG028 | Error | Constructor parameter cannot handle target paths |
info
Mapperly only emits updated source code on build. You won't see the updated mapper code or mapper diagnostics until you perform a build.
This is done for performance reasons, otherwise the IDE could become laggy. Improvements are tracked in #72.
Editorconfig
The severity of these diagnostics can be customized via an .editorconfig
file:
.editorconfig
dotnet_diagnostic.{RuleID}.severity = error
dotnet_diagnostic.RMG020.severity = error
Strict mappings
To enforce strict mappings (all source properties have to be mapped to a target property and all target properties have to be mapped from a source property) set the following two editorconfig settings:
.editorconfig
dotnet_diagnostic.RMG012.severity = error # Unmapped target property
dotnet_diagnostic.RMG020.severity = error # Unmapped source property