From 99ee324fd64587f3aa31bacf84804008e3a01689 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Mon, 12 Jun 2023 16:56:33 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20openapi=E3=81=ABpost=E3=81=AE=E5=AE=9A?= =?UTF-8?q?=E7=BE=A9=E3=82=92=E6=9B=B8=E3=81=84=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/openapi/api.yaml | 116 +++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 1 deletion(-) diff --git a/src/main/resources/openapi/api.yaml b/src/main/resources/openapi/api.yaml index 5d79479e..0bfacf33 100644 --- a/src/main/resources/openapi/api.yaml +++ b/src/main/resources/openapi/api.yaml @@ -8,10 +8,57 @@ servers: paths: /posts: get: - summary: 権限に応じて投稿を返す + summary: 権限に応じて投稿一覧を返す security: - { } - BearerAuth: [ ] + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Post" + 401: + $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/Forbidden" + 429: + $ref: "#/components/responses/TooManyRequests" + post: + summary: 投稿する + security: + - BearerAuth: [ ] + requestBody: + description: 投稿する内容 + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/Post" + responses: + 200: + description: 成功 + headers: + Location: + description: 作成した投稿のURL + schema: + type: string + format: uri + 401: + $ref: "#/components/responses/Unauthorized" + 429: + $ref: "#/components/responses/TooManyRequests" + /posts/{postId}: + get: + summary: 権限に応じてIDの投稿を取得 + security: + - { } + - BearerAuth: [ ] + parameters: + - $ref: "#/components/parameters/postId" responses: 200: description: 成功 @@ -23,6 +70,57 @@ paths: $ref: "#/components/responses/Unauthorized" 403: $ref: "#/components/responses/Forbidden" + 404: + $ref: "#/components/responses/NotFound" + 429: + $ref: "#/components/responses/TooManyRequests" + /users/{userName}/posts: + get: + summary: 権限に応じてユーザーの投稿一覧を返す + security: + - { } + - BearerAuth: [ ] + parameters: + - $ref: "#/components/parameters/userName" + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Post" + 401: + $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/Forbidden" + 429: + $ref: "#/components/responses/TooManyRequests" + + /users/{userName}/posts/{postId}: + get: + summary: 権限に応じてIDの投稿を取得 + description: userNameが間違っていても取得できます。 + security: + - { } + - BearerAuth: [ ] + parameters: + - $ref: "#/components/parameters/userName" + - $ref: "#/components/parameters/postId" + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/Post" + 401: + $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/Forbidden" + 404: + $ref: "#/components/responses/NotFound" 429: $ref: "#/components/responses/TooManyRequests" @@ -37,6 +135,22 @@ components: TooManyRequests: description: レートリミット + parameters: + postId: + name: postId + in: path + description: 投稿ID + required: true + schema: + type: integer + format: int64 + userName: + name: userName + in: path + description: ユーザーIDまたはAcctなど @name@domain name@domain name + required: true + schema: + type: string schemas: Post: