-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi-doc.yaml
599 lines (573 loc) · 16.6 KB
/
api-doc.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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
openapi: 3.1.0
info:
title: Malloy Publisher - Semantic Model Serving API
description:
The Malloy Publisher - Semantic Model Serving API serves Malloy packages. A Malloy package is a directory of Malloy models (.malloy files),
Malloy notebooks (.malloynb files), and embedded datbases (.parque files) with a malloy-publisher.json manifest at the package's root directory.
For example, see the Malloy samples packages (https://github.com/malloydata/malloy-samples) repo.
version: v0
servers:
- url: /api/v0/
paths:
/about:
get:
tags:
- about:
operationId: about
summary:
Returns metadata about the publisher service.
responses:
200:
description:
Metadata about the publisher service.
content:
application/json:
schema:
$ref: "#/components/schemas/About"
401:
$ref: "#/components/responses/UnauthorizedError"
500:
$ref: "#/components/responses/InternalServerError"
/packages:
get:
tags:
- packages
operationId: list-packages
summary:
Returns a list of the Packages hosted on this server.
responses:
200:
description:
A list of the Packages names.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Package"
401:
$ref: "#/components/responses/UnauthorizedError"
500:
$ref: "#/components/responses/InternalServerError"
501:
$ref: "#/components/responses/NotImplementedError"
/packages/{name}:
get:
tags:
- packages
operationId: get-package
summary:
Returns the package metadata.
parameters:
- in: header
name: X-Version-Id
schema:
type: string
- name: name
in: path
description: Package name
required: true
schema:
type: string
responses:
200:
description:
Package metadata.
content:
application/json:
schema:
$ref: "#/components/schemas/Package"
401:
$ref: "#/components/responses/UnauthorizedError"
404:
$ref: "#/components/responses/NotFoundError"
500:
$ref: "#/components/responses/InternalServerError"
501:
$ref: "#/components/responses/NotImplementedError"
/packages/{name}/models:
get:
tags:
- models
operationId: list-models
summary:
Returns a list of relative paths to the models in the package.
parameters:
- in: header
name: X-Version-Id
schema:
type: string
- name: name
in: path
description: Name of package
required: true
schema:
type: string
responses:
200:
description:
A list of relative paths to the models in the package.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Model"
401:
$ref: "#/components/responses/UnauthorizedError"
404:
$ref: "#/components/responses/NotFoundError"
500:
$ref: "#/components/responses/InternalServerError"
501:
$ref: "#/components/responses/NotImplementedError"
/packages/{name}/models/{path}:
get:
tags:
- models
operationId: get-model
summary:
Returns a Malloy model.
parameters:
- name: X-Version-Id
in: header
schema:
type: string
- name: name
in: path
description: Name of package.
required: true
schema:
type: string
- name: path
in: path
description: Path to model wihin the package.
required: true
schema:
type: string
responses:
200:
description:
A Malloy model.
content:
"application/json":
schema:
$ref: "#/components/schemas/CompiledModel"
401:
$ref: "#/components/responses/UnauthorizedError"
404:
$ref: "#/components/responses/NotFoundError"
500:
$ref: "#/components/responses/InternalServerError"
501:
$ref: "#/components/responses/NotImplementedError"
/packages/{name}/queryResults/{path}:
get:
tags:
- queryresults
operationId: execute-query
summary:
Returns a query and its results.
parameters:
- name: X-Version-Id
in: header
schema:
type: string
- name: name
in: path
description: Name of package
required: true
schema:
type: string
- name: path
in: path
description: Path to model within the package.
required: true
schema:
type: string
- in: query
name: query
description:
Query string to execute on the model. If the query is paramter is set, the queryName parameter must be empty.
required: false
schema:
type: string
- in: query
name: sourceName
description: Name of the source in the model to use for queryName, search, and topValue requests.
required: false
schema:
type: string
- in: query
name: queryName
description: Name of a query to execute on a source in the model. Requires the sourceName parameter is set. If the queryName is paramter is set, the query parameter must be empty.
required: false
schema:
type: string
responses:
200:
description:
A query and its results.
content:
"application/json":
schema:
$ref: "#/components/schemas/QueryResult"
400:
$ref: "#/components/responses/BadRequestError"
401:
$ref: "#/components/responses/UnauthorizedError"
404:
$ref: "#/components/responses/NotFoundError"
500:
$ref: "#/components/responses/InternalServerError"
501:
$ref: "#/components/responses/NotImplementedError"
/packages/{name}/databases:
get:
tags:
- databases
operationId: list-databases
summary:
Returns a list of relative paths to the databases embedded in the package.
parameters:
- name: X-Version-Id
in: header
schema:
type: string
- name: name
in: path
description: Name of package
required: true
schema:
type: string
responses:
200:
description:
A list of relative paths to the databases embedded in the package.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Database"
401:
$ref: "#/components/responses/UnauthorizedError"
404:
$ref: "#/components/responses/NotFoundError"
500:
$ref: "#/components/responses/InternalServerError"
501:
$ref: "#/components/responses/NotImplementedError"
/packages/{name}/schedules:
get:
tags:
- schedules
operationId: list-schedules
summary:
Returns a list of running schedules.
parameters:
- name: X-Version-Id
in: header
schema:
type: string
- name: name
in: path
description: Name of package
required: true
schema:
type: string
responses:
200:
description:
A list of running schedules.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Schedule"
401:
$ref: "#/components/responses/UnauthorizedError"
404:
$ref: "#/components/responses/NotFoundError"
500:
$ref: "#/components/responses/InternalServerError"
501:
$ref: "#/components/responses/NotImplementedError"
components:
responses:
InternalServerError:
description: The server encountered an internal error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
NotFoundError:
description: The specified resource was not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
NotImplementedError:
description: Not implemented
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
UnauthorizedError:
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
BadRequestError:
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
schemas:
About:
type: object
properties:
readme:
type: string
description: Readme markdown.
Package:
type: object
properties:
name:
type: string
description: Package name.
description:
type: string
description: Package description.
Model:
type: object
description: Malloy model def and result data. Malloy model def and result data is Malloy version depdendent.
properties:
packageName:
type: string
description: Model's package Name
path:
type: string
description: Model's relative path in its package directory.
type:
type: string
enum: ["source", "notebook"]
description: Type of malloy model file -- source file or notebook file.
CompiledModel:
type: object
description: Malloy model def and result data. Malloy model def and result data is Malloy version depdendent.
properties:
packageName:
type: string
description: Model's package Name
path:
type: string
description: Model's relative path in its package directory.
type:
type: string
enum: ["source", "notebook"]
description: Type of malloy model file -- source file or notebook file.
malloyVersion:
type: string
description: Version of the Malloy compiler that generated the model def and results fields.
# Pass data styles as an opaque JSON string that is malloyVersion depdendent.
dataStyles:
type: string
description: Data style for rendering query results.
# Pass model def as an opaque JSON string that is malloyVersion depdendent.
modelDef:
type: string
description: Malloy model def.
sources:
type: array
description: Array of model sources.
items:
$ref: "#/components/schemas/Source"
queries:
type: array
descript: Array of named queries.
items:
$ref: "#/components/schemas/Query"
notebookCells:
type: array
description: Array of notebook cells.
items:
$ref: "#/components/schemas/NotebookCell"
Source:
type: object
description: Model source.
properties:
name:
type: string
description: Source's name.
annotations:
type: array
description: Annotations attached to source.
items:
type: string
views:
type: array
description: List of views in the source.\
items:
$ref: "#/components/schemas/View"
View:
type: object
description: Named model view.
properties:
name:
type: string
description: View's name.
annotations:
type: array
description: Annotations attached to view.
items:
type: string
Query:
type: object
description: Named model query.
properties:
name:
type: string
description: Query's name.
annotations:
type: array
description: Annotations attached to query.
items:
type: string
NotebookCell:
type: object
description: Notebook cell.
properties:
type:
type: string
enum: ["markdown", "code"]
description: Type of notebook cell.
text:
type: string
description: Text contents of the notebook cell.
queryName:
type: string
description: Name of query, if this is a named query. Otherwise, empty.
# Pass data styles as an opaque JSON string that is malloyVersion depdendent.
queryResult:
type: string
description: Malloy query results. Populated only if a code cell.
QueryResult:
type: object
description: A Malloy query's results, its model def, and its data styles.
properties:
# Pass data styles as an opaque JSON string that is malloyVersion depdendent.
dataStyles:
type: string
description: Data style for rendering query results.
# Pass model def as an opaque JSON string that is malloyVersion depdendent.
modelDef:
type: string
description: Malloy model def.
# Pass data styles as an opaque JSON string that is malloyVersion depdendent.
queryResult:
type: string
description: Malloy query results. Populated only if a code cell.
Database:
type: object
description: An in-memory DuckDB database embedded in the package.
properties:
path:
type: string
description: Database's relative path in its package directory.
size:
type: integer
description: Size of the embedded database in bytes.
Schedule:
type: object
description: A scheduled task.
properties:
resource:
type: string
description: Resource in the package that the schedule is attached to.
schedule:
type: string
description: Schedule (cron format) for executing task.
action:
type: string
description: Action to execute.
connection:
type: string
description: Connection to perform action on.
lastRunTime:
type: number
description: Timestamp in milliseconds of the last run.
lastRunStatus:
type: string
description: Status of the last run.
Connection:
type: object
properties:
name:
type: string
type:
type: string
enum: [postgres, bigquery, snowflake]
postgresConnection:
$ref: "#/components/schemas/PostgresConnection"
bigqueryConnection:
$ref: "#/components/schemas/BigqueryConnection"
snowflakeConnection:
$ref: "#/components/schemas/SnowflakeConnection"
PostgresConnection:
type: object
properties:
host:
type: string
port:
type: integer
databaseName:
type: string
userName:
type: string
password:
type: string
connectionString:
type: string
BigqueryConnection:
type: object
properties:
defaultProjectId:
type: string
billingProjectId:
type: string
location:
type: string
serviceAccountKeyJson:
type: string
maximumBytesBilled:
type: string
queryTimeoutMilliseconds:
type: string
SnowflakeConnection:
type: object
properties:
account:
type: string
username:
type: string
password:
type: string
warehouse:
type: string
database:
type: string
schema:
type: string
responseTimeoutMilliseconds:
type: integer
Error:
type: object
properties:
code:
type: string
message:
type: string