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: MIGRATION.md
+58-2Lines changed: 58 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,62 @@
1
1
# Migration
2
2
3
-
## 2.0 to 3.0
3
+
## 3 to 4
4
+
5
+
### NIO removal
6
+
7
+
All NIO-based arguments and return types were removed, including all `EventLoopGroup` and `EventLoopFuture` parameters.
8
+
9
+
As such, all `execute` and `subscribe` calls should have the `eventLoopGroup` argument removed, and the `await` keyword should be used.
10
+
11
+
Also, all resolver closures must remove the `eventLoopGroup` argument, and all that return an `EventLoopFuture` should be converted to an `async` function.
12
+
13
+
The documentation here will 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. For more details on the conversion, see the [Sendable documentation](https://developer.apple.com/documentation/swift/sendable).
18
+
19
+
### `ExecutionStrategy` argument removals
20
+
21
+
The `queryStrategy`, `mutationStrategy`, and `subscriptionStrategy` arguments have been removed from `graphql` and `graphqlSubscribe`. Instead Queries and Subscriptions are executed in parallel and Mutations are executed serially, [as required by the spec](https://spec.graphql.org/October2021/#sec-Mutation).
22
+
23
+
### `validationRules` argument reorder
24
+
25
+
The `validationRules` argument has been moved from the beginning of `graphql` and `graphqlSubscribe` to the end to better reflect its relative importance:
26
+
27
+
28
+
```swift
29
+
// Before
30
+
let result =tryawaitgraphql(
31
+
validationRules: [ruleABC],
32
+
schema: schema,
33
+
...
34
+
)
35
+
// After
36
+
let result =tryawaitgraphql(
37
+
schema: schema,
38
+
...
39
+
validationRules: [ruleABC]
40
+
)
41
+
```
42
+
43
+
### EventStream removal
44
+
45
+
The `EventStream` abstraction used to provide pre-concurrency subscription support has been removed. This means that `graphqlSubscribe(...).stream` will now be an `AsyncThrowingStream<GraphQLResult, Error>` type, instead of an `EventStream` type, and that downcasting to `ConcurrentEventStream` is no longer necessary.
46
+
47
+
### SubscriptionResult removal
48
+
49
+
The `SubscriptionResult` type was removed, and `graphqlSubscribe` now returns `Result<AsyncThrowingStream<GraphQLResult, Error>, GraphQLErrors>`.
50
+
51
+
### Instrumentation removal
52
+
53
+
The `Instrumentation` type has been removed, with anticipated support for tracing using [`swift-distributed-tracing`](https://github.com/apple/swift-distributed-tracing). `instrumentation` arguments must be removed from `graphql` and `graphqlSubscribe` calls.
54
+
55
+
### AST Node `set`
56
+
57
+
The deprecated `Node.set(value: Node?, key: String)` function was removed in preference of the `Node.set(value _: NodeResult?, key _: String)`. Change any calls from `node.set(value: node, key: string)` to `node.set(.node(node), string)`.
58
+
59
+
## 2 to 3
4
60
5
61
### TypeReference removal
6
62
@@ -73,4 +129,4 @@ The following type properties were changed from arrays to closures. To get the a
73
129
74
130
### GraphQL type codability
75
131
76
-
With GraphQL type definitions now including closures, many of the objects in [Definition](https://github.com/GraphQLSwift/GraphQL/blob/main/Sources/GraphQL/Type/Definition.swift) are no longer codable. If you are depending on codability, you can conform the type appropriately in your downstream package.
132
+
With GraphQL type definitions now including closures, many of the objects in [Definition](https://github.com/GraphQLSwift/GraphQL/blob/main/Sources/GraphQL/Type/Definition.swift) are no longer codable. If you are depending on codability, you can conform the type appropriately in your downstream package.
0 commit comments