-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswagger.yaml
241 lines (237 loc) · 7.04 KB
/
swagger.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
swagger: "2.0"
basePath: /v1
info:
title: "dp-nlp-berlin-api"
description: "A Python microservice to wrap the Berlin package for identifying locations and tagging them with UN-LOCODEs and ISO-3166-2 subdivisions."
version: 1.0.0
license:
name: "MIT License"
schemes:
- http
paths:
/berlin/code/{code}:
get:
summary: retrieve an individual code by its identifier
description: Returns information about a code, if it exists
produces:
- application/json
parameters:
- in: path
name: code
description: "The query string to search data by"
required: true
type: "string"
responses:
200:
description: OK
schema:
$ref: "#/definitions/location_codes"
examples:
application/json:
matches:
- encoding: "UN-LOCODE"
id: "ca:lod"
key: "UN-LOCODE-ca:lod"
words:
- "london"
names:
- "london"
codes:
- "lod"
state:
- "ca"
- "canada"
subdiv:
- "on"
- "ontario"
- encoding: "UN-LOCODE"
id: "us:ldn"
key: "UN-LOCODE-us:ldn"
words:
- "london"
names:
- "london"
codes:
- "ldn"
state:
- "us"
- "united states of america"
subdiv:
- "oh"
- "ohio"
404:
$ref: '#/responses/NotFound'
500:
$ref: '#/responses/InternalError'
/berlin/search:
get:
summary: identifies locations and tagging them with UN-LOCODEs and ISO-3166-2 subdivisions
description: Returns UN-LOCODEs and ISO3166-2 subdivisions
produces:
- application/json
parameters:
- in: query
name: q
description: "The query string to search data by"
required: true
type: "string"
- in: query
type: "integer"
required: false
name: limit
description: limits the data returned in the response
- in: query
type: "string"
required: false
name: state
description: let's you specify in which state are you looking for that specific location
- in: query
type: "integer"
required: false
name: lev_distance
description: do a fuzzy search via a Levenshtein distance enabled finite-state transducer. The pre-filtered results are passed through a string-similarity evaluation algorithm and sorted by score
responses:
200:
description: OK
schema:
$ref: "#/definitions/matches"
examples:
application/json:
matches:
- encoding: "UN-LOCODE"
id: "ca:lod"
key: "UN-LOCODE-ca:lod"
words:
- "london"
- encoding: "UN-LOCODE"
id: "us:ldn"
key: "UN-LOCODE-us:ldn"
words:
- "london"
500:
$ref: '#/responses/InternalError'
/health:
get:
tags:
- private
summary: "Returns API's health status"
description: "Returns health status of the API and checks on dependent services"
produces:
- application/json
responses:
200:
description: "Successfully returns OK status with checks of dependent services"
schema:
$ref: "#/definitions/Health"
429:
description: "Services warming up or degraded (at least one check in WARNING or CRITICAL status)"
500:
$ref: "#/responses/InternalError"
responses:
NotFound:
description: "Resource not found"
InternalError:
description: "Failed to process the request due to an internal error"
definitions:
matches:
type: "array"
items:
$ref: "#/definitions/location_codes"
location_codes:
type: "object"
properties:
encoding:
type: "string"
id:
type: "string"
key:
type: "string"
words:
type: "array"
items:
type: "string"
subdiv:
type: "array"
items:
type: "string"
state:
type: "array"
items:
type: "string"
names:
type: "array"
items:
type: "string"
codes:
type: "array"
items:
type: "string"
Health:
type: object
properties:
status:
type: string
description: "The status of the API"
enum: ["OK", "WARNING", "CRITICAL"]
version:
type: object
properties:
build_time:
type: string
description: "The build date and time of the API"
example: "2020-06-11T12:49:20+01:00"
git_commit:
type: string
description: "The git commit hash of the API"
example: "7c2febbf2b818175112478d4ffbadbee1b654f63"
language:
type: string
description: "The programming language used to implement API"
example: "go"
language_version:
type: string
description: "The version of the programming language used to implement API"
example: "go1.14.3"
version:
type: string
description: "The version of API"
example: "1.0.0"
uptime:
type: string
description: "The uptime of API"
example: "34516"
start_time:
type: string
description: "The start date and time of API running"
example: "2020-06-11T11:49:21.520922Z"
checks:
type: array
items:
$ref: '#/definitions/HealthChecker'
HealthChecker:
type: object
properties:
name:
type: string
description: "The name of external service used by API"
enum: ["mongodb"]
status:
type: string
description: "The status of the external service"
enum: ["OK", "WARNING", "CRITICAL"]
message:
type: string
description: "The message status of the external service"
example: "mongodb is OK"
last_checked:
type: string
description: "The last health check date and time of the external service"
example: "2020-06-11T11:49:50.330089Z"
last_success:
type: string
description: "The last successful health check date and time of the external service"
example: "2020-06-11T11:49:50.330089Z"
last_failure:
type: string
description: "The last failed health check date and time of the external service"
example: "2019-09-22T11:48:51.0000001Z"