Skip to content

Commit 89ba2f4

Browse files
committed
Move batching configuration into a sub-block
1 parent 761a498 commit 89ba2f4

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@ There are tools that help with this and can handle the batching for you, e.g. [A
18201820
> - No limitations on the number of queries/mutations
18211821
> Currently there's no way to limit this.
18221822
1823-
Support for batching can be disabled by setting the config `batching` to `false`.
1823+
Support for batching can be disabled by setting the config `batching.enable` to `false`.
18241824

18251825
### Scalar types
18261826

config/config.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@
5454
// parameter.
5555
'default_schema' => 'default',
5656

57-
// Whether to support GraphQL batching or not.
58-
// See e.g. https://www.apollographql.com/blog/batching-client-graphql-queries-a685f5bcd41b/
59-
// for pro and con
60-
'batching' => true,
57+
'batching' => [
58+
// Whether to support GraphQL batching or not.
59+
// See e.g. https://www.apollographql.com/blog/batching-client-graphql-queries-a685f5bcd41b/
60+
// for pro and con
61+
'enable' => true,
62+
],
6163

6264
// The schemas for query and/or mutation. It expects an array of schemas to provide
6365
// both the 'query' fields and the 'mutation' fields.
@@ -110,6 +112,9 @@
110112
],
111113
'middleware' => [],
112114
'method' => ['get', 'post'],
115+
'batching' => [
116+
// 'enable' => false,
117+
],
113118
],
114119
],
115120

src/GraphQLController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function query(Request $request, string $schema = null): JsonResponse
4646
// check if is batch (check if the array is associative)
4747
$isBatch = !Arr::isAssoc($request->input());
4848

49-
$supportsBatching = config('graphql.batching', true);
49+
$supportsBatching = config('graphql.batching.enable', true);
5050

5151
if ($isBatch && !$supportsBatching) {
5252
$data = $this->createBatchingNotSupportedResponse($request->input());

tests/Unit/EndpointTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function testBatchedQueries(): void
159159

160160
public function testBatchedQueriesButBatchingDisabled(): void
161161
{
162-
config(['graphql.batching' => false]);
162+
config(['graphql.batching.enable' => false]);
163163

164164
$response = $this->call('GET', '/graphql', [
165165
[

0 commit comments

Comments
 (0)