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 #1247 support nil case when decoding optionals #1248

Merged
merged 2 commits into from
Mar 22, 2024

Conversation

Chris-Stockbridge
Copy link

#1247 describes a bug where decoding a nil value in an optional throws an error when nil is a valid response.

This same bug occurs with arrays or structs encoded to either optional string or data types.

Testing

I added a unit test "test_insert_custom_encodable_type" which demonstrates the issue. The current master branch fails when decoding a nil value.

Chris Stockbridge added 2 commits March 5, 2024 11:16
Copy link
Collaborator

@nathanfallet nathanfallet left a comment

Choose a reason for hiding this comment

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

You're right! decodeIfPresent was added not a long ago, and that's its goal to return nil instead of throwing. I missed that point in the review.

@nathanfallet nathanfallet merged commit c361380 into stephencelis:master Mar 22, 2024
2 checks passed
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.

2 participants