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 99-->
1010<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:module:Magento_Config:etc/system_file.xsd" >
1111 <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 >
1815 <field id =" input_limit_enabled" translate =" label" type =" select" sortOrder =" 5" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
1916 <source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
2017 <label >Enable Input Limits</label >
18+ <config_path >graphql/validation/input_limit_enabled</config_path >
2119 </field >
2220 <field id =" maximum_page_size" translate =" label comment" type =" text" sortOrder =" 15" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
2321 <label >Maximum Page Size</label >
2422 <comment >Maximum number of items allowed in a paginated search result.</comment >
23+ <config_path >graphql/validation/maximum_page_size</config_path >
2524 <depends >
2625 <field id =" input_limit_enabled" >1</field >
2726 </depends >
Original file line number Diff line number Diff line change 2121 </field >
2222 </group >
2323 <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 >
2525 <field id =" input_limit_enabled" translate =" label" type =" select" sortOrder =" 5" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
2626 <source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
2727 <label >Enable Input Limits</label >
2828 </field >
2929 <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 >
3131 <comment >Maximum number of items allowed in an entity's array property.</comment >
3232 <depends >
3333 <field id =" input_limit_enabled" >1</field >
Original file line number Diff line number Diff line change 66
77declare (strict_types=1 );
88
9- namespace Magento \Framework \GraphQl \Query \Resolver \Argument \Validator ;
9+ namespace Magento \Framework \GraphQl \Query \Resolver \Argument \Validator \ IOLimit ;
1010
1111use Magento \Framework \App \Config \ScopeConfigInterface ;
1212use Magento \Store \Model \ScopeInterface ;
1313
1414/**
1515 * Provides configuration related to the GraphQL input limit validation
1616 */
17- class ConfigProvider
17+ class IOLimitConfigProvider
1818{
1919 /**
2020 * Path to the configuration setting for if the input limiting is enabled
@@ -40,7 +40,7 @@ public function __construct(ScopeConfigInterface $scopeConfig)
4040 }
4141
4242 /**
43- * @inheritDoc
43+ * Get the stored configuration for if the input limiting is enabled
4444 */
4545 public function isInputLimitingEnabled (): bool
4646 {
@@ -51,7 +51,7 @@ public function isInputLimitingEnabled(): bool
5151 }
5252
5353 /**
54- * @inheritDoc
54+ * Get the stored configuration for the maximum page size
5555 */
5656 public function getMaximumPageSize (): ?int
5757 {
Original file line number Diff line number Diff line change 1111use Magento \Framework \App \ObjectManager ;
1212use Magento \Framework \GraphQl \Config \Element \Field ;
1313use Magento \Framework \GraphQl \Exception \GraphQlInputException ;
14+ use Magento \Framework \GraphQl \Query \Resolver \Argument \Validator \IOLimit \IOLimitConfigProvider ;
1415use Magento \Framework \GraphQl \Query \Resolver \Argument \ValidatorInterface ;
1516
1617/**
@@ -24,19 +25,19 @@ class SearchCriteriaValidator implements ValidatorInterface
2425 private $ maxPageSize ;
2526
2627 /**
27- * @var ConfigProvider |null
28+ * @var IOLimitConfigProvider |null
2829 */
2930 private $ configProvider ;
3031
3132 /**
3233 * @param int $maxPageSize
33- * @param ConfigProvider |null $configProvider
34+ * @param IOLimitConfigProvider |null $configProvider
3435 */
35- public function __construct (int $ maxPageSize , ?ConfigProvider $ configProvider = null )
36+ public function __construct (int $ maxPageSize , ?IOLimitConfigProvider $ configProvider = null )
3637 {
3738 $ this ->maxPageSize = $ maxPageSize ;
3839 $ this ->configProvider = $ configProvider ?? ObjectManager::getInstance ()
39- ->get (ConfigProvider ::class);
40+ ->get (IOLimitConfigProvider ::class);
4041 }
4142
4243 /**
Original file line number Diff line number Diff line change 1010
1111use Magento \Framework \GraphQl \Config \Element \Field ;
1212use 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 ;
1414use Magento \Framework \GraphQl \Query \Resolver \Argument \Validator \SearchCriteriaValidator ;
1515use PHPUnit \Framework \MockObject \MockObject ;
1616use PHPUnit \Framework \TestCase ;
2121class SearchCriteriaValidatorTest extends TestCase
2222{
2323 /**
24- * @var ConfigProvider |MockObject
24+ * @var IOLimitConfigProvider |MockObject
2525 */
2626 private $ configProvider ;
2727
@@ -32,7 +32,7 @@ class SearchCriteriaValidatorTest extends TestCase
3232
3333 protected function setUp (): void
3434 {
35- $ this ->configProvider = self ::getMockBuilder (ConfigProvider ::class)
35+ $ this ->configProvider = self ::getMockBuilder (IOLimitConfigProvider ::class)
3636 ->disableOriginalConstructor ()
3737 ->getMock ();
3838 $ this ->validator = new SearchCriteriaValidator (3 , $ this ->configProvider );
Original file line number Diff line number Diff line change 2424use Magento \Framework \Webapi \Exception as WebapiException ;
2525use Magento \Framework \Webapi \CustomAttribute \PreprocessorInterface ;
2626use Laminas \Code \Reflection \ClassReflection ;
27- use Magento \Framework \Webapi \InputLimit \DefaultPageSizeSetter ;
27+ use Magento \Framework \Webapi \Validator \ IOLimit \DefaultPageSizeSetter ;
2828use Magento \Framework \Webapi \Validator \ServiceInputValidatorInterface ;
2929
3030/**
Original file line number Diff line number Diff line change 99namespace Magento \Framework \Webapi \Test \Unit \InputLimit ;
1010
1111use 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 ;
1414use PHPUnit \Framework \MockObject \MockObject ;
1515use PHPUnit \Framework \TestCase ;
1616
2020class DefaultPageSizeSetterTest extends TestCase
2121{
2222 /**
23- * @var ConfigProvider |MockObject
23+ * @var IOLimitConfigProvider |MockObject
2424 */
2525 private $ configProvider ;
2626
@@ -31,7 +31,7 @@ class DefaultPageSizeSetterTest extends TestCase
3131
3232 protected function setUp (): void
3333 {
34- $ this ->configProvider = $ this ->getMockBuilder (ConfigProvider ::class)
34+ $ this ->configProvider = $ this ->getMockBuilder (IOLimitConfigProvider ::class)
3535 ->disableOriginalConstructor ()
3636 ->getMock ();
3737 $ this ->setter = new DefaultPageSizeSetter ($ this ->configProvider );
Original file line number Diff line number Diff line change 2020use Magento \Framework \Reflection \TypeProcessor ;
2121use Magento \Framework \Serialize \SerializerInterface ;
2222use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
23- use Magento \Framework \Webapi \InputLimit \DefaultPageSizeSetter ;
23+ use Magento \Framework \Webapi \Validator \ IOLimit \DefaultPageSizeSetter ;
2424use Magento \Framework \Webapi \ServiceInputProcessor ;
25- use Magento \Framework \Webapi \Validator \ConfigProvider ;
25+ use Magento \Framework \Webapi \Validator \IOLimit \ IOLimitConfigProvider ;
2626use Magento \Framework \Webapi \Validator \EntityArrayValidator ;
2727use Magento \Framework \Webapi \ServiceTypeToEntityTypeMap ;
2828use Magento \Framework \Webapi \Test \Unit \ServiceInputProcessor \AssociativeArray ;
@@ -74,7 +74,7 @@ class ServiceInputProcessorTest extends TestCase
7474 private $ serviceTypeToEntityTypeMap ;
7575
7676 /**
77- * @var ConfigProvider |MockObject
77+ * @var IOLimitConfigProvider |MockObject
7878 */
7979 private $ inputLimitConfig ;
8080
@@ -163,7 +163,7 @@ function () use ($objectManager) {
163163 ->disableOriginalConstructor ()
164164 ->getMock ();
165165
166- $ this ->inputLimitConfig = self ::getMockBuilder (ConfigProvider ::class)
166+ $ this ->inputLimitConfig = self ::getMockBuilder (IOLimitConfigProvider ::class)
167167 ->disableOriginalConstructor ()
168168 ->getMock ();
169169
Original file line number Diff line number Diff line change 99namespace Magento \Framework \Webapi \Test \Unit \Validator ;
1010
1111use Magento \Framework \Exception \InvalidArgumentException ;
12- use Magento \Framework \Webapi \Validator \ConfigProvider ;
12+ use Magento \Framework \Webapi \Validator \IOLimit \ IOLimitConfigProvider ;
1313use Magento \Framework \Webapi \Validator \EntityArrayValidator ;
1414use PHPUnit \Framework \MockObject \MockObject ;
1515use PHPUnit \Framework \TestCase ;
2020class EntityArrayValidatorTest extends TestCase
2121{
2222 /**
23- * @var ConfigProvider |MockObject
23+ * @var IOLimitConfigProvider |MockObject
2424 */
2525 private $ config ;
2626
@@ -31,7 +31,7 @@ class EntityArrayValidatorTest extends TestCase
3131
3232 protected function setUp (): void
3333 {
34- $ this ->config = self ::getMockBuilder (ConfigProvider ::class)
34+ $ this ->config = self ::getMockBuilder (IOLimitConfigProvider ::class)
3535 ->disableOriginalConstructor ()
3636 ->getMock ();
3737 $ this ->validator = new EntityArrayValidator (3 , $ this ->config );
Original file line number Diff line number Diff line change 1010
1111use Magento \Framework \Api \SearchCriteria ;
1212use Magento \Framework \Exception \InvalidArgumentException ;
13- use Magento \Framework \Webapi \Validator \ConfigProvider ;
13+ use Magento \Framework \Webapi \Validator \IOLimit \ IOLimitConfigProvider ;
1414use Magento \Framework \Webapi \Validator \SearchCriteriaValidator ;
1515use PHPUnit \Framework \MockObject \MockObject ;
1616use PHPUnit \Framework \TestCase ;
2121class SearchCriteriaValidatorTest extends TestCase
2222{
2323 /**
24- * @var ConfigProvider |MockObject
24+ * @var IOLimitConfigProvider |MockObject
2525 */
2626 private $ config ;
2727
@@ -32,7 +32,7 @@ class SearchCriteriaValidatorTest extends TestCase
3232
3333 protected function setUp (): void
3434 {
35- $ this ->config = self ::getMockBuilder (ConfigProvider ::class)
35+ $ this ->config = self ::getMockBuilder (IOLimitConfigProvider ::class)
3636 ->disableOriginalConstructor ()
3737 ->getMock ();
3838 $ this ->validator = new SearchCriteriaValidator (3 , $ this ->config );
You can’t perform that action at this time.
0 commit comments