OneTable removes empty strings in nested objects #540
Labels
bug
Something isn't working
discussion
Question or issue being discussed
fixed
Issue has been fixed in the repo
I noticed an issue with create/update methods where Model fields with
type: Object
that have empty strings are being removed unless you use thenulls: true
param. For example:would lead to an object in the table that looks like:
The property
b
, ends up missing.After reviewing the code in
Model.js
, I noticed the lines:https://github.com/sensedeep/dynamodb-onetable/blob/main/src/Model.js#L1617-L1622
and
https://github.com/sensedeep/dynamodb-onetable/blob/main/src/Model.js#L1999-L2001
Which reference an old issue where DynamoDB did not support storing empty strings.
This is no longer the case as of 2020. I was using this feature in DynamoDB-Toolbox previously:
https://aws.amazon.com/about-aws/whats-new/2020/05/amazon-dynamodb-now-supports-empty-values-for-non-key-string-and-binary-attributes-in-dynamodb-tables/
At the time that code was written it may have been accurate, but now I would consider it a bug. I'm working around this with
nulls: true
andtransform
for now. Any chance we could get this code updated?The text was updated successfully, but these errors were encountered: