From 2d29324a237125239f7753aae5ca8da5fcafe2b9 Mon Sep 17 00:00:00 2001 From: Martin Chudoba Date: Wed, 18 Dec 2024 12:35:33 +0100 Subject: [PATCH] [FIX] configuration --- src/Laravel/public/init-swagger-ui.js | 1 + src/Symfony/Bundle/DependencyInjection/Configuration.php | 5 ++--- src/Symfony/Bundle/Resources/config/openapi.xml | 1 + .../Symfony/Bundle/DependencyInjection/ConfigurationTest.php | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Laravel/public/init-swagger-ui.js b/src/Laravel/public/init-swagger-ui.js index ec8b4a8f87c..101d4fc83b2 100644 --- a/src/Laravel/public/init-swagger-ui.js +++ b/src/Laravel/public/init-swagger-ui.js @@ -45,6 +45,7 @@ window.onload = function() { spec: data.spec, dom_id: '#swagger-ui', validatorUrl: null, + persistAuthorization: data.persistAuthorization, oauth2RedirectUrl: data.oauth.redirectUrl, presets: [ SwaggerUIBundle.presets.apis, diff --git a/src/Symfony/Bundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/DependencyInjection/Configuration.php index 8df35ec7a9b..81c4bb74fc8 100644 --- a/src/Symfony/Bundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/DependencyInjection/Configuration.php @@ -105,9 +105,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->end() ->booleanNode('handle_symfony_errors')->defaultFalse()->info('Allows to handle symfony exceptions.')->end() ->booleanNode('enable_swagger')->defaultTrue()->info('Enable the Swagger documentation and export.')->end() - ->booleanNode('enable_swagger_ui')->defaultValue(class_exists(TwigBundle::class))->info('Enable Swagger UI') - ->booleanNode('persistAuthorization')->defaultValue(false)->info('Enable Swagger UI Persist Authorization')->end() - ->end() + ->booleanNode('enable_swagger_ui')->defaultValue(class_exists(TwigBundle::class))->info('Enable Swagger UI')->end() ->booleanNode('enable_re_doc')->defaultValue(class_exists(TwigBundle::class))->info('Enable ReDoc')->end() ->booleanNode('enable_entrypoint')->defaultTrue()->info('Enable the entrypoint')->end() ->booleanNode('enable_docs')->defaultTrue()->info('Enable the docs')->end() @@ -291,6 +289,7 @@ private function addSwaggerSection(ArrayNodeDefinition $rootNode): void ->arrayNode('swagger') ->addDefaultsIfNotSet() ->children() + ->booleanNode('persistAuthorization')->defaultValue(false)->info('Enable Swagger UI Persist Authorization')->end() ->arrayNode('versions') ->info('The active versions of OpenAPI to be exported or used in Swagger UI. The first value is the default.') ->defaultValue($supportedVersions) diff --git a/src/Symfony/Bundle/Resources/config/openapi.xml b/src/Symfony/Bundle/Resources/config/openapi.xml index 2f1a7391ac1..af4569477a5 100644 --- a/src/Symfony/Bundle/Resources/config/openapi.xml +++ b/src/Symfony/Bundle/Resources/config/openapi.xml @@ -59,6 +59,7 @@ %api_platform.openapi.license.name% %api_platform.openapi.license.url% %api_platform.openapi.overrideResponses% + %api_platform.swagger_ui.overrideResponses% diff --git a/tests/Symfony/Bundle/DependencyInjection/ConfigurationTest.php b/tests/Symfony/Bundle/DependencyInjection/ConfigurationTest.php index 84a1ed5066c..e513fa62d9a 100644 --- a/tests/Symfony/Bundle/DependencyInjection/ConfigurationTest.php +++ b/tests/Symfony/Bundle/DependencyInjection/ConfigurationTest.php @@ -150,6 +150,7 @@ private function runDefaultConfigTests(array $doctrineIntegrationsToLoad = ['orm 'versions' => [3], 'api_keys' => [], 'swagger_ui_extra_configuration' => [], + 'persistAuthorization' => false, ], 'eager_loading' => [ 'enabled' => true,