Priority: P2 - Important
Tier: 3 - Advanced Features
Effort: Medium (4-6 hours)
Already In Codebase
[DynamoField(Kind = ...)] is already parsed and threaded into generated calls.
- Parsing:
src/LayeredCraft.DynamoMapper.Generators/MapperSyntaxProvider.cs
- Strategy selection + kind threading:
src/LayeredCraft.DynamoMapper.Generators/PropertyMapping/TypeMappingStrategyResolver.cs and src/LayeredCraft.DynamoMapper.Generators/PropertyMapping/PropertyMappingSpecBuilder.cs
- The generator currently rejects Phase-2 collection kinds (
L/M/SS/NS/BS) with DM0001 (CannotConvertFromAttributeValue).
- There is a snapshot test demonstrating kind override usage:
test/LayeredCraft.DynamoMapper.Generators.Tests/DynamoFieldVerifyTests.cs.
Goal
Add compatibility validation and diagnostics for Kind overrides.
Today kind overrides are effectively "pass-through" (codegen compiles) but can lead to runtime NotImplementedException (e.g., DynamoKind.B) or confusing parsing behavior.
Scope
- Validate that
Kind overrides are compatible with the CLR property type and the runtime extension methods.
- Emit generator diagnostics (rather than letting invalid combinations fail at runtime).
Examples
string + DynamoKind.S is valid.
string + DynamoKind.B should emit a diagnostic until binary support is implemented.
Guid + DynamoKind.S and Guid + DynamoKind.N may be allowed, but should be intentionally validated.
Implementation notes
- Add a validator (e.g.,
KindValidator) that runs after type strategy resolution.
- Expand diagnostics beyond
DM0001 for invalid kind override combinations.
- Keep the current behavior of rejecting
L/M/SS/NS/BS until Story 5.1 (collections) is implemented.
Acceptance criteria
- Invalid kind overrides produce clear compile-time diagnostics.
- Valid kind overrides continue to generate correct code.
- Tests cover at least one valid and one invalid kind override.
Priority: P2 - Important
Tier: 3 - Advanced Features
Effort: Medium (4-6 hours)
Already In Codebase
[DynamoField(Kind = ...)]is already parsed and threaded into generated calls.src/LayeredCraft.DynamoMapper.Generators/MapperSyntaxProvider.cssrc/LayeredCraft.DynamoMapper.Generators/PropertyMapping/TypeMappingStrategyResolver.csandsrc/LayeredCraft.DynamoMapper.Generators/PropertyMapping/PropertyMappingSpecBuilder.csL/M/SS/NS/BS) withDM0001(CannotConvertFromAttributeValue).test/LayeredCraft.DynamoMapper.Generators.Tests/DynamoFieldVerifyTests.cs.Goal
Add compatibility validation and diagnostics for
Kindoverrides.Today kind overrides are effectively "pass-through" (codegen compiles) but can lead to runtime
NotImplementedException(e.g.,DynamoKind.B) or confusing parsing behavior.Scope
Kindoverrides are compatible with the CLR property type and the runtime extension methods.Examples
string+DynamoKind.Sis valid.string+DynamoKind.Bshould emit a diagnostic until binary support is implemented.Guid+DynamoKind.SandGuid+DynamoKind.Nmay be allowed, but should be intentionally validated.Implementation notes
KindValidator) that runs after type strategy resolution.DM0001for invalid kind override combinations.L/M/SS/NS/BSuntil Story 5.1 (collections) is implemented.Acceptance criteria