Extend Expression Builder for Projection expressions#4310
Open
aanton-git wants to merge 4 commits intoaws:developmentfrom
Open
Extend Expression Builder for Projection expressions#4310aanton-git wants to merge 4 commits intoaws:developmentfrom
aanton-git wants to merge 4 commits intoaws:developmentfrom
Conversation
irina-herciu
suggested changes
Jan 28, 2026
sdk/src/Services/DynamoDBv2/Custom/DocumentModel/ExpressionBuilder.cs
Outdated
Show resolved
Hide resolved
sdk/test/Services/DynamoDBv2/UnitTests/Custom/ExpressionBuilderTests.cs
Outdated
Show resolved
Hide resolved
…ameBuilder, update unit tests to reflect the changes, add changeLog file
irina-herciu
suggested changes
Jan 29, 2026
sdk/src/Services/DynamoDBv2/Custom/DocumentModel/ExpressionBuilder.cs
Outdated
Show resolved
Hide resolved
sdk/src/Services/DynamoDBv2/Custom/DocumentModel/ExpressionBuilder.cs
Outdated
Show resolved
Hide resolved
sdk/src/Services/DynamoDBv2/Custom/DocumentModel/ExpressionBuilder.cs
Outdated
Show resolved
Hide resolved
AlexDaines
requested changes
Feb 6, 2026
sdk/src/Services/DynamoDBv2/Custom/DocumentModel/ExpressionBuilder.cs
Outdated
Show resolved
Hide resolved
sdk/src/Services/DynamoDBv2/Custom/DocumentModel/ExpressionBuilder.cs
Outdated
Show resolved
Hide resolved
sdk/src/Services/DynamoDBv2/Custom/DocumentModel/ExpressionBuilder.cs
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new fluent builder for DynamoDB ProjectionExpression construction in the DocumentModel expression-building framework, aiming to reduce manual string composition and make projection building consistent with existing expression builders.
Changes:
- Introduces
ProjectionExpressionBuilderto build comma-separated projection expressions with automatic attribute name aliasing. - Adds unit tests covering single-name, nested-path, special-character, and multi-name projection scenarios (plus empty-builder exception).
- Adds a DevConfig entry for DynamoDBv2 release notes/version bump metadata.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| sdk/src/Services/DynamoDBv2/Custom/DocumentModel/ExpressionBuilder.cs | Adds new ProjectionExpressionBuilder implementation integrated with existing ExpressionBuilder/aliasing mechanism. |
| sdk/test/Services/DynamoDBv2/UnitTests/Custom/ExpressionBuilderTests.cs | Adds unit tests validating projection expression statements and generated ExpressionAttributeNames. |
| generator/.DevConfigs/264e45e8-60ef-4e07-8f70-7fb4dc554186.json | Adds release metadata for the DynamoDBv2 change. |
sdk/src/Services/DynamoDBv2/Custom/DocumentModel/ExpressionBuilder.cs
Outdated
Show resolved
Hide resolved
sdk/src/Services/DynamoDBv2/Custom/DocumentModel/ExpressionBuilder.cs
Outdated
Show resolved
Hide resolved
sdk/test/Services/DynamoDBv2/UnitTests/Custom/ExpressionBuilderTests.cs
Outdated
Show resolved
Hide resolved
GarrettBeatty
approved these changes
Feb 9, 2026
Contributor
GarrettBeatty
left a comment
There was a problem hiding this comment.
can you update the pr description with example of how user can use it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The AWS SDK for .NET does not currently provide a structured or fluent API for constructing ProjectionExpressions. Users must manually compose projection strings and manage ExpressionAttributeNames, which is error-prone and inconsistent with other AWS SDKs.
The Go SDK v2 includes a dedicated ProjectionBuilder as part of its DynamoDB expression package, enabling safe, composable construction of projection expressions with automatic attribute name aliasing.
Usage example
var projection = ProjectionExpressionBuilder
.New()
.WithName("parent.child[0].attribute1")
.AddName(NameBuilder.New("test.attribute2"))
.NamesList(NameBuilder.New("Attribute1"), NameBuilder.New("Attribute2"))
.Build();
Motivation and Context
This would:
Testing
Breaking Changes Assessment
Screenshots (if appropriate)
Types of changes
Checklist
License