-
Notifications
You must be signed in to change notification settings - Fork 859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DynamoDBv2: Document.FromAttributeMap Fails to Handle M or L if NULL is set to false #1887
Comments
Here is a unit test that will expose the issue: #r "nuget:AWSSDK.DynamoDBv2/3.7.0.45"
#r "nuget:xunit/2.4.1"
using System.Text.Json;
using Amazon.DynamoDBv2.DocumentModel;
using Amazon.DynamoDBv2.Model;
using Xunit;
var mapJson = @"{
""Account"": {
""B"": null,
""BOOL"": false,
""IsBOOLSet"": false,
""BS"": [],
""L"": [],
""IsLSet"": false,
""M"": {
""Name"": {
""B"": null,
""BOOL"": false,
""IsBOOLSet"": false,
""BS"": [],
""L"": [],
""IsLSet"": false,
""M"": {},
""IsMSet"": false,
""N"": null,
""NS"": [],
""NULL"": false,
""S"": ""Test Account"",
""SS"": []
}
},
""IsMSet"": true,
""N"": null,
""NS"": [],
""NULL"": false,
""S"": null,
""SS"": []
}
}";
var map = JsonSerializer.Deserialize<Dictionary<string, AttributeValue>>(mapJson);
var doc = Document.FromAttributeMap(map);
Assert.NotNull(doc);
Assert.True(doc.ContainsKey("Account"));
Assert.NotNull(doc["Account"]);
var accountDoc = doc["Account"].AsDocument();
Assert.NotNull(accountDoc);
Assert.True(accountDoc.ContainsKey("Name"));
Assert.Equal("Test Account", accountDoc["Name"]); |
@david-beckman I'm able to see that |
Also revisit #1980 since it appears to be a related issue. |
I re-ran that unit test above and it now passes; it looks like it was fixed between 3.7.3.23 & 3.7.3.24. I am closing this issue. |
|
Steps to reproduce:
Dictionary<string, AttributeValue>
such that at least one of theAttributeValue
instances hasM
orL
set. Also update saidAttributeValue
such thatNULL
isfalse
. An easy way to do that is via JSON Deserialization:Document
from this attribute map viaDocument.FromAttributeMap
Expected Behavior:
The value is set to the correct
Document
instanceActual Behavior:
The value is set to
DynamoDBNull
Technical Details
In the
AttributeValueToDynamoDBEntry
method,TryToDynamoDBNull
is called prior toTryToDynamoDBList
orTryToDocument
and it is returningDynamoDBNull
incorrectly. The call toattributeValue.IsSetNULL
should beattributeValue.NULL
instead.The text was updated successfully, but these errors were encountered: