From 3b0cc0d2fff6d9a5efd0d37ad6843575e8ca6e7c Mon Sep 17 00:00:00 2001 From: jihwooon Date: Fri, 4 Oct 2024 00:00:56 +0900 Subject: [PATCH] =?UTF-8?q?OpenAPI=20=EB=AA=85=EC=84=B8=EC=97=90=20Task=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenAPI 명세서에 Task를 생성, 조회, 수정, 삭제하는 API를 추가하였습니다. 주요 변경사항: 1. Task 생성을 위한 POST /tasks API 추가: Task의 내용을 입력받아 새로운 Task를 생성합니다. 2. Task 조회를 위한 GET /tasks/{taskId} API 추가: 특정 Task의 정보를 조회합니다. 3. Task 수정을 위한 PATCH /tasks/{taskId} API 추가: 특정 Task의 내용을 수정합니다. 4. Task 삭제를 위한 DELETE /tasks/{taskId} API 추가: 특정 Task를 삭제합니다. 5. 각 API의 요청과 응답에 대한 명세를 추가하였습니다. --- todo-app/openapi.yaml | 117 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 1 deletion(-) diff --git a/todo-app/openapi.yaml b/todo-app/openapi.yaml index 2258929..11fd57a 100644 --- a/todo-app/openapi.yaml +++ b/todo-app/openapi.yaml @@ -19,7 +19,7 @@ paths: API 서버가 잘 작동하는지 확인하는 용도의 API. responses: '200': - description: 멀쩡함. + description: 서버가 정상 작동함 /tasks: get: tags: @@ -52,3 +52,118 @@ paths: type: string description: 할 일 등록 일시 (UTC) example: "2024-10-01 12:34:56" + post: + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + contents: + type: string + description: 내용 + example: "오늘 할 일" + responses: + 200: + description: Task 저장 결과 + content: + application/json: + schema: + type: object + properties: + id: + type: number + description: 저장 된 id 값 + example: 1 + contents: + type: string + description: 내용 + example: "오늘 할 일" + 400: + description: 잘못된 입력 형식 + content: + application/json: + schema: + type: object + properties: + error: + type: string + example: "문자열 타입이 아닙니다." + /tasks/{taskId}: + get: + parameters: + - name: taskId + in: path + required: true + schema: + type: string + responses: + 200: + description: Task 목록 조회 + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + patch: + parameters: + - name: taskId + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + contents: + type: string + description: 내용 + example: "내일 할 일" + responses: + 200: + description: Task 수정 결과 + content: + application/json: + schema: + type: object + properties: + id: + type: number + description: 저장 된 id 값 + example: 1 + contents: + type: string + description: 내용 + example: "내일 할 일" + delete: + parameters: + - name: taskId + in: path + required: true + schema: + type: string + responses: + 200: + description: Task 삭제 결과 + content: + application/json: + schema: + type: object + properties: + message: + type: string + description: 삭제 성공 + example: "success" +components: + schemas: + Task: + type: object + properties: + id: + type: integer + content: + type: string