-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Priority: P2 - Important
Tier: 3 - Advanced Features
Effort: Medium (6-8 hours)
Already In Codebase
- Requiredness is already calculated and passed into runtime Get methods:
- Field override + global default requiredness:
src/LayeredCraft.DynamoMapper.Generators/PropertyMapping/PropertyMappingSpecBuilder.cs - Runtime behavior on missing keys:
Requiredness.RequiredandRequiredness.InferFromNullabilitycurrently throwInvalidOperationException.Requiredness.Optionalreturns a DynamoDB NULL value.src/LayeredCraft.DynamoMapper.Runtime/AttributeValueExtensions/UtilAttributeValueExtensions.cs
- Field override + global default requiredness:
- There are tests that exercise requiredness override scenarios:
test/LayeredCraft.DynamoMapper.Generators.Tests/DynamoFieldVerifyTests.cs
Goal
Improve required field validation behavior in FromItem:
- Ensure requiredness rules are consistently enforced.
- Throw a purpose-built
DynamoMappingException(already exists) with useful context (mapper/type/field/member).
Implementation notes
- Prefer updating runtime Get helpers to throw
DynamoMappingExceptioninstead ofInvalidOperationException. - Include:
- mapper name
- target type
- field name
- member name
- details about what was missing
- Ensure behavior is consistent for:
- required non-nullable members
[DynamoField(Required = true/false)]overridesDefaultRequirednessmapper option
Tests
- Add verify/behavior tests for missing required fields that validate the thrown exception type/message.
Acceptance criteria
- Missing required fields throw
DynamoMappingExceptionwith actionable details. - Optional fields remain optional and do not throw.
- Tests cover both required and optional cases.
Metadata
Metadata
Assignees
Labels
No labels