This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +14
-14
lines changed
app/code/Magento/GraphQl/etc
dev/tests/api-functional/testsuite/Magento/GraphQl/Framework
lib/internal/Magento/Framework/GraphQl/Query Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change 99
99
</type >
100
100
<type name =" Magento\Framework\GraphQl\Query\QueryComplexityLimiter" >
101
101
<arguments >
102
- <argument name =" queryDepth" xsi : type =" number" >10 </argument >
102
+ <argument name =" queryDepth" xsi : type =" number" >15 </argument >
103
103
<argument name =" queryComplexity" xsi : type =" number" >50</argument >
104
104
</arguments >
105
105
</type >
Original file line number Diff line number Diff line change 9
9
10
10
use Magento \TestFramework \TestCase \GraphQlAbstract ;
11
11
12
+ /**
13
+ * Tests query complexity limiter and depth limiter.
14
+ * Actual for production mode only
15
+ */
12
16
class QueryComplexityLimiterTest extends GraphQlAbstract
13
17
{
14
18
/**
@@ -159,7 +163,7 @@ public function testQueryDepthIsLimited()
159
163
}
160
164
}
161
165
QUERY ;
162
- self ::expectExceptionMessageRegExp ('/Max query depth should be 10 but got 20/ ' );
166
+ self ::expectExceptionMessageRegExp ('/Max query depth should be 15 but got 20/ ' );
163
167
$ this ->graphQlQuery ($ query );
164
168
}
165
169
}
Original file line number Diff line number Diff line change @@ -36,23 +36,17 @@ class QueryComplexityLimiter
36
36
* @param int $queryComplexity
37
37
*/
38
38
public function __construct (
39
- int $ queryDepth = 10 ,
39
+ int $ queryDepth = 15 ,
40
40
int $ queryComplexity = 50
41
41
) {
42
42
$ this ->queryDepth = $ queryDepth ;
43
43
$ this ->queryComplexity = $ queryComplexity ;
44
44
}
45
45
46
- /**
47
- * @param bool $developerMode
48
- */
49
- public function execute (bool $ developerMode = false ): void
46
+ public function execute (): void
50
47
{
51
48
DocumentValidator::addRule (new QueryComplexity ($ this ->queryComplexity ));
52
-
53
- if (!$ developerMode ) {
54
- DocumentValidator::addRule (new DisableIntrospection ());
55
- DocumentValidator::addRule (new QueryDepth ($ this ->queryDepth ));
56
- }
49
+ DocumentValidator::addRule (new DisableIntrospection ());
50
+ DocumentValidator::addRule (new QueryDepth ($ this ->queryDepth ));
57
51
}
58
52
}
Original file line number Diff line number Diff line change @@ -55,8 +55,10 @@ public function process(
55
55
array $ variableValues = null ,
56
56
string $ operationName = null
57
57
) : array {
58
- $ developerMode = !$ this ->exceptionFormatter ->shouldShowDetail ();
59
- $ this ->queryComplexityLimiter ->execute ($ developerMode );
58
+ var_dump ($ this ->exceptionFormatter ->shouldShowDetail ());
59
+ if (!$ this ->exceptionFormatter ->shouldShowDetail ()) {
60
+ $ this ->queryComplexityLimiter ->execute ();
61
+ }
60
62
61
63
$ rootValue = null ;
62
64
return \GraphQL \GraphQL::executeQuery (
You can’t perform that action at this time.
0 commit comments