From 72e11afb1dc61880247de8871b7582dd56ef298b Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Mon, 12 Feb 2024 20:39:39 +0000 Subject: [PATCH 1/2] Fix OpenAPI docs --- jhub_apps/service/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jhub_apps/service/app.py b/jhub_apps/service/app.py index 2d74e1fb..ba58486b 100644 --- a/jhub_apps/service/app.py +++ b/jhub_apps/service/app.py @@ -18,7 +18,7 @@ app = FastAPI( title="JApps Service", - version=get_version(), + version=str(get_version()), ### Serve out Swagger from the service prefix (/services/:name/docs) openapi_url=router.prefix + "/openapi.json", docs_url=router.prefix + "/docs", From b1cbbe299991bb12937b61676d1c55044bdff2ee Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Mon, 12 Feb 2024 20:53:20 +0000 Subject: [PATCH 2/2] add a test --- jhub_apps/tests/test_api.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jhub_apps/tests/test_api.py b/jhub_apps/tests/test_api.py index d8ef7da3..3ded1d5b 100644 --- a/jhub_apps/tests/test_api.py +++ b/jhub_apps/tests/test_api.py @@ -156,3 +156,12 @@ def test_api_status(client): rjson = response.json() assert rjson["status"] == "ok" assert "version" in rjson + + +def test_open_api_docs(client): + response = client.get( + "/openapi.json", + ) + assert response.status_code == 200 + rjson = response.json() + assert rjson['info']['version']