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 ignore enum values #536

Merged
merged 1 commit into from Jul 14, 2023

Conversation

latonz
Copy link
Contributor

@latonz latonz commented Jul 4, 2023

Adds option to ignore enum values

Adds new attributes MapperIgnoreSourceValue and MapperIgnoreTargetValue to ignore source/target enum values. This is especially useful for strict enum mappings (to ignore single values not present in the source and/or target without emitting a diagnostic).

Fixes #337

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 Jul 4, 2023
@codecov
Copy link

codecov bot commented Jul 4, 2023

Codecov Report

Merging #536 (3a2a29d) into main (85347e4) will decrease coverage by 0.98%.
The diff coverage is 89.07%.

@@            Coverage Diff             @@
##             main     #536      +/-   ##
==========================================
- Coverage   91.96%   90.99%   -0.98%     
==========================================
  Files         147      166      +19     
  Lines        4656     5606     +950     
  Branches      588      710     +122     
==========================================
+ Hits         4282     5101     +819     
- Misses        254      354     +100     
- Partials      120      151      +31     
Impacted Files Coverage Δ
...y.Abstractions/MapperIgnoreSourceValueAttribute.cs 0.00% <0.00%> (ø)
...y.Abstractions/MapperIgnoreTargetValueAttribute.cs 0.00% <0.00%> (ø)
src/Riok.Mapperly/Helpers/HashHelper.cs 0.00% <0.00%> (ø)
...numerables/EnsureCapacity/EnsureCapacityBuilder.cs 45.94% <42.10%> (-32.32%) ⬇️
src/Riok.Mapperly/MapperResults.cs 50.00% <50.00%> (ø)
src/Riok.Mapperly/ImmutableEquatableArray.cs 54.54% <54.54%> (ø)
...ok.Mapperly/Configuration/AttributeDataAccessor.cs 68.88% <64.58%> (-7.93%) ⬇️
.../Descriptors/MappingBuilders/SpanMappingBuilder.cs 80.00% <80.00%> (ø)
.../Descriptors/MappingBuilders/EnumMappingBuilder.cs 84.75% <81.13%> (-7.01%) ⬇️
...lders/NewInstanceObjectMemberMappingBodyBuilder.cs 80.00% <83.33%> (+1.21%) ⬆️
... and 63 more

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@latonz latonz force-pushed the 337-ignored-enum-values branch 4 times, most recently from 837f765 to e435bc2 Compare July 13, 2023 13:30
@latonz latonz marked this pull request as ready for review July 13, 2023 13:38
@latonz latonz requested a review from CommonGuy July 13, 2023 13:38
@latonz latonz merged commit 3e2a2c8 into riok:main Jul 14, 2023
12 of 14 checks passed
@latonz latonz deleted the 337-ignored-enum-values branch July 14, 2023 11:01
@github-actions
Copy link

🎉 This PR is included in version 2.9.0-next.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Aug 7, 2023

🎉 This PR is included in version 3.0.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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ignore enum values
2 participants