-
Notifications
You must be signed in to change notification settings - Fork 3
/
openapi.yaml
358 lines (358 loc) · 9.77 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
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
openapi: '3.0.2'
info:
title: Apertium Stats Service
version: '0.1.0'
description: Stateful Rust web service that enables the efficient concurrent compilation
and distribution of statistics regarding Apertium packages via a RESTful API.
servers:
- url: https://apertium.org/stats-service
description: Production
- url: http://localhost:8000
description: Development
paths:
/:
get:
summary: Returns usage instructions
responses:
'200':
description: Usage instructions
content:
text/plain: {}
/{package}:
parameters:
- $ref: '#/components/parameters/Package'
- $ref: '#/components/parameters/Recursive'
- $ref: '#/components/parameters/Async'
get:
summary: Returns statistics for the specified package
responses:
'200':
$ref: '#components/responses/Stats'
'202':
$ref: '#components/responses/StatsInProgress'
'429':
$ref: '#components/responses/StatsAlreadyInProgress'
'400':
$ref: '#components/responses/BadRequestError'
'404':
$ref: '#/components/responses/PackageNotFoundError'
'500':
$ref: '#/components/responses/InternalServerError'
post:
summary: Computes statistics for the specified package
responses:
'202':
$ref: '#components/responses/StatsInProgress'
'429':
$ref: '#components/responses/StatsAlreadyInProgress'
'400':
$ref: '#components/responses/BadRequestError'
'500':
$ref: '#/components/responses/InternalServerError'
/{package}/{kind}:
parameters:
- $ref: '#/components/parameters/Package'
- $ref: '#/components/parameters/Kind'
- $ref: '#/components/parameters/Recursive'
- $ref: '#/components/parameters/Async'
get:
summary: Returns statistics of the specified kind for the specified package
responses:
'200':
$ref: '#components/responses/Stats'
'202':
$ref: '#components/responses/StatsInProgress'
'429':
$ref: '#components/responses/StatsAlreadyInProgress'
'400':
$ref: '#components/responses/BadRequestError'
'404':
$ref: '#/components/responses/PackageNotFoundError'
'500':
$ref: '#/components/responses/InternalServerError'
post:
summary: Computes statistics of the specified kind for the specified package
responses:
'202':
$ref: '#components/responses/StatsInProgress'
'429':
$ref: '#components/responses/StatsAlreadyInProgress'
'400':
$ref: '#components/responses/BadRequestError'
'500':
$ref: '#/components/responses/InternalServerError'
/packages:
get:
summary: Returns listing of packages
responses:
'200':
$ref: '#components/responses/Packages'
'500':
$ref: '#/components/responses/InternalServerError'
post:
summary: Updates package cache and returns updated listing
responses:
'200':
$ref: '#components/responses/Packages'
'500':
$ref: '#/components/responses/InternalServerError'
/packages/{query}:
parameters:
Query:
name: query
in: path
required: false
description: search string for case-insensitive package name filtering
example: eng
schema:
type: string
get:
summary: Returns listing of packages filtered by query
responses:
'200':
$ref: '#components/responses/Packages'
'500':
$ref: '#/components/responses/InternalServerError'
post:
summary: Updates cache of packages and returns updated listing filtered by query
responses:
'200':
$ref: '#components/responses/Packages'
'500':
$ref: '#/components/responses/InternalServerError'
components:
responses:
Stats:
description: Package statistics
content:
application/json:
schema:
type: object
properties:
name:
type: string
stats:
$ref: '#/components/schemas/Stats'
in_progress:
$ref: '#/components/schemas/StatsInProgress'
StatsInProgress:
description: Package statistics in progress
content:
application/json:
schema:
type: object
properties:
name:
example: apertium-pl-dsb
type: string
in_progress:
$ref: '#/components/schemas/StatsInProgress'
StatsAlreadyInProgress:
description: Package statistics already in progress
content:
application/json:
schema:
type: object
properties:
name:
example: apertium-pl-dsb
type: string
in_progress:
$ref: '#/components/schemas/StatsInProgress'
Packages:
description: Package metadata
content:
application/json:
schema:
type: object
properties:
as_of:
$ref: '#/components/schemas/DateTime'
next_update:
$ref: '#/components/schemas/DateTime'
packages:
type: array
items:
$ref: '#/components/schemas/Package'
BadRequestError:
description: Bad request error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
PackageNotFoundError:
description: Package not found error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
InternalServerError:
description: Internal server error
parameters:
Package:
name: package
in: path
required: true
description: package identifier
example: apertium-pl-dsb
schema:
type: string
Kind:
name: kind
in: kind
required: true
description: file kind identifier
example: bidix
schema:
type: string
Recursive:
name: recursive
in: query
description: whether file search should be recursive
schema:
type: boolean
default: false
Async:
name: async
in: query
description: whether statistics compilation should be asynchronous
schema:
type: boolean
default: true
schemas:
Sha:
type: string
example: 9f09e5e37aadb005fbd420e79803e506a8202f73
DateTime:
type: string
format: date-time
example: '2018-12-08T01:14:30.363888593'
Actor:
type: object
properties:
name:
type: string
example: sushain97
email:
type: string
format: email
example: [email protected]
Error:
type: object
properties:
name:
example: apertium-pl-dsb
type: string
error:
example: No recognized files
type: string
StatKind:
type: string
enum:
- Entries
- Paradigms
- Rules
- Macros
- Stems
- VanillaStems
- Lexicons
- LexiconEntries
- Patterns
- PatternEntries
FileKind:
type: string
enum:
- Monodix
- Bidix
- MetaMonodix
- MetaBidix
- Postdix
- Rlx
- Transfer
- Lexc
- Twol
- Lexd
File:
type: object
properties:
last_author:
type: string
example: jim.o.regan
size:
type: integer
example: 13
last_changed:
$ref: '#components/schemas/DateTime'
path:
type: string
example: apertium-pl-dsb.pl-dsb.dix
revision:
type: integer
example: 13
sha:
$ref: '#components/schemas/Sha'
Stats:
type: array
items:
allOf:
- $ref: '#/components/schemas/File'
- type: object
properties:
name:
type: string
example: apertium-pl-dsb
file_kind:
$ref: '#components/schemas/FileKind'
example: stems
stat_kind:
$ref: '#components/schemas/StatKind'
example: rlx
value:
example: 366
created:
$ref: '#components/schemas/DateTime'
requested:
$ref: '#components/schemas/DateTime'
StatsInProgress:
type: array
items:
type: object
properties:
file:
$ref: '#/components/schemas/File'
kind:
$ref: '#components/schemas/FileKind'
created:
$ref: '#components/schemas/DateTime'
Commit:
type: object
properties:
message:
type: string
example: more words, some weird spellrelax
sha:
$ref: '#components/schemas/Sha'
authored:
$ref: '#components/schemas/DateTime'
committed:
$ref: '#components/schemas/DateTime'
author:
$ref: '#components/schemas/Actor'
committer:
$ref: '#components/schemas/Actor'
Package:
type: object
properties:
description:
type: string
example: Apertium linguistic data for English
name:
type: string
example: apertium-eng
topics:
type: array
items:
type: string
example: apertium-languages
last_commit:
$ref: '#components/schemas/Commit'