Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>1.0.6</VersionPrefix>
<VersionPrefix>1.0.0</VersionPrefix>
<!-- SPDX license identifier for MIT -->
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<!-- Other useful metadata -->
Expand Down
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<PackageVersion Include="AutoFixture.AutoNSubstitute" Version="4.18.1" />
<PackageVersion Include="AutoFixture.Xunit3" Version="4.19.0" />
<PackageVersion Include="AwesomeAssertions" Version="9.4.0" />
<PackageVersion Include="AWSSDK.DynamoDBv2" Version="4.0.17" />
<PackageVersion Include="AWSSDK.DynamoDBv2" Version="4.0.17.3" />
<PackageVersion Include="Basic.Reference.Assemblies.Net100" Version="1.8.4" />
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.8.4" />
<PackageVersion Include="Basic.Reference.Assemblies.Net90" Version="1.8.4" />
<PackageVersion Include="Humanizer.Core" Version="3.0.10" />
<PackageVersion Include="LayeredCraft.SourceGeneratorTools" Version="0.1.0-beta.10" />
<PackageVersion Include="Meziantou.Polyfill" Version="1.0.104" />
<PackageVersion Include="Meziantou.Polyfill" Version="1.0.105" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="5.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.3.0" />
Expand All @@ -24,7 +24,7 @@
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.201" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="Scriban" Version="7.0.0" />
<PackageVersion Include="Scriban" Version="7.0.6" />
<PackageVersion Include="Verify.SourceGenerators" Version="2.5.0" />
<PackageVersion Include="Verify.XunitV3" Version="31.13.5" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# DynamoMapper
# LayeredCraft.DynamoMapper
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

**High-performance source generator for DynamoDB attribute mapping**

