Skip to content

Commit

Permalink
Merge pull request #9 from su-its/docs/api-spec
Browse files Browse the repository at this point in the history
feat:API定義を行いました
  • Loading branch information
shin0729 authored Mar 7, 2024
2 parents 1ceda35 + a4880dc commit 09e4f5a
Showing 1 changed file with 203 additions and 0 deletions.
203 changes: 203 additions & 0 deletions typing-server/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
openapi: 3.0.0
info:
title: Typing API
version: 1.0.0
servers:
- url: http://localhost:8080
description: ローカル開発環境
- url: https://typemaster.com
description: 本番環境
paths:
/users:
post:
summary: 新しいユーザーを作成
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
MailAdress:
type: string
maxLength: 255
HandleName:
type: string
maxLength: 36
Name:
type: string
maxLength: 36
HashedPassword:
type: string
maxLength: 255
Department:
type: string
enum: [CS, BI, IA]
responses:
'201':
description: ユーザー作成成功
'400':
description: 不正なリクエスト
/users/{userId}:
get:
summary: ユーザー情報を取得
parameters:
- in: path
name: userId
required: true
schema:
type: string
responses:
'200':
description: ユーザー情報取得成功
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'404':
description: ユーザーが見つからない
/users/{userId}/scores:
post:
summary: ユーザーのスコアを登録
parameters:
- in: path
name: userId
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
keystrokes:
type: integer
accuracy:
type: number
format: float
score:
type: number
format: float
startedAt:
type: string
format: date-time
endedAt:
type: string
format: date-time
responses:
'201':
description: スコア登録成功
'400':
description: 不正なリクエスト
/users/{userId}/scores/{scoreId}:
get:
summary: 特定のスコア情報の取得
parameters:
- in: path
name: userId
required: true
schema:
type: string
- in: path
name: scoreId
required: true
schema:
type: string
responses:
'200':
description: スコア情報の取得成功
content:
application/json:
schema:
$ref: '#/components/schemas/Score'
'404':
description: スコアが見つからない

put:
summary: ユーザーのスコアを更新
parameters:
- in: path
name: userId
required: true
schema:
type: string
- in: path
name: scoreId
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
keystrokes:
type: integer
accuracy:
type: number
format: float
score:
type: number
format: float
startedAt:
type: string
format: date-time
endedAt:
type: string
format: date-time
responses:
'200':
description: スコアの更新成功
'400':
description: 不正なリクエスト
'404':
description: スコアが見つからない
components:
schemas:
User:
type: object
properties:
id:
type: string
format: uuid
MailAdress:
type: string
HandleName:
type: string
Name:
type: string
HashedPassword:
type: string
Department:
type: string
enum: [CS, BI, IA]
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
Score:
type: object
properties:
id:
type: string
format: uuid
keystrokes:
type: integer
accuracy:
type: number
format: float
score:
type: number
format: float
startedAt:
type: string
format: date-time
endedAt:
type: string
format: date-time

0 comments on commit 09e4f5a

Please sign in to comment.