Skip to content

Commit 613a739

Browse files
committed
AC-465: Allow to configure input limit for RESTful endpoints
1 parent 3c14ce6 commit 613a739

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

app/code/Magento/Webapi/Controller/Soap/Request/Handler.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Magento\Framework\Exception\AuthorizationException;
1919
use Magento\Framework\Reflection\DataObjectProcessor;
2020
use Magento\Framework\Webapi\ServiceInputProcessor;
21-
use Magento\Framework\Webapi\Request as SoapRequest;
21+
use Magento\Framework\Webapi\Request as WebapiRequest;
2222
use Magento\Framework\Webapi\Exception as WebapiException;
2323
use Magento\Framework\Webapi\Validator\EntityArrayValidator\InputArraySizeLimitValue;
2424
use Magento\Webapi\Controller\Rest\ParamsOverrider;
@@ -38,7 +38,7 @@ class Handler
3838
public const RESULT_NODE_NAME = 'result';
3939

4040
/**
41-
* @var \Magento\Framework\Webapi\Request
41+
* @var WebapiRequest
4242
*/
4343
protected $_request;
4444

@@ -48,32 +48,32 @@ class Handler
4848
protected $_objectManager;
4949

5050
/**
51-
* @var \Magento\Webapi\Model\Soap\Config
51+
* @var SoapConfig
5252
*/
5353
protected $_apiConfig;
5454

5555
/**
56-
* @var \Magento\Framework\Webapi\Authorization
56+
* @var Authorization
5757
*/
5858
protected $authorization;
5959

6060
/**
61-
* @var \Magento\Framework\Api\SimpleDataObjectConverter
61+
* @var SimpleDataObjectConverter
6262
*/
6363
protected $_dataObjectConverter;
6464

6565
/**
66-
* @var \Magento\Framework\Webapi\ServiceInputProcessor
66+
* @var ServiceInputProcessor
6767
*/
6868
protected $serviceInputProcessor;
6969

7070
/**
71-
* @var \Magento\Framework\Reflection\DataObjectProcessor
71+
* @var DataObjectProcessor
7272
*/
7373
protected $_dataObjectProcessor;
7474

7575
/**
76-
* @var \Magento\Framework\Reflection\MethodsMap
76+
* @var MethodsMap
7777
*/
7878
protected $methodsMapProcessor;
7979

@@ -90,7 +90,7 @@ class Handler
9090
/**
9191
* Initialize dependencies.
9292
*
93-
* @param SoapRequest $request
93+
* @param WebapiRequest $request
9494
* @param ObjectManagerInterface $objectManager
9595
* @param SoapConfig $apiConfig
9696
* @param Authorization $authorization
@@ -100,9 +100,10 @@ class Handler
100100
* @param MethodsMap $methodsMapProcessor
101101
* @param ParamsOverrider|null $paramsOverrider
102102
* @param InputArraySizeLimitValue|null $inputArraySizeLimitValue
103+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
103104
*/
104105
public function __construct(
105-
SoapRequest $request,
106+
WebapiRequest $request,
106107
ObjectManagerInterface $objectManager,
107108
SoapConfig $apiConfig,
108109
Authorization $authorization,

app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class InputParamsResolver
7070
* @param Router $router
7171
* @param RequestValidator $requestValidator
7272
* @param WebapiInputParamsResolver $inputParamsResolver
73-
* @param InputArraySizeLimitValue|null $inputArraySizeLimitValue
7473
* @param bool $isBulk
74+
* @param InputArraySizeLimitValue|null $inputArraySizeLimitValue
7575
*/
7676
public function __construct(
7777
RestRequest $request,

lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ class ServiceInputProcessorTest extends TestCase
8484
*/
8585
private $defaultPageSizeSetter;
8686

87-
/**
88-
* @var InputArraySizeLimitValue
89-
*/
90-
private $inputArraySizeLimitValue;
91-
9287
/**
9388
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
9489
*/
@@ -173,7 +168,7 @@ function () use ($objectManager) {
173168
->disableOriginalConstructor()
174169
->getMock();
175170

176-
$this->inputArraySizeLimitValue = $this->createMock(InputArraySizeLimitValue::class);
171+
$inputArraySizeLimitValue = $this->createMock(InputArraySizeLimitValue::class);
177172

178173
$this->defaultPageSizeSetter = self::getMockBuilder(DefaultPageSizeSetter::class)
179174
->disableOriginalConstructor()
@@ -191,11 +186,10 @@ function () use ($objectManager) {
191186
'serviceInputValidator' => new EntityArrayValidator(
192187
50,
193188
$this->inputLimitConfig,
194-
$this->inputArraySizeLimitValue
189+
$inputArraySizeLimitValue
195190
),
196191
'defaultPageSizeSetter' => $this->defaultPageSizeSetter,
197-
'defaultPageSize' => 123,
198-
'inputArraySizeLimitValue' => $this->inputArraySizeLimitValue
192+
'defaultPageSize' => 123
199193
]
200194
);
201195

0 commit comments

Comments
 (0)