MapsterMapper / MapsterMapper/Mapster

Tweaking null propagation easily

Open
#740 3 comments 0 reactions 0 assignees View on GitHub

@DocSvartz is already working on this.

Since May 24, 2025.

  • #804 by @DocSvartz — open
help wanted improvement
Dominant language
C#
Stars
5.2k
Forks
410
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Is there an easy way to change how [null propagation](https://github.com/MapsterMapper/Mapster/wiki/Custom-mapping#null-propagation) works?

1) If we wanted to throw an exception when null reference encountered? There are lots of various `Ignore` methods, similarly I wish there were `Required` methods or maybe an `ThrowIfNull` argument to be passed in
2) If null encountered, use a provided value (I know atm it uses default or null value)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked custom-mapping null-propagation documentation and inspect pull request #804, which is already open for this issue. Clarify whether the requested behavior is throwing on null, substituting a provided value, or both, then define the API and tests needed to demonstrate the agreed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.