JARMourato / Kodable

A supercharged extension of Codable
MIT License
83 stars 6 forks source link

Improve encoding of null values #7

Closed JARMourato closed 3 years ago

JARMourato commented 3 years ago

Fixes the default behaviour, where nil values were encoded as null. Now it skips nil values, following default Codable behaviour.

It adds an option to force nil values to be encoded as null by doing

@Coding(encodeAsNullIfNil: true) var lastName: String?

Resolves #6

codecov-commenter commented 3 years ago

Codecov Report

Merging #7 (ace5849) into main (6d8f825) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main        #7   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines          367       377   +10     
=========================================
+ Hits           367       377   +10     
Impacted Files Coverage Δ
Sources/Extensions/Optional+Utilities.swift 100.00% <100.00%> (ø)
Sources/Kodable/Codable+AnyCodingKey.swift 100.00% <100.00%> (ø)
Sources/Kodable/KodableTransformable.swift 100.00% <100.00%> (ø)
Sources/Wrappers/CodableDate.swift 100.00% <100.00%> (ø)
Sources/Wrappers/Coding.swift 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6d8f825...ace5849. Read the comment docs.