renderOpenApi = $renderOpenApi; } public function __invoke(Request $request, $area = 'default') { try { $response = new Response( $this->renderOpenApi->renderFromRequest($request, RenderOpenApi::HTML, $area, [ 'assets_mode' => AssetsMode::BUNDLE, ]), Response::HTTP_OK, ['Content-Type' => 'text/html'] ); return $response->setCharset('UTF-8'); } catch (RenderInvalidArgumentException $e) { $advice = ''; if (false !== strpos($area, '.json')) { $advice = ' Since the area provided contains `.json`, the issue is likely caused by route priorities. Try switching the Swagger UI / the json documentation routes order.'; } throw new BadRequestHttpException(sprintf('Area "%s" is not supported as it isn\'t defined in config.%s', $area, $advice), $e); } } }