Skip to content

Commit

Permalink
fix openapi.json path
Browse files Browse the repository at this point in the history
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
  • Loading branch information
Teo Koon Peng committed Feb 28, 2024
1 parent 0e8ef2d commit 8cbc0b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions packages/api-server/api_server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,7 @@ async def on_shutdown():

@app.get("/docs", include_in_schema=False)
async def custom_swagger_ui_html():
openapi_url = (
app.openapi_url
if app.openapi_url is not None
else f"{app_config.public_url.geturl()}/openapi.json"
)
openapi_url = f"{app_config.public_url.geturl()}{app.openapi_url}"
return get_swagger_ui_html(
openapi_url=openapi_url,
title=app.title + " - Swagger UI",
Expand All @@ -238,7 +234,7 @@ async def swagger_ui_redirect():

@app.get("/redoc", include_in_schema=False)
async def redoc_html():
openapi_url = app.openapi_url if app.openapi_url is not None else "/openapi.json"
openapi_url = f"{app_config.public_url.geturl()}{app.openapi_url}"
return get_redoc_html(
openapi_url=openapi_url,
title=app.title + " - ReDoc",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"prepack": "../../scripts/pipenv run python setup.py bdist_wheel",
"restart": "RMF_API_SERVER_CONFIG=sqlite_local_config.py ../../scripts/pipenv run python -m api_server",
"start": "rm -rf run && mkdir -p run/cache && RMF_API_SERVER_CONFIG=sqlite_local_config.py ../../scripts/pipenv run python -m api_server",
"start": "rm -rf run && mkdir -p run/cache && RMF_API_SERVER_CONFIG=${RMF_API_SERVER_CONFIG:=-sqlite_local_config.py} ../../scripts/pipenv run python -m api_server",
"start:psql": "rm -rf run && mkdir -p run/cache && RMF_API_SERVER_CONFIG=psql_local_config.py ../../scripts/pipenv run python -m api_server",
"test": "../../scripts/pipenv run python scripts/test.py",
"test:cov": "../../scripts/pipenv run python -m coverage run scripts/test.py",
Expand Down

0 comments on commit 8cbc0b7

Please sign in to comment.