-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
112 lines (112 loc) · 2.57 KB
/
openapi.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
openapi: 3.0.2
info:
version: 1.0.0
title: Newcomer training API
servers:
- url: http://localhost:4000
description: development
paths:
"/comments":
get:
summary: コメント一覧の取得
responses:
"200":
$ref: "#/components/responses/Comments"
post:
summary: コメントの作成
requestBody:
$ref: "#/components/requestBodies/Comment"
responses:
"200":
$ref: "#/components/responses/Comment"
"422":
$ref: "#/components/responses/UnprocessableEntity"
components:
schemas:
CommentProperties:
type: object
properties:
id:
type: integer
example: 1
name:
type: string
example: 山田太郎
content:
type: string
example: こんにちは!
created_at:
type: string
format: data-time
example: "2020-04-01T00:00:00Z"
required:
- id
- name
- content
- created_at
CommentParameters:
type: object
properties:
name:
type: string
example: 山田太郎
content:
type: string
example: こんにちは!
required:
- name
- content
CommentRequest:
type: object
properties:
comment:
$ref: "#/components/schemas/CommentParameters"
required:
- comment
ErrorProperties:
type: object
properties:
title:
type: string
example: Something went wrong
detail:
type: string
example: Please try again later.
required:
- title
- detail
Errors:
type: object
properties:
errors:
type: array
items:
$ref: "#/components/schemas/ErrorProperties"
requestBodies:
Comment:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CommentRequest"
responses:
Comment:
description: コメント
content:
application/json:
schema:
$ref: "#/components/schemas/CommentProperties"
Comments:
description: コメントの配列
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/CommentProperties"
UnprocessableEntity:
description: 無効なパラメータ
content:
application/json:
schema:
$ref: "#/components/schemas/Errors"