Skip to content

Commit f21a29c

Browse files
adriendupuismnocon
andauthored
Document some GraphQL changes between 3.3 and 4.x (#2595)
--------- Co-authored-by: Marek Nocoń <[email protected]>
1 parent 518769c commit f21a29c

File tree

3 files changed

+69
-6
lines changed

3 files changed

+69
-6
lines changed

docs/api/graphql/graphql_queries.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To get a specific content item by its content ID, location ID, or URL alias, use
1515
```
1616
{
1717
content {
18-
article (contentId: 62) {
18+
article(contentId: 62) {
1919
title
2020
author {
2121
name
@@ -52,8 +52,17 @@ The query accepts `locationId`, `remoteId`, and `urlAlias` as arguments.
5252

5353
```
5454
{
55-
item (locationId: 2) {
55+
item(locationId: 2) {
5656
_name
57+
... on FolderItem {
58+
name
59+
}
60+
... on LandingPageItem {
61+
name
62+
}
63+
... on ArticleItem {
64+
title
65+
}
5766
}
5867
}
5968
```
@@ -181,9 +190,9 @@ To get the IDs and names of all Fields in the `article` content type:
181190
{
182191
content {
183192
_types {
184-
article{
193+
article {
185194
_info {
186-
fieldDefinitions{
195+
fieldDefinitions {
187196
id
188197
name
189198
}
@@ -318,8 +327,8 @@ Alternatively, you can query the `children` property of an `item` or `content` o
318327

319328
```
320329
{
321-
item (locationId: 2) {
322-
_location{
330+
item(locationId: 2) {
331+
_location {
323332
children {
324333
edges {
325334
node {

docs/css/custom.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@ ul li li li {
379379
background-color: var(--table-header);
380380
}
381381

382+
.md-typeset table td.compare {
383+
border: 0.05rem solid var(--md-typeset-table-color)
384+
}
385+
382386
.md-nav__link[data-md-state=blur] {
383387
color: rgb(19, 28, 38);
384388
}

docs/update_and_migration/from_3.3/to_4.0.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,56 @@ php bin/console ibexa:migrations:migrate
168168

169169
## Update your custom code
170170

171+
### GraphQL
172+
173+
Some GraphQL names have changed. Adapt your queries according to the table below.
174+
175+
| 3.3 name | 4.0 name |
176+
|:--------------------------------------------------|:--------------------------------------------|
177+
| `id` argument | `contentId` argument |
178+
| `_info` content item property | `_contentInfo` content item property |
179+
| `<ContentType>Content` (example: `FolderContent`) | `<ContentType>Item` (example: `FolderItem`) |
180+
181+
Example of an updated query:
182+
183+
<table>
184+
<thead><tr><th scope="col">3.3</th><th scope="col">4.0</th></tr></thead>
185+
<tbody>
186+
<tr><td class="compare">
187+
```graphql
188+
{
189+
content {
190+
folder(id: 1) {
191+
_info {
192+
id
193+
name
194+
}
195+
}
196+
}
197+
}
198+
```
199+
</td><td class="compare">
200+
```graphql
201+
{
202+
content {
203+
folder(contentId: 1) {
204+
_contentInfo{
205+
id
206+
name
207+
}
208+
}
209+
}
210+
}
211+
```
212+
</td></tr>
213+
</tbody></table>
214+
215+
Notice that the argument have been updated to `contentId` while the `id` property keeps its name.
216+
217+
While revisiting GraphQL queries, you may consider the new feature `item`
218+
allowing to fetch a content item without knowing its content type.
219+
For more information, see [Get a content item](graphql_queries.md#get-a-content-item).
220+
171221
### Back office customization
172222

173223
The v4 version of [[= product_name =]] is using Bootstrap 5 in the back office. If you were using Bootstrap 4 for styling, you need to update and adjust all custom back office components [following the migration guide from Bootstrap 4](https://getbootstrap.com/docs/5.0/migration/).

0 commit comments

Comments
 (0)