Skip to content

Commit 9379c44

Browse files
authored
Respect assets mode config in controller (#2280)
| Q | A | |---------------|---------------------------------------------------------------------------------------------------------------------------| | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - Currently the `SwaggerUiController` doesn't respect the `assets_mode` configuration added in #2251. ```yaml nelmio_api_doc: html_config: assets_mode: cdn ``` As far as I can tell, there's no reason for the default any more as it can be set through the configuration and overridden in the `DumpCommand` command using the `html-config` option.
1 parent 2d45e53 commit 9379c44

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Controller/SwaggerUiController.php

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Nelmio\ApiDocBundle\Controller;
1313

1414
use Nelmio\ApiDocBundle\Exception\RenderInvalidArgumentException;
15-
use Nelmio\ApiDocBundle\Render\Html\AssetsMode;
1615
use Nelmio\ApiDocBundle\Render\RenderOpenApi;
1716
use Symfony\Component\HttpFoundation\Request;
1817
use Symfony\Component\HttpFoundation\Response;
@@ -35,7 +34,6 @@ public function __invoke(Request $request, string $area = 'default'): Response
3534
try {
3635
$response = new Response(
3736
$this->renderOpenApi->renderFromRequest($request, RenderOpenApi::HTML, $area, [
38-
'assets_mode' => AssetsMode::BUNDLE,
3937
'ui_renderer' => $this->uiRenderer,
4038
]),
4139
Response::HTTP_OK,

tests/Functional/TestKernel.php

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Hateoas\Configuration\Embedded;
1919
use JMS\SerializerBundle\JMSSerializerBundle;
2020
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
21+
use Nelmio\ApiDocBundle\Render\Html\AssetsMode;
2122
use Nelmio\ApiDocBundle\Tests\Functional\Entity\BazingaUser;
2223
use Nelmio\ApiDocBundle\Tests\Functional\Entity\JMSComplex80;
2324
use Nelmio\ApiDocBundle\Tests\Functional\Entity\JMSComplex81;
@@ -242,6 +243,9 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
242243

243244
// Filter routes
244245
$c->loadFromExtension('nelmio_api_doc', [
246+
'html_config' => [
247+
'assets_mode' => AssetsMode::BUNDLE,
248+
],
245249
'use_validation_groups' => boolval(self::USE_VALIDATION_GROUPS === $this->flag),
246250
'documentation' => [
247251
'info' => [

0 commit comments

Comments
 (0)