Please do the checklist before filing an issue:
- [ x] I have read the documentation, including the FAQ
- [x ] I can reproduce the bug using the latest prerelease version
- [x ] I have searched existing discussion and issue to avoid duplicates
Describe the bug
Try Mapping ValueObject contains dictionary inside to GRPC-message contains map field. Mapperly ignore custom converter, got warning "The member Value on the mapping source type mapperly_test.Metadata is not mapped to any member on the mapping target type Google.Protobuf.Collections.MapField<string?, string?>"
Declaration code
syntax = "proto3";
option csharp_namespace = "Test";
message TestMessage {
map<string, string> metadata = 3;
}
public record Source
{
public Metadata Metadata { get; set; } = new();
}
public record Dest
{
public Dictionary<string, string> Metadata { get; set; } = new();
}
[Mapper]
public partial class Mapper
{
public partial TestMessage MapToGrpc1(Source source); //<-- Warning
[MapProperty(nameof(Source.Metadata), nameof(TestMessage.Metadata), Use = nameof(MetadataToMapField))]
public partial TestMessage MapToGrpc2(Source source); // <-- Ignore Use
public partial Dest MapToDest(Source source); //<-- Mapping to Dictionary<string, string> works fine
public static MapField<string, string> MetadataToMapField(Metadata metadata) => new() { metadata.Value };
public static Dictionary<string, string> MetadataToDictionary(Metadata metadata) => metadata.Value;
}
Actual relevant generated code
public partial class Mapper
{
[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "5.0.0.0")]
public partial global::Test.TestMessage MapToGrpc1(global::mapperly_test.Source source)
{
var target = new global::Test.TestMessage();
return target;
}
[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "5.0.0.0")]
public partial global::Test.TestMessage MapToGrpc2(global::mapperly_test.Source source)
{
var target = new global::Test.TestMessage();
return target;
}
[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "5.0.0.0")]
public partial global::mapperly_test.Dest MapToDest(global::mapperly_test.Source source)
{
var target = new global::mapperly_test.Dest();
target.Metadata = MetadataToDictionary(source.Metadata);
return target;
}
}
Expected relevant generated code
var target = new global::Test.TestMessage();
target.Metadata = { MetadataToMapField(source.Metadata) };
return target;
Reported relevant diagnostics
- RMG020: The member Value on the mapping source type mapperly_test.Metadata is not mapped to any member on the mapping target type Google.Protobuf.Collections.MapField<string?, string?>
Environment (please complete the following information):
- Mapperly Version: 5.0.0-next.8
- Nullable reference types: enabled
- .NET Version: Net 10.0.301
- Target Framework: .net10
- Compiler Version: 5.7.0-1.26220.12 (5e5ee328113910b2d963ccb8870a810563778cae)
- C# Language Version: [e.g. 14.0]
- IDE: Visual Studio Code
- OS: Windows 10
Additional context
Add any other context about the problem here.
Please do the checklist before filing an issue:
Describe the bug
Try Mapping ValueObject contains dictionary inside to GRPC-message contains map field. Mapperly ignore custom converter, got warning "The member Value on the mapping source type mapperly_test.Metadata is not mapped to any member on the mapping target type Google.Protobuf.Collections.MapField<string?, string?>"
Declaration code
Actual relevant generated code
Expected relevant generated code
Reported relevant diagnostics
Environment (please complete the following information):
Additional context
Add any other context about the problem here.