Skip to content
This repository has been archived by the owner on Apr 29, 2019. It is now read-only.

Commit

Permalink
GraphQL-133: Complexity limiter prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
Valeriy Nayda committed Sep 17, 2018
1 parent b1227fc commit b91f5c8
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
use GraphQL\Validator\Rules\QueryComplexity;

/**
* QueryComplexityLimiter
*
* Sets limits for query complexity. A single GraphQL query can potentially
* generate thousands of database operations so, the very complex queries
* should be filtered and rejected.
Expand Down Expand Up @@ -43,6 +45,11 @@ public function __construct(
$this->queryComplexity = $queryComplexity;
}

/**
* Sets limits for query complexity
*
* @return void
*/
public function execute(): void
{
DocumentValidator::addRule(new QueryComplexity($this->queryComplexity));
Expand Down

0 comments on commit b91f5c8

Please sign in to comment.