/
api-v1.0.yaml
125 lines (123 loc) · 4.12 KB
/
api-v1.0.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
openapi: "3.0.0"
info:
title: 【TechBlog】社内ランチ共有アプリ API
version: 1.0.0
paths:
/posts:
get:
summary: すべてのランチ投稿を取得
responses:
'200':
description: 成功。すべてのランチ投稿を返す。
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Post'
example:
- postId: "2f1fa759-72c2-a68e-364f-54fb3f1e4ed1"
userId: "user123"
content: "今日ここ行ってきました!とても良かった!"
imageKey: "lunch.jpg"
restaurant: "AAA店"
likes:
- "user456"
- "user789"
comments:
- userId: "user456"
comment: "良いですね!"
- postId: "429d4ee2-44f1-d25b-9912-41c604eabef0"
userId: "user456"
content: "チーム〇〇でラーメンを食べてきました!"
imageKey: "ramen.jpg"
restaurant: "BBB店"
likes:
- "user123"
comments: []
- postId: "f3c512e1-faad-b4cc-1bee-955db716bdca"
userId: "user789"
content: "〇〇さんとランチしました。デザートがとても美味しかった!"
imageKey: "dessert.jpg"
restaurant: "CCC店"
likes:
- "user123"
- "user456"
- "user789"
post:
summary: 新しいランチ投稿を作成
requestBody:
description: 作成するランチ投稿の情報
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Post'
example:
content: "今日ここ行ってきました!とても良かった!"
imageKey: "lunch.jpg"
restaurant: "AAA店"
responses:
'201':
description: 投稿成功。作成したランチ投稿の情報を返す.
content:
application/json:
schema:
$ref: '#/components/schemas/Post'
example:
- postId: "2f1fa759-72c2-a68e-364f-54fb3f1e4ed1"
userId: "user123"
content: "今日ここ行ってきました!とても良かった!"
imageKey: "lunch.jpg"
restaurant: "AAA店"
likes: []
/posts/{postId}/likes:
post:
summary: 特定のランチ投稿にいいねを押す
parameters:
- $ref: '#/components/parameters/postId'
responses:
'200':
description: いいね成功。いいねを押したランチ投稿の情報を返す.
content:
application/json:
schema:
$ref: '#/components/schemas/Post'
example:
postId: "4"
userId: "user789"
content: "〇〇さんとランチしました。デザートがとても美味しかった!"
imageKey: "dessert.jpg"
restaurant: "CCC店"
likes:
- "user789"
components:
parameters:
postId:
name: postId
in: path
description: ランチ投稿ID
required: true
schema:
type: string
schemas:
Post:
type: object
properties:
postId:
type: string
description: ランチ投稿ID
content:
type: string
description: ランチ投稿の内容
imageKey:
type: string
description: ランチ投稿の画像のキー
restaurant:
type: string
description: ランチ投稿のレストラン名
likes:
type: array
description: いいねを押したユーザーのIDの配列
items:
type: string