This repository has been archived by the owner on Mar 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yml
218 lines (211 loc) · 6.01 KB
/
swagger.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
# this is an example of the Uber API
# as a demonstration of an API spec in YAML
swagger: '2.0'
info:
title: SQL HTTP Bridge
description: |
SQL HTTP Bridge serves as an HTTP/JSON API based bridge between client
software and various relational database servers.
version: "1.0.0"
# the domain of the service
host: sql-json-bridge
# array of all schemes that your API supports
schemes:
- https
# will be prefixed to all paths
produces:
- application/json
paths:
#v1.0 Endpoints
/query:
options:
summary: Database Endpoint Options
description: |
The Database Endpoint Options endpoint will return all available
database endpoints, and information associated with them.
tags:
- Databases
responses:
200:
description: An array of available database endpoints.
schema:
type: array
items:
$ref: "#/definitions/DatabaseOption"
401:
description: Unauthorized to access this resource.
schema:
$ref: "#/definitions/Error"
default:
description: Unexpected Error
schema:
$ref: "#/definitions/Error"
post:
summary: Perform a Query
description: |
Perform an arbitrary query against a configured database. This
endpoint takes the database as part of the json body.
tags:
- Queries
responses:
200:
description: Database results
schema:
$ref: '#/definitions/ResultSet'
400:
description: Bad Request
schema:
$ref: "#/definitions/Error"
401:
description: Unauthorized to access SQL-HTTP-Bridge.
schema:
$ref: "#/definitions/Error"
403:
description: Forbidden to access this endpoint.
schema:
$ref: '#/definitions/Error'
422:
description: The Database Server could not process your query.
schema:
$ref: "#/definitions/Error"
default:
description: Unexpected Error
schema:
$ref: "#/definitions/Error"
# Legacy Endpoints
/list:
get:
summary: List Databases endpoint
description: |
List all configured and available database endpoints for use with
the /query/{database_name} endpoint.
tags:
- Databases
- Legacy
responses:
200:
description: An array of database names
schema:
$ref: "#/definitions/DatabaseList"
/query/{database_name}:
post:
summary: Query Endpoint
description: |
The Query endpoint accepts arbitrary SQL based queries, and returns
database results as json items, with keys as column headers.
parameters:
- name: database_name
in: path
description: Latitude component of location.
required: true
type: string
tags:
- Legacy
- Queries
responses:
200:
description: An array of database results
schema:
$ref: '#/definitions/ResultSet'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/update/{database_identifier}:
post:
summary: Query Endpoint
description: |
The Query endpoint accepts arbitrary SQL based queries, and returns
database results as json items, with keys as column headers.
parameters:
- name: database_identifier
in: path
description: Latitude component of location.
required: true
type: string
tags:
- Legacy
- Queries
responses:
200:
description: An array of database results
schema:
$ref: '#/definitions/ResultSet'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
DatabaseOption:
description: |
A database connection specification for a single configured
database.The specific details exposed will vary from driver
to driver, and can typically be hidden on an option by option
basis per database. endpoints will always be exposed.
type: object
properties:
identifier:
type: string
description: |
The identifier by which this particular database is known
to SQL-HTTP-Bridge. This identifier may be regex based, and
matching groups can be used in variables for configuration
properties.
endpoints:
description: |
An array of available endpoints for the spec
type: array
items:
type: object
properties:
endpoint_url:
type: string
endpoint_type:
type: string
options:
type: object
properties:
driver:
type: string
hostname:
type: string
username:
type: string
ResultSet:
type: object
properties:
result:
type: array
description: |
Array of result objects returned from a query. Each result
object will represent one row from the sql response.
items:
type: object
description: |
Result objects represent a single row in the result set. Keys
will be column names, values will be column data items.
rows_matched:
type: integer
description: Number of rows matched by select or update.
DatabaseList:
type: object
properties:
databases:
type: array
description: |
Array of available database endpoints for use with the /query
endpoint.
items:
type: string
description: database name
UnauthorizedError:
Error:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
fields:
type: string