-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
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.csandsrc/LayeredCraft.DynamoMapper.Generators/PropertyMapping/PropertyMappingSpecBuilder.cs
- Parsing:
- The generator currently rejects Phase-2 collection kinds (
L/M/SS/NS/BS) withDM0001(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
Kindoverrides 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.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
- Add a validator (e.g.,
KindValidator) that runs after type strategy resolution. - Expand diagnostics beyond
DM0001for invalid kind override combinations. - Keep the current behavior of rejecting
L/M/SS/NS/BSuntil 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.
Metadata
Metadata
Assignees
Labels
No labels