[![NuGet](https://img.shields.io/nuget/v/DynamoMapper.svg)](https://www.nuget.org/packages/DynamoMapper/)
> **Migrating from `DynamoMapper`?** This package (`LayeredCraft.DynamoMapper`) is the successor to the original `DynamoMapper` NuGet package. Update your `using DynamoMapper.Runtime;` statements to `using LayeredCraft.DynamoMapper.Runtime;`.

[![NuGet](https://img.shields.io/nuget/v/LayeredCraft.DynamoMapper.svg)](https://www.nuget.org/packages/LayeredCraft.DynamoMapper/)
[![Build Status](https://github.com/LayeredCraft/dynamo-mapper/actions/workflows/build.yaml/badge.svg)](https://github.com/LayeredCraft/dynamo-mapper/actions/workflows/build.yaml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Documentation](https://img.shields.io/badge/docs-latest-blue)](https://layeredcraft.github.io/dynamo-mapper/)
Expand All @@ -29,7 +31,7 @@ DynamoMapper is a .NET incremental source generator that generates high-performa
Install the NuGet package:

```bash
dotnet add package DynamoMapper --prerelease
dotnet add package LayeredCraft.DynamoMapper --prerelease
```

Install the DynamoMapper agent skill:
Expand Down Expand Up @@ -66,7 +68,7 @@ public class Product
### 2. Create a mapper class

```csharp
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;
using Amazon.DynamoDBv2.Model;

namespace MyApp.Data;
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Marks which constructor DynamoMapper should use when generating `FromItem` for a
This attribute is applied to the **model's constructor**, not the mapper class.

```csharp
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

public class User
{
Expand Down
10 changes: 5 additions & 5 deletions docs/api-reference/generated-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ extension methods. The example below is a real-world output.

#nullable enable

using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;

namespace Trivia.Manager.Shared.Models;

internal static partial class DuplicateResultMapper
{
[global::System.CodeDom.Compiler.GeneratedCode("DynamoMapper", "1.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("LayeredCraft.DynamoMapper", "1.0.0.0")]
internal static partial global::System.Collections.Generic.Dictionary<string, global::Amazon.DynamoDBv2.Model.AttributeValue> ToItem(global::Trivia.Manager.Shared.Models.DuplicateResult duplicateResult) =>
new Dictionary<string, AttributeValue>(2)
.SetString("id", duplicateResult.Id, false, true)
.Set("score", ScoreToAttribute(duplicateResult));

[global::System.CodeDom.Compiler.GeneratedCode("DynamoMapper", "1.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("LayeredCraft.DynamoMapper", "1.0.0.0")]
internal static partial global::Trivia.Manager.Shared.Models.DuplicateResult FromItem(global::System.Collections.Generic.Dictionary<string, global::Amazon.DynamoDBv2.Model.AttributeValue> item)
{
var duplicateResult = new global::Trivia.Manager.Shared.Models.DuplicateResult
Expand All @@ -43,7 +43,7 @@ internal static partial class DuplicateResultMapper
```

Notes:
- Generated code uses `SetX`/`GetX` helpers from `DynamoMapper.Runtime`.
- Generated code uses `SetX`/`GetX` helpers from `LayeredCraft.DynamoMapper.Runtime`.
- Class-level `[DynamoField]`/`[DynamoIgnore]` configuration influences argument values.

## Constructor-Based `FromItem`
Expand All @@ -55,7 +55,7 @@ See [Basic Mapping](../usage/basic-mapping.md#constructor-mapping-rules-fromitem
constructor selection rules and gotchas.

```csharp
[global::System.CodeDom.Compiler.GeneratedCode("DynamoMapper", "REPLACED")]
[global::System.CodeDom.Compiler.GeneratedCode("LayeredCraft.DynamoMapper", "REPLACED")]
public static partial global::MyNamespace.Product FromItem(
global::System.Collections.Generic.Dictionary<string, global::Amazon.DynamoDBv2.Model.AttributeValue> item
)
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/runtime-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The runtime package exposes extension methods on

## Core Value Helpers

These methods live in `DynamoMapper.Runtime` and are used by the generator.
These methods live in `LayeredCraft.DynamoMapper.Runtime` and are used by the generator.

String:
- `GetString`, `GetNullableString`
Expand Down
9 changes: 8 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# Changelog

All notable changes to DynamoMapper will be documented here.
All notable changes to LayeredCraft.DynamoMapper will be documented here.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Breaking Changes

- **Package renamed**: NuGet package renamed from `DynamoMapper` to `LayeredCraft.DynamoMapper`. This package supersedes `DynamoMapper`.
- **Namespace renamed**: All public namespaces changed from `DynamoMapper.Runtime` to `LayeredCraft.DynamoMapper.Runtime`.
- Update all `using DynamoMapper.Runtime;` to `using LayeredCraft.DynamoMapper.Runtime;`.
- **Assembly renamed**: Runtime assembly is now `LayeredCraft.DynamoMapper.Runtime.dll`.

### Added
- Nested object and nested collection mapping in the source generator.
- Mapper registry lookup with inline fallback for nested types.
Expand Down
6 changes: 3 additions & 3 deletions docs/core-concepts/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,22 @@ DynamoMapper generates:

#nullable enable

using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;

namespace MyApp;

public static partial class ProductMapper
{
[global::System.CodeDom.Compiler.GeneratedCode("DynamoMapper", "REPLACED")]
[global::System.CodeDom.Compiler.GeneratedCode("LayeredCraft.DynamoMapper", "REPLACED")]
public static partial global::System.Collections.Generic.Dictionary<string, global::Amazon.DynamoDBv2.Model.AttributeValue> ToItem(global::MyApp.Product source) =>
new Dictionary<string, AttributeValue>(3)
.SetGuid("productId", source.ProductId, false, true)
.SetString("name", source.Name, false, true)
.SetDecimal("price", source.Price, false, true);

[global::System.CodeDom.Compiler.GeneratedCode("DynamoMapper", "REPLACED")]
[global::System.CodeDom.Compiler.GeneratedCode("LayeredCraft.DynamoMapper", "REPLACED")]
public static partial global::MyApp.Product FromItem(global::System.Collections.Generic.Dictionary<string, global::Amazon.DynamoDBv2.Model.AttributeValue> item)
{
var product = new global::MyApp.Product
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/inheritance-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To include inherited properties, enable the mapper option:
```csharp
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

namespace MyApp.Data;

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/nested-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The `examples/DynamoMapper.Nested` project demonstrates:
```csharp
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

[DynamoMapper]
public static partial class OrderMapper
Expand Down
13 changes: 10 additions & 3 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Installation

This guide walks you through installing DynamoMapper in your .NET project.
This guide walks you through installing LayeredCraft.DynamoMapper in your .NET project.

!!! note "Migrating from `DynamoMapper`"
`LayeredCraft.DynamoMapper` replaces the original `DynamoMapper` NuGet package. If you are upgrading:

1. Uninstall the old package: `dotnet remove package DynamoMapper`
2. Install the new package: `dotnet add package LayeredCraft.DynamoMapper --prerelease`
3. Update all `using LayeredCraft.DynamoMapper.Runtime;` statements to `using LayeredCraft.DynamoMapper.Runtime;`

## Prerequisites

Expand All @@ -13,7 +20,7 @@ This guide walks you through installing DynamoMapper in your .NET project.
Add the DynamoMapper package to your project:

```bash
dotnet add package DynamoMapper --prerelease
dotnet add package LayeredCraft.DynamoMapper --prerelease
```

This installs both the source generator and runtime packages.
Expand Down Expand Up @@ -43,7 +50,7 @@ Ensure your project uses C# 11 or later in your `.csproj` file:
Create a simple test mapper to verify installation:

```csharp
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;
using Amazon.DynamoDBv2.Model;

[DynamoMapper]
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum OrderStatus
## Step 2: Create a Mapper

```csharp
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;
using Amazon.DynamoDBv2.Model;

namespace MyApp.Data;
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ DynamoMapper requires:

DynamoMapper packages target:

- **Runtime package** (`DynamoMapper.Runtime`): .NET Standard 2.0
- **Generator package** (`DynamoMapper`): .NET Standard 2.0
- **Runtime package** (`LayeredCraft.DynamoMapper.Runtime`): .NET Standard 2.0
- **Generator package** (`LayeredCraft.DynamoMapper`): .NET Standard 2.0

This means you can use DynamoMapper in projects targeting:

Expand Down
6 changes: 4 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# DynamoMapper
# LayeredCraft.DynamoMapper

**High-performance source generator for DynamoDB attribute mapping**

> **Migrating from `DynamoMapper`?** This package (`LayeredCraft.DynamoMapper`) replaces the original `DynamoMapper` NuGet package. Update your using statements from `using LayeredCraft.DynamoMapper.Runtime;` to `using LayeredCraft.DynamoMapper.Runtime;`.

---

## Overview
Expand Down Expand Up @@ -92,4 +94,4 @@ npx skills add https://github.com/LayeredCraft/dynamo-mapper --skill dynamo-mapp

- **Documentation**: [https://layeredcraft.github.io/dynamo-mapper/](https://layeredcraft.github.io/dynamo-mapper/)
- **GitHub**: [https://github.com/LayeredCraft/dynamo-mapper](https://github.com/LayeredCraft/dynamo-mapper)
- **NuGet**: [https://www.nuget.org/packages/DynamoMapper/](https://www.nuget.org/packages/DynamoMapper/)
- **NuGet**: [https://www.nuget.org/packages/LayeredCraft.DynamoMapper/](https://www.nuget.org/packages/LayeredCraft.DynamoMapper/)
12 changes: 6 additions & 6 deletions docs/roadmap/phase-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Phase 1 must provide:
- Clear runtime exceptions for missing required fields.

6. **Packaging**
- `DynamoMapper` (generator/analyzer) depends on `DynamoMapper.Runtime` (attributes + helpers).
- `DynamoMapper` (generator/analyzer) depends on `LayeredCraft.DynamoMapper.Runtime` (attributes + helpers).

---

Expand All @@ -58,9 +58,9 @@ Phase 1 must provide:
#### 2.1.1 `DynamoMapper` (Generator Package)
- Ships the incremental generator as an analyzer.
- Provides no public runtime API beyond referencing runtime package.
- Depends on `DynamoMapper.Runtime`.
- Depends on `LayeredCraft.DynamoMapper.Runtime`.

#### 2.1.2 `DynamoMapper.Runtime` (Runtime Package)
#### 2.1.2 `LayeredCraft.DynamoMapper.Runtime` (Runtime Package)
- Ships public attributes, runtime exception types, and helper APIs.
- Ships `AttributeValue` extension helpers usable independently from generator.

Expand Down Expand Up @@ -826,7 +826,7 @@ Must recognize:

---

## 14. Runtime Helpers (DynamoMapper.Runtime)
## 14. Runtime Helpers (LayeredCraft.DynamoMapper.Runtime)

### 14.1 AttributeValue Extensions (Consumer-Facing)
Provide extension methods similar to:
Expand Down Expand Up @@ -893,7 +893,7 @@ The README is intentionally brief and focused on first-use success. It should as
**README.md must include:**
- What is DynamoMapper?
- Install instructions:
- `DynamoMapper` vs `DynamoMapper.Runtime`
- `DynamoMapper` vs `LayeredCraft.DynamoMapper.Runtime`
- Quick start example
- Configuration reference (attributes)
- Supported types
Expand All @@ -908,7 +908,7 @@ GitHub Pages is the primary long-form documentation site for DynamoMapper and mu
**GitHub Pages must include:**

- Conceptual overview (why DynamoMapper exists)
- Installation guide (`DynamoMapper` vs `DynamoMapper.Runtime`)
- Installation guide (`DynamoMapper` vs `LayeredCraft.DynamoMapper.Runtime`)
- Attribute reference (full API docs)
- Naming conventions and defaults
- Required vs optional behavior
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/basic-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The mapper itself remains the same:
```csharp
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

namespace MyApp.Data;

Expand Down Expand Up @@ -199,7 +199,7 @@ public record Person(string FirstName, string LastName, int Age);
If your class has get-only properties, DynamoMapper can deserialize using a constructor:

```csharp
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

public class Person
{
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/customization-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static partial void AfterFromItem(Dictionary<string, AttributeValue> item, ref T

```csharp
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

[DynamoMapper(Convention = DynamoNamingConvention.CamelCase)]
public static partial class ProductMapper
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/field-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ models.
## Basic Usage

```csharp
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

[DynamoMapper]
[DynamoField(nameof(Product.Name), AttributeName = "productName", Required = true)]
Expand Down
2 changes: 1 addition & 1 deletion examples/DynamoMapper.FieldLevelOverride/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

// Example enum definitions
var exampleAttributes = new Dictionary<string, AttributeValue>
Expand Down
4 changes: 2 additions & 2 deletions examples/DynamoMapper.Inheritance/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

namespace DynamoMapper.Inheritance;
namespace LayeredCraft.DynamoMapper.Inheritance;

[DynamoMapper]
internal static partial class OrderMapper_Default
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

namespace DynamoMapper.MapperConstructor;
namespace LayeredCraft.DynamoMapper.MapperConstructor;

[DynamoMapper]
public static partial class PersonClassMapper
Expand Down
4 changes: 2 additions & 2 deletions examples/DynamoMapper.MapperConstructor/RecordMapper.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

namespace DynamoMapper.MapperConstructor;
namespace LayeredCraft.DynamoMapper.MapperConstructor;

[DynamoMapper]
public static partial class PersonRecordMapper
Expand Down
4 changes: 2 additions & 2 deletions examples/DynamoMapper.Nested/MapperBasedNested.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;
using LayeredCraft.DynamoMapper.Runtime;

namespace DynamoMapper.Nested;
namespace LayeredCraft.DynamoMapper.Nested;

/// <summary>
/// Example: Mapper-based nested object - Author has its own mapper
Expand Down
Loading
Loading