Skip to content

Commit

Permalink
feat: add scalar docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zobweyt committed Nov 14, 2024
1 parent 3e74de8 commit 35252fd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies = [
"redis>=5.0.8",
"pillow>=10.4.0",
"emoji>=2.14.0",
"scalar-fastapi>=1.0.3",
]
requires-python = "==3.12.*"

Expand Down
6 changes: 6 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from fastapi import Depends, FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from scalar_fastapi import get_scalar_api_reference

from src.api import router
from src.config import settings
Expand Down Expand Up @@ -30,3 +31,8 @@
app.add_middleware(I18nMiddleware)

app.include_router(router)


@app.get("/scalar", include_in_schema=False)
def get_scalar():
return get_scalar_api_reference(title=app.title, openapi_url=app.openapi_url) if app.openapi_url else None

0 comments on commit 35252fd

Please sign in to comment.