From 0c7eba5c23bf68ecd3e1c7c20f33c2c0b6085394 Mon Sep 17 00:00:00 2001
From: Al Munnings <al.munnings@gmail.com>
Date: Wed, 26 Mar 2025 10:14:10 +1100
Subject: [PATCH 1/5] Missing fields on ObjectType

---
 .../src/Plugin/GraphQLCompose/SchemaType/EdgeNode.php            | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/graphql_compose_edges/src/Plugin/GraphQLCompose/SchemaType/EdgeNode.php b/modules/graphql_compose_edges/src/Plugin/GraphQLCompose/SchemaType/EdgeNode.php
index dca0474c..ef10b5a8 100644
--- a/modules/graphql_compose_edges/src/Plugin/GraphQLCompose/SchemaType/EdgeNode.php
+++ b/modules/graphql_compose_edges/src/Plugin/GraphQLCompose/SchemaType/EdgeNode.php
@@ -53,6 +53,7 @@ class EdgeNode extends GraphQLComposeSchemaTypeBase {
         'interfaces' => fn() => [
           static::type('EdgeNode'),
         ],
+        'fields' => fn () => [],
       ]);
     }
 
-- 
GitLab


From e24dce29114716c9640b7934a93b435983fb538a Mon Sep 17 00:00:00 2001
From: Al Munnings <al.munnings@gmail.com>
Date: Wed, 26 Mar 2025 10:14:29 +1100
Subject: [PATCH 2/5] Use same fn style

---
 .../GraphQLCompose/SchemaType/LanguageType.php     | 14 ++++++--------
 .../SchemaType/SchemaInformationType.php           | 14 ++++++--------
 .../GraphQLCompose/SchemaType/TranslationType.php  | 14 ++++++--------
 3 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/src/Plugin/GraphQLCompose/SchemaType/LanguageType.php b/src/Plugin/GraphQLCompose/SchemaType/LanguageType.php
