From 6fe8870b5dcfd9e655611c364763cb23ffe191b9 Mon Sep 17 00:00:00 2001 From: Anuj Chhikara <107175639+AnujChhikara@users.noreply.github.com> Date: Thu, 29 May 2025 16:50:14 +0530 Subject: [PATCH 1/2] doc: add API contract for the todo backend delete api --- todo-backend/README.md | 83 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 6 deletions(-) diff --git a/todo-backend/README.md b/todo-backend/README.md index c96181d..453be8b 100644 --- a/todo-backend/README.md +++ b/todo-backend/README.md @@ -58,12 +58,13 @@ ## **Requests** -| Route | Description | -| :------------------------------------------: | :-------------------------------: | -| [GET /v1/tasks](#get-v1tasks) | Return all tasks with pagination | -| [POST /v1/tasks](#post-v1tasks) | Creates new task | -| [GET /v1/health](#get-v1health) | Health check endpoint | -| [GET /v1/tasks/{taskId}](#get-v1taskstaskid) | Retrieves a single task by its ID | +| Route | Description | +| :------------------------------------------------: | :-------------------------------: | +| [GET /v1/tasks](#get-v1tasks) | Return all tasks with pagination | +| [POST /v1/tasks](#post-v1tasks) | Creates new task | +| [GET /v1/health](#get-v1health) | Health check endpoint | +| [GET /v1/tasks/{taskId}](#get-v1taskstaskid) | Retrieves a single task by its ID | +| [DELETE /v1/tasks/{taskId}](#delete-v1taskstaskid) | Deletes a specific task | ## **GET /v1/tasks** @@ -274,6 +275,76 @@ Creates a new task } ``` +## **DELETE /v1/tasks/{task_id}** + +Deletes a task with the given `task_id`. + +- **Params** + + - `task_id`: The unique identifier of the task (as a path parameter) + +- **Success Response:** + + - **Code:** 204 + - **Content:** None + +- **Error Responses:** + + - **Code:** 400 + + - **Reason:** Invalid `task_id` format + - **Content:** + ```json + { + "statusCode": 400, + "message": "Please enter a valid Task ID format.", + "errors": [ + { + "source": { + "path": "task_id" + }, + "title": "Validation Error", + "detail": "Please enter a valid Task ID format." + } + ] + } + ``` + + - **Code:** 404 + + - **Reason:** Task with the given `task_id` was not found + - **Content:** + ```json + { + "statusCode": 404, + "message": "Task with ID not found.", + "errors": [ + { + "source": { + "parameter": "task_id" + }, + "title": "Resource Not Found", + "detail": "Task with ID not found." + } + ] + } + ``` + + - **Code:** 500 + - **Reason:** Internal server error + - **Content:** + ```json + { + "statusCode": 500, + "message": "An unexpected error occurred", + "errors": [ + { + "detail": "Internal server error" + } + ] + } + ``` + ## **GET /v1/health** Health check endpoint From d15b7883d26952c49ea6936bb7846e2226b8b043 Mon Sep 17 00:00:00 2001 From: Anuj Chhikara <107175639+AnujChhikara@users.noreply.github.com> Date: Tue, 3 Jun 2025 21:24:33 +0530 Subject: [PATCH 2/2] fix: inconsistency in source path --- todo-backend/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/todo-backend/README.md b/todo-backend/README.md index 453be8b..5a69df6 100644 --- a/todo-backend/README.md +++ b/todo-backend/README.md @@ -275,7 +275,7 @@ Creates a new task } ``` -## **DELETE /v1/tasks/{task_id}** +## **DELETE /v1/tasks/{taskId}** Deletes a task with the given `task_id`. @@ -321,7 +321,7 @@ Deletes a task with the given `task_id`. "errors": [ { "source": { - "parameter": "task_id" + "path": "task_id" }, "title": "Resource Not Found", "detail": "Task with ID not found."