Skip to content
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: Add option to specify the string format of a property #921

Merged
merged 1 commit into from
Nov 21, 2023
Merged

feat: Add option to specify the string format of a property #921

merged 1 commit into from
Nov 21, 2023

Conversation

latonz
Copy link
Contributor

@latonz latonz commented Nov 20, 2023

String format for property mappings

Description

Adds a StringFormat property to the MapPropertyAttribute to specify the format of the to string conversion.
Use the TypeMappingKey to resolve mappings (including the configuration (for now only the string format)) instead of only the source and target type to allow the same type conversion with different configurations.

Partially implements #887

Checklist

  • The existing code style is followed
  • The commit message follows our guidelines
  • Performed a self-review of my code
  • Hard-to-understand areas of my code are commented
  • The documentation is updated (as applicable)
  • Unit tests are added/updated
  • Integration tests are added/updated (as applicable, especially if feature/bug depends on roslyn or framework version in use)

@latonz latonz self-assigned this Nov 20, 2023
Copy link

codecov bot commented Nov 20, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (1f6f1f5) 91.50% compared to head (8280aaf) 91.53%.

Files Patch % Lines
...Riok.Mapperly.Abstractions/MapPropertyAttribute.cs 0.00% 1 Missing ⚠️
...criptors/MappingBuilders/NullableMappingBuilder.cs 92.30% 0 Missing and 1 partial ⚠️
src/Riok.Mapperly/Descriptors/MappingCollection.cs 90.00% 0 Missing and 1 partial ⚠️
src/Riok.Mapperly/Helpers/SymbolExtensions.cs 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #921      +/-   ##
==========================================
+ Coverage   91.50%   91.53%   +0.03%     
==========================================
  Files         215      217       +2     
  Lines        7216     7269      +53     
  Branches      873      879       +6     
==========================================
+ Hits         6603     6654      +51     
- Misses        407      408       +1     
- Partials      206      207       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@latonz latonz marked this pull request as ready for review November 20, 2023 12:51
CommonGuy
CommonGuy previously approved these changes Nov 20, 2023
ni507
ni507 previously approved these changes Nov 20, 2023
@latonz
Copy link
Contributor Author

latonz commented Nov 20, 2023

Switched to a IFormattable based implementation. This also allows simpler support for IFormatProvider, see #929

@latonz latonz enabled auto-merge (squash) November 21, 2023 12:38
@latonz latonz merged commit 236a46f into riok:main Nov 21, 2023
19 checks passed
@latonz latonz deleted the 887-property-string-format branch November 21, 2023 12:42
Copy link

🎉 This PR is included in version 3.3.0-next.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 3.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants