Skip to content

Fixes and tests for decoding binary items and empty lists in DynamoDBEvent.Decoder#103

Merged
sebsto merged 4 commits into
awslabs:mainfrom
SongShift:main
Oct 22, 2025
Merged

Fixes and tests for decoding binary items and empty lists in DynamoDBEvent.Decoder#103
sebsto merged 4 commits into
awslabs:mainfrom
SongShift:main

Conversation

@benrosen78

Copy link
Copy Markdown
Contributor

Cleaned up version of #61 that also has tests.

This PR makes it so that in lists, the decoder will not try to access the 0th index of an empty array.

This PR will also make it so that AttributeValues of type .binary will properly decode to base64 Strings when String is put as the type in the the Decodable. To avoid including Data in the code, I included code from the original source of the base 64 decoding methods (https://github.com/fabianfett/swift-base64-kit) to add in the corresponding encoding methods. However, I saw lots of Foundation is imported throughout so I reverted it. What are your thoughts on this matter?

I also added tests that aim to make these failure points more resilient in the future.

@sebsto

sebsto commented Oct 22, 2025

Copy link
Copy Markdown
Collaborator

Thank you Ben for submitting this.

Cleaned up version of #61

Can we close that one in favor of this one ?

I saw lots of Foundation is imported throughout so I reverted it. What are your thoughts on this matter?

Data.base64EncodedString(options:) is part of FoundationEssentials, so it is OK to use that function.

@sebsto sebsto self-assigned this Oct 22, 2025
@sebsto sebsto added the 🆕 semver/minor Adds new public API. label Oct 22, 2025

@sebsto sebsto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sebsto sebsto merged commit a85c7a7 into awslabs:main Oct 22, 2025
31 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants