diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py index 442f4faa1974d..4abfe067cb043 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py @@ -30,11 +30,9 @@ config_router = AirflowRouter(tags=["Config"]) -WEBSERVER_CONFIG_KEYS = [ - "enable_swagger_ui", -] API_CONFIG_KEYS = [ + "enable_swagger_ui", "hide_paused_dags_by_default", "page_size", "default_wrap", @@ -50,9 +48,7 @@ ) def get_configs() -> ConfigResponse: """Get configs for UI.""" - config = {key: conf.get("webserver", key) for key in WEBSERVER_CONFIG_KEYS} - - config.update({key: conf.get("api", key) for key in API_CONFIG_KEYS}) + config = {key: conf.get("api", key) for key in API_CONFIG_KEYS} task_log_reader = TaskLogReader() additional_config: dict[str, Any] = { diff --git a/airflow-core/src/airflow/cli/commands/config_command.py b/airflow-core/src/airflow/cli/commands/config_command.py index 77ef371ff1212..41f1fe0a7c1de 100644 --- a/airflow-core/src/airflow/cli/commands/config_command.py +++ b/airflow-core/src/airflow/cli/commands/config_command.py @@ -446,6 +446,10 @@ def message(self) -> str | None: config=ConfigParameter("webserver", "grid_view_sorting_order"), renamed_to=ConfigParameter("api", "grid_view_sorting_order"), ), + ConfigChange( + config=ConfigParameter("webserver", "enable_swagger_ui"), + renamed_to=ConfigParameter("api", "enable_swagger_ui"), + ), ConfigChange( config=ConfigParameter("webserver", "error_logfile"), was_deprecated=False, diff --git a/airflow-core/src/airflow/config_templates/config.yml b/airflow-core/src/airflow/config_templates/config.yml index 02137117bb658..8adac57d17996 100644 --- a/airflow-core/src/airflow/config_templates/config.yml +++ b/airflow-core/src/airflow/config_templates/config.yml @@ -1284,6 +1284,13 @@ secrets: api: description: ~ options: + enable_swagger_ui: + description: | + Boolean for running SwaggerUI in the webserver. + version_added: 2.6.0 + type: boolean + example: ~ + default: "True" secret_key: description: | Secret key used to run your api server. It should be as random as possible. However, when running @@ -1787,13 +1794,6 @@ webserver: type: string example: "dagrun_cleared,failed" default: ~ - enable_swagger_ui: - description: | - Boolean for running SwaggerUI in the webserver. - version_added: 2.6.0 - type: boolean - example: ~ - default: "True" email: description: | Configuration email backend and whether to diff --git a/airflow-core/src/airflow/configuration.py b/airflow-core/src/airflow/configuration.py index 5ec5bf770a18e..bdf642338f57f 100644 --- a/airflow-core/src/airflow/configuration.py +++ b/airflow-core/src/airflow/configuration.py @@ -363,6 +363,7 @@ def sensitive_config_values(self) -> set[tuple[str, str]]: ("fab", "navbar_hover_color"): ("webserver", "navbar_hover_color", "3.0.2"), ("fab", "navbar_text_hover_color"): ("webserver", "navbar_text_hover_color", "3.0.2"), ("api", "secret_key"): ("webserver", "secret_key", "3.0.2"), + ("api", "enable_swagger_ui"): ("webserver", "enable_swagger_ui", "3.0.2"), ("api", "grid_view_sorting_order"): ("webserver", "grid_view_sorting_order", "3.1.0"), ("api", "log_fetch_timeout_sec"): ("webserver", "log_fetch_timeout_sec", "3.1.0"), ("api", "hide_paused_dags_by_default"): ("webserver", "hide_paused_dags_by_default", "3.1.0"), diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_config.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_config.py index 622ed577ff0c1..c2f92e3ca443f 100644 --- a/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_config.py +++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_config.py @@ -47,7 +47,7 @@ def mock_config_data(): with conf_vars( { ("webserver", "instance_name"): "Airflow", - ("webserver", "enable_swagger_ui"): "true", + ("api", "enable_swagger_ui"): "true", ("api", "hide_paused_dags_by_default"): "true", ("api", "page_size"): "100", ("api", "default_wrap"): "false", diff --git a/providers/fab/src/airflow/providers/fab/www/constants.py b/providers/fab/src/airflow/providers/fab/www/constants.py index 263caf1576c4c..69e1a1965bf96 100644 --- a/providers/fab/src/airflow/providers/fab/www/constants.py +++ b/providers/fab/src/airflow/providers/fab/www/constants.py @@ -24,5 +24,5 @@ # There is a difference with configuring Swagger in Connexion 2.x and Connexion 3.x # Connexion 2: https://connexion.readthedocs.io/en/2.14.2/quickstart.html#the-swagger-ui-console # Connexion 3: https://connexion.readthedocs.io/en/stable/swagger_ui.html#configuring-the-swagger-ui -SWAGGER_ENABLED = conf.getboolean("webserver", "enable_swagger_ui", fallback=True) +SWAGGER_ENABLED = conf.getboolean("api", "enable_swagger_ui", fallback=True) SWAGGER_BUNDLE = WWW.joinpath("static", "dist", "swagger-ui") diff --git a/providers/fab/www-hash.txt b/providers/fab/www-hash.txt index 5ba1e80f4b528..dc232df01d249 100644 --- a/providers/fab/www-hash.txt +++ b/providers/fab/www-hash.txt @@ -1 +1 @@ -e6d566ed6f8c2b19eda800f6bb53b2bf7b3ede110978d3628e55f1e63f201704 +c721979395879c5bc6be835a168a3fd354e99de9f11515580d04c402373fbc0f