Skip to content

Commit

Permalink
📌 Pin Swagger UI version to 5.9.0 temporarily to handle a bug crashin…
Browse files Browse the repository at this point in the history
…g it in 5.9.1 (#10529)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
alejandraklachquin and pre-commit-ci[bot] authored Oct 30, 2023
1 parent e4b21c6 commit 758a8f2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/en/docs/how-to/custom-docs-ui-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ You can probably right-click each link and select an option similar to `Save lin

**Swagger UI** uses the files:

* <a href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-bundle.js" class="external-link" target="_blank">`swagger-ui-bundle.js`</a>
* <a href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui.css" class="external-link" target="_blank">`swagger-ui.css`</a>
* <a href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.9.0/swagger-ui-bundle.js" class="external-link" target="_blank">`swagger-ui-bundle.js`</a>
* <a href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.9.0/swagger-ui.css" class="external-link" target="_blank">`swagger-ui.css`</a>

And **ReDoc** uses the file:

Expand Down
4 changes: 2 additions & 2 deletions docs_src/custom_docs_ui/tutorial001.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ async def custom_swagger_ui_html():
openapi_url=app.openapi_url,
title=app.title + " - Swagger UI",
oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
swagger_js_url="https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js",
swagger_css_url="https://unpkg.com/swagger-ui-dist@5/swagger-ui.css",
swagger_js_url="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-bundle.js",
swagger_css_url="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui.css",
)


Expand Down
4 changes: 2 additions & 2 deletions fastapi/openapi/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_swagger_ui_html(
It is normally set to a CDN URL.
"""
),
] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-bundle.js",
] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.9.0/swagger-ui-bundle.js",
swagger_css_url: Annotated[
str,
Doc(
Expand All @@ -63,7 +63,7 @@ def get_swagger_ui_html(
It is normally set to a CDN URL.
"""
),
] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui.css",
] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.9.0/swagger-ui.css",
swagger_favicon_url: Annotated[
str,
Doc(
Expand Down
6 changes: 4 additions & 2 deletions tests/test_tutorial/test_custom_docs_ui/test_tutorial001.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ def client():
def test_swagger_ui_html(client: TestClient):
response = client.get("/docs")
assert response.status_code == 200, response.text
assert "https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js" in response.text
assert "https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" in response.text
assert (
"https://unpkg.com/[email protected]/swagger-ui-bundle.js" in response.text
)
assert "https://unpkg.com/[email protected]/swagger-ui.css" in response.text


def test_swagger_ui_oauth2_redirect_html(client: TestClient):
Expand Down

0 comments on commit 758a8f2

Please sign in to comment.