-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspec.yml
173 lines (173 loc) · 4.06 KB
/
spec.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
openapi: 3.0.0
tags:
- name: game
info:
title: Capture the Flag
version: 1.0.0
description: A friendly game of Capture the Flag
license:
name: MIT
contact:
name: Test Double
url: 'https://testdouble.com'
email: [email protected]
servers:
- url: 'http://localhost:3000/api'
description: Game API (development)
- url: 'https://staging.retreat-game.com/api'
description: Game API (staging)
- url: 'https://retreat-game.com/api'
description: Game API (production)
paths:
/moves:
post:
summary: Create Move
operationId: post-moves
tags:
- game
responses:
'202':
description: Accepted
content:
application/json:
schema:
type: object
properties:
player:
$ref: '#/components/schemas/Player'
flag:
$ref: '#/components/schemas/Flag'
opponents:
type: array
items:
$ref: '#/components/schemas/Player'
examples: {}
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
error:
$ref: '#/components/schemas/Error'
description: Create a player move
parameters:
- schema:
type: string
enum:
- north
- east
- west
- south
in: query
name: direction
description: The direction to move
required: true
/player:
get:
summary: Get Player
tags:
- game
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
player:
$ref: '#/components/schemas/Player'
flag:
$ref: '#/components/schemas/Flag'
opponents:
type: array
items:
$ref: '#/components/schemas/Player'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
error:
$ref: '#/components/schemas/Error'
operationId: get-player
description: Get player information
components:
schemas:
Player:
title: Player
type: object
description: Player information
properties:
name:
type: string
has_peg:
type: boolean
has_flag:
type: boolean
is_in_safe_zone:
type: boolean
x:
type: integer
format: int32
y:
type: integer
format: int32
required:
- name
- has_peg
- has_flag
- is_in_safe_zone
- x
- y
Flag:
title: Flag
type: object
description: Opponent flag information
properties:
revealed:
type: boolean
held:
type: boolean
x:
type: integer
format: int32
y:
type: integer
format: int32
required:
- revealed
- held
- x
- y
Error:
title: Error
type: object
properties:
code:
type: integer
format: int32
minimum: 100
maximum: 600
description: The HTTP status code
message:
type: string
description: The error message indicating what the issue is
required:
- code
- message
x-examples:
Bad Request:
code: 400
message: Move not valid
securitySchemes:
token:
type: http
scheme: bearer
description: Use provided token for all requests
security:
- token: []