Skip to content

0.5.0 Migration guide

Johannes Lund edited this page Sep 12, 2016 · 6 revisions

Breaking Changes

Dedicated KeyPath and OptionalKeyPath are used instead of strings.

Still ok:

let value = json => "a" => "b" => "c" // still ok
let value = json =>? "a" => "b" => "c" // still ok

Doesn't work:

let key = "a"
let value = json => a

Please use:

let key = "a"
let value = json => KeyPath(a)

Errors are now enums once gain

-MissingKeyError
+DecodingError.missingKey(key)
-TypeMismatchError
+DecodingError.typeMismatch(expected, actual, metadata)
-RawRepresentableInitializationError
+DecodingError.rawRepresentableInitializationError(rawValue, metadata)

Any is now used instead of AnyObject

This applies everywhere. E.g

static func decode(_ json: Any) throws -> Self