Skip to content

Commit

Permalink
fix(symfony): load swagger_ui when enabled (#6424)
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka authored Jun 13, 2024
1 parent ff53356 commit d667690
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,9 @@ private function registerSwaggerConfiguration(ContainerBuilder $container, array
$loader->load('symfony/swagger_ui.xml');
}

$loader->load('state/swagger_ui.xml');
if ($config['enable_swagger_ui']) {
$loader->load('state/swagger_ui.xml');
}

if (!$config['enable_swagger_ui'] && !$config['enable_re_doc']) {
// Remove the listener but keep the controller to allow customizing the path of the UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,16 @@ public function testSwaggerConfiguration(): void
$this->assertServiceHasTags('api_platform.swagger.listener.ui', ['kernel.event_listener']);
}

public function testSwaggerUiDisabled(): void
{
$config = self::DEFAULT_CONFIG;
$config['api_platform']['enable_swagger_ui'] = false;

(new ApiPlatformExtension())->load($config, $this->container);

$this->assertNotContainerHasService('api_platform.swagger_ui.provider');
}

public function testJsonApiConfiguration(): void
{
$config = self::DEFAULT_CONFIG;
Expand Down

0 comments on commit d667690

Please sign in to comment.