-
-
Notifications
You must be signed in to change notification settings - Fork 196
Add support for ignoring static convert methods with MapperIgnore #1941
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
Conversation
- Extend MapperIgnoreAttribute to support methods - Filter out ignored static methods during conversion discovery - Add tests for ignored static methods - Proposed fix for Issue riok#1929
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 your contribution! I added my feedback.
src/Riok.Mapperly/Descriptors/MappingBuilders/ConvertStaticMethodMappingBuilder.cs
Show resolved
Hide resolved
- Add [MapperIgnore] attribute filtering to ConvertInstanceMethodMappingBuilder - Add [MapperIgnore] attribute filtering to ParseMappingBuilder - Update test to use nameof(FromB) for better maintainability - Add test case for constructor fallback when static method is ignored Proposal to fix Issue riok#1929
src/Riok.Mapperly/Descriptors/MappingBuilders/ConvertInstanceMethodMappingBuilder.cs
Show resolved
Hide resolved
…th MapperIgnore - Extend MapperIgnoreAttribute to support methods - Add filtering for ignored methods in ParseMappingBuilder and ConvertInstanceMethodMappingBuilder - Add test cases for ignored parse and instance methods Proposal to fix Issue riok#1929
- Add AttributeTargets.Method to MapperIgnoreAttribute - Update snapshot to include Method (order matched) - Move/adjust tests for parse and ToTarget ignore - Docs: mention methods and add ignore examples
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 again for the updates, almost good to merge 😊
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 the updates, now it almost looks good to be merged. One small nitpick 🙈 And please also check the linter issues: https://github.com/riok/mapperly/actions/runs/17701857152/job/50422690421?pr=1941
Should fix #1929 by extending
MapperIgnore
to work with static conversion methods. Now one can mark specific static methods with[MapperIgnore]
to prevent them from being used as conversion methods.Changes:
MapperIgnoreAttribute
to support methodsConvertStaticMethodMappingBuilder
to skip ignored static methodsTesting: