From 7676bc16eb1039eb70b4303df64cafdf8b3fc2af Mon Sep 17 00:00:00 2001 From: KafayatYusuf <155323901+KafayatYusuf@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:04:50 +0100 Subject: [PATCH 1/3] Removed trail slash --- API/stats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API/stats.py b/API/stats.py index b2ca5414..c8ebd6ee 100644 --- a/API/stats.py +++ b/API/stats.py @@ -11,7 +11,7 @@ router = APIRouter(prefix="/stats", tags=["Stats"]) -@router.post("/polygon/") +@router.post("/polygon") @limiter.limit(f"{POLYGON_STATISTICS_API_RATE_LIMIT}/minute") @version(1) async def get_polygon_stats( From 772119fd4026df1a16be06a2c08d050b861fd39d Mon Sep 17 00:00:00 2001 From: KafayatYusuf <155323901+KafayatYusuf@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:21:39 +0100 Subject: [PATCH 2/3] Added a summary of what the API is about --- API/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/API/main.py b/API/main.py index f887895a..332cf255 100644 --- a/API/main.py +++ b/API/main.py @@ -75,7 +75,11 @@ os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1" -app = FastAPI(title="Raw Data API ", swagger_ui_parameters={"syntaxHighlight": False}) +app = FastAPI( + title="Raw Data API ", + summary="RAW Data API (Application Programming Interface) helps to transform and export OpenStreetMap (OSM) data in different GIS file formats.", + swagger_ui_parameters={"syntaxHighlight": False}, +) app.include_router(auth_router) app.include_router(raw_data_router) app.include_router(tasks_router) From c7d9fdccc7cf91031dcad34cb7a199385711dfc8 Mon Sep 17 00:00:00 2001 From: KafayatYusuf <155323901+KafayatYusuf@users.noreply.github.com> Date: Sun, 7 Apr 2024 14:23:41 +0100 Subject: [PATCH 3/3] Added response codes --- API/stats.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/API/stats.py b/API/stats.py index c8ebd6ee..6d0065fb 100644 --- a/API/stats.py +++ b/API/stats.py @@ -11,7 +11,18 @@ router = APIRouter(prefix="/stats", tags=["Stats"]) -@router.post("/polygon") +@router.post( + "/polygon", + responses={ + 200: { + "description": "Successful", + "content": {"application/json": {"example": {"statistics": {...}}}}, + }, + 422: {"description": "validation Error"}, + 429: {"description": "Rate limit per minute exceeded"}, + 500: {"description": "Internal Server Error"}, + }, +) @limiter.limit(f"{POLYGON_STATISTICS_API_RATE_LIMIT}/minute") @version(1) async def get_polygon_stats(