Skip to content

Commit 1f35674

Browse files
doc: Adds migration guide
1 parent 8ef2aae commit 1f35674

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

MIGRATION.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Migration
2+
3+
## 1.0 to 2.0
4+
5+
### TypeReference removal
6+
7+
The `TypeReference` type was removed in v2.0.0, since it was made unnecessary when using the [GraphQL](https://github.com/GraphQLSwift/GraphQL) closure-based `field` API. Simply replace any `TypeReference` usage with the actual type:
8+
9+
```swift
10+
// Before
11+
let schema = try! Schema<HelloResolver, HelloContext> {
12+
Type(Object1.self) { }
13+
Type(Object2.self) {
14+
Field("object1", at: \.object1, as: TypeReference<Object1>.self)
15+
}
16+
}
17+
18+
// After
19+
let schema = try! Schema<HelloResolver, HelloContext> {
20+
Type(Object1.self) { }
21+
Type(Object2.self) {
22+
Field("object1", at: \.object1)
23+
}
24+
}
25+
```
26+
27+
### Field/InputField `as` argument removal
28+
29+
Since TypeReference was removed, there is no longer a functional need for the `as` argument on `Field` and `InputField`
30+
types. To remove it, simply omit it and let the compiler determine the type from the signature of the `at` argument.
31+
32+
### `Types` removal
33+
34+
The deprecated `Types` type has been removed. Instead define types individually using the `Type` initializers.
35+
36+
### Reflection `isEncodable`
37+
38+
The deprecated `Reflection.isEncodable(type: Any.Type) -> Bool` function has been removed. Please re-implement in your
39+
package if this functionality is needed.

0 commit comments

Comments
 (0)