Skip to content

Commit 82dcfda

Browse files
soyukamauriau
andauthored
feat(graphql): allow to configure max query depth and max query complexity (#6880)
Co-authored-by: mauriau <[email protected]>
1 parent 2dc0186 commit 82dcfda

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

ApiPlatformProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ private function registerGraphQl(Application $app): void
12941294
/** @var ConfigRepository */
12951295
$config = $app['config'];
12961296

1297-
return new Executor($config->get('api-platform.graphql.introspection.enabled') ?? false);
1297+
return new Executor($config->get('api-platform.graphql.introspection.enabled') ?? false, $config->get('api-platform.graphql.max_query_complexity'), $config->get('api-platform.graphql.max_query_depth'));
12981298
});
12991299

13001300
$app->singleton(GraphiQlController::class, function (Application $app) {

config/api-platform.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@
6262
'graphql' => [
6363
'enabled' => false,
6464
'nesting_separator' => '__',
65-
'introspection' => ['enabled' => true]
65+
'introspection' => ['enabled' => true],
66+
'max_query_complexity' => 500,
67+
'max_query_depth' => 200
6668
],
6769

6870
'exception_to_status' => [

0 commit comments

Comments
 (0)