1728 - Enhance/Fix ByteArrayConverter to support base64 deserialization of byte[]#1736
Merged
1728 - Enhance/Fix ByteArrayConverter to support base64 deserialization of byte[]#1736
Conversation
…base64 encoded strings.
Contributor
Author
|
One callout: serialization will still convert a byte[] to an array of numbers (ints) in json. No good way of supporting both write formats in one converter. But in this approach, at least reading/deserializing can be flexible. |
normj
approved these changes
Apr 21, 2024
Member
normj
left a comment
There was a problem hiding this comment.
Thanks for the fix. I agree there isn't really anything we can do for writes without some pre knowledge of what the format is supposed to be.
If you want bump the version in the project file to 2.4.3 that will save us from creating another version bump BR. https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.Serialization.SystemTextJson/Amazon.Lambda.Serialization.SystemTextJson.csproj#L12C10-L12C23
ashishdhingra
approved these changes
Apr 22, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: 1728
Description of changes:
Add support for deserializing a base64
stringto abyte[].If the token is a string, assume it is base64 encoded string and get bytes.
Otherwise, continue to do what it did before.
I added xunit tests for both conditions. To ensure my desired behavior works, and the existing behavior also works. I'm not strong in xunit, so if there are tweaks needed, please advise. Also wasn't sure where the best home/project for those tests might be.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.