Skip to content

Conversation

@jacob-buckaroo
Copy link
Contributor

@jacob-buckaroo jacob-buckaroo commented Nov 13, 2024

Separate RequiredMappingStrategy configuration for enums

Description

Add MapperAttribute.RequiredEnumMappingStrategy / MapperDefaultsAttribute.RequiredEnumMappingStrategy
Resolve RequiredMappingStrategy for each enum mapping in the following order, fall back to the next one if the previous one is not set:

  1. MapperRequiredMappingAttribute on the mapping method
  2. MapperAttribute.RequiredEnumMappingStrategy
  3. MapperDefaultsAttribute.RequiredEnumMappingStrategy
  4. MapperAttribute.RequiredMappingStrategy
  5. MapperDefaultsAttribute.RequiredMappingStrategy

Fixes #1590

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)

@jacob-buckaroo jacob-buckaroo marked this pull request as draft November 13, 2024 13:02
@jacob-buckaroo jacob-buckaroo marked this pull request as ready for review November 13, 2024 13:03
…bute.RequiredEnumMappingStrategy

Resolve RequiredMappingStrategy for each enum mapping in the following order, fall back to the next one if the previous one is not set:
1.MapperRequiredMappingAttribute on the mapping method
2. MapperAttribute.RequiredEnumMappingStrategy
3. MapperDefaultsAttribute.RequiredEnumMappingStrategy
4. MapperAttribute.RequiredMappingStrategy
5. MapperDefaultsAttribute.RequiredMappingStrategy
@jacob-buckaroo jacob-buckaroo changed the title RequiredMappingStrategy should still warn for Enum values not present Separate RequiredMappingStrategy configuration for enums Nov 15, 2024
Copy link
Contributor

@latonz latonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR, I added my feedback.

Copy link
Contributor

@latonz latonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates, two small feedback points...

Copy link
Contributor

@latonz latonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added my feedback...

@latonz latonz added the enhancement New feature or request label Nov 20, 2024
jacob-buckaroo and others added 2 commits November 20, 2024 14:37
@latonz latonz merged commit add55fb into riok:main Nov 20, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Separate RequiredMappingStrategy configuration for enums

2 participants