question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mapping `init` or `required` properties does not use `PropertyNameMappingStrategy`

See original GitHub issue

Describe the bug Mapping to required or init properties doesn’t use the PropertyNameMappingStrategy.

Expected behavior Mapping should use PropertyNameMappingStrategy

Code snippets

[Mapper(PropertyNameMappingStrategy = PropertyNameMappingStrategy.CaseInsensitive)]
public static partial class Mapper
{
    public static partial B Map(A src);
}
public class A
{
    public int Value { get; set; }
}
public class B
{
    // can also be required
    public int value { get; init; }
}

Generated code

public static partial global::Riok.Mapperly.Sample.B Map(global::Riok.Mapperly.Sample.A src)
{
    var target = new global::Riok.Mapperly.Sample.B();
    return target;
}

Issue Analytics

  • State:closed
  • Created 3 months ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
latonzcommented, Jul 11, 2023

@cristianUrbina FYI here is a guide on how to request a review: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review. However, I just noted this may only be possible for accounts having write access to the repository…

1reaction
latonzcommented, Jul 11, 2023

@cristianUrbina thank you very much for the contribution 😊 Well done! 🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Releases · riok/mapperly
A .NET source generator for generating object mappings. ... required/init properties not using PropertyNameMappingStrategy (#505) (#556) (564a43e) ...
Read more >
How to properly use 'init' to prevent the error: "property ...
I am creating an application that receives the localization information from an Apple Watch and with the coordinates that I receive, I want...
Read more >
How to access Class's property in required convenience init?
One way is making it a class property. Code Block. class Person: NSObject, NSCoding {.
Read more >
Initialization | Documentation - Swift.org
Classes and structures must set all of their stored properties to an appropriate initial value by the time an instance of that class...
Read more >
SE-0400: Init Accessors - Proposal Reviews
All computed properties with init accessors are initialized on all paths. This doesn't line up with the degrees/radians example, in which only ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found