Skip to content

Commit 48ef503

Browse files
docs: Adds migration documentation
1 parent 492dfb1 commit 48ef503

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

MIGRATION.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Migration
22

3+
## 2.0 to 3.0
4+
5+
### NIO removal
6+
7+
All NIO-based parameters and return types were removed, including all that used `EventLoopGroup` and `EventLoopFuture`s.
8+
9+
As such, all `API.execute` and `API.subscribe` calls should have the `eventLoopGroup` argument removed, and the `await` keyword should be used. If access to an `eventLoopGroup` is required in the resolver, one should be passed via the `Context`.
10+
11+
Also, all resolver closures have had the `eventLoopGroup` parameter removed, and all that return an `EventLoopFuture` should be converted to an `async` function.
12+
13+
The documentation here may be very helpful in the conversion: https://www.swift.org/documentation/server/guides/libraries/concurrency-adoption-guidelines.html
14+
15+
### Swift Concurrency checking
16+
17+
With the conversion from NIO to Swift Concurrency, types used across async boundaries should conform to `Sendable` to avoid errors and warnings. This includes the Swift types and functions that back the GraphQL schema, including the `Resolver` and `Context` types. For more details on the conversion, see the [Sendable documentation](https://developer.apple.com/documentation/swift/sendable).
18+
19+
### Subscription result changes
20+
21+
The `API.subscribe(...)` will return a `Result<AsyncThrowingStream<GraphQLResult, Error>>`, instead of an `EventStream`. This means extracting the stream via a `.stream` call and downcasting to `ConcurrentEventStream` are no longer necessary.
22+
The `EventStream` and `SubscriptionResult` types have been removed.
23+
24+
### GraphQL v4 upgrades
25+
26+
See [the GraphQL v4 migration documentation](https://github.com/GraphQLSwift/GraphQL/blob/main/MIGRATION.md#3-to-4) for additional details.
27+
328
## 1.0 to 2.0
429

530
### TypeReference removal
@@ -36,4 +61,4 @@ The deprecated `Types` type has been removed. Instead define types individually
3661
### Reflection `isEncodable`
3762

3863
The deprecated `Reflection.isEncodable(type: Any.Type) -> Bool` function has been removed. Please re-implement in your
39-
package if this functionality is needed.
64+
package if this functionality is needed.

0 commit comments

Comments
 (0)