Skip to content

fix: IgnoreNullValues regression from MapToTarget cases in #905#908

Merged
DocSvartz merged 4 commits intoMapsterMapper:developmentfrom
DocSvartz:d26
Apr 1, 2026
Merged

fix: IgnoreNullValues regression from MapToTarget cases in #905#908
DocSvartz merged 4 commits intoMapsterMapper:developmentfrom
DocSvartz:d26

Conversation

@DocSvartz
Copy link
Copy Markdown
Contributor

@DocSvartz DocSvartz commented Mar 31, 2026

#858 Bug overview:
Nullable custom ValueType not mapping to custom ValueType
or NotNullable custom ValueType on a potentially nullable path: property<Class>.property<ValueType>

Causes of occurrence:

  1. Not adapter for custom Nullable ValueType
  2. ApplyNullPropagation algoritm

If custom ValueType on a potentially nullable path: property<Class>.property<ValueType> ApplyNullPropagation tranform it to (Nullable<ValueType>) property<Class>.property<ValueType>
What is actually required only in the case of MapToTarget is to support IgnoreNullValues feature

Since an initially NotNullable source becomes nullable and can be skipped when the value is null

before ApplyNullPropagation
Expression (property<Class>.property<ValueType>) return ValueType data - not null

after ApplyNullPropagation
Expression ((Nullable<ValueType>) property<Class>.property<ValueType>) return Nullable<ValueType> data - can be null

@DocSvartz DocSvartz merged commit 8b02e28 into MapsterMapper:development Apr 1, 2026
1 of 2 checks passed
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.

src.Inner.Amount return Nullable<Money> when property Amount is not nullable

1 participant