Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Users to disable SwaggerUI via configuration #28354

Merged
merged 28 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ab95896
Allow Users to disable SwaggerUI via configuration
gschuurman Dec 14, 2022
d595216
Implement fallback for not updating config file
gschuurman Dec 14, 2022
9f12a89
Simply code using tenary expression
gschuurman Dec 15, 2022
87a3d22
Adjust default configuration based on changes in code
gschuurman Dec 15, 2022
76fb463
Remove swaggerUI from menu when disabled
gschuurman Dec 15, 2022
7fa5ddf
Update airflow/config_templates/config.yml
gschuurman Dec 19, 2022
4425578
Add a new config for adapting masked secrets to make it easier to pre…
csm10495 Dec 15, 2022
e0a0398
Refactor get_mapped_group_summaries for web UI (#28374)
uranusjr Dec 15, 2022
8f48254
Correctly select a mapped task's "previous" task (#28379)
uranusjr Dec 15, 2022
d842078
Update README_RELEASE_PROVIDER_PACKAGES.md (#28377)
eladkal Dec 15, 2022
cd687ef
Adding an example dag for dynamic task mapping (#28325)
amoghrajesh Dec 15, 2022
db345b5
Add EMR Notebook operators (#28312)
syedahsn Dec 15, 2022
4102823
Fix failing static checks in main (#28401)
potiuk Dec 16, 2022
556c9e9
Add documentation for task group mapping (#28001)
uranusjr Dec 16, 2022
1da4c8b
Dont show task/run durations when there is no start_date (#28395)
bbovenzi Dec 16, 2022
b5a7ce6
Restructure Docs (#27235)
TohnJhomas Dec 16, 2022
4949d2b
Add Amazon Elastic Container Registry (ECR) Hook (#28279)
Taragolis Dec 17, 2022
56dd6a3
fIx isort problems introduced by recent isort release (#28434)
potiuk Dec 18, 2022
4ccd889
Fix output buffering for `breeze testing test` (#28433)
potiuk Dec 18, 2022
91fe4bb
Fix discoverability of tests for ARM in Breeze (#28432)
potiuk Dec 18, 2022
c637d82
Re-enable Plyvel on ARM as it now builds cleanly (#28443)
potiuk Dec 18, 2022
3c024c6
Correctly template Glue Jobs `create_job_kwargs` arg (#28403)
IAL32 Dec 18, 2022
e2319f1
fix: very small typo error in readme (#28447)
0xflotus Dec 18, 2022
b55334e
Maintain manual scroll position in task logs (#28386)
bbovenzi Dec 19, 2022
a2c9f48
Log FileTaskHandler to work with KubernetesExecutor's multi_namespace…
XD-DENG Dec 19, 2022
9fb0910
Add `ensure_ascii=False` in trigger dag run API (#28451)
akakakakakaa Dec 19, 2022
172d89f
Merge branch 'main' into feature/disable_swagger_ui
msumit Dec 19, 2022
4e3dc39
Solve Static checks
gschuurman Dec 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,13 @@
type: string
example: "dagrun_cleared,failed"
default: ~
- name: enable_swagger_ui
description: |
Boolean for running SwaggerUI in the webserver.
version_added: 2.6.0
type: boolean
example: ~
default: "True"
- name: run_internal_api
description: |
Boolean for running Internal API in the webserver.
Expand Down
3 changes: 3 additions & 0 deletions airflow/config_templates/default_airflow.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,9 @@ audit_view_excluded_events = gantt,landing_times,tries,duration,calendar,graph,g
# Example: audit_view_included_events = dagrun_cleared,failed
# audit_view_included_events =

# Boolean for running SwaggerUI in the webserver.
enable_swagger_ui = True

# Boolean for running Internal API in the webserver.
run_internal_api = False

Expand Down
15 changes: 9 additions & 6 deletions airflow/www/extensions/init_appbuilder_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.
from __future__ import annotations

from airflow.configuration import conf
from airflow.utils.docs import get_docs_url


Expand All @@ -36,12 +37,14 @@ def init_appbuilder_links(app):
appbuilder.add_link(
name="Documentation", label="GitHub Repo", href="https://github.com/apache/airflow", category="Docs"
)
appbuilder.add_link(
name="Documentation",
label="REST API Reference (Swagger UI)",
href="/api/v1./api/v1_swagger_ui_index",
category="Docs",
)

if conf.getboolean("webserver", "enable_swagger_ui", fallback=True):
appbuilder.add_link(
name="Documentation",
label="REST API Reference (Swagger UI)",
href="/api/v1./api/v1_swagger_ui_index",
category="Docs",
)
appbuilder.add_link(
name="Documentation", label="REST API Reference (Redoc)", href="RedocView.redoc", category="Docs"
)
6 changes: 4 additions & 2 deletions airflow/www/extensions/init_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ def _handle_method_not_allowed(ex):
return views.method_not_allowed(ex)

spec_dir = path.join(ROOT_APP_DIR, "api_connexion", "openapi")
connexion_app = App(__name__, specification_dir=spec_dir, skip_error_handlers=True)
options = {"swagger_ui": conf.getboolean("webserver", "enable_swagger_ui", fallback=True)}
connexion_app = App(__name__, specification_dir=spec_dir, skip_error_handlers=True, options=options)
connexion_app.app = app
api_bp = connexion_app.add_api(
specification="v1.yaml", base_path=base_path, validate_responses=True, strict_validation=True
Expand All @@ -227,7 +228,8 @@ def init_api_internal(app: Flask) -> None:
base_path = "/internal_api/v1"

spec_dir = path.join(ROOT_APP_DIR, "api_internal", "openapi")
internal_app = App(__name__, specification_dir=spec_dir, skip_error_handlers=True)
options = {"swagger_ui": conf.getboolean("webserver", "enable_swagger_ui", fallback=True)}
internal_app = App(__name__, specification_dir=spec_dir, skip_error_handlers=True, options=options)
internal_app.app = app
api_bp = internal_app.add_api(
specification="internal_api_v1.yaml",
Expand Down