Skip to content

feat: support GUID collections and set-like CLR collections#99

Merged
j-d-ha merged 6 commits intomainfrom
fix/generic-collections
Apr 9, 2026
Merged

feat: support GUID collections and set-like CLR collections#99
j-d-ha merged 6 commits intomainfrom
fix/generic-collections

Conversation

@j-d-ha
Copy link
Copy Markdown
Collaborator

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

Summary

This adds generator support for GUID-based collection shapes and broadens materialization for set-like CLR collections such as HashSet<T>. It also extends the canonical model and docs so the new collection behavior is covered by integration tests and user-facing guidance.

Changes

  • Update collection analysis and code generation so GUID collections and set-like CLR collection targets materialize correctly from DynamoDB values.
  • Extend canonical integration fixtures, assertions, and verified outputs to cover the new collection shapes.
  • Document the new set-like collection support in the core concepts docs and type matrix reference.

Validation

  • Ran dotnet test --project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj -f net10.0 -v q --no-progress --no-ansi
  • Result: 109 tests passed
  • Existing RS2001 analyzer warnings were emitted from DiagnosticDescriptors.cs during the test run

Release Notes

  • Add support for GUID collection materialization and set-like CLR collections in generated mappers.

j-d-ha added 6 commits April 9, 2026 09:28
…odel

- Added `RelatedIds`, `LegacyIds`, `AlternateIds`, `UniqueIds`, and `ContactIdsByRole` to `CanonicalModel`.
- Updated `CanonicalModelFactory` to generate test data for new GUID fields.
- Enhanced `CanonicalMapperTests` to validate round-trip mapping of GUID collections.
- Extended `CanonicalModelAssertions` to include checks for new GUID collection fields.
- Added `Collection_GuidShapes` test in `CollectionVerifyTests` for GUID collections.
…d HashSets

- Introduced `CollectionReadMaterialization` enum to define additional materialization logic.
- Enhanced `PropertyMappingCodeRenderer` to apply read materialization for arrays and HashSets.
- Added logic to handle `HashSet` materialization in `MaterializeHashSet` helper.
- Updated `CollectionInfo` to replace `IsArray` with `ReadMaterialization`.
- Enhanced `CollectionTypeAnalyzer` to infer and apply read materialization for arrays and HashSets.
- Fixed test case for `payload` property to remove redundant `.ToArray()` call.
- Added snapshots for `Collection_GuidShapes` to validate GUID collection mapping logic.
… DynamoDB

- Clarified the use of DynamoDB native set types (`SS`, `NS`, `BS`) for supported element types.
- Explained storage and materialization behavior for unsupported set element types like `Guid`, `DateTimeOffset`, and enums.
- Updated type matrix reference to describe round-trip preservation of set-like CLR shapes.
- Enhanced mapping logic to allow custom formats for scalars in collections (e.g., `Guid`, `TimeSpan`, `Enum`).
- Updated `AttributeValueExtensions` to handle nullable and non-nullable lists/maps with scalar formatting.
- Extended `TypeMappingStrategy` to include format-specific arguments for scalar collections.
- Added integration tests for round-trip validation of formatted scalar collections.
- Updated snapshots and test coverage for formatted scalar collection mapping.
- Changed categories for existing analyzer rules in `AnalyzerReleases.Unshipped.md`.
- Added release `1.2.0` details with new analyzer rules in `AnalyzerReleases.Shipped.md`.
- Updated `.editorconfig` to include formatting settings for additional files.
- Updated `VersionPrefix` in `Directory.Build.props` to prepare for the 1.3.0 release.
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.

✅ LGTM

@j-d-ha j-d-ha merged commit be26057 into main Apr 9, 2026
3 checks passed
@j-d-ha j-d-ha deleted the fix/generic-collections branch April 9, 2026 15:03
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