feat: more openAPI tag description
This commit is contained in:
@@ -21,6 +21,41 @@ from freqtrade.rpc.rpc_types import RPCSendMsg
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
_TRADE_MODE_ONLY = "*only available in trading mode*"
|
||||||
|
|
||||||
|
_OPENAPI_TAGS = (
|
||||||
|
{"name": "Auth", "description": "Authentication endpoints."},
|
||||||
|
{
|
||||||
|
"name": "info",
|
||||||
|
"description": ("Information endpoints providing general information about the bot."),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "trading",
|
||||||
|
"description": f"Trading related endpoints - {_TRADE_MODE_ONLY}.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "webserver",
|
||||||
|
"description": ("Webserver related endpoints - *only available in webserver mode*."),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "botcontrol",
|
||||||
|
"description": (f"Bot control endpoints to start/stop trading - {_TRADE_MODE_ONLY}."),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pairlist",
|
||||||
|
"description": f"Pairlist management - {_TRADE_MODE_ONLY}.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "locks",
|
||||||
|
"description": f"Pair lock management - {_TRADE_MODE_ONLY}.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "candle data",
|
||||||
|
"description": "Candle / OHLCV data.",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class FTJSONResponse(JSONResponse):
|
class FTJSONResponse(JSONResponse):
|
||||||
media_type = "application/json"
|
media_type = "application/json"
|
||||||
|
|
||||||
@@ -62,38 +97,13 @@ class ApiServer(RPCHandler):
|
|||||||
ApiServer.__initialized = True
|
ApiServer.__initialized = True
|
||||||
|
|
||||||
api_config = self._config["api_server"]
|
api_config = self._config["api_server"]
|
||||||
trade_mode_only = "*only available in trading mode*"
|
|
||||||
|
|
||||||
self.app = FastAPI(
|
self.app = FastAPI(
|
||||||
title="Freqtrade API",
|
title="Freqtrade API",
|
||||||
docs_url="/docs" if api_config.get("enable_openapi", False) else None,
|
docs_url="/docs" if api_config.get("enable_openapi", False) else None,
|
||||||
redoc_url=None,
|
redoc_url=None,
|
||||||
default_response_class=FTJSONResponse,
|
default_response_class=FTJSONResponse,
|
||||||
openapi_tags=[
|
openapi_tags=_OPENAPI_TAGS,
|
||||||
{"name": "auth", "description": "Authentication endpoints."},
|
|
||||||
{
|
|
||||||
"name": "info",
|
|
||||||
"description": (
|
|
||||||
"Information endpoints providing general information about the bot."
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "trading",
|
|
||||||
"description": f"Trading related endpoints - {trade_mode_only}.",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "webserver",
|
|
||||||
"description": (
|
|
||||||
"Webserver related endpoints - *only available in webserver mode*."
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "botcontrol",
|
|
||||||
"description": (
|
|
||||||
f"Bot control endpoints to start/stop trading - {trade_mode_only}."
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
self.configure_app(self.app, self._config)
|
self.configure_app(self.app, self._config)
|
||||||
self.start_api()
|
self.start_api()
|
||||||
@@ -158,7 +168,7 @@ class ApiServer(RPCHandler):
|
|||||||
|
|
||||||
app.include_router(api_v1_public, prefix="/api/v1")
|
app.include_router(api_v1_public, prefix="/api/v1")
|
||||||
|
|
||||||
app.include_router(router_login, prefix="/api/v1", tags=["auth"])
|
app.include_router(router_login, prefix="/api/v1", tags=["Auth"])
|
||||||
app.include_router(
|
app.include_router(
|
||||||
api_v1,
|
api_v1,
|
||||||
prefix="/api/v1",
|
prefix="/api/v1",
|
||||||
|
|||||||
Reference in New Issue
Block a user