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

Added bypass for AnyNullEncoder when wrapped in Immutable #25

Merged

Conversation

jayrhynas
Copy link
Contributor

@jayrhynas jayrhynas commented Feb 9, 2022

NullEncoding.swift includes a specific override of encode for AnyNullEncoder (NullEncoding.swift) to bypass the default behaviour of OptionalEncodingWrapper which would otherwise skip the property when the wrappedValue is nil.

However, Immutable also overrides encoding of wrapped OptionalEncodingWrappers (ImmutableWrapper.swift) to check if the deeply nested wrappedValue is nil or not, which means the above AnyNullEncoder override is never called.

This PR adds an additional bypass for AnyNullEncoders wrapped in AnyImmutableWrapper.

Fixes `EncodeNulls` being skipped when the wrappedValue is `nil`
@sonarcloud
Copy link

sonarcloud bot commented Feb 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@GottaGetSwifty
Copy link
Owner

Looks good, thanks for validating with a Test!

@GottaGetSwifty GottaGetSwifty merged commit 65c19ad into GottaGetSwifty:master Feb 9, 2022
@jayrhynas jayrhynas deleted the immutable-encodenulls branch February 9, 2022 22:43
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.

None yet

2 participants