swaggerGenerator = $swaggerGenerator; $this->response = $response; $this->processorPath = $processorPath; } /** * {@inheritdoc} */ public function process(\Magento\Framework\Webapi\Rest\Request $request) { $requestedServices = $request->getRequestedServices('all'); $requestedServices = $requestedServices == Request::ALL_SERVICES ? $this->swaggerGenerator->getListOfServices() : $requestedServices; $responseBody = $this->swaggerGenerator->generate( $requestedServices, $request->getScheme(), $request->getHttpHost(), $request->getRequestUri() ); $this->response->setBody($responseBody)->setHeader('Content-Type', 'application/json'); } /** * {@inheritdoc} */ public function canProcess(\Magento\Framework\Webapi\Rest\Request $request) { if (strpos(ltrim($request->getPathInfo(), '/'), $this->processorPath) === 0) { return true; } return false; } /** * @param \Magento\Framework\Webapi\Rest\Request $request * @return bool */ public function isBulk(\Magento\Framework\Webapi\Rest\Request $request) { if (strpos(ltrim($request->getPathInfo(), '/'), self::BULK_PROCESSOR_PATH) === 0) { return true; } return false; } }