Open
Description
Describe the bug
After upgrading to AWS SDK v4, it is no longer possible to create a Document from an attribute map due to the relocation of DynamoDB Streams models into a separate NuGet package.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
The attribute map from a DynamoDB stream record should be convertible into a Document object as in previous SDK versions.
Current Behavior
Argument 1: cannot convert from 'System.Collections.Generic.Dictionary<string, Amazon.DynamoDBStreams.Model.AttributeValue>' to 'System.Collections.Generic.Dictionary<string, Amazon.DynamoDBv2.Model.AttributeValue>'
Reproduction Steps
getRecordsResponse = await dynamoDBStreams.GetRecordsAsync(recordsRequest, token);
foreach (Record record in getRecordsResponse.Records)
{
Profile? oldImage = null;
if (record.Dynamodb.OldImage is not null)
{
Document oldImageDocument = Document.FromAttributeMap(record.Dynamodb.OldImage); // Error
oldImage = JsonSerializer.Deserialize<Profile>(oldImageDocument.ToJson());
}
}
Possible Solution
Provide new static method to create a Document from the DynamoDBStreams models.
Creating a Document object is required to then serialize it as a JSON. An alternative of this could be to support direct JSON serialization of the DynamoDBStreams models, as it is done in the Lambda SDK.
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.DynamoDBv2 - 4.0.1.9
AWSSDK.DynamoDBStreams - 4.0.0.11
Targeted .NET Platform
.NET 8
Operating System and version
Windows 11