RxCodable
RxCodable copied to clipboard
add toDictionary, toJSONString
My project using Firebase, needs convertings between Model and Dictionary, [String:Any]. So I added "toDictionary()" and "toJSONString()" for POST request
- when error occured, toDictionay() and toJSONString() returns empty not nil , followed your map() that returns empty Data when error
- respected your coding convention, 2 space indent, and space after colon
Codecov Report
Merging #2 into master will decrease coverage by
4.87%. The diff coverage is83.56%.
@@ Coverage Diff @@
## master #2 +/- ##
==========================================
- Coverage 92.5% 87.62% -4.88%
==========================================
Files 4 3 -1
Lines 40 97 +57
Branches 3 0 -3
==========================================
+ Hits 37 85 +48
- Misses 0 12 +12
+ Partials 3 0 -3
| Impacted Files | Coverage Δ | |
|---|---|---|
| Sources/RxCodable/ObservableType+RxCodable.swift | 87.09% <82.6%> (-3.82%) |
:arrow_down: |
| Sources/RxCodable/Single+RxCodable.swift | 87.87% <84%> (-3.04%) |
:arrow_down: |
| Sources/RxCodable/Maybe+RxCodable.swift | 87.87% <84%> (-3.04%) |
:arrow_down: |
| Sources/TestUtil/Fixture.swift |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 3e4c053...ef78616. Read the comment docs.
-
toDictionary(),toJSONString()got parameterJSONEncoderas first with no name. -
toDoctionary()throwsRxError.noElements.RxError.noElementsseems not exactly matched, but I don't want to create new ErrorType - UnitTest added, that shows [Encodable] ==> JSON string.