fastapi空白文档解决方法

moxiaoying
2年前发布 /正在检测是否收录...
温馨提示:
本文最后更新于2023年07月17日,已超过641天没有更新,若内容或图片失效,请留言反馈。

重写文档渲染

@app.get(settings.DOCS_URL, 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_js_url="https://cdn.bootcdn.net/ajax/libs/swagger-ui/4.10.3/swagger-ui-bundle.js",
        swagger_css_url="https://cdn.bootcdn.net/ajax/libs/swagger-ui/4.10.3/swagger-ui.css",
    )
喜欢就支持一下吧
点赞 0 分享 收藏
评论
所有页面的评论已关闭