Skip to content
Discussion options

You must be logged in to vote
Admin verified this answer by cookesan Apr 23, 2026

This looks like expected strict-enum behavior, not a generated-code bug.

Mapperly's default required enum strategy checks both sides, so it warns that CompanyType.CompanyC cannot be produced from CompanyTypeMq. The generated switch is still correct for runtime values that can come from the source enum.

If extra target enum values are acceptable for this mapper, configure enum required mapping as source-only:

[Mapper(
    EnumMappingStrategy = EnumMappingStrategy.ByName,
    RequiredEnumMappingStrategy = RequiredMappingStrategy.Source)]
internal static partial class MapExtensions
{
    internal static partial Command Map(this MqDto dto);
}

If you want to keep stricter enum checks globally,…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer verified by Admin Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants