Skip to content

feat(runtime): add support for omitting null values in generated mappers#97

Merged
j-d-ha merged 5 commits intomainfrom
feature/96-nested-omit-if-null
Apr 8, 2026
Merged

feat(runtime): add support for omitting null values in generated mappers#97
j-d-ha merged 5 commits intomainfrom
feature/96-nested-omit-if-null

Conversation

@j-d-ha
Copy link
Copy Markdown
Collaborator

@j-d-ha j-d-ha commented Apr 8, 2026

Summary

  • add mapper-level OmitNullValues, deprecate legacy OmitNullStrings, and preserve null-omit overrides through nested mapping analysis
  • update generated ToItem code so OmitIfNull works uniformly for nested object and nested collection properties, including deeper dot-notation paths
  • add runtime and generator coverage, plus update docs, examples, and the repo skills/dynamo-mapper references

Testing

  • dotnet test --project test/LayeredCraft.DynamoMapper.Runtime.Tests/LayeredCraft.DynamoMapper.Runtime.Tests.csproj

j-d-ha added 5 commits April 8, 2026 11:03
- Introduced `OmitNullValues` in mapper options and attributes to control null omission behavior.
- Added `SetIfNotNull` extension method on `AttributeValue` for conditional attribute setting.
- Updated nested object/collection property mapping logic to respect `OmitNullValues` settings.
- Deprecated `OmitNullStrings` in favor of `OmitNullValues` for broader applicability.
- Enhanced tests to verify new null omission feature functionality.
…ssion

- Added generated snapshot files for `NestedObjectVerifyTests`.
- Verified behavior for dot notation null omission and inline nullable handling.
- Ensured nested mappers respect null omission settings in all scenarios.
- Updated `<VersionPrefix>` to `1.1.0` to prepare for the next release.
- Minor formatting adjustments to metadata items for consistency.
- Introduced handling for `OmitNullValuesSpecified` to prioritize explicit settings.
- Replaced `.Set(...)` with `.SetIfNotNull(...)` for conditional null checks in mappings.
- Updated logic in nested object and collection mappings to respect `OmitNullValues` behavior.
- Added snapshots for new test cases, including `ExplicitOmitNullValuesFalse` and inline nullable checks.
- Adjusted default `OmitNullValues` to `true` in both runtime attributes and generator options.
- Added a new `publish` task for publishing packages to NuGet.
- Introduced `dotenv` support in `taskfile.yaml` for environment variable management.
- Updated `.gitignore` to include `.env` file exclusion.
Copy link
Copy Markdown
Contributor

@ncipollina ncipollina left a comment

Choose a reason for hiding this comment

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

Looks good.

@j-d-ha j-d-ha merged commit 867ef87 into main Apr 8, 2026
3 checks passed
@j-d-ha j-d-ha deleted the feature/96-nested-omit-if-null branch April 8, 2026 17:32
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.

2 participants