-
Notifications
You must be signed in to change notification settings - Fork 1
/
openapi-schema.yml
245 lines (245 loc) · 5.48 KB
/
openapi-schema.yml
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
---
openapi: 3.0.3
info:
title: Fights API
description: This API performs fights between a Hero and a Villain
contact:
name: Quarkus
url: https://github.com/quarkusio
version: "1.0"
servers:
- url: http://localhost:8082
tags:
- name: fights
- name: hello
paths:
/api/fights:
get:
tags:
- fights
summary: Returns all the fights
responses:
"200":
description: "Gets all fights, or empty list if none"
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Fight'
post:
tags:
- fights
summary: Initiates a fight
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Fighters'
responses:
"200":
description: The fight
content:
application/json:
schema:
$ref: '#/components/schemas/Fight'
"400":
description: Invalid fighters passed in (or no request body found)
/api/fights/hello:
get:
tags:
- hello
summary: Ping hello
responses:
"200":
description: Ping hello
content:
text/plain:
schema:
type: string
/api/fights/hello/heroes:
get:
tags:
- hello
summary: Ping Heroes hello
responses:
"200":
description: Ping Heroes hello
content:
text/plain:
schema:
type: string
/api/fights/hello/villains:
get:
tags:
- hello
summary: Ping Villains hello
responses:
"200":
description: Ping Villains hello
content:
text/plain:
schema:
type: string
/api/fights/randomfighters:
get:
tags:
- fights
summary: Returns random fighters
responses:
"200":
description: Gets a random Hero and Villain fighter
content:
application/json:
schema:
$ref: '#/components/schemas/Fighters'
/api/fights/{id}:
get:
tags:
- fights
summary: Returns a fight for a given identifier
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
"200":
description: Gets a fight for a given id
content:
application/json:
schema:
$ref: '#/components/schemas/Hero'
"404":
description: The fight is not found for a given identifier
components:
schemas:
Fight:
description: Each fight has a winner and a loser
required:
- fightDate
- winnerName
- winnerLevel
- winnerPicture
- loserName
- loserLevel
- loserPicture
- winnerTeam
- loserTeam
type: object
properties:
id:
$ref: '#/components/schemas/ObjectId'
fightDate:
format: date-time
type: string
nullable: false
winnerName:
minLength: 1
type: string
nullable: false
winnerLevel:
format: int32
type: integer
nullable: false
winnerPicture:
minLength: 1
type: string
nullable: false
loserName:
minLength: 1
type: string
nullable: false
loserLevel:
format: int32
type: integer
nullable: false
loserPicture:
minLength: 1
type: string
nullable: false
winnerTeam:
minLength: 1
type: string
nullable: false
loserTeam:
minLength: 1
type: string
nullable: false
Fighters:
description: A fight between one hero and one villain
required:
- hero
- villain
type: object
properties:
hero:
allOf:
- $ref: '#/components/schemas/Hero'
- nullable: false
villain:
allOf:
- $ref: '#/components/schemas/Villain'
- nullable: false
Hero:
description: The hero fighting against the villain
required:
- name
- level
- picture
type: object
properties:
name:
minLength: 1
type: string
nullable: false
level:
format: int32
type: integer
nullable: false
picture:
minLength: 1
type: string
nullable: false
powers:
type: string
ObjectId:
type: object
properties:
timestamp:
format: int32
type: integer
counter:
format: int32
type: integer
randomValue1:
format: int32
type: integer
randomValue2:
type: integer
date:
format: date
type: string
Villain:
description: The villain fighting against the hero
required:
- name
- level
- picture
type: object
properties:
name:
minLength: 1
type: string
nullable: false
level:
format: int32
type: integer
nullable: false
picture:
minLength: 1
type: string
nullable: false
powers:
type: string