Replace legacy DeleteItem params#4364
Conversation
irina-herciu
left a comment
There was a problem hiding this comment.
make sure all changes are covered with unit tests
|
@irina-herciu @aanton-git I apologize but today's release included a massive refactoring of the SDK integration tests. I updated them to: use xUnit for parallelism, target .NET 8 in addition to .NET Framework, and (for DynamoDB specifically) split the large document / data model tests into separate classes (new structure is https://github.com/aws/aws-sdk-net/tree/main/sdk/test/Services/DynamoDBv2/IntegrationTests). Unfortunately you'll need to rebase your branches, but hopefully this change makes adding new tests / troubleshooting easier in the future (not to mention actually testing non |
1459ec3 to
28d3796
Compare
28d3796 to
f258868
Compare
There was a problem hiding this comment.
Pull request overview
Updates the DynamoDBv2 DataModel delete flow to stop constructing legacy Expected/ConditionalOperator conditions and instead build expression-based ConditionExpression for version checks, aligning DeleteItem/DeleteItemAsync with AWS-recommended patterns.
Changes:
- Refactors DataModel delete-by-entity path to build an internal document-model delete request that can carry a
ConditionalExpression. - Introduces a shared delete request base type and updates the document-model delete pipeline/table helpers to accept it.
- Adds/updates unit + integration tests to validate version-check and
SkipVersionCheckdelete behaviors.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/test/Services/DynamoDBv2/UnitTests/Custom/DataModel/ContextInternalTests.cs | Adds versioned entity + unit tests validating ConditionExpression vs SkipVersionCheck. |
| sdk/test/Services/DynamoDBv2/IntegrationTests/DataModel/DataModelMultiTableTests.cs | Adds integration coverage for delete with/without version checks. |
| sdk/src/Services/DynamoDBv2/Custom/DocumentModel/Table.cs | Updates internal delete helper overloads to accept the new shared base request type. |
| sdk/src/Services/DynamoDBv2/Custom/DocumentModel/InternalDeleteItemDocumentOperationRequest.cs | Adds internal request type used by DataModel delete path to pass low-level key + expressions. |
| sdk/src/Services/DynamoDBv2/Custom/DocumentModel/DocumentOperationRequest.cs | Introduces BaseDeleteItemDocumentOperationRequest and moves delete expression/return-values members onto it. |
| sdk/src/Services/DynamoDBv2/Custom/DocumentModel/DocumentOperationPipeline.cs | Updates delete pipeline to handle both public and internal delete request shapes. |
| sdk/src/Services/DynamoDBv2/Custom/DataModel/Context.cs | Refactors delete-by-entity to use expression-based version condition via internal request. |
| generator/.DevConfigs/264e45e8-60ef-4e07-8f70-7fb4dc554187.json | Adds DevConfig entry for the DynamoDBv2 change. |
| "services": [ | ||
| { | ||
| "serviceName": "DynamoDBv2", | ||
| "type": "patch", |
There was a problem hiding this comment.
New public API is being added/changed in this PR (e.g., introducing BaseDeleteItemDocumentOperationRequest and changing DeleteItemDocumentOperationRequest's base type). Per DevConfig guidance, this should likely be a minor bump rather than patch to reflect the public surface area change.
| "type": "patch", | |
| "type": "minor", |
Description
DeleteAsync<[DynamicallyAccessedMembers(InternalConstants.DataModelModeledType) ends up in DeleteHelperAsync<[DynamicallyAccessedMembers(InternalConstants.DataModelModeledType), which still uses legacy Expected and ConditionalOperator. AWS recommends ConditionExpression instead. Update delete request construction to use expression-based conditions.
Motivation and Context
• Context.Async.cs:184 → DeleteAsync<[DynamicallyAccessedMembers(InternalConstants.DataModelModeledType)
• Context.cs → DeleteHelperAsync<[DynamicallyAccessedMembers(InternalConstants.DataModelModeledType)
• Table.cs → DeleteHelperAsync<[DynamicallyAccessedMembers(InternalConstants.DataModelModeledType) builds DeleteItemRequest
Testing
-feature branch mocked client benchmarks
-development branch mocked client benchmarks
Breaking Changes Assessment
Screenshots (if appropriate)
Types of changes
Checklist
License