dh_demo

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

openapi.yaml (6787B)


      1 openapi: 3.0.3
      2 info:
      3   title: Wiki
      4   description: Wiki API
      5   version: 0.0.1
      6 
      7 components:
      8   schemas:
      9     UserProfile:
     10       type: object
     11       properties:
     12         id:
     13           type: integer
     14           format: int32
     15         nickname:
     16           type: string
     17         bio:
     18           type: string
     19         updatedAt:
     20           type: string
     21           format: date-time
     22 
     23     TokenResponse:
     24       type: object
     25       properties:
     26         expires:
     27           description: 토큰이 만료되는 시간 (밀리초)
     28           type: integer
     29           format: int64
     30 
     31 paths:
     32   /api/auth/token:
     33     post:
     34       description: 새 토큰을 발급함.
     35       requestBody:
     36         description: 사용자의 이메일 주소와 비밀번호
     37         required: true
     38         content:
     39           application/json:
     40             schema:
     41               type: object
     42               properties:
     43                 email:
     44                   type: string
     45                   format: email
     46                 password:
     47                   type: string
     48             example: |
     49               {"email": "email@domain.tld", "password": "password"}
     50       responses:
     51         200:
     52           description: 토큰이 성공적으로 발급됨.
     53           content:
     54             application/json:
     55               schema:
     56                 $ref: '#/components/schemas/TokenResponse'
     57         400:
     58           description: 이메일이 올바르지 않거나 비밀번호가 올바르지 않음.
     59         404:
     60           description: 사용자를 찾을 수 없음.
     61   /api/auth/refresh:
     62     post:
     63       description: 리프레시 토큰을 사용해 토큰을 갱신함.
     64       parameters:
     65         - name: wiki_jwt_refresh_token
     66           in: cookie
     67           description: 리프레시 토큰
     68           required: true
     69           schema:
     70             type: string
     71       responses:
     72         200:
     73           description: 토큰이 성공적으로 갱신됨.
     74           content:
     75             application/json:
     76               schema:
     77                 $ref: '#/components/schemas/TokenResponse'
     78         401:
     79           description: 리프레시 토큰이 올바르지 않아 사용자를 인증하지 못함.
     80 
     81   /api/talks/{slug}/{...path}:
     82     post:
     83       description: 새 토론 스레드를 만듦.
     84       parameters:
     85         - name: slug
     86           in: path
     87           description: 위키의 슬러그
     88           required: true
     89           schema:
     90             type: string
     91         - name: path
     92           in: path
     93           description: 문서의 경로
     94           required: true
     95           schema:
     96             type: string
     97       requestBody:
     98         required: true
     99         content:
    100           application/json:
    101             schema:
    102               type: object
    103               properties:
    104                 title:
    105                   type: string
    106                 content:
    107                   type: string
    108             example: |
    109               {"title": "Foo", "content": "Hello, World!"}
    110       responses:
    111         200:
    112           description: 토론 스레드가 성공적으로 생성됨.
    113           content:
    114             application/json:
    115               schema:
    116                 type: object
    117                 properties:
    118                   thread:
    119                     type: integer
    120                     format: int32
    121         401:
    122           description: 인증되지 않음.
    123         404:
    124           description: 위키나 문서를 찾을 수 없음.
    125 
    126   /api/threads/{id}/comments:
    127     post:
    128       description: 새 댓글을 작성함.
    129       parameters:
    130         - name: id
    131           in: path
    132           description: 토론 스레드의 ID
    133           required: true
    134           schema:
    135             type: integer
    136             format: int32
    137       requestBody:
    138         required: true
    139         content:
    140           application/json:
    141             schema:
    142               type: object
    143               properties:
    144                 content:
    145                   type: string
    146             example: |
    147               {"content": "Hello, World!"}
    148       responses:
    149         200:
    150           description: 댓글이 성공적으로 작성됨.
    151         401:
    152           description: 인증되지 않음.
    153         404:
    154           description: 토론 스레드를 찾을 수 없음.
    155 
    156   /api/users/me:
    157     get:
    158       description: 현재 로그인 된 사용자의 정보를 조회함.
    159       responses:
    160         200:
    161           description: 사용자의 정보를 성공적으로 받아옴.
    162           content:
    163             application/json:
    164               schema:
    165                 $ref: '#/components/schemas/UserProfile'
    166         401:
    167           description: 인증되지 않음.
    168 
    169   /api/users/{id}:
    170     get:
    171       description: 사용자의 정보를 조회함.
    172       parameters:
    173       - name: id
    174         in: path
    175         description: 사용자의 ID
    176         required: true
    177         schema:
    178           type: string
    179       responses:
    180         200:
    181           description: 사용자의 정보를 성공적으로 받아옴.
    182           content:
    183             application/json:
    184               schema:
    185                 $ref: '#/components/schemas/UserProfile'
    186         404:
    187           description: 사용자를 찾을 수 없음.
    188 
    189   /api/users/signup:
    190     post:
    191       description: 새 가입 요청을 생성함.
    192       requestBody:
    193         description: 사용자의 이메일 주소
    194         required: true
    195         content:
    196           application/json:
    197             schema:
    198               type: object
    199               properties:
    200                 email:
    201                   type: string
    202                   format: email
    203             example: |
    204                 {"email": "email@domain.tld"}
    205       responses:
    206         201:
    207           description: 가입 요청이 성공적으로 생성됨.
    208         400:
    209           description: 이메일이 올바르지 않음.
    210         409:
    211           description: 같은 이메일을 사용한 요청이 이미 존재함.
    212 
    213   /api/users/signup/{id}:
    214     post:
    215       description: 새 사용자를 생성함.
    216       parameters:
    217       - name: id
    218         in: path
    219         description: 가입 요청의 ID
    220         required: true
    221         schema:
    222           type: string
    223       requestBody:
    224         description: 사용자의 닉네임과 비밀번호
    225         required: true
    226         content:
    227           application/json:
    228             schema:
    229               type: object
    230               properties:
    231                 name:
    232                   type: string
    233                 password:
    234                   type: string
    235             example: |
    236               {"name": "John Doe", "password": "password"}
    237       responses:
    238         201:
    239           description: 사용자가 성공적으로 생성됨.
    240         400:
    241           description: 비밀번호 혹은 닉네임이 비어있거나 올바르지 않음.
    242         404:
    243           description: 해당 ID를 가진 가입 요청이 존재하지 않음.
    244         409:
    245           description: 같은 닉네임을 사용한 사용자가 이미 존재함.