-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: make targetMembers
case sensitive
#1077
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1077 +/- ##
==========================================
- Coverage 91.18% 91.18% -0.01%
==========================================
Files 220 220
Lines 7203 7201 -2
Branches 915 915
==========================================
- Hits 6568 6566 -2
Misses 418 418
Partials 217 217 ☔ View full report in Codecov by Sentry. |
cb64d59
to
1854967
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR!
return BuilderContext | ||
.SymbolAccessor.GetAllAccessibleMappableMembers(Mapping.TargetType) | ||
.ToDictionary(x => x.Name, StringComparer.OrdinalIgnoreCase); | ||
return BuilderContext.SymbolAccessor.GetAllAccessibleMappableMembers(Mapping.TargetType).ToDictionary(x => x.Name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't
src\Riok.Mapperly\Descriptors\MappingBodyBuilders\BuilderContext\NewInstanceBuilderContext.cs:10
and src\Riok.Mapperly\Descriptors\MappingBodyBuilders\BuilderContext\NewInstanceContainerBuilderContext.cs:17
have the same problems for configurations?
@@ -235,7 +235,7 @@ private static void BuildConstructorMapping(INewInstanceBuilderContext<IMapping> | |||
continue; | |||
} | |||
|
|||
ctx.TargetMembers.RemoveRange(mappedTargetMemberNames); | |||
ctx.TargetMembers.RemoveRange(ctx.TargetMembers.Keys.Intersect(mappedTargetMemberNames, StringComparer.OrdinalIgnoreCase)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should adjust this to use a similar approach to RootTargetNameCasingMapping
, wdyt?
- Create a case mapping dictionary
- Use that dictionary to resolve correct casing in
AddConstructorParameterMapping
and remove fromTargetMembers
dictionary accordingly
Description
Having two members with case insensitive similar names would cause mapperly to fail.
value
&Value
TargetMember
case sensitiveFixes #1076
Checklist