Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

✨ Allow including additional scripts to Swagger UI page and adding presets#14762

Draft
YuriiMotov wants to merge 4 commits intomasterfrom
additional-scripts-and-presets-in-get_swagger_ui_html
Draft

✨ Allow including additional scripts to Swagger UI page and adding presets#14762
YuriiMotov wants to merge 4 commits intomasterfrom
additional-scripts-and-presets-in-get_swagger_ui_html

Conversation

@YuriiMotov
Copy link
Member

@YuriiMotovYuriiMotov commentedJan 22, 2026
edited
Loading

For now there is no easy way to enableStandaloneLayout and dark mode that comes with it.

To do this you need to:

With changes from this PR we will be able to enableStandaloneLayout the following way:

from fastapi import FastAPIfrom fastapi.openapi.docs import (    get_swagger_ui_html,    get_swagger_ui_oauth2_redirect_html,)app = FastAPI(docs_url=None, redoc_url=None)@app.get("/docs", include_in_schema=False)async def custom_swagger_ui_html():    return get_swagger_ui_html(        openapi_url=app.openapi_url,        title=app.title + " - Swagger UI",        oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,+       swagger_extra_js_urls=["https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-standalone-preset.js"],+       swagger_extra_presets=["SwaggerUIStandalonePreset"],+       swagger_ui_parameters={"layout": "StandaloneLayout"},    )@app.get(app.swagger_ui_oauth2_redirect_url, include_in_schema=False)async def swagger_ui_redirect():    return get_swagger_ui_oauth2_redirect_html()@app.get("/users/{username}")async def read_user(username: str):    return {"message": f"Hello {username}"}
image

@YuriiMotovYuriiMotov added the featureNew feature or request labelJan 22, 2026
@github-actions
Copy link
Contributor

@codspeed-hq
Copy link

codspeed-hqbot commentedJan 22, 2026
edited
Loading

CodSpeed Performance Report

Merging this PR willnot alter performance

Comparingadditional-scripts-and-presets-in-get_swagger_ui_html (841c5c3) withmaster (74cc27f)1

Summary

✅ 20 untouched benchmarks

Footnotes

  1. No successful run was found onmaster (597b435) during the generation of this report, so74cc27f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

featureNew feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@YuriiMotov

[8]ページ先頭

©2009-2026 Movatter.jp