dynamodb-toolbox icon indicating copy to clipboard operation
dynamodb-toolbox copied to clipboard

DynamoDB createSet after transform call

Open mohit-singh-pepper opened this issue 3 years ago • 1 comments

We feed arrays to dynamo-toolbox and it converts it to set. But dynamoDB or aws-sdk can't handle empty array.

dymanoDB.createSet([]) // throws error

I tried to mitigate this through transform but transform as following:

{ numSet: {type: 'set', setType: 'number', transform: v => Array.isArray(v) && v.length ? v : null }

But transform runs after createSet which doesn't make sense because then value of transform function is a dynamo set wrapper instead of array which I passed.

mohit-singh-pepper avatar Jul 21 '22 09:07 mohit-singh-pepper

Thanks for reporting this. We'll take a look.

jeremydaly avatar Jul 22 '22 14:07 jeremydaly