Skip to content

Commit 5c61c63

Browse files
committed
Fix Static test and add deprecated notices
1 parent f071e99 commit 5c61c63

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

app/code/Magento/SwaggerWebapi/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"config": {
55
"sort-packages": true
66
},
7+
"version": "100.2.2",
78
"require": {
89
"php": "~7.0.13|~7.1.0",
910
"magento/framework": "*",
@@ -22,4 +23,4 @@
2223
"Magento\\SwaggerWebapi\\": ""
2324
}
2425
}
25-
}
26+
}

app/code/Magento/Webapi/Controller/Rest.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,76 @@ protected function validateRequest()
255255
throw new \Magento\Framework\Webapi\Exception(__('Cannot perform GET operation with store code \'all\''));
256256
}
257257
}
258+
259+
/**
260+
* Execute schema request
261+
*
262+
* @return void
263+
* @deprecated 100.1.0
264+
*/
265+
protected function processSchemaRequest()
266+
{
267+
$requestedServices = $this->_request->getRequestedServices('all');
268+
$requestedServices = $requestedServices == Request::ALL_SERVICES
269+
? $this->swaggerGenerator->getListOfServices()
270+
: $requestedServices;
271+
$responseBody = $this->swaggerGenerator->generate(
272+
$requestedServices,
273+
$this->_request->getScheme(),
274+
$this->_request->getHttpHost(false),
275+
$this->_request->getRequestUri()
276+
);
277+
$this->_response->setBody($responseBody)->setHeader('Content-Type', 'application/json');
278+
}
279+
280+
/**
281+
* Execute API request
282+
*
283+
* @return void
284+
* @deprecated 100.1.0
285+
* @throws AuthorizationException
286+
* @throws \Magento\Framework\Exception\InputException
287+
* @throws \Magento\Framework\Webapi\Exception
288+
*/
289+
protected function processApiRequest()
290+
{
291+
$inputParams = $this->getInputParamsResolver()->resolve();
292+
293+
$route = $this->getInputParamsResolver()->getRoute();
294+
$serviceMethodName = $route->getServiceMethod();
295+
$serviceClassName = $route->getServiceClass();
296+
297+
$service = $this->_objectManager->get($serviceClassName);
298+
/** @var \Magento\Framework\Api\AbstractExtensibleObject $outputData */
299+
$outputData = call_user_func_array([$service, $serviceMethodName], $inputParams);
300+
$outputData = $this->serviceOutputProcessor->process(
301+
$outputData,
302+
$serviceClassName,
303+
$serviceMethodName
304+
);
305+
if ($this->_request->getParam(FieldsFilter::FILTER_PARAMETER) && is_array($outputData)) {
306+
$outputData = $this->fieldsFilter->filter($outputData);
307+
}
308+
$header = $this->getDeploymentConfig()->get(ConfigOptionsListConstants::CONFIG_PATH_X_FRAME_OPT);
309+
if ($header) {
310+
$this->_response->setHeader('X-Frame-Options', $header);
311+
}
312+
$this->_response->prepareResponse($outputData);
313+
}
314+
315+
/**
316+
* Get deployment config
317+
*
318+
* @return DeploymentConfig
319+
* @deprecated 100.1.0
320+
*/
321+
private function getDeploymentConfig()
322+
{
323+
if (!$this->deploymentConfig instanceof \Magento\Framework\App\DeploymentConfig) {
324+
$this->deploymentConfig = \Magento\Framework\App\ObjectManager::getInstance()
325+
->get(\Magento\Framework\App\DeploymentConfig::class);
326+
}
327+
return $this->deploymentConfig;
328+
}
329+
258330
}

0 commit comments

Comments
 (0)