index c66f9985..b932aa8a 100644
--- a/src/Plugin/GraphQLCompose/SchemaType/LanguageType.php
+++ b/src/Plugin/GraphQLCompose/SchemaType/LanguageType.php
@@ -57,14 +57,12 @@ class LanguageType extends GraphQLComposeSchemaTypeBase {
 
     $extensions[] = new ObjectType([
       'name' => 'SchemaInformation',
-      'fields' => function () {
-        return [
-          'languages' => [
-            'type' => Type::nonNull(Type::listOf(Type::nonNull(static::type('Language')))),
-            'description' => (string) $this->t('List of languages available.'),
-          ],
-        ];
-      },
+      'fields' => fn () => [
+        'languages' => [
+          'type' => Type::nonNull(Type::listOf(Type::nonNull(static::type('Language')))),
+          'description' => (string) $this->t('List of languages available.'),
+        ],
+      ],
     ]);
 
     return $extensions;
diff --git a/src/Plugin/GraphQLCompose/SchemaType/SchemaInformationType.php b/src/Plugin/GraphQLCompose/SchemaType/SchemaInformationType.php
index 94a498dd..d3dd0137 100644
--- a/src/Plugin/GraphQLCompose/SchemaType/SchemaInformationType.php
+++ b/src/Plugin/GraphQLCompose/SchemaType/SchemaInformationType.php
@@ -103,14 +103,12 @@ class SchemaInformationType extends GraphQLComposeSchemaTypeBase {
 
     $extensions[] = new ObjectType([
       'name' => 'Query',
-      'fields' => function () {
-        return [
-          'info' => [
-            'type' => Type::nonNull(static::type($this->getPluginId())),
-            'description' => (string) $this->t('Schema information.'),
-          ],
-        ];
-      },
+      'fields' => fn () => [
+        'info' => [
+          'type' => Type::nonNull(static::type($this->getPluginId())),
+          'description' => (string) $this->t('Schema information.'),
+        ],
+      ],
     ]);
 
     return $extensions;
diff --git a/src/Plugin/GraphQLCompose/SchemaType/TranslationType.php b/src/Plugin/GraphQLCompose/SchemaType/TranslationType.php
index b9db00fe..d9a048f2 100644
--- a/src/Plugin/GraphQLCompose/SchemaType/TranslationType.php
+++ b/src/Plugin/GraphQLCompose/SchemaType/TranslationType.php
@@ -68,14 +68,12 @@ class TranslationType extends GraphQLComposeSchemaTypeBase {
 
         $extensions[] = new ObjectType([
           'name' => $bundle->getTypeSdl(),
-          'fields' => function () {
-            return [
-              'translations' => [
-                'type' => Type::nonNull(Type::listOf(Type::nonNull(static::type($this->getPluginId())))),
-                'description' => (string) $this->t('Available translations for content.'),
-              ],
-            ];
-          },
+          'fields' => fn () => [
+            'translations' => [
+              'type' => Type::nonNull(Type::listOf(Type::nonNull(static::type($this->getPluginId())))),
+              'description' => (string) $this->t('Available translations for content.'),
+            ],
+          ],
         ]);
       }
     }
-- 
GitLab


From 29223aff6e5ea3114267e3ee7e925d7edf3bc0c6 Mon Sep 17 00:00:00 2001
From: Al Munnings <al.munnings@gmail.com>
Date: Wed, 26 Mar 2025 10:14:36 +1100
Subject: [PATCH 3/5] Bump composer deps

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index f6b13bf7..2b8c03ca 100644
--- a/composer.json
+++ b/composer.json
@@ -12,7 +12,7 @@
   },
   "require": {
     "php": "^8.1",
-    "drupal/graphql": "^4.9",
+    "drupal/graphql": "^4.11 || ^5",
     "doctrine/inflector": "^2"
   },
   "require-dev": {
-- 
GitLab


From 52b9b1b1b5551bbe74b05c54a28d67c684318c16 Mon Sep 17 00:00:00 2001
From: Al Munnings <al.munnings@gmail.com>
Date: Wed, 26 Mar 2025 10:33:00 +1100
Subject: [PATCH 4/5] Fix failing test

---
 tests/src/Functional/Core/LayoutBuilderTest.php | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/src/Functional/Core/LayoutBuilderTest.php b/tests/src/Functional/Core/LayoutBuilderTest.php
index 0b12c7e7..3a9fef74 100644
--- a/tests/src/Functional/Core/LayoutBuilderTest.php
+++ b/tests/src/Functional/Core/LayoutBuilderTest.php
@@ -644,10 +644,13 @@ class LayoutBuilderTest extends GraphQLComposeBrowserTestBase {
       // Swallow error.
     }
 
-    $this->assertStringContainsStringIgnoringCase(
-      '"BlockFieldNodeTestBody" not found in document',
-      $content['errors'][0]['message'] ?? NULL
-    );
+    $error = $content['errors'][0]['message'] ?? NULL;
+
+    // Check for the expected error in GraphQL 4/5.
+    $contains5 = stripos($error, '"BlockFieldNodeTestBody" not found in document') !== FALSE;
+    $contains4 = stripos($error, 'Unknown type "BlockFieldNodeTestBody"') !== FALSE;
+
+    $this->assertTrue($contains5 || $contains4, 'Error did not meet expectations.');
 
     $node = $content['data']['node'] ?? NULL;
     $body = $node['sections'][1]['components'][1] ?? NULL;
-- 
GitLab


From d8c008fcd963cc853c6a8fbb8cc5a2978725a9c7 Mon Sep 17 00:00:00 2001
From: Al Munnings <al.munnings@gmail.com>
Date: Wed, 26 Mar 2025 10:42:13 +1100
Subject: [PATCH 5/5] Run tests against 5.x-dev

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index 2b8c03ca..64393d87 100644
--- a/composer.json
+++ b/composer.json
@@ -12,7 +12,7 @@
   },
   "require": {
     "php": "^8.1",
-    "drupal/graphql": "^4.11 || ^5",
+    "drupal/graphql": "5.x-dev@dev",
     "doctrine/inflector": "^2"
   },
   "require-dev": {
-- 
GitLab