fastapi交互文档
要隐藏部分接口,可以在路由装饰器上面添加一个参数include_in_schema=False,如下所示:

@app.post('/login', include_in_schema=False)

关闭全部文档,实例化FastAPI对象时,传入以下参数.

from fastapi import FastAPI
app = FastAPI(
    docs_url=None,
    redoc_url=None,
    openapi_url=None,
)

最后修改:2024 年 09 月 18 日
如果觉得我的文章对你有用,请随意赞赏