Skip to content

Commit 980d9d8

Browse files
committed
Added first version of the beta6 upgrade guide.
1 parent 645ad3f commit 980d9d8

File tree

1 file changed

+203
-0
lines changed

1 file changed

+203
-0
lines changed

doc/upgrade/beta6.md

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# Beta 6 Upgrade Guide
2+
## Schema changes
3+
These changes affect you if you are using the schema automatically generated by the `graphql_core` module.
4+
5+
### Url Interfaces
6+
The type structure of the `Url` object changed. While before there have been just the `InternalUrl` and `ExternalUrl` types, the `InternalUrl` has become an interface that can resolve to different Url types, depending on the underlying route. The `DefaultInternalUrl` has the fields for context resolving and other generic rout information. The `EntityCanonicalUrl` has access to the underlying entity.
7+
8+
In a nutshell, if you were using this kind of query:
9+
10+
```
11+
query {
12+
route(path: "/node/1") {
13+
entity {
14+
entityLabel
15+
}
16+
}
17+
}
18+
```
19+
20+
It has to become this:
21+
```
22+
query {
23+
route(path: "/node/1") {
24+
... EntityCanonicalUrl {
25+
entity {
26+
entityLabel
27+
}
28+
}
29+
}
30+
}
31+
```
32+
33+
### Entity Interfaces
34+
The interfaces for entities have been aligned with the entity interfaces in Drupal. There is an `EntityOwnable`, `EntityPublishable` and `EntityRevisionable` interface which now hold the respective fields.
35+
36+
Before:
37+
```
38+
query {
39+
entity:route(path: "/node/1") {
40+
... on EntityCanonicalUrl {
41+
entity {
42+
entityOwner {
43+
uid
44+
}
45+
entityPublished
46+
entityRevisions {
47+
count
48+
}
49+
}
50+
}
51+
}
52+
}
53+
54+
```
55+
56+
After:
57+
58+
```
59+
query {
60+
entity:route(path: "/node/1") {
61+
... on EntityCanonicalUrl {
62+
entity {
63+
... on EntityOwnable {
64+
entityOwner {
65+
uid
66+
}
67+
}
68+
... on EntityPublishable {
69+
entityPublished
70+
}
71+
... on EntityRevisionable {
72+
entityRevisions {
73+
count
74+
}
75+
}
76+
}
77+
}
78+
}
79+
}
80+
81+
```
82+
83+
### Uppercased Enums
84+
Emumerations are uppercased now. For the schema generated by `graphql_core` this means language identifiers and image styles.
85+
86+
Before:
87+
88+
```
89+
query {
90+
entity:route(path: "/node/1") {
91+
... on EntityCanonicalUrl {
92+
entity {
93+
entityTranslation(language: de) {
94+
... on NodeArticle {
95+
entityLabel
96+
fieldImage {
97+
derivative(style: thumbnail) {
98+
url
99+
}
100+
}
101+
}
102+
}
103+
}
104+
}
105+
}
106+
}
107+
```
108+
109+
After:
110+
```
111+
query {
112+
entity:route(path: "/node/1") {
113+
... on EntityCanonicalUrl {
114+
entity {
115+
entityTranslation(language: DE) {
116+
... on NodeArticle {
117+
entityLabel
118+
fieldImage {
119+
derivative(style: THUMBNAIL) {
120+
url
121+
}
122+
}
123+
}
124+
}
125+
}
126+
}
127+
}
128+
}
129+
```
130+
131+
### Optimized simple fields
132+
Entity fields that contain only one property are simplified and directly emit that value.
133+
134+
Before:
135+
```
136+
... on NodeArticle {
137+
fieldPlainText {
138+
value
139+
}
140+
}
141+
```
142+
143+
After:
144+
```
145+
... on NodeArticle {
146+
fieldPlainText
147+
}
148+
```
149+
150+
### Null in string results
151+
Due to the way the new execution library handles results, `null` values in Strings, an empty string field will not yield `null` but a string containing `”null”`.
152+
153+
## API changes
154+
These changes affect you if you’ve been developing custom schema plugins.
155+
156+
## API changes
157+
### Development flag
158+
The three settings for result cache, schema cache and field security have been replaced with one `development` flag, which turns the GraphQL module into development mode. This will also enable advanced error reporting in the underlying execution library.
159+
160+
### Enum definitions
161+
`buildEnumValues` has to return an array of the following structure:
162+
163+
```php
164+
[
165+
'VALUE_A' => [
166+
'value' => 'a',
167+
'description' => 'The letter a',
168+
],
169+
]
170+
```
171+
172+
Instead of:
173+
```php
174+
[
175+
[
176+
'value' => 'a',
177+
'name' => 'VALUE_A',
178+
'description' => 'The letter a',
179+
],
180+
]
181+
```
182+
183+
By convention the enums keys should be uppercases.
184+
185+
### Resolve context
186+
The field plugins resolve methods receive an additional argument of type `ResolveContext`, that can be used to pass information to children down the query tree.
187+
188+
If you field plugins have strict method annotations like this:
189+
```php
190+
public function resolveValues($value, $args, ResolveInfo $info) {
191+
...
192+
}
193+
```
194+
195+
They have to be changed to:
196+
```php
197+
public function resolveValues($value, $args, ResolveContext $context, ResolveInfo $info) {
198+
...
199+
}
200+
```
201+
202+
### Processors and persisted Queries
203+
The interfaces for the `QueryProcessor` and `QueryProvider` changed slightly. The `QueryProcessor` doesn’t accept a pair of `$query` and `$variables` any more, but an object of type `OperationParams`. The `QueryProviders` `$id` and `$version` arguments have been merged into one `$id` argument that has to contain both.

0 commit comments

Comments
 (0)