11import json
2+ from typing import Annotated
23
34import pydantic_asyncapi as pa
45from fastapi import APIRouter
6+ from fastapi .params import Depends
57from starlette .responses import HTMLResponse
68
9+ from common import AppConfig
710from common .asyncapi import get_schema
11+ from http_app .dependencies import get_app_config
812
913router = APIRouter (prefix = "/docs/ws" )
1014
@@ -32,6 +36,7 @@ def asyncapi_raw() -> pa.v3.AsyncAPI:
3236# https://github.com/asyncapi/asyncapi-react/blob/v2.5.0/docs/usage/standalone-bundle.md
3337@router .get ("" , include_in_schema = False )
3438async def get_asyncapi_html (
39+ app_config : Annotated [AppConfig , Depends (get_app_config )],
3540 sidebar : bool = True ,
3641 info : bool = True ,
3742 servers : bool = True ,
@@ -40,7 +45,6 @@ async def get_asyncapi_html(
4045 schemas : bool = True ,
4146 errors : bool = True ,
4247 expand_message_examples : bool = False ,
43- title : str = "Websocket" ,
4448) -> HTMLResponse :
4549 """Generate HTML for displaying an AsyncAPI document."""
4650 config = {
@@ -74,7 +78,7 @@ async def get_asyncapi_html(
7478 <head>
7579 """
7680 f"""
77- <title>{ title } AsyncAPI</title>
81+ <title>{ app_config . APP_NAME } AsyncAPI</title>
7882 """
7983 """
8084 <link rel="icon" href="https://www.asyncapi.com/favicon.ico">
0 commit comments