Skip to content

Commit

Permalink
feat(graphql): add configuration on laravel, for max query depth and …
Browse files Browse the repository at this point in the history
…max query complexity
  • Loading branch information
mauriau authored and soyuka committed Dec 20, 2024
1 parent 15675e6 commit 902a6f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Laravel/ApiPlatformProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ private function registerGraphQl(Application $app): void
/** @var ConfigRepository */
$config = $app['config'];

return new Executor($config->get('api-platform.graphql.introspection.enabled') ?? false);
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'));
});

$app->singleton(GraphiQlController::class, function (Application $app) {
Expand Down
4 changes: 3 additions & 1 deletion src/Laravel/config/api-platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
'graphql' => [
'enabled' => false,
'nesting_separator' => '__',
'introspection' => ['enabled' => true]
'introspection' => ['enabled' => true],
'max_query_complexity' => 500,
'max_query_depth' => 200
],

'exception_to_status' => [
Expand Down

0 comments on commit 902a6f3

Please sign in to comment.