From 23841a7b43bd66acbda0a8ed4846889c6169ee28 Mon Sep 17 00:00:00 2001 From: ramdos0207 Date: Sun, 18 Aug 2024 18:28:07 +0900 Subject: [PATCH 01/13] add openapi.yaml --- docs/openapi.yaml | 1457 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1457 insertions(+) create mode 100644 docs/openapi.yaml diff --git a/docs/openapi.yaml b/docs/openapi.yaml new file mode 100644 index 0000000..287ff53 --- /dev/null +++ b/docs/openapi.yaml @@ -0,0 +1,1457 @@ +openapi: 3.0.3 +info: + title: traO Judge API + description: traO Judge API (front ↔ back) + version: 0.1.0 +tags: + - name: authentication + - name: editorials + - name: me + - name: oauth2 + - name: problems + - name: submissions + - name: users +paths: + '/editorials/{editorialId}': + parameters: + - $ref: '#/components/parameters/editorialIdInPath' + get: + summary: getEditorial + operationId: getEditorial + tags: + - editorials + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/EditorialDetail' + '400': + description: Bad Request + '404': + description: 解説が存在しません(または解説の閲覧権限がありません) + description: 個別の解説を取得する + put: + summary: putEditorial + operationId: putEditorial + tags: + - editorials + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PutEditorialRequest' + responses: + '201': + description: |- + No Content + 正常に変更されました. + '400': + description: Bad Request + '403': + description: |- + Forbidden + 解説を変更する権限がありません. + '404': + description: |- + Not Found + 解説が存在しません. (または解説の閲覧権限がありません.) + description: 個別の解説を変更する + delete: + summary: deleteEditorial + operationId: deleteEditorial + tags: + - editorials + responses: + '201': + description: |- + No Content + 正常に削除されました. + '400': + description: Bad Request + '403': + description: |- + Forbidden + 解説を削除する権限がありません. + '404': + description: |- + Not Found + 解説が存在しません. (または解説の閲覧権限がありません.) + description: 個別の解説を削除する + /problems: + post: + summary: postProblem + description: |- + 問題を新規作成・投稿する + このとき作成された問題は必ず非公開になる + 公開する場合は PATCH で変更する必要がある + operationId: postProblem + tags: + - problems + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PostProblemRequest' + responses: + '200': + description: |- + OK + 問題が投稿されました. + content: + application/json: + schema: + $ref: '#/components/schemas/Problem' + '400': + description: Bad Request + get: + summary: getProblems + operationId: getProblems + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Problems' + '400': + description: Bad Request + '404': + description: Not Found + description: 問題一覧を取得する + requestBody: + content: {} + tags: + - problems + parameters: + - $ref: '#/components/parameters/limitInQuery' + - $ref: '#/components/parameters/offsetInQuery' + - $ref: '#/components/parameters/problemsOrderByInQuery' + - $ref: '#/components/parameters/userNameInQuery' + - $ref: '#/components/parameters/userIdInQuery' + '/problems/{problemId}': + parameters: + - $ref: '#/components/parameters/problemIdInPath' + get: + summary: getProblem + operationId: getProblem + tags: + - problems + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Problem' + '400': + description: Bad Request + '404': + description: |- + Not Found + 問題が存在しません. (または問題の閲覧権限がありません.) + description: 個別の問題を取得する + put: + summary: putProblem + operationId: putProblem + tags: + - problems + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Problem' + '400': + description: Bad Request + '403': + description: |- + Forbidden + 問題を編集する権限がありません. + '404': + description: |- + Not Found + 問題が存在しません. (または問題の閲覧権限がありません.) + description: 問題を修正する + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PutProblemRequest' + delete: + summary: deleteProblem + operationId: deleteProblem + tags: + - problems + responses: + '201': + description: |- + No Content + 正常に削除されました. + '400': + description: Bad Request + '403': + description: |- + Forbidden + 問題を削除する権限がありません. + '404': + description: |- + Not Found + 問題が存在しません. (または問題の閲覧権限がありません.) + description: 問題を削除する + '/problems/{problemId}/editorials': + parameters: + - $ref: '#/components/parameters/problemIdInPath' + get: + summary: getEditorialsOnProblem + operationId: getEditorialsOnProblem + tags: + - editorials + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Editorials' + '400': + description: Bad Request + '404': + description: |- + Not Found + 問題が存在しません. (または問題の閲覧権限がありません.) + description: ある問題の全ての解説を取得する + post: + summary: postEditorial + operationId: postEditorial + tags: + - editorials + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PostEditorialRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/EditorialDetail' + '400': + description: Bad Request + '401': + description: |- + Unauthorized + ログインしていません. + '403': + description: |- + Forbidden + 解説を投稿する権限がありません. + '404': + description: |- + Not Found + 問題が存在しません. (または問題の閲覧権限がありません.) + description: 解説を投稿する + '/problems/{problemId}/submissions': + parameters: + - $ref: '#/components/parameters/problemIdInPath' + get: + summary: getSubmissionsForProblem + operationId: getSubmissionsForProblem + tags: + - submissions + parameters: + - $ref: '#/components/parameters/submissionsOrderByInQuery' + - $ref: '#/components/parameters/judgeStatusInQuery' + - $ref: '#/components/parameters/codeLanguageInQuery' + - $ref: '#/components/parameters/userNameInQuery' + - $ref: '#/components/parameters/limitInQuery' + - $ref: '#/components/parameters/offsetInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Submissions' + '403': + description: |- + Forbidden + 提出一覧を取得する権限がありません. + '404': + description: |- + Not Found + 問題が存在しません. (または問題の閲覧権限がありません.) + description: 問題への提出一覧を取得する + post: + summary: postSubmission + operationId: postSubmission + tags: + - submissions + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PostSubmissionRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SubmissionDetail' + '400': + description: Bad Request + '403': + description: |- + Forbidden + ソースコードを提出する権限がありません. + '404': + description: |- + Not Found + 提出が存在しません. (または提出の閲覧権限がありません.) + description: ソースコードを提出する + /submissions: + get: + summary: getSubmissions + operationId: getSubmissions + tags: + - submissions + parameters: + - $ref: '#/components/parameters/submissionsOrderByInQuery' + - $ref: '#/components/parameters/judgeStatusInQuery' + - $ref: '#/components/parameters/codeLanguageInQuery' + - $ref: '#/components/parameters/userNameInQuery' + - $ref: '#/components/parameters/userIdInQuery' + - $ref: '#/components/parameters/limitInQuery' + - $ref: '#/components/parameters/offsetInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Submissions' + '400': + description: Bad Request + description: 提出一覧を取得する + '/submissions/{submissionId}': + parameters: + - $ref: '#/components/parameters/submissionIdInPath' + get: + summary: getSubmission + operationId: getSubmission + tags: + - submissions + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SubmissionDetail' + '400': + description: Bad Request + '404': + description: |- + Not Found + 提出が存在しません. (または提出の閲覧権限がありません.) + description: 個別の提出を取得する + '/users/{userId}': + parameters: + - $ref: '#/components/parameters/userIdInPath' + get: + summary: getUser + operationId: getUser + tags: + - users + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Bad Request + '404': + description: |- + Not Found + ユーザーが存在しません. + description: 個別のユーザー情報を取得する + /users/me: + get: + summary: getMe + operationId: getMe + tags: + - me + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '401': + description: |- + Unauthorized + ログインしていません. + description: 自身の情報を取得する + put: + summary: putMe + operationId: putUsersMeIcon + responses: + '200': + description: 正常に更新されました + content: + application/json: + schema: + type: object + properties: + iconUrl: + type: string + required: + - iconUrl + '400': + description: 不正なリクエストです + tags: + - me + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PutMeRequest' + description: アイコンなど自身に関連する情報の編集をします + /users/me/submissions: + get: + summary: getMeSubmissions + operationId: getMeSubmissions + tags: + - me + parameters: + - $ref: '#/components/parameters/submissionsOrderByInQuery' + - $ref: '#/components/parameters/judgeStatusInQuery' + - $ref: '#/components/parameters/codeLanguageInQuery' + - $ref: '#/components/parameters/userNameInQuery' + - $ref: '#/components/parameters/userIdInQuery' + - $ref: '#/components/parameters/limitInQuery' + - $ref: '#/components/parameters/offsetInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Submission' + '401': + description: |- + Unauthorized + ログインしていません + description: 自分の提出を全て取得する + /users/me/email: + put: + summary: putMeEmail + operationId: putMeEmail + responses: + '204': + description: 正常に更新されました メール認証を行なってください + '400': + description: 不正なリクエストです + tags: + - me + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Email' + description: メール情報を書き換える メール情報を書き換えた後はメール認証が必要である + /users/me/password: + put: + summary: putUserMePassword + operationId: putUsersMePassword + responses: + '204': + description: 正常に更新されました + '400': + description: 不正なリクエストです + tags: + - me + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PutPasswordRequest' + description: ログイン後にパスワードを変更する + /signup/request: + post: + summary: postSignupRequest + operationId: postSignupRequest + responses: + '201': + description: 認証用のURLを送信しました メール認証を行なってください + '400': + description: 不正なリクエストです メールアドレスの形式を確認してください + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SignupRequest' + tags: + - authentication + description: メールアドレスを渡し,そこに認証用のリンクを送る。 + /signup: + post: + summary: postSignup + operationId: postSignup + responses: + '201': + description: 正常にユーザーを作成できました メール認証を行なってください + '400': + description: 不正なリクエストです + '401': + description: Unauthorized + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Signup' + tags: + - authentication + description: |- + email+passwordによるユーザー登録 + クエリパラメタにtokenを持ち,それでメール情報を管理する + parameters: + - $ref: '#/components/parameters/token' + /login: + post: + summary: postLogin + operationId: postLogin + responses: + '204': + description: No Content + '400': + description: 不正なリクエストです ユーザー名とパスワードを確認してください + tags: + - authentication + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserEmailAndPassword' + description: ログイン + /logout: + post: + summary: postLogout + operationId: postLogout + responses: + '204': + description: No Content + description: ログアウト + tags: + - authentication + /reset-password/request: + post: + summary: postResetPasswordReset + tags: + - authentication + responses: + '204': + description: 正常にリセットメールを送信しました + operationId: postRequestResetPassword + description: パスワード変更のリクエスト + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Email' + /reset-password: + post: + summary: postResetPassword + operationId: postResetPassword + responses: + '204': + description: 正常に更新されました + description: 新しいパスワードをPOSTする + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ResetPasswordRequest' + tags: + - authentication + parameters: + - $ref: '#/components/parameters/token' + /google-oauth2/params: + get: + summary: getGoogleOAuth2Params + operationId: getGoogleAuthParams + responses: + '200': + description: 正しいURLが返されました + content: + application/json: + schema: + type: object + properties: + url: + type: string + required: + - url + '500': + description: Internal server error + content: + application/json: + schema: + type: object + properties: + message: + type: string + description: GoogleOAuthのためのエンドポイント + tags: + - oauth2 + parameters: [] + /github-oauth2/params: + get: + summary: getGithubOAuth2Params + operationId: getgithubAuthParams + responses: + '200': + description: 正しいURLが返されました + content: + application/json: + schema: + type: object + properties: + url: + type: string + required: + - url + '500': + description: Internal server error + content: + application/json: + schema: + type: object + properties: + message: + type: string + description: GitHubOAutheのためのエンドポイント + tags: + - oauth2 + parameters: [] + /traq-oauth2/revoke: + post: + summary: postTraqAouth2Revoke + operationId: revokeTraqAuth + tags: + - oauth2 + requestBody: + description: Access token to be revoked + required: true + content: + application/json: + schema: + type: object + properties: + token: + type: string + description: The access token to revoke + required: + - token + responses: + '201': + description: トークンは正常に削除されました + content: {} + '400': + description: Invalid request or token + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: Invalid token or request + '500': + description: Internal server error + content: + application/json: + schema: + type: object + properties: + message: + type: string + description: traQOAuthのトークンを削除する + /google-oauth2/revoke: + post: + summary: postGoogleOAuth2Revoke + operationId: revokeGoogleAuth + tags: + - oauth2 + requestBody: + description: Access token to be revoked + required: true + content: + application/json: + schema: + type: object + properties: + token: + type: string + description: The access token to revoke + required: + - token + responses: + '201': + description: トークンは正常に削除されました + content: {} + '400': + description: Invalid request or token + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: Invalid token or request + '500': + description: Internal server error + content: + application/json: + schema: + type: object + properties: + message: + type: string + description: GoogleOAuthのトークンを削除する + /github-oauth2/revoke: + post: + summary: postGithubOAuth2Revoke + operationId: revokeGithubAuth + tags: + - oauth2 + requestBody: + description: Access token to be revoked + required: true + content: + application/json: + schema: + type: object + properties: + token: + type: string + description: The access token to revoke + required: + - token + responses: + '201': + description: トークンは正常に削除されました + content: {} + '400': + description: Invalid request or token + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: Invalid token or request + '500': + description: Internal server error + content: + application/json: + schema: + type: object + properties: + message: + type: string + description: GithubOAuthのトークンを削除する +components: + schemas: + Problem: + title: Problem + type: object + description: 問題の詳細 + properties: + id: + type: integer + description: 問題ID + title: + type: string + description: 問題タイトル + authorId: + type: integer + description: 作問者のユーザーID + isPublic: + type: boolean + description: |- + 問題が全体公開かどうか. + + * `true` - 公開 + * `false` - 非公開 (問題の作者のみ閲覧可) + difficulty: + type: integer + description: 難易度 + statement: + type: string + description: 問題文 (HTML形式) + timeLimit: + type: integer + description: 実行時間制限 (ms) + memoryLimit: + type: integer + description: メモリ制限 (MiB) + testcases: + type: array + items: + $ref: '#/components/schemas/TestCase' + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + required: + - id + - title + - authorId + - isPublic + - difficulty + - timeLimit + - memoryLimit + - testcases + - createdAt + - updatedAt + Problems: + title: Problems + type: object + properties: + total: + type: integer + problems: + type: array + items: + $ref: '#/components/schemas/Problem' + required: + - total + - problems + PostProblemRequest: + title: PostProblemRequest + type: object + description: 問題の投稿リクエスト + properties: + title: + type: string + description: 問題タイトル + difficulty: + type: integer + description: 難易度 + statement: + type: string + description: 問題文 (HTML形式) + timeLimit: + type: integer + description: 実行時間制限 (ms) + memoryLimit: + type: integer + description: メモリ制限 (MiB) + testcases: + type: array + items: + $ref: '#/components/schemas/TestCase' + required: + - title + - difficulty + - statement + - timeLimit + - memoryLimit + PutProblemRequest: + title: PutProblemRequest + type: object + description: 問題の変更リクエスト + properties: + title: + type: string + description: 問題タイトル + isPublic: + type: boolean + description: |- + 問題が全体公開かどうか. + + * `true` - 公開 + * `false` - 非公開 (問題の作者のみ閲覧可) + difficulty: + type: integer + description: 難易度 + statement: + type: string + description: 問題文 (HTML形式) + timeLimit: + type: integer + description: 実行時間制限 (ms) + memoryLimit: + type: integer + description: メモリ制限 (MiB) + testcases: + type: array + items: + $ref: '#/components/schemas/TestCase' + required: + - title + - isPublic + - difficulty + - timeLimit + - memoryLimit + User: + title: User + type: object + description: ユーザー情報 + properties: + id: + type: integer + description: ユーザーID + name: + type: string + description: ユーザー名 + traqId: + type: string + description: traQのID + githubId: + type: string + description: GitHubのID + iconUrl: + type: string + postProblem: + type: array + items: + type: string + submit: + type: array + items: + type: string + xLink: + type: string + githubLink: + type: string + selfIntroduction: + type: string + role: + $ref: '#/components/schemas/Role' + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + '': + type: string + required: + - id + - name + - role + - createdAt + - updatedAt + PutMeRequest: + title: PutMeRequest + type: object + properties: + icon: + type: string + format: binary + xLink: + type: string + githubLink: + type: string + selfIntroduction: + type: string + PutPasswordRequest: + title: PutPasswordRequest + type: object + description: ログイン後のパスワード変更用 + properties: + oldPassword: + type: string + format: password + newPassword: + type: string + format: password + required: + - oldPassword + - newPassword + Submission: + title: Submission + type: object + description: 提出 + properties: + id: + type: integer + description: 提出ID + userId: + type: integer + description: 提出ユーザーID + problemId: + type: integer + description: 問題ID + submittedAt: + type: string + format: date-time + description: 提出日時 + languageId: + type: integer + description: 提出コードの言語ID + totalScore: + type: integer + description: スコアの合計 + maxTime: + type: integer + description: 実行時間の最大値 (ms) + maxMemory: + type: number + description: メモリ使用量の最大値 (MiB) + judgeStatus: + $ref: '#/components/schemas/JudgeStatus' + required: + - id + - userId + - problemId + - submittedAt + - languageId + - totalScore + - maxTime + - maxMemory + - judgeStatus + Submissions: + title: Submissions + description: 提出一覧 + type: object + properties: + total: + type: integer + problems: + type: array + items: + $ref: '#/components/schemas/Submission' + SubmissionDetail: + title: SubmissionDetail + type: object + description: 提出の詳細 + properties: + id: + type: integer + description: 提出ID + userId: + type: integer + description: 提出ユーザーID + problemId: + type: integer + description: 問題ID + submittedAt: + type: string + format: date-time + description: 提出日時 + languageId: + type: integer + description: 提出コードの言語ID + source: + type: string + description: 提出コード + totalScore: + type: integer + description: スコアの合計 + maxTime: + type: integer + description: 実行時間の最大値 (ms) + maxMemory: + type: number + description: メモリ使用量の最大値 (MiB) + overallJudgeStatus: + $ref: '#/components/schemas/JudgeStatus' + judgeResults: + type: array + description: ジャッジ結果の配列 + items: + $ref: '#/components/schemas/JudgeResult' + required: + - id + - userId + - problemId + - submittedAt + - languageId + - source + - totalScore + - maxTime + - maxMemory + - overallJudgeStatus + - judgeResults + PostSubmissionRequest: + title: PostProblemRequest + type: object + description: 回答の提出リクエスト + properties: + languageId: + type: integer + description: 提出コードの言語ID + source: + type: string + description: ソースコード + Editorial: + title: Editorial + description: 解説 + type: object + properties: + id: + description: 解説ID + type: integer + createdAt: + description: 作成日時 + type: string + format: date-time + updatedAt: + description: 更新日時 + type: string + format: date-time + authorId: + description: 投稿者のユーザーID + type: integer + isPublic: + description: |- + 解説が全体公開かどうか. + + * `true` - 公開 + * `false` - 非公開 (問題の作者のみ閲覧可) + type: boolean + Editorials: + title: Editorials + description: 解説一覧 + type: array + items: + $ref: '#/components/schemas/Editorial' + EditorialDetail: + title: EditorialDetail + description: 解説の詳細 + type: object + properties: + id: + description: 解説ID + type: integer + createdAt: + description: 作成日時 + type: string + format: date-time + updatedAt: + description: 更新日時 + type: string + format: date-time + authorId: + description: 投稿者のユーザーID + type: integer + statement: + description: 解説本文 (HTML) + type: string + isPublic: + description: |- + 解説が全体公開かどうか. + + * `true` - 公開 + * `false` - 非公開 (問題の作者のみ閲覧可) + type: boolean + required: + - id + - createdAt + - authorId + - statement + - isPublic + PostEditorialRequest: + title: PostEditorialRequest + description: 解説の作成リクエスト + type: object + properties: + statement: + description: 解説本文 (HTML) + type: string + isPublic: + description: |- + 解説が全体公開かどうか. + + * `true` - 公開 + * `false` - 非公開 (問題の作者のみ閲覧可) + type: boolean + required: + - statement + - isPublic + PutEditorialRequest: + title: PutEditorialRequest + description: 解説の変更リクエスト. + type: object + properties: + statement: + description: 解説本文 (HTML) + type: string + isPublic: + description: 公開されているかどうか + type: boolean + Signup: + title: Signup + type: object + description: email+password登録 + properties: + userName: + type: string + password: + type: string + token: + type: string + required: + - userName + - password + - token + SignupRequest: + title: SignupRequest + type: object + description: Signupのリクエスト + properties: + email: + type: string + format: email + required: + - email + Email: + title: Email + type: object + properties: + email: + type: string + format: email + required: + - email + UserEmailAndPassword: + title: UserEmailAndPassword + type: object + description: login + properties: + email: + type: string + format: email + password: + type: string + required: + - email + - password + ResetPasswordRequest: + title: ResetPasswordRequest + type: object + properties: + password: + type: string + token: + type: string + required: + - password + - token + description: '' + JudgeStatus: + title: JudgeStatus + description: |- + ジャッジの状態 + + * `AC` - 正解 + * `WA` - 不正解 + * `CE` - コンパイルエラー + * `IE` - 内部エラー + * `MLE` - メモリ制限超過 + * `RE` - 実行時エラー + * `TLE` - 実行時間超過 + * `WJ` - ジャッジ待ち + type: string + enum: + - AC + - WA + - CE + - IE + - MLE + - RE + - TLE + - WJ + JudgeResult: + title: JudgeResult + type: object + description: ジャッジ結果 + properties: + testcaseId: + type: string + testcaseName: + type: string + judgeStatus: + $ref: '#/components/schemas/JudgeStatus' + score: + type: integer + time: + type: integer + memory: + type: number + required: + - testcaseId + - judgeStatus + - score + - time + - memory + Role: + title: Role + description: |- + ユーザの役割 + + * `Admin` - Admin + * `traPUser` - AdminでないtraP部員 + * `CommonUser` - Adminでない一般ユーザー(traP部員以外のユーザー) + type: string + enum: + - Admin + - traPUser + - CommonUser + TestCase: + title: TestCase + type: object + properties: + name: + type: string + testNumber: + type: integer + testInput: + type: string + testOutput: + type: string + required: + - name + - testNumber + - testInput + - testOutput + parameters: + problemIdInPath: + name: problemId + in: path + description: 問題ID + required: true + schema: + type: number + problemsOrderByInQuery: + name: orderBy + in: query + description: |- + 問題一覧一覧の並び替え + + 文字列の先頭に `-` が付いていれば降順, 付いていなければ昇順. + + * `createdAt` - 提出日時 + * `updatedAt` - 更新日時 + * `difficulty` - 難易度 + required: false + schema: + type: string + default: '-createdAt' + enum: + - createdAt + - '-createdAt' + - updatedAt + - '-updatedAt' + - difficulty + - '-difficulty' + submissionIdInPath: + name: submissionId + in: path + description: 提出ID + required: true + schema: + type: number + submissionsOrderByInQuery: + name: orderBy + in: query + description: |- + 提出一覧の並び替え + + 文字列の先頭に `-` が付いていれば降順, 付いていなければ昇順. + + * `createdAt` - 提出日時 + * `timeConsumption` - 実行時間 + * `memoryConsumption` - メモリ量 + required: false + schema: + type: string + default: '-createdAt' + enum: + - createdAt + - '-createdAt' + - timeConsumption + - '-timeConsumption' + - memoryConsumption + - '-memoryConsumption' + limitInQuery: + name: limit + in: query + description: 取得数の上限 + required: false + schema: + type: integer + maximum: 100 + minimum: 0 + offsetInQuery: + name: offset + in: query + description: 取得の開始位置 + required: false + schema: + type: integer + minimum: 0 + judgeStatusInQuery: + name: status + in: query + description: ジャッジ結果 + required: false + schema: + $ref: '#/components/schemas/JudgeStatus' + codeLanguageInQuery: + name: language + in: query + description: ソースコードの言語 + required: false + schema: + type: integer + userNameInQuery: + name: username + in: query + description: ユーザー名 + schema: + type: string + userIdInQuery: + name: userId + in: query + description: ユーザーID + schema: + type: integer + userIdInPath: + name: userId + in: path + description: ユーザーID + required: true + schema: + type: number + editorialIdInPath: + name: editorialId + in: path + description: 解説ID + required: true + schema: + type: integer + token: + name: token + in: query + required: false + schema: + type: string + description: JWTトークン From 76b6e0c3fd7952aac19035b20f8a1b0991fec712 Mon Sep 17 00:00:00 2001 From: ramdos0207 Date: Sun, 18 Aug 2024 18:33:27 +0900 Subject: [PATCH 02/13] Add Dockerfile for OpenAPI --- docs/openapi-ui.Dockerfile | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/openapi-ui.Dockerfile diff --git a/docs/openapi-ui.Dockerfile b/docs/openapi-ui.Dockerfile new file mode 100644 index 0000000..1f5e649 --- /dev/null +++ b/docs/openapi-ui.Dockerfile @@ -0,0 +1,3 @@ +FROM swaggerapi/swagger-ui:v5.3.1 +COPY docs/openapi.yaml /docs/openapi.yaml +ENV SWAGGER_JSON=/docs/openapi.yaml \ No newline at end of file From ffe51ba89c235edd00643ceccfcdcd65f73417f9 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Thu, 22 Aug 2024 21:41:32 +0900 Subject: [PATCH 03/13] =?UTF-8?q?fix:=E3=83=86=E3=82=B9=E3=83=88=E3=82=B1?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E5=91=A8=E3=82=8A=E3=81=AE=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E3=81=AA=E3=81=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/openapi.yaml | 719 +++++++++++++++++++++++++++++++++------------- 1 file changed, 523 insertions(+), 196 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 287ff53..ca0081a 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1,4 +1,6 @@ openapi: 3.0.3 +x-stoplight: + id: nw1uyle5yrj87 info: title: traO Judge API description: traO Judge API (front ↔ back) @@ -10,26 +12,27 @@ tags: - name: oauth2 - name: problems - name: submissions + - name: testcases - name: users paths: - '/editorials/{editorialId}': + "/editorials/{editorialId}": parameters: - - $ref: '#/components/parameters/editorialIdInPath' + - $ref: "#/components/parameters/editorialIdInPath" get: summary: getEditorial operationId: getEditorial tags: - editorials responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/EditorialDetail' - '400': + $ref: "#/components/schemas/EditorialDetail" + "400": description: Bad Request - '404': + "404": description: 解説が存在しません(または解説の閲覧権限がありません) description: 個別の解説を取得する put: @@ -41,19 +44,21 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PutEditorialRequest' + $ref: "#/components/schemas/PutEditorialRequest" responses: - '201': - description: |- - No Content - 正常に変更されました. - '400': + "200": + description: 正常に変更されました. + content: + application/json: + schema: + $ref: "#/components/schemas/Editorial" + "400": description: Bad Request - '403': + "403": description: |- Forbidden 解説を変更する権限がありません. - '404': + "404": description: |- Not Found 解説が存在しません. (または解説の閲覧権限がありません.) @@ -64,21 +69,83 @@ paths: tags: - editorials responses: - '201': - description: |- - No Content - 正常に削除されました. - '400': + "204": + description: 正常に削除されました. + "400": description: Bad Request - '403': + "403": description: |- Forbidden 解説を削除する権限がありません. - '404': + "404": description: |- Not Found 解説が存在しません. (または解説の閲覧権限がありません.) description: 個別の解説を削除する + "/testcases/{testcaseId}": + parameters: + - $ref: "#/components/parameters/testcaseIdInPath" + get: + summary: getTestcase + tags: + - testcases + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Testcase" + "400": + description: Bad Request + "401": + description: Unauthorized + "403": + description: Forbidden + "404": + description: Not Found + operationId: getTestcase + description: あるidのテストケースを取得 + put: + summary: putTestcase + operationId: putTestcase + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Testcase" + "400": + description: Bad Request + "403": + description: Forbidden + "404": + description: Not Found + description: 単体のテストケースの編集 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/PutTestcaseRequest" + tags: + - testcases + delete: + summary: deleteTestcase + operationId: deleteTestcase + responses: + "204": + description: 正常に削除されました + "400": + description: Bad Request + "401": + description: Unauthorized + "404": + description: Not Found + description: 単一のテストケースの削除 + tags: + - testcases /problems: post: summary: postProblem @@ -93,31 +160,31 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PostProblemRequest' + $ref: "#/components/schemas/PostProblemRequest" responses: - '200': + "200": description: |- OK 問題が投稿されました. content: application/json: schema: - $ref: '#/components/schemas/Problem' - '400': + $ref: "#/components/schemas/Problem" + "400": description: Bad Request get: summary: getProblems operationId: getProblems responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/Problems' - '400': + $ref: "#/components/schemas/Problems" + "400": description: Bad Request - '404': + "404": description: Not Found description: 問題一覧を取得する requestBody: @@ -125,29 +192,29 @@ paths: tags: - problems parameters: - - $ref: '#/components/parameters/limitInQuery' - - $ref: '#/components/parameters/offsetInQuery' - - $ref: '#/components/parameters/problemsOrderByInQuery' - - $ref: '#/components/parameters/userNameInQuery' - - $ref: '#/components/parameters/userIdInQuery' - '/problems/{problemId}': + - $ref: "#/components/parameters/limitInQuery" + - $ref: "#/components/parameters/offsetInQuery" + - $ref: "#/components/parameters/problemsOrderByInQuery" + - $ref: "#/components/parameters/userNameInQuery" + - $ref: "#/components/parameters/userIdInQuery" + "/problems/{problemId}": parameters: - - $ref: '#/components/parameters/problemIdInPath' + - $ref: "#/components/parameters/problemIdInPath" get: summary: getProblem operationId: getProblem tags: - problems responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/Problem' - '400': + $ref: "#/components/schemas/Problem" + "400": description: Bad Request - '404': + "404": description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) @@ -158,19 +225,19 @@ paths: tags: - problems responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/Problem' - '400': + $ref: "#/components/schemas/Problem" + "400": description: Bad Request - '403': + "403": description: |- Forbidden 問題を編集する権限がありません. - '404': + "404": description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) @@ -179,46 +246,44 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PutProblemRequest' + $ref: "#/components/schemas/PutProblemRequest" delete: summary: deleteProblem operationId: deleteProblem tags: - problems responses: - '201': - description: |- - No Content - 正常に削除されました. - '400': + "204": + description: 正常に削除されました. + "400": description: Bad Request - '403': + "403": description: |- Forbidden 問題を削除する権限がありません. - '404': + "404": description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) description: 問題を削除する - '/problems/{problemId}/editorials': + "/problems/{problemId}/editorials": parameters: - - $ref: '#/components/parameters/problemIdInPath' + - $ref: "#/components/parameters/problemIdInPath" get: summary: getEditorialsOnProblem operationId: getEditorialsOnProblem tags: - editorials responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/Editorials' - '400': + $ref: "#/components/schemas/Editorials" + "400": description: Bad Request - '404': + "404": description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) @@ -232,56 +297,108 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PostEditorialRequest' + $ref: "#/components/schemas/PostEditorialRequest" responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/EditorialDetail' - '400': + $ref: "#/components/schemas/EditorialDetail" + "400": description: Bad Request - '401': + "401": description: |- Unauthorized ログインしていません. - '403': + "403": description: |- Forbidden 解説を投稿する権限がありません. - '404': + "404": description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) description: 解説を投稿する - '/problems/{problemId}/submissions': + "/problems/{problemId}/testcases": parameters: - - $ref: '#/components/parameters/problemIdInPath' + - $ref: "#/components/parameters/problemIdInPath" + post: + summary: postTestcases + operationId: postTestcases + tags: + - testcases + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/PostTestcaseRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Testcases" + "400": + description: Bad Request + "401": + description: |- + Unauthorized + ログインしていません. + "403": + description: |- + Forbidden + 解説を投稿する権限がありません. + "404": + description: |- + Not Found + 問題が存在しません. (または問題の閲覧権限がありません.) + description: テストケースを投稿する + get: + summary: getTestcases + operationId: getTestcases + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Testcases" + "400": + description: Bad Request + "404": + description: Not Found + description: 全てのテストケースを取得 + tags: + - testcases + "/problems/{problemId}/submissions'": + parameters: + - $ref: "#/components/parameters/problemIdInPath" get: summary: getSubmissionsForProblem operationId: getSubmissionsForProblem tags: - submissions parameters: - - $ref: '#/components/parameters/submissionsOrderByInQuery' - - $ref: '#/components/parameters/judgeStatusInQuery' - - $ref: '#/components/parameters/codeLanguageInQuery' - - $ref: '#/components/parameters/userNameInQuery' - - $ref: '#/components/parameters/limitInQuery' - - $ref: '#/components/parameters/offsetInQuery' + - $ref: "#/components/parameters/submissionsOrderByInQuery" + - $ref: "#/components/parameters/judgeStatusInQuery" + - $ref: "#/components/parameters/codeLanguageInQuery" + - $ref: "#/components/parameters/userNameInQuery" + - $ref: "#/components/parameters/limitInQuery" + - $ref: "#/components/parameters/offsetInQuery" responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/Submissions' - '403': + $ref: "#/components/schemas/Submissions" + "403": description: |- Forbidden 提出一覧を取得する権限がありません. - '404': + "404": description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) @@ -295,21 +412,21 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PostSubmissionRequest' + $ref: "#/components/schemas/PostSubmissionRequest" responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/SubmissionDetail' - '400': + $ref: "#/components/schemas/SubmissionDetail" + "400": description: Bad Request - '403': + "403": description: |- Forbidden ソースコードを提出する権限がありません. - '404': + "404": description: |- Not Found 提出が存在しません. (または提出の閲覧権限がありません.) @@ -321,63 +438,63 @@ paths: tags: - submissions parameters: - - $ref: '#/components/parameters/submissionsOrderByInQuery' - - $ref: '#/components/parameters/judgeStatusInQuery' - - $ref: '#/components/parameters/codeLanguageInQuery' - - $ref: '#/components/parameters/userNameInQuery' - - $ref: '#/components/parameters/userIdInQuery' - - $ref: '#/components/parameters/limitInQuery' - - $ref: '#/components/parameters/offsetInQuery' + - $ref: "#/components/parameters/submissionsOrderByInQuery" + - $ref: "#/components/parameters/judgeStatusInQuery" + - $ref: "#/components/parameters/codeLanguageInQuery" + - $ref: "#/components/parameters/userNameInQuery" + - $ref: "#/components/parameters/userIdInQuery" + - $ref: "#/components/parameters/limitInQuery" + - $ref: "#/components/parameters/offsetInQuery" responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/Submissions' - '400': + $ref: "#/components/schemas/Submissions" + "400": description: Bad Request description: 提出一覧を取得する - '/submissions/{submissionId}': + "/submissions/{submissionId}": parameters: - - $ref: '#/components/parameters/submissionIdInPath' + - $ref: "#/components/parameters/submissionIdInPath" get: summary: getSubmission operationId: getSubmission tags: - submissions responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/SubmissionDetail' - '400': + $ref: "#/components/schemas/SubmissionDetail" + "400": description: Bad Request - '404': + "404": description: |- Not Found 提出が存在しません. (または提出の閲覧権限がありません.) description: 個別の提出を取得する - '/users/{userId}': + "/users/{userId}": parameters: - - $ref: '#/components/parameters/userIdInPath' + - $ref: "#/components/parameters/userIdInPath" get: summary: getUser operationId: getUser tags: - users responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/User' - '400': + $ref: "#/components/schemas/User" + "400": description: Bad Request - '404': + "404": description: |- Not Found ユーザーが存在しません. @@ -389,13 +506,13 @@ paths: tags: - me responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/User' - '401': + $ref: "#/components/schemas/User" + "401": description: |- Unauthorized ログインしていません. @@ -404,7 +521,7 @@ paths: summary: putMe operationId: putUsersMeIcon responses: - '200': + "200": description: 正常に更新されました content: application/json: @@ -413,9 +530,11 @@ paths: properties: iconUrl: type: string + x-stoplight: + id: ah777i61peute required: - iconUrl - '400': + "400": description: 不正なリクエストです tags: - me @@ -423,7 +542,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PutMeRequest' + $ref: "#/components/schemas/PutMeRequest" description: アイコンなど自身に関連する情報の編集をします /users/me/submissions: get: @@ -432,23 +551,23 @@ paths: tags: - me parameters: - - $ref: '#/components/parameters/submissionsOrderByInQuery' - - $ref: '#/components/parameters/judgeStatusInQuery' - - $ref: '#/components/parameters/codeLanguageInQuery' - - $ref: '#/components/parameters/userNameInQuery' - - $ref: '#/components/parameters/userIdInQuery' - - $ref: '#/components/parameters/limitInQuery' - - $ref: '#/components/parameters/offsetInQuery' + - $ref: "#/components/parameters/submissionsOrderByInQuery" + - $ref: "#/components/parameters/judgeStatusInQuery" + - $ref: "#/components/parameters/codeLanguageInQuery" + - $ref: "#/components/parameters/userNameInQuery" + - $ref: "#/components/parameters/userIdInQuery" + - $ref: "#/components/parameters/limitInQuery" + - $ref: "#/components/parameters/offsetInQuery" responses: - '200': + "200": description: OK content: application/json: schema: type: array items: - $ref: '#/components/schemas/Submission' - '401': + $ref: "#/components/schemas/Submission" + "401": description: |- Unauthorized ログインしていません @@ -458,9 +577,9 @@ paths: summary: putMeEmail operationId: putMeEmail responses: - '204': + "204": description: 正常に更新されました メール認証を行なってください - '400': + "400": description: 不正なリクエストです tags: - me @@ -468,16 +587,16 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Email' + $ref: "#/components/schemas/Email" description: メール情報を書き換える メール情報を書き換えた後はメール認証が必要である /users/me/password: put: summary: putUserMePassword operationId: putUsersMePassword responses: - '204': + "204": description: 正常に更新されました - '400': + "400": description: 不正なリクエストです tags: - me @@ -485,22 +604,22 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PutPasswordRequest' + $ref: "#/components/schemas/PutPasswordRequest" description: ログイン後にパスワードを変更する /signup/request: post: summary: postSignupRequest operationId: postSignupRequest responses: - '201': + "201": description: 認証用のURLを送信しました メール認証を行なってください - '400': + "400": description: 不正なリクエストです メールアドレスの形式を確認してください requestBody: content: application/json: schema: - $ref: '#/components/schemas/SignupRequest' + $ref: "#/components/schemas/SignupRequest" tags: - authentication description: メールアドレスを渡し,そこに認証用のリンクを送る。 @@ -509,32 +628,32 @@ paths: summary: postSignup operationId: postSignup responses: - '201': + "201": description: 正常にユーザーを作成できました メール認証を行なってください - '400': + "400": description: 不正なリクエストです - '401': + "401": description: Unauthorized requestBody: content: application/json: schema: - $ref: '#/components/schemas/Signup' + $ref: "#/components/schemas/Signup" tags: - authentication description: |- email+passwordによるユーザー登録 クエリパラメタにtokenを持ち,それでメール情報を管理する parameters: - - $ref: '#/components/parameters/token' + - $ref: "#/components/parameters/token" /login: post: summary: postLogin operationId: postLogin responses: - '204': + "204": description: No Content - '400': + "400": description: 不正なリクエストです ユーザー名とパスワードを確認してください tags: - authentication @@ -542,14 +661,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/UserEmailAndPassword' + $ref: "#/components/schemas/UserEmailAndPassword" description: ログイン /logout: post: summary: postLogout operationId: postLogout responses: - '204': + "204": description: No Content description: ログアウト tags: @@ -560,7 +679,7 @@ paths: tags: - authentication responses: - '204': + "204": description: 正常にリセットメールを送信しました operationId: postRequestResetPassword description: パスワード変更のリクエスト @@ -568,30 +687,30 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Email' + $ref: "#/components/schemas/Email" /reset-password: post: summary: postResetPassword operationId: postResetPassword responses: - '204': + "204": description: 正常に更新されました description: 新しいパスワードをPOSTする requestBody: content: application/json: schema: - $ref: '#/components/schemas/ResetPasswordRequest' + $ref: "#/components/schemas/ResetPasswordRequest" tags: - authentication parameters: - - $ref: '#/components/parameters/token' + - $ref: "#/components/parameters/token" /google-oauth2/params: get: summary: getGoogleOAuth2Params operationId: getGoogleAuthParams responses: - '200': + "200": description: 正しいURLが返されました content: application/json: @@ -602,7 +721,7 @@ paths: type: string required: - url - '500': + "500": description: Internal server error content: application/json: @@ -620,7 +739,7 @@ paths: summary: getGithubOAuth2Params operationId: getgithubAuthParams responses: - '200': + "200": description: 正しいURLが返されました content: application/json: @@ -631,7 +750,7 @@ paths: type: string required: - url - '500': + "500": description: Internal server error content: application/json: @@ -640,13 +759,13 @@ paths: properties: message: type: string - description: GitHubOAutheのためのエンドポイント + description: GitHubOAuthのためのエンドポイント tags: - oauth2 parameters: [] /traq-oauth2/revoke: post: - summary: postTraqAouth2Revoke + summary: postTraqOAuth2Revoke operationId: revokeTraqAuth tags: - oauth2 @@ -664,10 +783,10 @@ paths: required: - token responses: - '201': + "201": description: トークンは正常に削除されました content: {} - '400': + "400": description: Invalid request or token content: application/json: @@ -677,7 +796,7 @@ paths: message: type: string example: Invalid token or request - '500': + "500": description: Internal server error content: application/json: @@ -707,10 +826,10 @@ paths: required: - token responses: - '201': + "201": description: トークンは正常に削除されました content: {} - '400': + "400": description: Invalid request or token content: application/json: @@ -720,7 +839,7 @@ paths: message: type: string example: Invalid token or request - '500': + "500": description: Internal server error content: application/json: @@ -750,10 +869,10 @@ paths: required: - token responses: - '201': + "201": description: トークンは正常に削除されました content: {} - '400': + "400": description: Invalid request or token content: application/json: @@ -763,7 +882,7 @@ paths: message: type: string example: Invalid token or request - '500': + "500": description: Internal server error content: application/json: @@ -779,6 +898,8 @@ components: title: Problem type: object description: 問題の詳細 + x-stoplight: + id: uhw48v4uc25fg properties: id: type: integer @@ -810,13 +931,19 @@ components: description: メモリ制限 (MiB) testcases: type: array + x-stoplight: + id: yqk7hsmce6plm items: - $ref: '#/components/schemas/TestCase' + $ref: "#/components/schemas/Testcase" createdAt: type: string + x-stoplight: + id: xy9cz574x9gg7 format: date-time updatedAt: type: string + x-stoplight: + id: s5hmr0sa68jhp format: date-time required: - id @@ -831,14 +958,20 @@ components: - updatedAt Problems: title: Problems + x-stoplight: + id: 9gf5tc4e2mwnw type: object properties: total: type: integer + x-stoplight: + id: 1gu5qpb9yngt2 problems: type: array + x-stoplight: + id: p790xy7gkt5p3 items: - $ref: '#/components/schemas/Problem' + $ref: "#/components/schemas/Problem" required: - total - problems @@ -846,6 +979,8 @@ components: title: PostProblemRequest type: object description: 問題の投稿リクエスト + x-stoplight: + id: chss8j0z12nvv properties: title: type: string @@ -859,13 +994,19 @@ components: timeLimit: type: integer description: 実行時間制限 (ms) + x-stoplight: + id: dgplwhk8tcebp memoryLimit: type: integer description: メモリ制限 (MiB) + x-stoplight: + id: 3w92jx80b8aw0 testcases: type: array + x-stoplight: + id: ln20jb8zi7o1l items: - $ref: '#/components/schemas/TestCase' + $ref: "#/components/schemas/Testcase" required: - title - difficulty @@ -876,6 +1017,8 @@ components: title: PutProblemRequest type: object description: 問題の変更リクエスト + x-stoplight: + id: 98ocidfpouev7 properties: title: type: string @@ -901,8 +1044,10 @@ components: description: メモリ制限 (MiB) testcases: type: array + x-stoplight: + id: ltrbj7cs827sn items: - $ref: '#/components/schemas/TestCase' + $ref: "#/components/schemas/Testcase" required: - title - isPublic @@ -913,6 +1058,8 @@ components: title: User type: object description: ユーザー情報 + x-stoplight: + id: 90q4quaqlwzjz properties: id: type: integer @@ -928,30 +1075,36 @@ components: description: GitHubのID iconUrl: type: string - postProblem: - type: array - items: - type: string - submit: - type: array - items: - type: string + x-stoplight: + id: fql62dfmen787 + postProblems: + $ref: "#/components/schemas/Problems" + submitProblems: + $ref: "#/components/schemas/Problems" xLink: type: string + x-stoplight: + id: clm7vsicf5lkl githubLink: type: string + x-stoplight: + id: x0sgsyzjg0ukw selfIntroduction: type: string + x-stoplight: + id: zvjwukuab2cia role: - $ref: '#/components/schemas/Role' + $ref: "#/components/schemas/Role" createdAt: type: string + x-stoplight: + id: 2xbtpuhe98l7y format: date-time updatedAt: type: string + x-stoplight: + id: hiepvg9s68yt1 format: date-time - '': - type: string required: - id - name @@ -960,27 +1113,43 @@ components: - updatedAt PutMeRequest: title: PutMeRequest + x-stoplight: + id: jmrdp3he5jixc type: object properties: icon: type: string + x-stoplight: + id: j6hqsqrhjvyuh format: binary xLink: type: string + x-stoplight: + id: nrtfgf6emv2fr githubLink: type: string + x-stoplight: + id: ksnqob7ogsca4 selfIntroduction: type: string + x-stoplight: + id: o9lbyk9kcspoo PutPasswordRequest: title: PutPasswordRequest + x-stoplight: + id: 0o8o9675avscq type: object description: ログイン後のパスワード変更用 properties: oldPassword: type: string + x-stoplight: + id: 242qfkvy4u2vt format: password newPassword: type: string + x-stoplight: + id: lc9bt96ozzubs format: password required: - oldPassword @@ -1016,7 +1185,7 @@ components: type: number description: メモリ使用量の最大値 (MiB) judgeStatus: - $ref: '#/components/schemas/JudgeStatus' + $ref: "#/components/schemas/JudgeStatus" required: - id - userId @@ -1027,6 +1196,8 @@ components: - maxTime - maxMemory - judgeStatus + x-stoplight: + id: x8ryeeewom6jj Submissions: title: Submissions description: 提出一覧 @@ -1037,11 +1208,15 @@ components: problems: type: array items: - $ref: '#/components/schemas/Submission' + $ref: "#/components/schemas/Submission" + x-stoplight: + id: uf33tsy68epqd SubmissionDetail: title: SubmissionDetail type: object description: 提出の詳細 + x-stoplight: + id: mfmhczdc1gwvo properties: id: type: integer @@ -1072,12 +1247,12 @@ components: type: number description: メモリ使用量の最大値 (MiB) overallJudgeStatus: - $ref: '#/components/schemas/JudgeStatus' + $ref: "#/components/schemas/JudgeStatus" judgeResults: type: array description: ジャッジ結果の配列 items: - $ref: '#/components/schemas/JudgeResult' + $ref: "#/components/schemas/JudgeResult" required: - id - userId @@ -1101,6 +1276,8 @@ components: source: type: string description: ソースコード + x-stoplight: + id: eqxwkvraeiz3b Editorial: title: Editorial description: 解説 @@ -1127,12 +1304,16 @@ components: * `true` - 公開 * `false` - 非公開 (問題の作者のみ閲覧可) type: boolean + x-stoplight: + id: m9xwpnby2q6xp Editorials: title: Editorials description: 解説一覧 type: array items: - $ref: '#/components/schemas/Editorial' + $ref: "#/components/schemas/Editorial" + x-stoplight: + id: vuibc5h3eb7et EditorialDetail: title: EditorialDetail description: 解説の詳細 @@ -1168,6 +1349,8 @@ components: - authorId - statement - isPublic + x-stoplight: + id: puu5epz5pkyci PostEditorialRequest: title: PostEditorialRequest description: 解説の作成リクエスト @@ -1186,6 +1369,8 @@ components: required: - statement - isPublic + x-stoplight: + id: gfnu7alfyx3jr PutEditorialRequest: title: PutEditorialRequest description: 解説の変更リクエスト. @@ -1197,65 +1382,95 @@ components: isPublic: description: 公開されているかどうか type: boolean + x-stoplight: + id: zrrckaetgkydt Signup: title: Signup + x-stoplight: + id: zsjzxxygfdwys type: object description: email+password登録 properties: userName: type: string + x-stoplight: + id: g01wpo208sxxa password: type: string + x-stoplight: + id: 24uowhxqcp3pf token: type: string + x-stoplight: + id: k1v6ysycc6u4i required: - userName - password - token SignupRequest: title: SignupRequest + x-stoplight: + id: gcoei6xqe4ln6 type: object description: Signupのリクエスト properties: email: type: string + x-stoplight: + id: fb0b1msis28v6 format: email required: - email Email: title: Email + x-stoplight: + id: tphw8h07sooqq type: object properties: email: type: string + x-stoplight: + id: m4tunmpzgkpvr format: email required: - email UserEmailAndPassword: title: UserEmailAndPassword + x-stoplight: + id: 26q5bxdrs0z3d type: object description: login properties: email: type: string + x-stoplight: + id: e3l8ep9c0loa8 format: email password: type: string + x-stoplight: + id: xju40q8ojc42q required: - email - password ResetPasswordRequest: title: ResetPasswordRequest + x-stoplight: + id: 04oi9n1ji1hl9 type: object properties: password: type: string + x-stoplight: + id: kvbv5f1cqmzjw token: type: string + x-stoplight: + id: 1o25ezao3w37s required: - password - token - description: '' + description: "" JudgeStatus: title: JudgeStatus description: |- @@ -1279,23 +1494,37 @@ components: - RE - TLE - WJ + x-stoplight: + id: 5qo9li0rmup12 JudgeResult: title: JudgeResult + x-stoplight: + id: gi7dbpvfrs8m7 type: object description: ジャッジ結果 properties: testcaseId: type: string + x-stoplight: + id: xheta3et8g9q9 testcaseName: type: string + x-stoplight: + id: c5m8bww6qs0ye judgeStatus: - $ref: '#/components/schemas/JudgeStatus' + $ref: "#/components/schemas/JudgeStatus" score: type: integer + x-stoplight: + id: vewi2fgbmn3gy time: type: integer + x-stoplight: + id: i94m12b5w4dno memory: type: number + x-stoplight: + id: z854uf4g2e8l9 required: - testcaseId - judgeStatus @@ -1315,21 +1544,112 @@ components: - Admin - traPUser - CommonUser - TestCase: - title: TestCase + x-stoplight: + id: ugyx5gmo9hy7r + Testcase: + title: Testcase + x-stoplight: + id: 2x3f3ma4z9y3d type: object + description: テストケース properties: name: type: string - testNumber: - type: integer + x-stoplight: + id: wmk8xj90sqxn6 + id: + type: string + x-stoplight: + id: s11rjbq4fe0jt + testInput: + type: string + x-stoplight: + id: 459r1ej6x57nt + testOutput: + type: string + x-stoplight: + id: cuh09avqiv5wr + createdAt: + type: string + x-stoplight: + id: mwwa3xo4gm9jn + format: date-time + updatedAt: + type: string + x-stoplight: + id: y686xeh0zjvtb + format: date-time + required: + - name + - id + - testInput + - testOutput + - createdAt + - updatedAt + PostTestcaseRequest: + title: PostTestcasesRequest + x-stoplight: + id: edr4huxi5qh39 + type: array + description: テストケースの投稿 + items: + x-stoplight: + id: qcd4jxstx1s2j + type: object + properties: + name: + type: string + x-stoplight: + id: d33zmxcr8ydlr + testInput: + type: string + x-stoplight: + id: bl152tf6tq3fv + testOutput: + type: string + x-stoplight: + id: 5cc7p8clvsecm + required: + - name + - testInput + - testOutput + Testcases: + title: Testcases + x-stoplight: + id: 1c6ojz2rn58kj + type: object + description: Testcaseの配列 + properties: + total: + type: string + x-stoplight: + id: mrq1xcdfc2zcv + testcases: + $ref: "#/components/schemas/Testcase" + required: + - total + - testcases + PutTestcaseRequest: + title: PutTestcaseRequest + x-stoplight: + id: 736n95f89ef1u + type: object + description: 単体のテストケースの編集 + properties: + name: + type: string + x-stoplight: + id: 3kz6lokf8yq4q testInput: type: string + x-stoplight: + id: 415bmlsu2ry74 testOutput: type: string + x-stoplight: + id: btrwfs2v1ws59 required: - name - - testNumber - testInput - testOutput parameters: @@ -1354,14 +1674,14 @@ components: required: false schema: type: string - default: '-createdAt' + default: "-createdAt" enum: - createdAt - - '-createdAt' + - "-createdAt" - updatedAt - - '-updatedAt' + - "-updatedAt" - difficulty - - '-difficulty' + - "-difficulty" submissionIdInPath: name: submissionId in: path @@ -1383,14 +1703,14 @@ components: required: false schema: type: string - default: '-createdAt' + default: "-createdAt" enum: - createdAt - - '-createdAt' + - "-createdAt" - timeConsumption - - '-timeConsumption' + - "-timeConsumption" - memoryConsumption - - '-memoryConsumption' + - "-memoryConsumption" limitInQuery: name: limit in: query @@ -1414,7 +1734,7 @@ components: description: ジャッジ結果 required: false schema: - $ref: '#/components/schemas/JudgeStatus' + $ref: "#/components/schemas/JudgeStatus" codeLanguageInQuery: name: language in: query @@ -1455,3 +1775,10 @@ components: schema: type: string description: JWTトークン + testcaseIdInPath: + name: testcaseId + in: path + required: true + schema: + type: string + description: テストケースID From 9f8a679ac6bcca6d89a7e68f2b5ff44a86f0d999 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Mon, 26 Aug 2024 12:43:58 +0900 Subject: [PATCH 04/13] =?UTF-8?q?fix:=E3=83=86=E3=82=B9=E3=83=88=E3=82=B1?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E5=91=A8=E3=82=8A=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/openapi.yaml | 625 ++++++++++++++++++---------------------------- 1 file changed, 247 insertions(+), 378 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index ca0081a..9410384 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1,6 +1,4 @@ openapi: 3.0.3 -x-stoplight: - id: nw1uyle5yrj87 info: title: traO Judge API description: traO Judge API (front ↔ back) @@ -15,24 +13,24 @@ tags: - name: testcases - name: users paths: - "/editorials/{editorialId}": + '/editorials/{editorialId}': parameters: - - $ref: "#/components/parameters/editorialIdInPath" + - $ref: '#/components/parameters/editorialIdInPath' get: summary: getEditorial operationId: getEditorial tags: - editorials responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/EditorialDetail" - "400": + $ref: '#/components/schemas/EditorialDetail' + '400': description: Bad Request - "404": + '404': description: 解説が存在しません(または解説の閲覧権限がありません) description: 個別の解説を取得する put: @@ -44,21 +42,21 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PutEditorialRequest" + $ref: '#/components/schemas/PutEditorialRequest' responses: - "200": + '200': description: 正常に変更されました. content: application/json: schema: - $ref: "#/components/schemas/Editorial" - "400": + $ref: '#/components/schemas/Editorial' + '400': description: Bad Request - "403": + '403': description: |- Forbidden 解説を変更する権限がありません. - "404": + '404': description: |- Not Found 解説が存在しません. (または解説の閲覧権限がありません.) @@ -69,40 +67,40 @@ paths: tags: - editorials responses: - "204": + '204': description: 正常に削除されました. - "400": + '400': description: Bad Request - "403": + '403': description: |- Forbidden 解説を削除する権限がありません. - "404": + '404': description: |- Not Found 解説が存在しません. (または解説の閲覧権限がありません.) description: 個別の解説を削除する - "/testcases/{testcaseId}": + '/testcases/{testcaseId}': parameters: - - $ref: "#/components/parameters/testcaseIdInPath" + - $ref: '#/components/parameters/testcaseIdInPath' get: summary: getTestcase tags: - testcases responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/Testcase" - "400": + $ref: '#/components/schemas/Testcase' + '400': description: Bad Request - "401": + '401': description: Unauthorized - "403": + '403': description: Forbidden - "404": + '404': description: Not Found operationId: getTestcase description: あるidのテストケースを取得 @@ -110,17 +108,17 @@ paths: summary: putTestcase operationId: putTestcase responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/Testcase" - "400": + $ref: '#/components/schemas/Testcase' + '400': description: Bad Request - "403": + '403': description: Forbidden - "404": + '404': description: Not Found description: 単体のテストケースの編集 requestBody: @@ -128,20 +126,20 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PutTestcaseRequest" + $ref: '#/components/schemas/PutTestcaseRequest' tags: - testcases delete: summary: deleteTestcase operationId: deleteTestcase responses: - "204": + '204': description: 正常に削除されました - "400": + '400': description: Bad Request - "401": + '401': description: Unauthorized - "404": + '404': description: Not Found description: 単一のテストケースの削除 tags: @@ -160,31 +158,31 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PostProblemRequest" + $ref: '#/components/schemas/PostProblemRequest' responses: - "200": + '200': description: |- OK 問題が投稿されました. content: application/json: schema: - $ref: "#/components/schemas/Problem" - "400": + $ref: '#/components/schemas/Problem' + '400': description: Bad Request get: summary: getProblems operationId: getProblems responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/Problems" - "400": + $ref: '#/components/schemas/Problems' + '400': description: Bad Request - "404": + '404': description: Not Found description: 問題一覧を取得する requestBody: @@ -192,29 +190,29 @@ paths: tags: - problems parameters: - - $ref: "#/components/parameters/limitInQuery" - - $ref: "#/components/parameters/offsetInQuery" - - $ref: "#/components/parameters/problemsOrderByInQuery" - - $ref: "#/components/parameters/userNameInQuery" - - $ref: "#/components/parameters/userIdInQuery" - "/problems/{problemId}": + - $ref: '#/components/parameters/limitInQuery' + - $ref: '#/components/parameters/offsetInQuery' + - $ref: '#/components/parameters/problemsOrderByInQuery' + - $ref: '#/components/parameters/userNameInQuery' + - $ref: '#/components/parameters/userIdInQuery' + '/problems/{problemId}': parameters: - - $ref: "#/components/parameters/problemIdInPath" + - $ref: '#/components/parameters/problemIdInPath' get: summary: getProblem operationId: getProblem tags: - problems responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/Problem" - "400": + $ref: '#/components/schemas/Problem' + '400': description: Bad Request - "404": + '404': description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) @@ -225,19 +223,19 @@ paths: tags: - problems responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/Problem" - "400": + $ref: '#/components/schemas/Problem' + '400': description: Bad Request - "403": + '403': description: |- Forbidden 問題を編集する権限がありません. - "404": + '404': description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) @@ -246,44 +244,44 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PutProblemRequest" + $ref: '#/components/schemas/PutProblemRequest' delete: summary: deleteProblem operationId: deleteProblem tags: - problems responses: - "204": + '204': description: 正常に削除されました. - "400": + '400': description: Bad Request - "403": + '403': description: |- Forbidden 問題を削除する権限がありません. - "404": + '404': description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) description: 問題を削除する - "/problems/{problemId}/editorials": + '/problems/{problemId}/editorials': parameters: - - $ref: "#/components/parameters/problemIdInPath" + - $ref: '#/components/parameters/problemIdInPath' get: summary: getEditorialsOnProblem operationId: getEditorialsOnProblem tags: - editorials responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/Editorials" - "400": + $ref: '#/components/schemas/Editorials' + '400': description: Bad Request - "404": + '404': description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) @@ -297,32 +295,32 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PostEditorialRequest" + $ref: '#/components/schemas/PostEditorialRequest' responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/EditorialDetail" - "400": + $ref: '#/components/schemas/EditorialDetail' + '400': description: Bad Request - "401": + '401': description: |- Unauthorized ログインしていません. - "403": + '403': description: |- Forbidden 解説を投稿する権限がありません. - "404": + '404': description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) description: 解説を投稿する - "/problems/{problemId}/testcases": + '/problems/{problemId}/testcases': parameters: - - $ref: "#/components/parameters/problemIdInPath" + - $ref: '#/components/parameters/problemIdInPath' post: summary: postTestcases operationId: postTestcases @@ -332,25 +330,25 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PostTestcaseRequest" + $ref: '#/components/schemas/PostTestcaseRequest' responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/Testcases" - "400": + $ref: '#/components/schemas/Testcases' + '400': description: Bad Request - "401": + '401': description: |- Unauthorized ログインしていません. - "403": + '403': description: |- Forbidden 解説を投稿する権限がありません. - "404": + '404': description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) @@ -359,46 +357,46 @@ paths: summary: getTestcases operationId: getTestcases responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/Testcases" - "400": + $ref: '#/components/schemas/Testcases' + '400': description: Bad Request - "404": + '404': description: Not Found description: 全てのテストケースを取得 tags: - testcases - "/problems/{problemId}/submissions'": + '/problems/{problemId}/submissions''': parameters: - - $ref: "#/components/parameters/problemIdInPath" + - $ref: '#/components/parameters/problemIdInPath' get: summary: getSubmissionsForProblem operationId: getSubmissionsForProblem tags: - submissions parameters: - - $ref: "#/components/parameters/submissionsOrderByInQuery" - - $ref: "#/components/parameters/judgeStatusInQuery" - - $ref: "#/components/parameters/codeLanguageInQuery" - - $ref: "#/components/parameters/userNameInQuery" - - $ref: "#/components/parameters/limitInQuery" - - $ref: "#/components/parameters/offsetInQuery" + - $ref: '#/components/parameters/submissionsOrderByInQuery' + - $ref: '#/components/parameters/judgeStatusInQuery' + - $ref: '#/components/parameters/codeLanguageInQuery' + - $ref: '#/components/parameters/userNameInQuery' + - $ref: '#/components/parameters/limitInQuery' + - $ref: '#/components/parameters/offsetInQuery' responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/Submissions" - "403": + $ref: '#/components/schemas/Submissions' + '403': description: |- Forbidden 提出一覧を取得する権限がありません. - "404": + '404': description: |- Not Found 問題が存在しません. (または問題の閲覧権限がありません.) @@ -412,21 +410,21 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PostSubmissionRequest" + $ref: '#/components/schemas/PostSubmissionRequest' responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/SubmissionDetail" - "400": + $ref: '#/components/schemas/SubmissionDetail' + '400': description: Bad Request - "403": + '403': description: |- Forbidden ソースコードを提出する権限がありません. - "404": + '404': description: |- Not Found 提出が存在しません. (または提出の閲覧権限がありません.) @@ -438,63 +436,63 @@ paths: tags: - submissions parameters: - - $ref: "#/components/parameters/submissionsOrderByInQuery" - - $ref: "#/components/parameters/judgeStatusInQuery" - - $ref: "#/components/parameters/codeLanguageInQuery" - - $ref: "#/components/parameters/userNameInQuery" - - $ref: "#/components/parameters/userIdInQuery" - - $ref: "#/components/parameters/limitInQuery" - - $ref: "#/components/parameters/offsetInQuery" + - $ref: '#/components/parameters/submissionsOrderByInQuery' + - $ref: '#/components/parameters/judgeStatusInQuery' + - $ref: '#/components/parameters/codeLanguageInQuery' + - $ref: '#/components/parameters/userNameInQuery' + - $ref: '#/components/parameters/userIdInQuery' + - $ref: '#/components/parameters/limitInQuery' + - $ref: '#/components/parameters/offsetInQuery' responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/Submissions" - "400": + $ref: '#/components/schemas/Submissions' + '400': description: Bad Request description: 提出一覧を取得する - "/submissions/{submissionId}": + '/submissions/{submissionId}': parameters: - - $ref: "#/components/parameters/submissionIdInPath" + - $ref: '#/components/parameters/submissionIdInPath' get: summary: getSubmission operationId: getSubmission tags: - submissions responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/SubmissionDetail" - "400": + $ref: '#/components/schemas/SubmissionDetail' + '400': description: Bad Request - "404": + '404': description: |- Not Found 提出が存在しません. (または提出の閲覧権限がありません.) description: 個別の提出を取得する - "/users/{userId}": + '/users/{userId}': parameters: - - $ref: "#/components/parameters/userIdInPath" + - $ref: '#/components/parameters/userIdInPath' get: summary: getUser operationId: getUser tags: - users responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/User" - "400": + $ref: '#/components/schemas/User' + '400': description: Bad Request - "404": + '404': description: |- Not Found ユーザーが存在しません. @@ -506,13 +504,13 @@ paths: tags: - me responses: - "200": + '200': description: OK content: application/json: schema: - $ref: "#/components/schemas/User" - "401": + $ref: '#/components/schemas/User' + '401': description: |- Unauthorized ログインしていません. @@ -521,7 +519,7 @@ paths: summary: putMe operationId: putUsersMeIcon responses: - "200": + '200': description: 正常に更新されました content: application/json: @@ -530,11 +528,9 @@ paths: properties: iconUrl: type: string - x-stoplight: - id: ah777i61peute required: - iconUrl - "400": + '400': description: 不正なリクエストです tags: - me @@ -542,7 +538,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PutMeRequest" + $ref: '#/components/schemas/PutMeRequest' description: アイコンなど自身に関連する情報の編集をします /users/me/submissions: get: @@ -551,23 +547,23 @@ paths: tags: - me parameters: - - $ref: "#/components/parameters/submissionsOrderByInQuery" - - $ref: "#/components/parameters/judgeStatusInQuery" - - $ref: "#/components/parameters/codeLanguageInQuery" - - $ref: "#/components/parameters/userNameInQuery" - - $ref: "#/components/parameters/userIdInQuery" - - $ref: "#/components/parameters/limitInQuery" - - $ref: "#/components/parameters/offsetInQuery" + - $ref: '#/components/parameters/submissionsOrderByInQuery' + - $ref: '#/components/parameters/judgeStatusInQuery' + - $ref: '#/components/parameters/codeLanguageInQuery' + - $ref: '#/components/parameters/userNameInQuery' + - $ref: '#/components/parameters/userIdInQuery' + - $ref: '#/components/parameters/limitInQuery' + - $ref: '#/components/parameters/offsetInQuery' responses: - "200": + '200': description: OK content: application/json: schema: type: array items: - $ref: "#/components/schemas/Submission" - "401": + $ref: '#/components/schemas/Submission' + '401': description: |- Unauthorized ログインしていません @@ -577,9 +573,9 @@ paths: summary: putMeEmail operationId: putMeEmail responses: - "204": + '204': description: 正常に更新されました メール認証を行なってください - "400": + '400': description: 不正なリクエストです tags: - me @@ -587,16 +583,16 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Email" + $ref: '#/components/schemas/Email' description: メール情報を書き換える メール情報を書き換えた後はメール認証が必要である /users/me/password: put: summary: putUserMePassword operationId: putUsersMePassword responses: - "204": + '204': description: 正常に更新されました - "400": + '400': description: 不正なリクエストです tags: - me @@ -604,22 +600,22 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PutPasswordRequest" + $ref: '#/components/schemas/PutPasswordRequest' description: ログイン後にパスワードを変更する /signup/request: post: summary: postSignupRequest operationId: postSignupRequest responses: - "201": + '201': description: 認証用のURLを送信しました メール認証を行なってください - "400": + '400': description: 不正なリクエストです メールアドレスの形式を確認してください requestBody: content: application/json: schema: - $ref: "#/components/schemas/SignupRequest" + $ref: '#/components/schemas/SignupRequest' tags: - authentication description: メールアドレスを渡し,そこに認証用のリンクを送る。 @@ -628,32 +624,32 @@ paths: summary: postSignup operationId: postSignup responses: - "201": + '201': description: 正常にユーザーを作成できました メール認証を行なってください - "400": + '400': description: 不正なリクエストです - "401": + '401': description: Unauthorized requestBody: content: application/json: schema: - $ref: "#/components/schemas/Signup" + $ref: '#/components/schemas/Signup' tags: - authentication description: |- email+passwordによるユーザー登録 クエリパラメタにtokenを持ち,それでメール情報を管理する parameters: - - $ref: "#/components/parameters/token" + - $ref: '#/components/parameters/token' /login: post: summary: postLogin operationId: postLogin responses: - "204": + '204': description: No Content - "400": + '400': description: 不正なリクエストです ユーザー名とパスワードを確認してください tags: - authentication @@ -661,14 +657,14 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/UserEmailAndPassword" + $ref: '#/components/schemas/UserEmailAndPassword' description: ログイン /logout: post: summary: postLogout operationId: postLogout responses: - "204": + '204': description: No Content description: ログアウト tags: @@ -679,7 +675,7 @@ paths: tags: - authentication responses: - "204": + '204': description: 正常にリセットメールを送信しました operationId: postRequestResetPassword description: パスワード変更のリクエスト @@ -687,30 +683,30 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Email" + $ref: '#/components/schemas/Email' /reset-password: post: summary: postResetPassword operationId: postResetPassword responses: - "204": + '204': description: 正常に更新されました description: 新しいパスワードをPOSTする requestBody: content: application/json: schema: - $ref: "#/components/schemas/ResetPasswordRequest" + $ref: '#/components/schemas/ResetPasswordRequest' tags: - authentication parameters: - - $ref: "#/components/parameters/token" + - $ref: '#/components/parameters/token' /google-oauth2/params: get: summary: getGoogleOAuth2Params operationId: getGoogleAuthParams responses: - "200": + '200': description: 正しいURLが返されました content: application/json: @@ -721,7 +717,7 @@ paths: type: string required: - url - "500": + '500': description: Internal server error content: application/json: @@ -739,7 +735,7 @@ paths: summary: getGithubOAuth2Params operationId: getgithubAuthParams responses: - "200": + '200': description: 正しいURLが返されました content: application/json: @@ -750,7 +746,7 @@ paths: type: string required: - url - "500": + '500': description: Internal server error content: application/json: @@ -783,10 +779,10 @@ paths: required: - token responses: - "201": + '201': description: トークンは正常に削除されました content: {} - "400": + '400': description: Invalid request or token content: application/json: @@ -796,7 +792,7 @@ paths: message: type: string example: Invalid token or request - "500": + '500': description: Internal server error content: application/json: @@ -826,10 +822,10 @@ paths: required: - token responses: - "201": + '201': description: トークンは正常に削除されました content: {} - "400": + '400': description: Invalid request or token content: application/json: @@ -839,7 +835,7 @@ paths: message: type: string example: Invalid token or request - "500": + '500': description: Internal server error content: application/json: @@ -869,10 +865,10 @@ paths: required: - token responses: - "201": + '201': description: トークンは正常に削除されました content: {} - "400": + '400': description: Invalid request or token content: application/json: @@ -882,7 +878,7 @@ paths: message: type: string example: Invalid token or request - "500": + '500': description: Internal server error content: application/json: @@ -898,8 +894,6 @@ components: title: Problem type: object description: 問題の詳細 - x-stoplight: - id: uhw48v4uc25fg properties: id: type: integer @@ -931,19 +925,13 @@ components: description: メモリ制限 (MiB) testcases: type: array - x-stoplight: - id: yqk7hsmce6plm items: - $ref: "#/components/schemas/Testcase" + $ref: '#/components/schemas/TestcaseSummaries' createdAt: type: string - x-stoplight: - id: xy9cz574x9gg7 format: date-time updatedAt: type: string - x-stoplight: - id: s5hmr0sa68jhp format: date-time required: - id @@ -958,20 +946,14 @@ components: - updatedAt Problems: title: Problems - x-stoplight: - id: 9gf5tc4e2mwnw type: object properties: total: type: integer - x-stoplight: - id: 1gu5qpb9yngt2 problems: type: array - x-stoplight: - id: p790xy7gkt5p3 items: - $ref: "#/components/schemas/Problem" + $ref: '#/components/schemas/Problem' required: - total - problems @@ -979,8 +961,6 @@ components: title: PostProblemRequest type: object description: 問題の投稿リクエスト - x-stoplight: - id: chss8j0z12nvv properties: title: type: string @@ -994,19 +974,13 @@ components: timeLimit: type: integer description: 実行時間制限 (ms) - x-stoplight: - id: dgplwhk8tcebp memoryLimit: type: integer description: メモリ制限 (MiB) - x-stoplight: - id: 3w92jx80b8aw0 testcases: type: array - x-stoplight: - id: ln20jb8zi7o1l items: - $ref: "#/components/schemas/Testcase" + $ref: '#/components/schemas/Testcase' required: - title - difficulty @@ -1017,8 +991,6 @@ components: title: PutProblemRequest type: object description: 問題の変更リクエスト - x-stoplight: - id: 98ocidfpouev7 properties: title: type: string @@ -1044,10 +1016,8 @@ components: description: メモリ制限 (MiB) testcases: type: array - x-stoplight: - id: ltrbj7cs827sn items: - $ref: "#/components/schemas/Testcase" + $ref: '#/components/schemas/Testcase' required: - title - isPublic @@ -1058,8 +1028,6 @@ components: title: User type: object description: ユーザー情報 - x-stoplight: - id: 90q4quaqlwzjz properties: id: type: integer @@ -1075,35 +1043,23 @@ components: description: GitHubのID iconUrl: type: string - x-stoplight: - id: fql62dfmen787 postProblems: - $ref: "#/components/schemas/Problems" + $ref: '#/components/schemas/Problems' submitProblems: - $ref: "#/components/schemas/Problems" + $ref: '#/components/schemas/Submissions' xLink: type: string - x-stoplight: - id: clm7vsicf5lkl githubLink: type: string - x-stoplight: - id: x0sgsyzjg0ukw selfIntroduction: type: string - x-stoplight: - id: zvjwukuab2cia role: - $ref: "#/components/schemas/Role" + $ref: '#/components/schemas/Role' createdAt: type: string - x-stoplight: - id: 2xbtpuhe98l7y format: date-time updatedAt: type: string - x-stoplight: - id: hiepvg9s68yt1 format: date-time required: - id @@ -1113,43 +1069,27 @@ components: - updatedAt PutMeRequest: title: PutMeRequest - x-stoplight: - id: jmrdp3he5jixc type: object properties: icon: type: string - x-stoplight: - id: j6hqsqrhjvyuh format: binary xLink: type: string - x-stoplight: - id: nrtfgf6emv2fr githubLink: type: string - x-stoplight: - id: ksnqob7ogsca4 selfIntroduction: type: string - x-stoplight: - id: o9lbyk9kcspoo PutPasswordRequest: title: PutPasswordRequest - x-stoplight: - id: 0o8o9675avscq type: object description: ログイン後のパスワード変更用 properties: oldPassword: type: string - x-stoplight: - id: 242qfkvy4u2vt format: password newPassword: type: string - x-stoplight: - id: lc9bt96ozzubs format: password required: - oldPassword @@ -1162,12 +1102,14 @@ components: id: type: integer description: 提出ID - userId: - type: integer - description: 提出ユーザーID + userName: + type: string problemId: type: integer description: 問題ID + userId: + type: integer + description: 提出ユーザーID submittedAt: type: string format: date-time @@ -1185,19 +1127,18 @@ components: type: number description: メモリ使用量の最大値 (MiB) judgeStatus: - $ref: "#/components/schemas/JudgeStatus" + $ref: '#/components/schemas/JudgeStatus' required: - id - - userId + - userName - problemId + - userId - submittedAt - languageId - totalScore - maxTime - maxMemory - judgeStatus - x-stoplight: - id: x8ryeeewom6jj Submissions: title: Submissions description: 提出一覧 @@ -1208,15 +1149,11 @@ components: problems: type: array items: - $ref: "#/components/schemas/Submission" - x-stoplight: - id: uf33tsy68epqd + $ref: '#/components/schemas/Submission' SubmissionDetail: title: SubmissionDetail type: object description: 提出の詳細 - x-stoplight: - id: mfmhczdc1gwvo properties: id: type: integer @@ -1247,12 +1184,12 @@ components: type: number description: メモリ使用量の最大値 (MiB) overallJudgeStatus: - $ref: "#/components/schemas/JudgeStatus" + $ref: '#/components/schemas/JudgeStatus' judgeResults: type: array description: ジャッジ結果の配列 items: - $ref: "#/components/schemas/JudgeResult" + $ref: '#/components/schemas/JudgeResult' required: - id - userId @@ -1276,8 +1213,6 @@ components: source: type: string description: ソースコード - x-stoplight: - id: eqxwkvraeiz3b Editorial: title: Editorial description: 解説 @@ -1304,16 +1239,12 @@ components: * `true` - 公開 * `false` - 非公開 (問題の作者のみ閲覧可) type: boolean - x-stoplight: - id: m9xwpnby2q6xp Editorials: title: Editorials description: 解説一覧 type: array items: - $ref: "#/components/schemas/Editorial" - x-stoplight: - id: vuibc5h3eb7et + $ref: '#/components/schemas/Editorial' EditorialDetail: title: EditorialDetail description: 解説の詳細 @@ -1349,8 +1280,6 @@ components: - authorId - statement - isPublic - x-stoplight: - id: puu5epz5pkyci PostEditorialRequest: title: PostEditorialRequest description: 解説の作成リクエスト @@ -1369,8 +1298,6 @@ components: required: - statement - isPublic - x-stoplight: - id: gfnu7alfyx3jr PutEditorialRequest: title: PutEditorialRequest description: 解説の変更リクエスト. @@ -1382,95 +1309,65 @@ components: isPublic: description: 公開されているかどうか type: boolean - x-stoplight: - id: zrrckaetgkydt Signup: title: Signup - x-stoplight: - id: zsjzxxygfdwys type: object description: email+password登録 properties: userName: type: string - x-stoplight: - id: g01wpo208sxxa password: type: string - x-stoplight: - id: 24uowhxqcp3pf token: type: string - x-stoplight: - id: k1v6ysycc6u4i required: - userName - password - token SignupRequest: title: SignupRequest - x-stoplight: - id: gcoei6xqe4ln6 type: object description: Signupのリクエスト properties: email: type: string - x-stoplight: - id: fb0b1msis28v6 format: email required: - email Email: title: Email - x-stoplight: - id: tphw8h07sooqq type: object properties: email: type: string - x-stoplight: - id: m4tunmpzgkpvr format: email required: - email UserEmailAndPassword: title: UserEmailAndPassword - x-stoplight: - id: 26q5bxdrs0z3d type: object description: login properties: email: type: string - x-stoplight: - id: e3l8ep9c0loa8 format: email password: type: string - x-stoplight: - id: xju40q8ojc42q required: - email - password ResetPasswordRequest: title: ResetPasswordRequest - x-stoplight: - id: 04oi9n1ji1hl9 type: object properties: password: type: string - x-stoplight: - id: kvbv5f1cqmzjw token: type: string - x-stoplight: - id: 1o25ezao3w37s required: - password - token - description: "" + description: '' JudgeStatus: title: JudgeStatus description: |- @@ -1494,37 +1391,23 @@ components: - RE - TLE - WJ - x-stoplight: - id: 5qo9li0rmup12 JudgeResult: title: JudgeResult - x-stoplight: - id: gi7dbpvfrs8m7 type: object description: ジャッジ結果 properties: testcaseId: type: string - x-stoplight: - id: xheta3et8g9q9 testcaseName: type: string - x-stoplight: - id: c5m8bww6qs0ye judgeStatus: - $ref: "#/components/schemas/JudgeStatus" + $ref: '#/components/schemas/JudgeStatus' score: type: integer - x-stoplight: - id: vewi2fgbmn3gy time: type: integer - x-stoplight: - id: i94m12b5w4dno memory: type: number - x-stoplight: - id: z854uf4g2e8l9 required: - testcaseId - judgeStatus @@ -1544,40 +1427,24 @@ components: - Admin - traPUser - CommonUser - x-stoplight: - id: ugyx5gmo9hy7r Testcase: title: Testcase - x-stoplight: - id: 2x3f3ma4z9y3d type: object description: テストケース properties: name: type: string - x-stoplight: - id: wmk8xj90sqxn6 id: type: string - x-stoplight: - id: s11rjbq4fe0jt testInput: type: string - x-stoplight: - id: 459r1ej6x57nt testOutput: type: string - x-stoplight: - id: cuh09avqiv5wr createdAt: type: string - x-stoplight: - id: mwwa3xo4gm9jn format: date-time updatedAt: type: string - x-stoplight: - id: y686xeh0zjvtb format: date-time required: - name @@ -1586,72 +1453,74 @@ components: - testOutput - createdAt - updatedAt + Testcases: + title: Testcases + type: object + description: Testcaseの配列 + properties: + total: + type: string + testcases: + $ref: '#/components/schemas/Testcase' + required: + - total + - testcases PostTestcaseRequest: title: PostTestcasesRequest - x-stoplight: - id: edr4huxi5qh39 type: array description: テストケースの投稿 items: - x-stoplight: - id: qcd4jxstx1s2j type: object properties: name: type: string - x-stoplight: - id: d33zmxcr8ydlr testInput: type: string - x-stoplight: - id: bl152tf6tq3fv testOutput: type: string - x-stoplight: - id: 5cc7p8clvsecm required: - name - testInput - testOutput - Testcases: - title: Testcases - x-stoplight: - id: 1c6ojz2rn58kj - type: object - description: Testcaseの配列 - properties: - total: - type: string - x-stoplight: - id: mrq1xcdfc2zcv - testcases: - $ref: "#/components/schemas/Testcase" - required: - - total - - testcases PutTestcaseRequest: title: PutTestcaseRequest - x-stoplight: - id: 736n95f89ef1u type: object description: 単体のテストケースの編集 properties: name: type: string - x-stoplight: - id: 3kz6lokf8yq4q testInput: type: string - x-stoplight: - id: 415bmlsu2ry74 testOutput: type: string - x-stoplight: - id: btrwfs2v1ws59 required: - name - testInput - testOutput + TestcaseSummary: + title: TestcaseSummary + type: object + properties: + id: + type: string + name: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + TestcaseSummaries: + title: TestcaseSummaries + type: object + properties: + total: + type: integer + testcaseSummaries: + type: array + items: + $ref: '#/components/schemas/TestcaseSummary' parameters: problemIdInPath: name: problemId @@ -1674,14 +1543,14 @@ components: required: false schema: type: string - default: "-createdAt" + default: '-createdAt' enum: - createdAt - - "-createdAt" + - '-createdAt' - updatedAt - - "-updatedAt" + - '-updatedAt' - difficulty - - "-difficulty" + - '-difficulty' submissionIdInPath: name: submissionId in: path @@ -1703,14 +1572,14 @@ components: required: false schema: type: string - default: "-createdAt" + default: '-createdAt' enum: - createdAt - - "-createdAt" + - '-createdAt' - timeConsumption - - "-timeConsumption" + - '-timeConsumption' - memoryConsumption - - "-memoryConsumption" + - '-memoryConsumption' limitInQuery: name: limit in: query @@ -1734,7 +1603,7 @@ components: description: ジャッジ結果 required: false schema: - $ref: "#/components/schemas/JudgeStatus" + $ref: '#/components/schemas/JudgeStatus' codeLanguageInQuery: name: language in: query From 9269c90d20f52f483682968340590578f2296ef5 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Fri, 6 Sep 2024 23:44:20 +0900 Subject: [PATCH 05/13] =?UTF-8?q?fix:=20ramdos=E3=81=8F=E3=82=93=E3=81=AB?= =?UTF-8?q?=E6=8C=87=E6=91=98=E3=81=84=E3=81=9F=E3=81=A0=E3=81=84=E3=81=9F?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E3=81=AA=E3=81=A9=E3=82=92=E5=8F=8D=E6=98=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 0 -> 6148 bytes docs/openapi.yaml | 255 ++++++++++++++++++++++++++++------------------ 2 files changed, 155 insertions(+), 100 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0f0fc05df07cebca6bf1311a8424a8de62740d91 GIT binary patch literal 6148 zcmeHKL2uJA82#J@nlK^tz@%M}B5|!sTM%g4CF|P5B;c?hb{JD>ma0T#@zkX2p{kTK z{1~qM68;M(c%SV~G~2WrnwUSye)i}09Qh@(VdF&vG6Xqhgl#M$=>Ny_YhL zR_#&rAsNqyjVJpuD@I8+o+?2Sk3so(lw`4-_v9>#bEOUSfa|&5u(7>ZbapyTzuSGi zZ2F6xZoBEfeDP|z^xUmy&vy@pU(&NoepPOez&EervB4F5L*sJY7vVHZWi~;M`E`0j z2eeNEdPgA*Dz32dZ^u141apu2^cL8nGm0yUUlj$qHmn2I0qel64w(JR-Mp1)3DyDY zzKD$Er_n45#pa*PLt zUux8H66(pA$2?h>8;UR&58*31i9n;RtpnD9bq6+dx54NC;O6`Py2$pd1J;56$^qf@ z!+sA-GH2_R#qn9|qkKZ)U|y;5Qi6s$ioxZhcpF6p@;*0!fx%KEG6?%4plq;}b>N>m F@CPO#hRXl| literal 0 HcmV?d00001 diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 9410384..8604765 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -6,6 +6,7 @@ info: tags: - name: authentication - name: editorials + - name: language - name: me - name: oauth2 - name: problems @@ -27,7 +28,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/EditorialDetail' + $ref: '#/components/schemas/Editorial' '400': description: Bad Request '404': @@ -49,7 +50,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Editorial' + $ref: '#/components/schemas/EditorialSummary' '400': description: Bad Request '403': @@ -179,7 +180,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Problems' + $ref: '#/components/schemas/ProblemSummaries' '400': description: Bad Request '404': @@ -228,7 +229,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Problem' + $ref: '#/components/schemas/ProblemSummary' '400': description: Bad Request '403': @@ -278,7 +279,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Editorials' + $ref: '#/components/schemas/EditorialSummaries' '400': description: Bad Request '404': @@ -302,7 +303,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/EditorialDetail' + $ref: '#/components/schemas/Editorial' '400': description: Bad Request '401': @@ -337,7 +338,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Testcases' + $ref: '#/components/schemas/TestcaseSummaries' '400': description: Bad Request '401': @@ -362,7 +363,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Testcases' + $ref: '#/components/schemas/TestcaseSummaries' '400': description: Bad Request '404': @@ -370,9 +371,14 @@ paths: description: 全てのテストケースを取得 tags: - testcases - '/problems/{problemId}/submissions''': + '/problems/{problemId}/submissions': parameters: - - $ref: '#/components/parameters/problemIdInPath' + - name: problemId + in: path + description: 問題ID + required: true + schema: + type: number get: summary: getSubmissionsForProblem operationId: getSubmissionsForProblem @@ -391,7 +397,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Submissions' + $ref: '#/components/schemas/SubmissionSummaries' '403': description: |- Forbidden @@ -417,7 +423,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SubmissionDetail' + $ref: '#/components/schemas/Submission' '400': description: Bad Request '403': @@ -429,30 +435,6 @@ paths: Not Found 提出が存在しません. (または提出の閲覧権限がありません.) description: ソースコードを提出する - /submissions: - get: - summary: getSubmissions - operationId: getSubmissions - tags: - - submissions - parameters: - - $ref: '#/components/parameters/submissionsOrderByInQuery' - - $ref: '#/components/parameters/judgeStatusInQuery' - - $ref: '#/components/parameters/codeLanguageInQuery' - - $ref: '#/components/parameters/userNameInQuery' - - $ref: '#/components/parameters/userIdInQuery' - - $ref: '#/components/parameters/limitInQuery' - - $ref: '#/components/parameters/offsetInQuery' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Submissions' - '400': - description: Bad Request - description: 提出一覧を取得する '/submissions/{submissionId}': parameters: - $ref: '#/components/parameters/submissionIdInPath' @@ -467,7 +449,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SubmissionDetail' + $ref: '#/components/schemas/Submission' '400': description: Bad Request '404': @@ -562,7 +544,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/Submission' + $ref: '#/components/schemas/SubmissionSummary' '401': description: |- Unauthorized @@ -888,6 +870,28 @@ paths: message: type: string description: GithubOAuthのトークンを削除する + /languages: + get: + summary: getLanguages + tags: + - language + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Language' + '400': + description: Bad Request + '404': + description: Not Found + operationId: getLanguages + description: 使用できる言語の一覧 + requestBody: + content: {} components: schemas: Problem: @@ -896,7 +900,7 @@ components: description: 問題の詳細 properties: id: - type: integer + type: string description: 問題ID title: type: string @@ -923,6 +927,8 @@ components: memoryLimit: type: integer description: メモリ制限 (MiB) + solvedCount: + type: integer testcases: type: array items: @@ -939,12 +945,63 @@ components: - authorId - isPublic - difficulty + - statement - timeLimit - memoryLimit + - solvedCount - testcases - createdAt - updatedAt - Problems: + ProblemSummary: + title: ProblemSummary + type: object + description: 問題の要約 + properties: + id: + type: string + description: 問題ID + title: + type: string + description: 問題タイトル + authorId: + type: integer + description: 作問者のユーザーID + isPublic: + type: boolean + description: |- + 問題が全体公開かどうか. + + * `true` - 公開 + * `false` - 非公開 (問題の作者のみ閲覧可) + difficulty: + type: integer + description: 難易度 + timeLimit: + type: integer + description: 実行時間制限 (ms) + memoryLimit: + type: integer + description: メモリ制限 (MiB) + solvedCount: + type: integer + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + required: + - id + - title + - authorId + - isPublic + - difficulty + - timeLimit + - memoryLimit + - solvedCount + - createdAt + - updatedAt + ProblemSummaries: title: Problems type: object properties: @@ -953,7 +1010,7 @@ components: problems: type: array items: - $ref: '#/components/schemas/Problem' + $ref: '#/components/schemas/ProblemSummary' required: - total - problems @@ -977,10 +1034,6 @@ components: memoryLimit: type: integer description: メモリ制限 (MiB) - testcases: - type: array - items: - $ref: '#/components/schemas/Testcase' required: - title - difficulty @@ -1014,10 +1067,6 @@ components: memoryLimit: type: integer description: メモリ制限 (MiB) - testcases: - type: array - items: - $ref: '#/components/schemas/Testcase' required: - title - isPublic @@ -1030,7 +1079,7 @@ components: description: ユーザー情報 properties: id: - type: integer + type: string description: ユーザーID name: type: string @@ -1044,9 +1093,9 @@ components: iconUrl: type: string postProblems: - $ref: '#/components/schemas/Problems' + $ref: '#/components/schemas/ProblemSummaries' submitProblems: - $ref: '#/components/schemas/Submissions' + $ref: '#/components/schemas/SubmissionSummaries' xLink: type: string githubLink: @@ -1094,22 +1143,22 @@ components: required: - oldPassword - newPassword - Submission: - title: Submission + SubmissionSummary: + title: SubmissionSummary type: object description: 提出 properties: id: - type: integer - description: 提出ID - userName: type: string + description: 提出ID problemId: type: integer description: 問題ID userId: type: integer description: 提出ユーザーID + userName: + type: string submittedAt: type: string format: date-time @@ -1126,21 +1175,24 @@ components: maxMemory: type: number description: メモリ使用量の最大値 (MiB) + codeLength: + type: number judgeStatus: $ref: '#/components/schemas/JudgeStatus' required: - id - - userName - problemId - userId + - userName - submittedAt - languageId - totalScore - maxTime - maxMemory + - codeLength - judgeStatus - Submissions: - title: Submissions + SubmissionSummaries: + title: SubmissionSummaries description: 提出一覧 type: object properties: @@ -1149,18 +1201,20 @@ components: problems: type: array items: - $ref: '#/components/schemas/Submission' - SubmissionDetail: - title: SubmissionDetail + $ref: '#/components/schemas/SubmissionSummary' + Submission: + title: Submission type: object description: 提出の詳細 properties: id: - type: integer + type: string description: 提出ID userId: type: integer description: 提出ユーザーID + userName: + type: string problemId: type: integer description: 問題ID @@ -1171,9 +1225,6 @@ components: languageId: type: integer description: 提出コードの言語ID - source: - type: string - description: 提出コード totalScore: type: integer description: スコアの合計 @@ -1183,25 +1234,24 @@ components: maxMemory: type: number description: メモリ使用量の最大値 (MiB) + codeLength: + type: number overallJudgeStatus: $ref: '#/components/schemas/JudgeStatus' judgeResults: type: array - description: ジャッジ結果の配列 items: $ref: '#/components/schemas/JudgeResult' required: - id - userId + - userName - problemId - submittedAt - languageId - - source - totalScore - maxTime - maxMemory - - overallJudgeStatus - - judgeResults PostSubmissionRequest: title: PostProblemRequest type: object @@ -1213,8 +1263,8 @@ components: source: type: string description: ソースコード - Editorial: - title: Editorial + EditorialSummary: + title: EditorialSummary description: 解説 type: object properties: @@ -1239,14 +1289,14 @@ components: * `true` - 公開 * `false` - 非公開 (問題の作者のみ閲覧可) type: boolean - Editorials: - title: Editorials + EditorialSummaries: + title: EditorialSummaries description: 解説一覧 type: array items: - $ref: '#/components/schemas/Editorial' - EditorialDetail: - title: EditorialDetail + $ref: '#/components/schemas/EditorialSummary' + Editorial: + title: Editorial description: 解説の詳細 type: object properties: @@ -1453,18 +1503,6 @@ components: - testOutput - createdAt - updatedAt - Testcases: - title: Testcases - type: object - description: Testcaseの配列 - properties: - total: - type: string - testcases: - $ref: '#/components/schemas/Testcase' - required: - - total - - testcases PostTestcaseRequest: title: PostTestcasesRequest type: array @@ -1521,6 +1559,18 @@ components: type: array items: $ref: '#/components/schemas/TestcaseSummary' + Language: + title: Language + type: object + description: プログラミング言語についての情報 + properties: + id: + type: integer + name: + type: string + required: + - id + - name parameters: problemIdInPath: name: problemId @@ -1528,7 +1578,7 @@ components: description: 問題ID required: true schema: - type: number + type: string problemsOrderByInQuery: name: orderBy in: query @@ -1566,20 +1616,25 @@ components: 文字列の先頭に `-` が付いていれば降順, 付いていなければ昇順. - * `createdAt` - 提出日時 + * `submittedAt` - 提出日時 * `timeConsumption` - 実行時間 + * `score` - スコア * `memoryConsumption` - メモリ量 - required: false + * `codeLength` - コード長 schema: type: string - default: '-createdAt' + default: '-submittedAt' enum: - - createdAt - - '-createdAt' + - submittedAt + - '-submittedAt' - timeConsumption - '-timeConsumption' + - score + - '-score' - memoryConsumption - '-memoryConsumption' + - codeLength + - '-codeLength' limitInQuery: name: limit in: query @@ -1610,7 +1665,7 @@ components: description: ソースコードの言語 required: false schema: - type: integer + type: string userNameInQuery: name: username in: query @@ -1622,21 +1677,21 @@ components: in: query description: ユーザーID schema: - type: integer + type: string userIdInPath: name: userId in: path description: ユーザーID required: true schema: - type: number + type: string editorialIdInPath: name: editorialId in: path description: 解説ID required: true schema: - type: integer + type: string token: name: token in: query From 70e31f2e294c3377a997447add1dfb2a43882a65 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Mon, 9 Sep 2024 23:46:32 +0900 Subject: [PATCH 06/13] =?UTF-8?q?fix:username=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/openapi.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 8604765..de59c2d 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1120,6 +1120,8 @@ components: title: PutMeRequest type: object properties: + userName: + type: string icon: type: string format: binary From 4f140a2e2bee94a67d8d042133e2a7cd9f16218e Mon Sep 17 00:00:00 2001 From: masky5859 Date: Mon, 9 Sep 2024 23:49:49 +0900 Subject: [PATCH 07/13] =?UTF-8?q?fix:=20total=E6=B6=88=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/openapi.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index de59c2d..4ff4318 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1555,8 +1555,6 @@ components: title: TestcaseSummaries type: object properties: - total: - type: integer testcaseSummaries: type: array items: From 53474ae473374028bd3ebcf30d1cd8453c9497e0 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Mon, 16 Sep 2024 23:56:25 +0900 Subject: [PATCH 08/13] =?UTF-8?q?fix:=20submissions=E3=82=92=E6=9F=94?= =?UTF-8?q?=E8=BB=9F=E3=81=AA=E5=BD=A2=E5=BC=8F=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/openapi.yaml | 91 ++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 56 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 4ff4318..b2e4e3a 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -379,34 +379,6 @@ paths: required: true schema: type: number - get: - summary: getSubmissionsForProblem - operationId: getSubmissionsForProblem - tags: - - submissions - parameters: - - $ref: '#/components/parameters/submissionsOrderByInQuery' - - $ref: '#/components/parameters/judgeStatusInQuery' - - $ref: '#/components/parameters/codeLanguageInQuery' - - $ref: '#/components/parameters/userNameInQuery' - - $ref: '#/components/parameters/limitInQuery' - - $ref: '#/components/parameters/offsetInQuery' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/SubmissionSummaries' - '403': - description: |- - Forbidden - 提出一覧を取得する権限がありません. - '404': - description: |- - Not Found - 問題が存在しません. (または問題の閲覧権限がありません.) - description: 問題への提出一覧を取得する post: summary: postSubmission operationId: postSubmission @@ -435,6 +407,33 @@ paths: Not Found 提出が存在しません. (または提出の閲覧権限がありません.) description: ソースコードを提出する + /submissions: + get: + summary: getSubmissions + tags: + - submissions + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SubmissionSummaries' + '400': + description: Bad Request + '404': + description: Not Found + operationId: getSubmissions + parameters: + - $ref: '#/components/parameters/submissionsOrderByInQuery' + - $ref: '#/components/parameters/judgeStatusInQuery' + - $ref: '#/components/parameters/codeLanguageInQuery' + - $ref: '#/components/parameters/userNameInQuery' + - $ref: '#/components/parameters/userIdInQuery' + - $ref: '#/components/parameters/limitInQuery' + - $ref: '#/components/parameters/offsetInQuery' + - $ref: '#/components/parameters/problemIdInQuery' + description: 全ての提出を取得 '/submissions/{submissionId}': parameters: - $ref: '#/components/parameters/submissionIdInPath' @@ -522,34 +521,7 @@ paths: schema: $ref: '#/components/schemas/PutMeRequest' description: アイコンなど自身に関連する情報の編集をします - /users/me/submissions: - get: - summary: getMeSubmissions - operationId: getMeSubmissions - tags: - - me - parameters: - - $ref: '#/components/parameters/submissionsOrderByInQuery' - - $ref: '#/components/parameters/judgeStatusInQuery' - - $ref: '#/components/parameters/codeLanguageInQuery' - - $ref: '#/components/parameters/userNameInQuery' - - $ref: '#/components/parameters/userIdInQuery' - - $ref: '#/components/parameters/limitInQuery' - - $ref: '#/components/parameters/offsetInQuery' - responses: - '200': - description: OK - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/SubmissionSummary' - '401': - description: |- - Unauthorized - ログインしていません - description: 自分の提出を全て取得する + /users/me/submissions: {} /users/me/email: put: summary: putMeEmail @@ -1706,3 +1678,10 @@ components: schema: type: string description: テストケースID + problemIdInQuery: + name: problemIdInQuery + in: query + required: false + schema: + type: string + description: 問題のID From 710d93991fe03a229969b8b2380907f31a84b986 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Thu, 26 Sep 2024 01:07:04 +0900 Subject: [PATCH 09/13] =?UTF-8?q?fix:=20orderBy=E3=82=92=E3=82=8F=E3=81=8B?= =?UTF-8?q?=E3=82=8A=E3=82=84=E3=81=99=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/openapi.yaml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index b2e4e3a..1202d8e 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1555,24 +1555,27 @@ components: name: orderBy in: query description: |- - 問題一覧一覧の並び替え + 問題一覧の並び替え - 文字列の先頭に `-` が付いていれば降順, 付いていなければ昇順. + `Asc` は昇順, `Desc` は降順を示す. - * `createdAt` - 提出日時 - * `updatedAt` - 更新日時 - * `difficulty` - 難易度 + * `createdAtAsc` - 提出日時の昇順 + * `createdAtDesc` - 提出日時の降順 + * `updatedAtAsc` - 更新日時の昇順 + * `updatedAtDesc` - 更新日時の降順 + * `difficultyAsc` - 難易度の昇順 + * `difficultyDesc` - 難易度の降順 required: false schema: type: string - default: '-createdAt' + default: createdAtDesc enum: - - createdAt - - '-createdAt' - - updatedAt - - '-updatedAt' - - difficulty - - '-difficulty' + - createdAtAsc + - createdAtDesc + - updatedAtAsc + - updatedAtDesc + - difficultyAsc + - difficultyDesc submissionIdInPath: name: submissionId in: path From fdc069f86e5e8955ccc25fa4ec742411452edabf Mon Sep 17 00:00:00 2001 From: masky5859 Date: Sat, 28 Sep 2024 15:53:25 +0900 Subject: [PATCH 10/13] =?UTF-8?q?fix:=20=E6=8C=87=E6=91=98=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=81=A0=E3=81=84=E3=81=9F=E5=86=85=E5=AE=B9=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/openapi.yaml | 64 ++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 1202d8e..f5ee2f3 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -505,12 +505,7 @@ paths: content: application/json: schema: - type: object - properties: - iconUrl: - type: string - required: - - iconUrl + $ref: '#/components/schemas/User' '400': description: 不正なリクエストです tags: @@ -521,7 +516,6 @@ paths: schema: $ref: '#/components/schemas/PutMeRequest' description: アイコンなど自身に関連する情報の編集をします - /users/me/submissions: {} /users/me/email: put: summary: putMeEmail @@ -594,6 +588,8 @@ paths: description: |- email+passwordによるユーザー登録 クエリパラメタにtokenを持ち,それでメール情報を管理する + リクエストを受け取ったら`/activate?payload=JWT`のような形式のメール有効化用エンドポイントを含むメールをバックエンドからユーザーに送る。 + ユーザーがそのアドレスをクリックしたら,メール有効化処理をし,適切に終了したらログイン画面にリダイレクトする。 parameters: - $ref: '#/components/parameters/token' /login: @@ -632,7 +628,10 @@ paths: '204': description: 正常にリセットメールを送信しました operationId: postRequestResetPassword - description: パスワード変更のリクエスト + description: |- + パスワード変更のリクエスト + リクエストを受け取ったら`/reset-password?token=JWT`のような形式のエンドポイントを含むメールをバックエンドからユーザーに送る。 + ユーザーがそれをクリックするとリセット用画面に遷移する。 requestBody: content: application/json: @@ -1589,27 +1588,32 @@ components: description: |- 提出一覧の並び替え - 文字列の先頭に `-` が付いていれば降順, 付いていなければ昇順. + `Asc` は昇順, `Desc` は降順を示す. - * `submittedAt` - 提出日時 - * `timeConsumption` - 実行時間 - * `score` - スコア - * `memoryConsumption` - メモリ量 - * `codeLength` - コード長 + * `submittedAtAsc` - 提出日時(昇順) + * `submittedAtDesc` - 提出日時(降順) + * `timeConsumptionAsc` - 実行時間(昇順) + * `timeConsumptionDesc` - 実行時間(降順) + * `scoreAsc` - スコア(昇順) + * `scoreDesc` - スコア(降順) + * `memoryConsumptionAsc` - メモリ量(昇順) + * `memoryConsumptionDesc` - メモリ量(降順) + * `codeLengthAsc` - コード長(昇順) + * `codeLengthDesc` - コード長(降順) schema: type: string - default: '-submittedAt' + default: submittedAtDesc enum: - - submittedAt - - '-submittedAt' - - timeConsumption - - '-timeConsumption' - - score - - '-score' - - memoryConsumption - - '-memoryConsumption' - - codeLength - - '-codeLength' + - submittedAtAsc + - submittedAtDesc + - timeConsumptionAsc + - timeConsumptionDesc + - scoreAsc + - scoreDesc + - memoryConsumptionAsc + - memoryConsumptionDesc + - codeLengthAsc + - codeLengthDesc limitInQuery: name: limit in: query @@ -1673,7 +1677,15 @@ components: required: false schema: type: string - description: JWTトークン + description: |- + JWTトークン。次のフィールドを持ちます: + + - `exp` (int): トークンの有効期限(UNIXタイムスタンプ)。 + - `iat` (int): トークンが発行された時刻(UNIXタイムスタンプ)。 + - `nbf` (int): トークンが有効となる最早時刻(UNIXタイムスタンプ)。 + - `userId` (string): ユーザーのID。 + - `email` (string): ユーザーのメールアドレス。 + - `action` (string): トークンのアクションタイプ。`reset_password`または`activate_email` testcaseIdInPath: name: testcaseId in: path From 0a95fb00487547367f191489215feb8ec65567cd Mon Sep 17 00:00:00 2001 From: masky5859 Date: Thu, 3 Oct 2024 22:50:23 +0900 Subject: [PATCH 11/13] =?UTF-8?q?fix:=20=E3=82=B9=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E3=82=B9=E3=82=B3=E3=83=BC=E3=83=89=E3=81=AE=E8=A6=8B?= =?UTF-8?q?=E7=9B=B4=E3=81=97=E3=81=AA=E3=81=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/openapi.yaml | 80 +++++++++++++---------------------------------- 1 file changed, 21 insertions(+), 59 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index f5ee2f3..816dc5d 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -29,8 +29,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Editorial' - '400': - description: Bad Request '404': description: 解説が存在しません(または解説の閲覧権限がありません) description: 個別の解説を取得する @@ -45,12 +43,8 @@ paths: schema: $ref: '#/components/schemas/PutEditorialRequest' responses: - '200': - description: 正常に変更されました. - content: - application/json: - schema: - $ref: '#/components/schemas/EditorialSummary' + '204': + description: 正常に変更されました '400': description: Bad Request '403': @@ -70,8 +64,6 @@ paths: responses: '204': description: 正常に削除されました. - '400': - description: Bad Request '403': description: |- Forbidden @@ -97,10 +89,6 @@ paths: $ref: '#/components/schemas/Testcase' '400': description: Bad Request - '401': - description: Unauthorized - '403': - description: Forbidden '404': description: Not Found operationId: getTestcase @@ -109,12 +97,9 @@ paths: summary: putTestcase operationId: putTestcase responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Testcase' + '204': + description: 正常に変更されました + content: {} '400': description: Bad Request '403': @@ -136,10 +121,8 @@ paths: responses: '204': description: 正常に削除されました - '400': - description: Bad Request - '401': - description: Unauthorized + '403': + description: Forbidden '404': description: Not Found description: 単一のテストケースの削除 @@ -151,7 +134,7 @@ paths: description: |- 問題を新規作成・投稿する このとき作成された問題は必ず非公開になる - 公開する場合は PATCH で変更する必要がある + 公開する場合は PUT で変更する必要がある operationId: postProblem tags: - problems @@ -175,8 +158,8 @@ paths: summary: getProblems operationId: getProblems responses: - '200': - description: OK + '201': + description: Created content: application/json: schema: @@ -211,8 +194,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Problem' - '400': - description: Bad Request '404': description: |- Not Found @@ -224,12 +205,9 @@ paths: tags: - problems responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ProblemSummary' + '204': + description: 正常に変更されました + content: {} '400': description: Bad Request '403': @@ -254,8 +232,6 @@ paths: responses: '204': description: 正常に削除されました. - '400': - description: Bad Request '403': description: |- Forbidden @@ -280,8 +256,6 @@ paths: application/json: schema: $ref: '#/components/schemas/EditorialSummaries' - '400': - description: Bad Request '404': description: |- Not Found @@ -298,18 +272,14 @@ paths: schema: $ref: '#/components/schemas/PostEditorialRequest' responses: - '200': - description: OK + '201': + description: Created content: application/json: schema: $ref: '#/components/schemas/Editorial' '400': description: Bad Request - '401': - description: |- - Unauthorized - ログインしていません. '403': description: |- Forbidden @@ -333,18 +303,14 @@ paths: schema: $ref: '#/components/schemas/PostTestcaseRequest' responses: - '200': - description: OK + '201': + description: Created content: application/json: schema: $ref: '#/components/schemas/TestcaseSummaries' '400': description: Bad Request - '401': - description: |- - Unauthorized - ログインしていません. '403': description: |- Forbidden @@ -364,8 +330,6 @@ paths: application/json: schema: $ref: '#/components/schemas/TestcaseSummaries' - '400': - description: Bad Request '404': description: Not Found description: 全てのテストケースを取得 @@ -390,8 +354,8 @@ paths: schema: $ref: '#/components/schemas/PostSubmissionRequest' responses: - '200': - description: OK + '201': + description: Created content: application/json: schema: @@ -449,8 +413,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Submission' - '400': - description: Bad Request '404': description: |- Not Found @@ -471,8 +433,6 @@ paths: application/json: schema: $ref: '#/components/schemas/User' - '400': - description: Bad Request '404': description: |- Not Found @@ -601,6 +561,8 @@ paths: description: No Content '400': description: 不正なリクエストです ユーザー名とパスワードを確認してください + '401': + description: Unauthorized tags: - authentication requestBody: From f43bbbc3bbb1a3ac9c2a85860cf700024daf9e96 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Sat, 5 Oct 2024 19:15:42 +0900 Subject: [PATCH 12/13] =?UTF-8?q?fix:=20token=E5=91=A8=E3=82=8A=E3=82=92?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/openapi.yaml | 48 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 816dc5d..db5f1ae 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -6,6 +6,7 @@ info: tags: - name: authentication - name: editorials + - name: email - name: language - name: me - name: oauth2 @@ -551,7 +552,7 @@ paths: リクエストを受け取ったら`/activate?payload=JWT`のような形式のメール有効化用エンドポイントを含むメールをバックエンドからユーザーに送る。 ユーザーがそのアドレスをクリックしたら,メール有効化処理をし,適切に終了したらログイン画面にリダイレクトする。 parameters: - - $ref: '#/components/parameters/token' + - $ref: '#/components/parameters/JWTWithoutUserId' /login: post: summary: postLogin @@ -615,7 +616,26 @@ paths: tags: - authentication parameters: - - $ref: '#/components/parameters/token' + - $ref: '#/components/parameters/JWTWithUserId' + /activate: + get: + summary: getActivateEmailAddress + parameters: + - $ref: '#/components/parameters/JWTWithUserId' + - $ref: '#/components/parameters/JWTWithoutUserId' + responses: + '200': + description: メールアドレスが正常に有効化されました + '400': + description: Invalid token or bad request + '401': + description: Unauthorized or expired token + '404': + description: User not found + operationId: getActivate + description: メールアドレスの有効化 + tags: + - email /google-oauth2/params: get: summary: getGoogleOAuth2Params @@ -1633,21 +1653,35 @@ components: required: true schema: type: string - token: - name: token + JWTWithUserId: + name: token-with-userid in: query required: false schema: type: string description: |- - JWTトークン。次のフィールドを持ちます: - + パスワードリセットまたはメールアドレス変更の際に使われるJWT。 + 次のフィールドを持つ: - `exp` (int): トークンの有効期限(UNIXタイムスタンプ)。 - `iat` (int): トークンが発行された時刻(UNIXタイムスタンプ)。 - `nbf` (int): トークンが有効となる最早時刻(UNIXタイムスタンプ)。 - `userId` (string): ユーザーのID。 - `email` (string): ユーザーのメールアドレス。 - - `action` (string): トークンのアクションタイプ。`reset_password`または`activate_email` + - `action` (string): トークンのアクションタイプ。`reset_password`または`change_email`。 + JWTWithoutUserId: + name: token-without-userid + in: query + required: false + schema: + type: string + description: |- + 初回のユーザー登録(メールアドレスの登録)の際に使われるJWT。 + 次のフィールドを持つ: + - `exp` (int): トークンの有効期限(UNIXタイムスタンプ)。 + - `iat` (int): トークンが発行された時刻(UNIXタイムスタンプ)。 + - `nbf` (int): トークンが有効となる最早時刻(UNIXタイムスタンプ)。 + - `email` (string): ユーザーのメールアドレス。 + - `action` (string): トークンのアクションタイプ。`register_email`。 testcaseIdInPath: name: testcaseId in: path From 969930951ec99aa744460441846e13ffdf72a070 Mon Sep 17 00:00:00 2001 From: Yuta Iida <93627045+mathsuky@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:22:42 +0900 Subject: [PATCH 13/13] Update docs/openapi.yaml Co-authored-by: kenken714 --- docs/openapi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index db5f1ae..0052d37 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -534,7 +534,7 @@ paths: operationId: postSignup responses: '201': - description: 正常にユーザーを作成できました メール認証を行なってください + description: 正常にユーザーを作成できました '400': description: 不正なリクエストです '401':