File tree Expand file tree Collapse file tree 14 files changed +53
-52
lines changed
lib/internal/Magento/Framework
Query/Resolver/Argument/Validator
Test/Unit/Query/Resolver/Argument/Validator Expand file tree Collapse file tree 14 files changed +53
-52
lines changed Original file line number Diff line number Diff line change 9
9
-->
10
10
<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:module:Magento_Config:etc/system_file.xsd" >
11
11
<system >
12
- <section id =" graphql" translate =" label" type =" text" sortOrder =" 103" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
13
- <label >Magento GraphQl</label >
14
- <tab >service</tab >
15
- <resource >Magento_GraphQl::config_graphql</resource >
16
- <group id =" validation" translate =" label" type =" text" sortOrder =" 10" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
17
- <label >Input Limits</label >
12
+ <section id =" webapi" >
13
+ <group id =" graphql_validation" translate =" label" type =" text" sortOrder =" 10" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
14
+ <label >GraphQl Input Limits</label >
18
15
<field id =" input_limit_enabled" translate =" label" type =" select" sortOrder =" 5" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
19
16
<source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
20
17
<label >Enable Input Limits</label >
18
+ <config_path >graphql/validation/input_limit_enabled</config_path >
21
19
</field >
22
20
<field id =" maximum_page_size" translate =" label comment" type =" text" sortOrder =" 15" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
23
21
<label >Maximum Page Size</label >
24
22
<comment >Maximum number of items allowed in a paginated search result.</comment >
23
+ <config_path >graphql/validation/maximum_page_size</config_path >
25
24
<depends >
26
25
<field id =" input_limit_enabled" >1</field >
27
26
</depends >
Original file line number Diff line number Diff line change 21
21
</field >
22
22
</group >
23
23
<group id =" validation" translate =" label" type =" text" sortOrder =" 10" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
24
- <label >Input Limits</label >
24
+ <label >Web Api Input Limits</label >
25
25
<field id =" input_limit_enabled" translate =" label" type =" select" sortOrder =" 5" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
26
26
<source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
27
27
<label >Enable Input Limits</label >
28
28
</field >
29
29
<field id =" complex_array_limit" translate =" label comment" type =" text" sortOrder =" 10" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
30
- <label >Complex Array Limit</label >
30
+ <label >Input List Limit</label >
31
31
<comment >Maximum number of items allowed in an entity's array property.</comment >
32
32
<depends >
33
33
<field id =" input_limit_enabled" >1</field >
Original file line number Diff line number Diff line change 6
6
7
7
declare (strict_types=1 );
8
8
9
- namespace Magento \Framework \GraphQl \Query \Resolver \Argument \Validator ;
9
+ namespace Magento \Framework \GraphQl \Query \Resolver \Argument \Validator \ IOLimit ;
10
10
11
11
use Magento \Framework \App \Config \ScopeConfigInterface ;
12
12
use Magento \Store \Model \ScopeInterface ;
13
13
14
14
/**
15
15
* Provides configuration related to the GraphQL input limit validation
16
16
*/
17
- class ConfigProvider
17
+ class IOLimitConfigProvider
18
18
{
19
19
/**
20
20
* Path to the configuration setting for if the input limiting is enabled
@@ -40,7 +40,7 @@ public function __construct(ScopeConfigInterface $scopeConfig)
40
40
}
41
41
42
42
/**
43
- * @inheritDoc
43
+ * Get the stored configuration for if the input limiting is enabled
44
44
*/
45
45
public function isInputLimitingEnabled (): bool
46
46
{
@@ -51,7 +51,7 @@ public function isInputLimitingEnabled(): bool
51
51
}
52
52
53
53
/**
54
- * @inheritDoc
54
+ * Get the stored configuration for the maximum page size
55
55
*/
56
56
public function getMaximumPageSize (): ?int
57
57
{
Original file line number Diff line number Diff line change 11
11
use Magento \Framework \App \ObjectManager ;
12
12
use Magento \Framework \GraphQl \Config \Element \Field ;
13
13
use Magento \Framework \GraphQl \Exception \GraphQlInputException ;
14
+ use Magento \Framework \GraphQl \Query \Resolver \Argument \Validator \IOLimit \IOLimitConfigProvider ;
14
15
use Magento \Framework \GraphQl \Query \Resolver \Argument \ValidatorInterface ;
15
16
16
17
/**
@@ -24,19 +25,19 @@ class SearchCriteriaValidator implements ValidatorInterface
24
25
private $ maxPageSize ;
25
26
26
27
/**
27
- * @var ConfigProvider |null
28
+ * @var IOLimitConfigProvider |null
28
29
*/
29
30
private $ configProvider ;
30
31
31
32
/**
32
33
* @param int $maxPageSize
33
- * @param ConfigProvider |null $configProvider
34
+ * @param IOLimitConfigProvider |null $configProvider
34
35
*/
35
- public function __construct (int $ maxPageSize , ?ConfigProvider $ configProvider = null )
36
+ public function __construct (int $ maxPageSize , ?IOLimitConfigProvider $ configProvider = null )
36
37
{
37
38
$ this ->maxPageSize = $ maxPageSize ;
38
39
$ this ->configProvider = $ configProvider ?? ObjectManager::getInstance ()
39
- ->get (ConfigProvider ::class);
40
+ ->get (IOLimitConfigProvider ::class);
40
41
}
41
42
42
43
/**
Original file line number Diff line number Diff line change 10
10
11
11
use Magento \Framework \GraphQl \Config \Element \Field ;
12
12
use Magento \Framework \GraphQl \Exception \GraphQlInputException ;
13
- use Magento \Framework \GraphQl \Query \Resolver \Argument \Validator \ConfigProvider ;
13
+ use Magento \Framework \GraphQl \Query \Resolver \Argument \Validator \IOLimit \ IOLimitConfigProvider ;
14
14
use Magento \Framework \GraphQl \Query \Resolver \Argument \Validator \SearchCriteriaValidator ;
15
15
use PHPUnit \Framework \MockObject \MockObject ;
16
16
use PHPUnit \Framework \TestCase ;
21
21
class SearchCriteriaValidatorTest extends TestCase
22
22
{
23
23
/**
24
- * @var ConfigProvider |MockObject
24
+ * @var IOLimitConfigProvider |MockObject
25
25
*/
26
26
private $ configProvider ;
27
27
@@ -32,7 +32,7 @@ class SearchCriteriaValidatorTest extends TestCase
32
32
33
33
protected function setUp (): void
34
34
{
35
- $ this ->configProvider = self ::getMockBuilder (ConfigProvider ::class)
35
+ $ this ->configProvider = self ::getMockBuilder (IOLimitConfigProvider ::class)
36
36
->disableOriginalConstructor ()
37
37
->getMock ();
38
38
$ this ->validator = new SearchCriteriaValidator (3 , $ this ->configProvider );
Original file line number Diff line number Diff line change 24
24
use Magento \Framework \Webapi \Exception as WebapiException ;
25
25
use Magento \Framework \Webapi \CustomAttribute \PreprocessorInterface ;
26
26
use Laminas \Code \Reflection \ClassReflection ;
27
- use Magento \Framework \Webapi \InputLimit \DefaultPageSizeSetter ;
27
+ use Magento \Framework \Webapi \Validator \ IOLimit \DefaultPageSizeSetter ;
28
28
use Magento \Framework \Webapi \Validator \ServiceInputValidatorInterface ;
29
29
30
30
/**
Original file line number Diff line number Diff line change 9
9
namespace Magento \Framework \Webapi \Test \Unit \InputLimit ;
10
10
11
11
use Magento \Framework \Api \Search \SearchCriteriaInterface ;
12
- use Magento \Framework \Webapi \InputLimit \DefaultPageSizeSetter ;
13
- use Magento \Framework \Webapi \Validator \ConfigProvider ;
12
+ use Magento \Framework \Webapi \Validator \ IOLimit \DefaultPageSizeSetter ;
13
+ use Magento \Framework \Webapi \Validator \IOLimit \ IOLimitConfigProvider ;
14
14
use PHPUnit \Framework \MockObject \MockObject ;
15
15
use PHPUnit \Framework \TestCase ;
16
16
20
20
class DefaultPageSizeSetterTest extends TestCase
21
21
{
22
22
/**
23
- * @var ConfigProvider |MockObject
23
+ * @var IOLimitConfigProvider |MockObject
24
24
*/
25
25
private $ configProvider ;
26
26
@@ -31,7 +31,7 @@ class DefaultPageSizeSetterTest extends TestCase
31
31
32
32
protected function setUp (): void
33
33
{
34
- $ this ->configProvider = $ this ->getMockBuilder (ConfigProvider ::class)
34
+ $ this ->configProvider = $ this ->getMockBuilder (IOLimitConfigProvider ::class)
35
35
->disableOriginalConstructor ()
36
36
->getMock ();
37
37
$ this ->setter = new DefaultPageSizeSetter ($ this ->configProvider );
Original file line number Diff line number Diff line change 20
20
use Magento \Framework \Reflection \TypeProcessor ;
21
21
use Magento \Framework \Serialize \SerializerInterface ;
22
22
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
23
- use Magento \Framework \Webapi \InputLimit \DefaultPageSizeSetter ;
23
+ use Magento \Framework \Webapi \Validator \ IOLimit \DefaultPageSizeSetter ;
24
24
use Magento \Framework \Webapi \ServiceInputProcessor ;
25
- use Magento \Framework \Webapi \Validator \ConfigProvider ;
25
+ use Magento \Framework \Webapi \Validator \IOLimit \ IOLimitConfigProvider ;
26
26
use Magento \Framework \Webapi \Validator \EntityArrayValidator ;
27
27
use Magento \Framework \Webapi \ServiceTypeToEntityTypeMap ;
28
28
use Magento \Framework \Webapi \Test \Unit \ServiceInputProcessor \AssociativeArray ;
@@ -74,7 +74,7 @@ class ServiceInputProcessorTest extends TestCase
74
74
private $ serviceTypeToEntityTypeMap ;
75
75
76
76
/**
77
- * @var ConfigProvider |MockObject
77
+ * @var IOLimitConfigProvider |MockObject
78
78
*/
79
79
private $ inputLimitConfig ;
80
80
@@ -163,7 +163,7 @@ function () use ($objectManager) {
163
163
->disableOriginalConstructor ()
164
164
->getMock ();
165
165
166
- $ this ->inputLimitConfig = self ::getMockBuilder (ConfigProvider ::class)
166
+ $ this ->inputLimitConfig = self ::getMockBuilder (IOLimitConfigProvider ::class)
167
167
->disableOriginalConstructor ()
168
168
->getMock ();
169
169
Original file line number Diff line number Diff line change 9
9
namespace Magento \Framework \Webapi \Test \Unit \Validator ;
10
10
11
11
use Magento \Framework \Exception \InvalidArgumentException ;
12
- use Magento \Framework \Webapi \Validator \ConfigProvider ;
12
+ use Magento \Framework \Webapi \Validator \IOLimit \ IOLimitConfigProvider ;
13
13
use Magento \Framework \Webapi \Validator \EntityArrayValidator ;
14
14
use PHPUnit \Framework \MockObject \MockObject ;
15
15
use PHPUnit \Framework \TestCase ;
20
20
class EntityArrayValidatorTest extends TestCase
21
21
{
22
22
/**
23
- * @var ConfigProvider |MockObject
23
+ * @var IOLimitConfigProvider |MockObject
24
24
*/
25
25
private $ config ;
26
26
@@ -31,7 +31,7 @@ class EntityArrayValidatorTest extends TestCase
31
31
32
32
protected function setUp (): void
33
33
{
34
- $ this ->config = self ::getMockBuilder (ConfigProvider ::class)
34
+ $ this ->config = self ::getMockBuilder (IOLimitConfigProvider ::class)
35
35
->disableOriginalConstructor ()
36
36
->getMock ();
37
37
$ this ->validator = new EntityArrayValidator (3 , $ this ->config );
Original file line number Diff line number Diff line change 10
10
11
11
use Magento \Framework \Api \SearchCriteria ;
12
12
use Magento \Framework \Exception \InvalidArgumentException ;
13
- use Magento \Framework \Webapi \Validator \ConfigProvider ;
13
+ use Magento \Framework \Webapi \Validator \IOLimit \ IOLimitConfigProvider ;
14
14
use Magento \Framework \Webapi \Validator \SearchCriteriaValidator ;
15
15
use PHPUnit \Framework \MockObject \MockObject ;
16
16
use PHPUnit \Framework \TestCase ;
21
21
class SearchCriteriaValidatorTest extends TestCase
22
22
{
23
23
/**
24
- * @var ConfigProvider |MockObject
24
+ * @var IOLimitConfigProvider |MockObject
25
25
*/
26
26
private $ config ;
27
27
@@ -32,7 +32,7 @@ class SearchCriteriaValidatorTest extends TestCase
32
32
33
33
protected function setUp (): void
34
34
{
35
- $ this ->config = self ::getMockBuilder (ConfigProvider ::class)
35
+ $ this ->config = self ::getMockBuilder (IOLimitConfigProvider ::class)
36
36
->disableOriginalConstructor ()
37
37
->getMock ();
38
38
$ this ->validator = new SearchCriteriaValidator (3 , $ this ->config );
You can’t perform that action at this time.
0 commit comments