Skip to content

Commit

Permalink
chore: replace root schema path with swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPandir committed Feb 17, 2024
1 parent 45b49bb commit e2f0ff8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from dotenv import load_dotenv
from litestar import Litestar, get, Response
from litestar.response import Redirect
from litestar.openapi import OpenAPIConfig
from litestar.config.response_cache import CACHE_FOREVER
from litestar.params import Parameter
Expand Down Expand Up @@ -63,8 +64,11 @@ def generate(
async def speakers() -> dict[str, list[str]]:
return tts.speakers

@get(["/", "/docs"], include_in_schema=False)
async def docs() -> Redirect:
return Redirect("/schema")

app = Litestar(
[generate, speakers],
openapi_config=OpenAPIConfig(title="Silero TTS API", version="1.0.0"),
[generate, speakers, docs],
openapi_config=OpenAPIConfig(title="Silero TTS API", version="1.0.0", root_schema_site="swagger"),
)

0 comments on commit e2f0ff8

Please sign in to comment.