You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+4-2
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# How to contribute
2
2
3
-
There are a few guidelines that we need contributors to follow so that we are able to process requests as efficiently as possible. If you have any questions or concerns please feel free to contact us at [[email protected]](mailto:[email protected]).
3
+
There are a few guidelines that we need contributors to follow so that we are able to process requests as efficiently as possible.
Copy file name to clipboardexpand all lines: Documentation/Elevate 2.0 Migration Guide.md
+25-9
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# Elevate 2.0 Migration Guide
2
2
3
-
Elevate 2.0 is the latest major release of Elevate, a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable for iOS, macOS, tvOS and watchOS. As a major release, following Semantic Versioning conventions, 2.0 introduces several API-breaking changes that one should be aware of.
3
+
Elevate 2.0 is the latest major release of Elevate, a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable for iOS, macOS, tvOS and watchOS.
4
+
As a major release, following Semantic Versioning conventions, 2.0 introduces several API-breaking changes that one should be aware of.
4
5
5
6
This guide is provided in order to ease the transition of existing applications using Elevate 1.x to the latest APIs, as well as explain the design and structure of new and changed functionality.
In general, we try to avoid MAJOR version bumps unless absolutely necessary. We realize the difficulty of transitioning between MAJOR version API changes. Elevate 2.0 was unavoidable due to the drastic API changes introduced by Apple in Swift 3. There was no possible way to adhere to the new Swift [API Design Guidelines](https://swift.org/documentation/api-design-guidelines/) and not bump the MAJOR version.
14
+
In general, we try to avoid MAJOR version bumps unless absolutely necessary.
15
+
We realize the difficulty of transitioning between MAJOR version API changes.
16
+
Elevate 2.0 was unavoidable due to the drastic API changes introduced by Apple in Swift 3.
17
+
There was no possible way to adhere to the new Swift [API Design Guidelines](https://swift.org/documentation/api-design-guidelines/) and not bump the MAJOR version.
14
18
15
-
Since we knew we had to cut a MAJOR release to support Swift 3, we decided to package up a few API changes as well while we were at it. These changes are covered in detail in the [Breaking API Changes](#breaking-api-changes) section below.
19
+
Since we knew we had to cut a MAJOR release to support Swift 3, we decided to package up a few API changes as well while we were at it.
20
+
These changes are covered in detail in the [Breaking API Changes](#breaking-api-changes) section below.
16
21
17
22
The changes to the Elevate API were primarily naming changes and the majority of them can be made through a global Find and Replace operation.
18
23
@@ -29,13 +34,15 @@ While these benefits are nice, the core motivation for updating to Elevate 2.0 s
29
34
30
35
## Breaking API Changes
31
36
32
-
Elevate 2.0 contains breaking API changes that primarily consist of renaming existing type, method and parameter names. In addition, all protocols and APIs were updated to use `Any` rather than `AnyObject` types to match Apple's `JSONSerialization` API.
37
+
Elevate 2.0 contains breaking API changes that primarily consist of renaming existing type, method and parameter names.
38
+
In addition, all protocols and APIs were updated to use `Any` rather than `AnyObject` types to match Apple's `JSONSerialization` API.
33
39
34
40
### Swift 3
35
41
36
42
#### AnyObject to Any
37
43
38
-
In Swift 3, the `NSJSONSerialization` API became `JSONSerialization` and returns `[String: Any]` dictionaries rather than `[String: AnyObject]` dictionaries. We followed suit and updated all protocols and APIs to use `Any`.
44
+
In Swift 3, the `NSJSONSerialization` API became `JSONSerialization` and returns `[String: Any]` dictionaries rather than `[String: AnyObject]` dictionaries.
45
+
We followed suit and updated all protocols and APIs to use `Any`.
39
46
40
47
Here's a look at the old `Decodable` and `Decoder` protocols.
41
48
@@ -66,7 +73,10 @@ All you need to do here is update your protocol conformance to use `Any` and als
66
73
67
74
#### Parse Object and Parse Array become Decode Object and Decode Array
68
75
69
-
The `Parser.parseObject` and `Parser.parseArray` APIs are provided as convenience methods to parse a top-level key path in a JSON document without having to build a schema for it. These methods do not actually perform the work of parsing, they simply create a lightweight schema for you and call the actual parsing APIs on your behalf. To clarify the intent and usage of these APIs they have been updated to `Elevate.decodeObject` and `Elevate.decodeArray` respectively. The parameter names have also been updated to follow Swift 3 API Design Guideline naming conventions.
76
+
The `Parser.parseObject` and `Parser.parseArray` APIs are provided as convenience methods to parse a top-level key path in a JSON document without having to build a schema for it.
77
+
These methods do not actually perform the work of parsing, they simply create a lightweight schema for you and call the actual parsing APIs on your behalf.
78
+
To clarify the intent and usage of these APIs they have been updated to `Elevate.decodeObject` and `Elevate.decodeArray` respectively.
79
+
The parameter names have also been updated to follow Swift 3 API Design Guideline naming conventions.
70
80
71
81
Here are the previous APIs in use:
72
82
```swift
@@ -85,7 +95,9 @@ Many of these changes can be made with a global find and replace operation.
85
95
86
96
#### Creating a Schema and Parsing It
87
97
88
-
Elevate has always followed a maker pattern to build up the list of properties that you expect to be parsed for a given JSON document. The previous API was concise and read well, but did not clearly communicate what the developer was actually doing while following the pattern. The updated APIs more clearly represent the activity of building a schema in the body of the closure and parsing it.
98
+
Elevate has always followed a maker pattern to build up the list of properties that you expect to be parsed for a given JSON document.
99
+
The previous API was concise and read well, but did not clearly communicate what the developer was actually doing while following the pattern.
100
+
The updated APIs more clearly represent the activity of building a schema in the body of the closure and parsing it.
89
101
90
102
Here is an example of the previous set of APIs.
91
103
```swift
@@ -113,8 +125,12 @@ let entity = try Parser.parseEntity(json: json) { schema in
113
125
114
126
The `Parser.parseProperties` API has been updated to `Parser.parseEntity` to more clearly reflect the work that it is doing to parse the entity defined by your schema from the JSON document.
115
127
116
-
We highly recommend that you update the closure parameter name from `make` to `schema` throughout your code base. Schema more accurately communicates what is being built in the closure. The `propertyForKeyPath` API has also been updated to `addProperty` to reflect that each property is being added to the schema being built.
128
+
We highly recommend that you update the closure parameter name from `make` to `schema` throughout your code base.
129
+
Schema more accurately communicates what is being built in the closure.
130
+
The `propertyForKeyPath` API has also been updated to `addProperty` to reflect that each property is being added to the schema being built.
117
131
118
132
#### Other Changes
119
133
120
-
To more accurately reflect their purpose the `ParserPropertyMaker` and `ParserProperty` APIs were updated to `Schema` and `SchemaProperty` respectively. You typically won't have references to these types directly in your source code. In addition, the enum used to indicate the type of each JSON property was updated from `JSONPropertyType` to `SchemaPropertyProtocol`.
134
+
To more accurately reflect their purpose the `ParserPropertyMaker` and `ParserProperty` APIs were updated to `Schema` and `SchemaProperty` respectively.
135
+
You typically won't have references to these types directly in your source code.
136
+
In addition, the enum used to indicate the type of each JSON property was updated from `JSONPropertyType` to `SchemaPropertyProtocol`.
0 commit comments