Skip to content

fix: apply EmptyCollectionIfNull to record constructor args (#943)#973

Closed
wyf027 wants to merge 2 commits into
MapsterMapper:developmentfrom
wyf027:fix/empty-collection-transform-ctor-943-dev
Closed

fix: apply EmptyCollectionIfNull to record constructor args (#943)#973
wyf027 wants to merge 2 commits into
MapsterMapper:developmentfrom
wyf027:fix/empty-collection-transform-ctor-943-dev

Conversation

@wyf027

@wyf027 wyf027 commented May 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Apply EmptyCollectionIfNull (and other destination transforms) to record/class constructor arguments when null sources would otherwise skip transforms.
  • Skip destination transforms when a member has an explicit .Map() resolver so explicit null mappings are preserved.

Fixes #943
Relates to #952 (ctor-parameter path; property path covered by #966)

Test plan

wyf027 and others added 2 commits May 25, 2026 15:52
Apply destination transforms when null-propagation is skipped for ctor
parameters and when building record constructor arguments.

Co-authored-by: Cursor <cursoragent@cursor.com>
…952)

Do not apply EmptyCollectionIfNull when a member has an explicit Map
resolver, including record constructor parameters.

Co-authored-by: Cursor <cursoragent@cursor.com>
@wyf027

wyf027 commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

Heads-up for review: #943 ctor-path transforms were partially addressed upstream in #945 (development). This PR additionally wires ApplyDestinationTransform + explicit-map skip (HasExplicitMemberMap) on the ctor path — overlapping with #966 (#952) on the adapter path. The added regression test currently references #952 (explicit null vs EmptyCollectionIfNull), same scenario as #966; happy to rebase onto latest development and split/rename tests if that helps review.

@wyf027

wyf027 commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

Consolidated into #966: ctor-path ApplyDestinationTransform + explicit-map skip now lives on fix/explicit-null-map-952-dev with record-ctor regression coverage in WhenPerformingDestinationTransforms. #943 baseline remains on development via #945.

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.

1 participant