Skip to content

Commit

Permalink
Updated documentation files to split out each sentence on a newline.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnoon committed Aug 29, 2017
1 parent d6a1e09 commit a2fe336
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 32 deletions.
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# How to contribute

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]).
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]).

## Getting Started

Expand All @@ -24,7 +25,8 @@ There are a few guidelines that we need contributors to follow so that we are ab

* Push your changes to a topic branch in your fork of the repository.
* Submit a pull request to the repository in the Nike-Inc organization.
* After feedback has been given we expect responses within two weeks. After two weeks we may close the pull request if it isn't showing any activity.
* After feedback has been given we expect responses within two weeks.
After two weeks we may close the pull request if it isn't showing any activity.
* Bug fixes or features that lack appropriate tests may not be considered for merge.
* Changes that lower test coverage may not be considered for merge.

Expand Down
34 changes: 25 additions & 9 deletions Documentation/Elevate 2.0 Migration Guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Elevate 2.0 Migration Guide

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.
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.

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.

Expand All @@ -10,9 +11,13 @@ Elevate 2.0 officially supports iOS 8.0+, macOS 10.10+, tvOS 9.0+, watchOS 2.0+,

## Reasons for Bumping to 2.0

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.
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.

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.
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.

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.

Expand All @@ -29,13 +34,15 @@ While these benefits are nice, the core motivation for updating to Elevate 2.0 s

## Breaking API Changes

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.
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.

### Swift 3

#### AnyObject to Any

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`.
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`.

Here's a look at the old `Decodable` and `Decoder` protocols.

Expand Down Expand Up @@ -66,7 +73,10 @@ All you need to do here is update your protocol conformance to use `Any` and als

#### Parse Object and Parse Array become Decode Object and Decode Array

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.
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.

Here are the previous APIs in use:
```swift
Expand All @@ -85,7 +95,9 @@ Many of these changes can be made with a global find and replace operation.

#### Creating a Schema and Parsing It

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.
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.

Here is an example of the previous set of APIs.
```swift
Expand Down Expand Up @@ -113,8 +125,12 @@ let entity = try Parser.parseEntity(json: json) { schema in

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.

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.
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.

#### Other Changes

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`.
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`.
Loading

0 comments on commit a2fe336

Please sign in to comment.