fix(generator): honor effective requiredness for nested FromItem fallbacks#115
Merged
Merged
Conversation
- Introduced `RequirednessResolver` to determine property requiredness before and after nullability inference. - Updated `NestedObjectTypeAnalyzer` to use `RequirednessResolver` for configured requiredness resolution. - Enhanced `PropertyMappingCodeRenderer` to improve fallback handling for required and nullable properties. - Modified `GetNestedObjectFallback` and `GetNestedCollectionFallback` methods for better requiredness handling. - Added `Requiredness` to `NestedPropertySpec` for consistent requiredness representation in property specs.
- Updated all generated mappings to use `Requiredness.InferFromNullability` instead of `Requiredness.Optional`. - Added runtime checks for required attributes and nested properties, throwing `InvalidOperationException` when missing. - Enhanced test snapshots to reflect stricter requiredness handling in `FromItem` methods. - Ensured consistency across nested object mappings, collections, and scalar properties in all test cases.
- Updated `publish-preview.yaml` to use `LayeredCraft/devops-templates@v8.1` instead of `@main`. - Updated `publish-release.yaml` to use `LayeredCraft/devops-templates@v8.1` instead of `@main`.
- Documented `Required` support for nested objects and collections, including dot-notation paths. - Clarified fallback behavior for missing nested attributes during `FromItem` based on requiredness. - Updated changelog with fixed fallback behavior respecting effective requiredness.
- Updated documentation to specify that missing required nested containers now throw at runtime. - Clarified effective requiredness behavior based on `DynamoField.Required` and nullability inference. - Expanded description of defaults and error handling for nested containers and scalar values.
- Updated `PropertyMappingCodeRenderer` to include explicit requiredness in rendered code.
- Replaced hardcoded `Requiredness.InferFromNullability` with dynamic `Requiredness.{prop.Requiredness}`.
- Ensured accurate requiredness representation in property mapping logic for better consistency.
- Updated `pr-build.yaml` to use `LayeredCraft/devops-templates@v8.1`. - Updated `pr-title-check.yaml` to use `LayeredCraft/devops-templates@v8.1`. - Updated `release-drafter.yaml` to use `LayeredCraft/devops-templates@v8.1`.
ncipollina
requested changes
Apr 20, 2026
Contributor
ncipollina
left a comment
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FromItemfallbacks so missing required containers throw instead of silently defaulting.null!for non-nullable optional nested object fallbacks to avoid CS8601 while preserving optional semantics.DefaultRequirednessand dot-notationRequiredoverrides.Validation
dotnet test --project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csprojdotnet test --project test/LayeredCraft.DynamoMapper.IntegrationTests/LayeredCraft.DynamoMapper.IntegrationTests.csprojCloses #114.