dh_demo

DreamHanks demo project
git clone git://git.lair.cx/dh_demo
Log | Files | Refs | README

commit 28f1b7390c102cf4fb37bf1a67430dc48c9c8c98
parent f1daffb4fc8f20e35e5dfa789ded2e1e58a7c7d1
Author: Yongbin Kim <iam@yongbin.kim>
Date:   Thu, 19 Jan 2023 22:23:24 +0900

docs: API 문서 추가

Signed-off-by: Yongbin Kim <iam@yongbin.kim>

Diffstat:
Adocs/openapi.yaml | 171+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 171 insertions(+), 0 deletions(-)

diff --git a/docs/openapi.yaml b/docs/openapi.yaml @@ -0,0 +1,171 @@ +openapi: 3.0.3 +info: + title: Wiki + description: Wiki API + version: 0.0.1 + +components: + schemas: + UserProfile: + type: object + properties: + id: + type: integer + format: int32 + nickname: + type: string + bio: + type: string + updatedAt: + type: string + format: date-time + + TokenResponse: + type: object + properties: + expires: + description: 토큰이 만료되는 시간 (밀리초) + type: integer + format: int64 + +paths: + /api/auth/token: + post: + description: 새 토큰을 발급함. + requestBody: + description: 사용자의 이메일 주소와 비밀번호 + required: true + content: + application/json: + schema: + type: object + properties: + email: + type: string + format: email + password: + type: string + example: | + {"email": "email@domain.tld", "password": "password"} + responses: + 200: + description: 토큰이 성공적으로 발급됨. + content: + application/json: + schema: + $ref: '#/components/schemas/TokenResponse' + 400: + description: 이메일이 올바르지 않거나 비밀번호가 올바르지 않음. + 404: + description: 사용자를 찾을 수 없음. + + /api/auth/refresh: + post: + description: 리프레시 토큰을 사용해 토큰을 갱신함. + parameters: + - name: wiki_jwt_refresh_token + in: cookie + description: 리프레시 토큰 + required: true + schema: + type: string + responses: + 200: + description: 토큰이 성공적으로 갱신됨. + content: + application/json: + schema: + $ref: '#/components/schemas/TokenResponse' + 401: + description: 리프레시 토큰이 올바르지 않아 사용자를 인증하지 못함. + + /api/users/me: + get: + description: 현재 로그인 된 사용자의 정보를 조회함. + responses: + 200: + description: 사용자의 정보를 성공적으로 받아옴. + content: + application/json: + schema: + $ref: '#/components/schemas/UserProfile' + 401: + description: 인증되지 않음. + + /api/users/{id}: + get: + description: 사용자의 정보를 조회함. + parameters: + - name: id + in: path + description: 사용자의 ID + required: true + schema: + type: string + responses: + 200: + description: 사용자의 정보를 성공적으로 받아옴. + content: + application/json: + schema: + $ref: '#/components/schemas/UserProfile' + 404: + description: 사용자를 찾을 수 없음. + + /api/users/signup: + post: + description: 새 가입 요청을 생성함. + requestBody: + description: 사용자의 이메일 주소 + required: true + content: + application/json: + schema: + type: object + properties: + email: + type: string + format: email + example: | + {"email": "email@domain.tld"} + responses: + 201: + description: 가입 요청이 성공적으로 생성됨. + 400: + description: 이메일이 올바르지 않음. + 409: + description: 같은 이메일을 사용한 요청이 이미 존재함. + + /api/users/signup/{id}: + post: + description: 새 사용자를 생성함. + parameters: + - name: id + in: path + description: 가입 요청의 ID + required: true + schema: + type: string + requestBody: + description: 사용자의 닉네임과 비밀번호 + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + password: + type: string + example: | + {"name": "John Doe", "password": "password"} + responses: + 201: + description: 사용자가 성공적으로 생성됨. + 400: + description: 비밀번호 혹은 닉네임이 비어있거나 올바르지 않음. + 404: + description: 해당 ID를 가진 가입 요청이 존재하지 않음. + 409: + description: 같은 닉네임을 사용한 사용자가 이미 존재함.