Skip to content
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

Fix #update, #update!, .update_fields, .upsert and save empty Set and String as nil #626

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

andrykonchin
Copy link
Member

@andrykonchin andrykonchin commented Jan 11, 2023

There is a limitation of DynamoDB - a Set cannot be empty (documentation). An attempt to save such incorrect value leads to a validation error. So in Dynamoid at saving an empty Set is replaced with nil to prevent raising exception.

Here we fix some missing cases when empty Set is not replaced with nil.

There was a yet another DynamoDB limitation - we couldn't save empty String. This is not actual anymore but Dynamoid still replaces empty Strings with nil as well. It should be changed in some future release.

Fixed methods:

  • #update, #update!
  • .update_fields
  • .upsert

@andrykonchin andrykonchin requested a review from pboling January 11, 2023 23:34
@codecov
Copy link

codecov bot commented Jan 11, 2023

Codecov Report

Merging #626 (56df2a5) into master (0df1e6f) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #626      +/-   ##
==========================================
+ Coverage   90.15%   90.17%   +0.01%     
==========================================
  Files          60       60              
  Lines        3048     3054       +6     
==========================================
+ Hits         2748     2754       +6     
  Misses        300      300              
Impacted Files Coverage Δ
...dynamoid/adapter_plugin/aws_sdk_v3/item_updater.rb 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@andrykonchin andrykonchin force-pushed the fix-saving-empty-set-and-string branch from 6908d4d to 56df2a5 Compare January 11, 2023 23:38
@github-actions
Copy link

Code Coverage

Package Line Rate Health
dynamoid 90%
Summary 90% (2754 / 3054)

Minimum allowed line rate is 90%

@andrykonchin andrykonchin merged commit 13ee680 into master Jan 12, 2023
@andrykonchin andrykonchin deleted the fix-saving-empty-set-and-string branch January 12, 2023 19:06
@andrykonchin andrykonchin added this to the v3.9.0 milestone Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant