Skip to content

Commit

Permalink
For testing - remove the lingk to swagger /api/v1
Browse files Browse the repository at this point in the history
  • Loading branch information
potiuk committed Apr 14, 2024
1 parent 35225e2 commit 73d7502
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion airflow/www/extensions/init_appbuilder_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def init_appbuilder_links(app):
appbuilder.add_link(
name=RESOURCE_DOCS,
label="REST API Reference (Swagger UI)",
href="/api/v1/ui",
href="SwaggerView.swagger",
category=RESOURCE_DOCS_MENU,
)
appbuilder.add_link(
Expand Down
1 change: 1 addition & 0 deletions airflow/www/extensions/init_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def init_appbuilder_views(app):
# add_view_no_menu to change item position.
# I added link in extensions.init_appbuilder_links.init_appbuilder_links
appbuilder.add_view_no_menu(views.RedocView)
appbuilder.add_view_no_menu(views.SwaggerView)
# Development views
appbuilder.add_view_no_menu(views.DevView)
appbuilder.add_view_no_menu(views.DocsView)
Expand Down
11 changes: 11 additions & 0 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3565,6 +3565,17 @@ def conf(self):
)


class SwaggerView(AirflowBaseView):
"""Swagger API documentation."""

default_view = "swagger"

@expose("/swagger")
def swagger(self):
"""Swagger UI."""
return redirect("/api/v1/ui")


class RedocView(AirflowBaseView):
"""Redoc Open API documentation."""

Expand Down
2 changes: 1 addition & 1 deletion tests/www/views/test_views_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_doc_urls(admin_client, monkeypatch):
resp = admin_client.get("/", follow_redirects=True)

check_content_in_response("!!DOCS_URL!!", resp)
check_content_in_response("/api/v1/ui", resp)
check_content_in_response("/swagger", resp)


@pytest.fixture
Expand Down

0 comments on commit 73d7502

Please sign in to comment.