@lightdash/common 0.2198.4 → 0.2199.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/schemas/json/model-as-code-1.0.json +839 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/schemas/json/model-as-code-1.0.json +839 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/schemas/json/model-as-code-1.0.json +839 -0
- package/package.json +1 -1
|
@@ -0,0 +1,839 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://schemas.lightdash.com/lightdash/model-as-code.json",
|
|
4
|
+
"title": "Lightdash Model as Code",
|
|
5
|
+
"description": "Schema for defining Lightdash models in YAML format independent of dbt",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"oneOf": [
|
|
8
|
+
{
|
|
9
|
+
"description": "Model with SQL query source",
|
|
10
|
+
"allOf": [
|
|
11
|
+
{
|
|
12
|
+
"$ref": "#/definitions/BaseModel"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"from_sql": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "SQL query to use as the model source"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": ["from_sql"],
|
|
23
|
+
"not": {
|
|
24
|
+
"required": ["from_table"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"description": "Model with table reference source",
|
|
31
|
+
"allOf": [
|
|
32
|
+
{
|
|
33
|
+
"$ref": "#/definitions/BaseModel"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "object",
|
|
37
|
+
"properties": {
|
|
38
|
+
"from_table": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "Table reference to use as the model source"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": ["from_table"],
|
|
44
|
+
"not": {
|
|
45
|
+
"required": ["from_sql"]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"definitions": {
|
|
52
|
+
"BaseModel": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"required": ["type", "name", "dimensions"],
|
|
55
|
+
"properties": {
|
|
56
|
+
"type": {
|
|
57
|
+
"enum": ["model", "model/v1beta", "model/v1"],
|
|
58
|
+
"description": "Resource type identifier"
|
|
59
|
+
},
|
|
60
|
+
"name": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "Model name (must be unique)"
|
|
63
|
+
},
|
|
64
|
+
"label": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "Human-readable label for the model"
|
|
67
|
+
},
|
|
68
|
+
"description": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": "Detailed description of the model"
|
|
71
|
+
},
|
|
72
|
+
"primary_key": {
|
|
73
|
+
"oneOf": [
|
|
74
|
+
{
|
|
75
|
+
"type": "string"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "array",
|
|
79
|
+
"items": {
|
|
80
|
+
"type": "string"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"description": "Primary key column(s) for the model"
|
|
85
|
+
},
|
|
86
|
+
"order_fields_by": {
|
|
87
|
+
"enum": ["INDEX", "LABEL"],
|
|
88
|
+
"description": "Strategy for ordering fields in the UI"
|
|
89
|
+
},
|
|
90
|
+
"group_label": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "Group label for organizing models"
|
|
93
|
+
},
|
|
94
|
+
"sql_filter": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "SQL filter to apply to all queries"
|
|
97
|
+
},
|
|
98
|
+
"sql_where": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"description": "Alias for sql_filter"
|
|
101
|
+
},
|
|
102
|
+
"required_attributes": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"additionalProperties": {
|
|
105
|
+
"oneOf": [
|
|
106
|
+
{
|
|
107
|
+
"type": "string"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"type": "array",
|
|
111
|
+
"items": {
|
|
112
|
+
"type": "string"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
"description": "Required user attributes for accessing this model"
|
|
118
|
+
},
|
|
119
|
+
"group_details": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"additionalProperties": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"properties": {
|
|
124
|
+
"label": {
|
|
125
|
+
"type": "string"
|
|
126
|
+
},
|
|
127
|
+
"description": {
|
|
128
|
+
"type": "string"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"required": ["label"]
|
|
132
|
+
},
|
|
133
|
+
"description": "Metadata for field groups"
|
|
134
|
+
},
|
|
135
|
+
"sets": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"additionalProperties": {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"properties": {
|
|
140
|
+
"label": {
|
|
141
|
+
"type": "string"
|
|
142
|
+
},
|
|
143
|
+
"description": {
|
|
144
|
+
"type": "string"
|
|
145
|
+
},
|
|
146
|
+
"fields": {
|
|
147
|
+
"type": "array",
|
|
148
|
+
"items": {
|
|
149
|
+
"type": "string"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"description": "Named sets of fields for quick selection"
|
|
155
|
+
},
|
|
156
|
+
"spotlight": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"properties": {
|
|
159
|
+
"visibility": {
|
|
160
|
+
"enum": ["show", "hide"],
|
|
161
|
+
"description": "Default visibility in spotlight"
|
|
162
|
+
},
|
|
163
|
+
"categories": {
|
|
164
|
+
"type": "array",
|
|
165
|
+
"items": {
|
|
166
|
+
"type": "string"
|
|
167
|
+
},
|
|
168
|
+
"description": "Categories for organizing models"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"description": "Spotlight configuration for model discovery"
|
|
172
|
+
},
|
|
173
|
+
"default_time_dimension": {
|
|
174
|
+
"type": "object",
|
|
175
|
+
"required": ["field", "interval"],
|
|
176
|
+
"properties": {
|
|
177
|
+
"field": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"description": "Name of the time dimension field"
|
|
180
|
+
},
|
|
181
|
+
"interval": {
|
|
182
|
+
"$ref": "#/definitions/TimeInterval",
|
|
183
|
+
"description": "Default time interval for grouping"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"description": "Default time dimension for time-series queries"
|
|
187
|
+
},
|
|
188
|
+
"joins": {
|
|
189
|
+
"type": "array",
|
|
190
|
+
"items": {
|
|
191
|
+
"$ref": "#/definitions/Join"
|
|
192
|
+
},
|
|
193
|
+
"description": "Join relationships to other models"
|
|
194
|
+
},
|
|
195
|
+
"required_filters": {
|
|
196
|
+
"type": "array",
|
|
197
|
+
"items": {
|
|
198
|
+
"$ref": "#/definitions/Filter"
|
|
199
|
+
},
|
|
200
|
+
"description": "Filters that must be applied to all queries"
|
|
201
|
+
},
|
|
202
|
+
"default_filters": {
|
|
203
|
+
"type": "array",
|
|
204
|
+
"items": {
|
|
205
|
+
"$ref": "#/definitions/Filter"
|
|
206
|
+
},
|
|
207
|
+
"description": "Default filters (alias for required_filters)"
|
|
208
|
+
},
|
|
209
|
+
"metrics": {
|
|
210
|
+
"type": "object",
|
|
211
|
+
"additionalProperties": {
|
|
212
|
+
"$ref": "#/definitions/Metric"
|
|
213
|
+
},
|
|
214
|
+
"description": "Model-level metrics (not tied to a specific dimension)"
|
|
215
|
+
},
|
|
216
|
+
"explores": {
|
|
217
|
+
"type": "object",
|
|
218
|
+
"additionalProperties": {
|
|
219
|
+
"$ref": "#/definitions/Explore"
|
|
220
|
+
},
|
|
221
|
+
"description": "Additional explores based on this model"
|
|
222
|
+
},
|
|
223
|
+
"ai_hint": {
|
|
224
|
+
"oneOf": [
|
|
225
|
+
{
|
|
226
|
+
"type": "string"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"type": "array",
|
|
230
|
+
"items": {
|
|
231
|
+
"type": "string"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
],
|
|
235
|
+
"description": "Hints for AI-powered query generation"
|
|
236
|
+
},
|
|
237
|
+
"parameters": {
|
|
238
|
+
"type": "object",
|
|
239
|
+
"description": "Dynamic parameters for the model"
|
|
240
|
+
},
|
|
241
|
+
"dimensions": {
|
|
242
|
+
"type": "array",
|
|
243
|
+
"items": {
|
|
244
|
+
"$ref": "#/definitions/Dimension"
|
|
245
|
+
},
|
|
246
|
+
"description": "Column definitions (required)"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"Dimension": {
|
|
251
|
+
"type": "object",
|
|
252
|
+
"required": ["name", "type"],
|
|
253
|
+
"properties": {
|
|
254
|
+
"name": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"description": "Dimension name (column name)"
|
|
257
|
+
},
|
|
258
|
+
"type": {
|
|
259
|
+
"enum": [
|
|
260
|
+
"string",
|
|
261
|
+
"number",
|
|
262
|
+
"timestamp",
|
|
263
|
+
"date",
|
|
264
|
+
"boolean"
|
|
265
|
+
],
|
|
266
|
+
"description": "Data type of the dimension"
|
|
267
|
+
},
|
|
268
|
+
"label": {
|
|
269
|
+
"type": "string",
|
|
270
|
+
"description": "Human-readable label"
|
|
271
|
+
},
|
|
272
|
+
"description": {
|
|
273
|
+
"type": "string",
|
|
274
|
+
"description": "Detailed description"
|
|
275
|
+
},
|
|
276
|
+
"sql": {
|
|
277
|
+
"type": "string",
|
|
278
|
+
"description": "Custom SQL expression for this dimension"
|
|
279
|
+
},
|
|
280
|
+
"time_intervals": {
|
|
281
|
+
"oneOf": [
|
|
282
|
+
{
|
|
283
|
+
"type": "array",
|
|
284
|
+
"items": {
|
|
285
|
+
"$ref": "#/definitions/TimeInterval"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"enum": ["OFF", "default", false, true]
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"description": "Time intervals to generate for timestamp/date dimensions"
|
|
293
|
+
},
|
|
294
|
+
"hidden": {
|
|
295
|
+
"type": "boolean",
|
|
296
|
+
"description": "Hide this dimension from the UI"
|
|
297
|
+
},
|
|
298
|
+
"round": {
|
|
299
|
+
"type": "number",
|
|
300
|
+
"description": "Number of decimal places to round to"
|
|
301
|
+
},
|
|
302
|
+
"format": {
|
|
303
|
+
"type": "string",
|
|
304
|
+
"description": "Format string for displaying values"
|
|
305
|
+
},
|
|
306
|
+
"group_label": {
|
|
307
|
+
"type": "string",
|
|
308
|
+
"description": "Group this dimension belongs to"
|
|
309
|
+
},
|
|
310
|
+
"groups": {
|
|
311
|
+
"oneOf": [
|
|
312
|
+
{
|
|
313
|
+
"type": "string"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"type": "array",
|
|
317
|
+
"items": {
|
|
318
|
+
"type": "string"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"description": "Groups this dimension belongs to"
|
|
323
|
+
},
|
|
324
|
+
"colors": {
|
|
325
|
+
"type": "object",
|
|
326
|
+
"additionalProperties": {
|
|
327
|
+
"type": "string"
|
|
328
|
+
},
|
|
329
|
+
"description": "Color mapping for dimension values"
|
|
330
|
+
},
|
|
331
|
+
"urls": {
|
|
332
|
+
"type": "array",
|
|
333
|
+
"items": {
|
|
334
|
+
"type": "object",
|
|
335
|
+
"required": ["url", "label"],
|
|
336
|
+
"properties": {
|
|
337
|
+
"url": {
|
|
338
|
+
"type": "string"
|
|
339
|
+
},
|
|
340
|
+
"label": {
|
|
341
|
+
"type": "string"
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
"description": "URL templates for dimension values"
|
|
346
|
+
},
|
|
347
|
+
"required_attributes": {
|
|
348
|
+
"type": "object",
|
|
349
|
+
"additionalProperties": {
|
|
350
|
+
"oneOf": [
|
|
351
|
+
{
|
|
352
|
+
"type": "string"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"type": "array",
|
|
356
|
+
"items": {
|
|
357
|
+
"type": "string"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
]
|
|
361
|
+
},
|
|
362
|
+
"description": "Required user attributes for accessing this dimension"
|
|
363
|
+
},
|
|
364
|
+
"ai_hint": {
|
|
365
|
+
"oneOf": [
|
|
366
|
+
{
|
|
367
|
+
"type": "string"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"type": "array",
|
|
371
|
+
"items": {
|
|
372
|
+
"type": "string"
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
"description": "Hints for AI-powered query generation"
|
|
377
|
+
},
|
|
378
|
+
"tags": {
|
|
379
|
+
"oneOf": [
|
|
380
|
+
{
|
|
381
|
+
"type": "string"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"type": "array",
|
|
385
|
+
"items": {
|
|
386
|
+
"type": "string"
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
],
|
|
390
|
+
"description": "Tags for organizing and filtering dimensions"
|
|
391
|
+
},
|
|
392
|
+
"compact": {
|
|
393
|
+
"enum": [
|
|
394
|
+
"thousands",
|
|
395
|
+
"thousand",
|
|
396
|
+
"K",
|
|
397
|
+
"millions",
|
|
398
|
+
"million",
|
|
399
|
+
"M",
|
|
400
|
+
"billions",
|
|
401
|
+
"billion",
|
|
402
|
+
"B",
|
|
403
|
+
"trillions",
|
|
404
|
+
"trillion",
|
|
405
|
+
"T",
|
|
406
|
+
"kilobytes",
|
|
407
|
+
"kilobyte",
|
|
408
|
+
"KB",
|
|
409
|
+
"KiB",
|
|
410
|
+
"kibibytes",
|
|
411
|
+
"kibibyte",
|
|
412
|
+
"megabytes",
|
|
413
|
+
"megabyte",
|
|
414
|
+
"MB",
|
|
415
|
+
"MiB",
|
|
416
|
+
"mebibytes",
|
|
417
|
+
"mebibyte",
|
|
418
|
+
"gigabytes",
|
|
419
|
+
"gigabyte",
|
|
420
|
+
"GB",
|
|
421
|
+
"GiB",
|
|
422
|
+
"gibibytes",
|
|
423
|
+
"gibibyte",
|
|
424
|
+
"terabytes",
|
|
425
|
+
"terabyte",
|
|
426
|
+
"TB",
|
|
427
|
+
"TiB",
|
|
428
|
+
"tebibytes",
|
|
429
|
+
"tebibyte",
|
|
430
|
+
"petabytes",
|
|
431
|
+
"petabyte",
|
|
432
|
+
"PB",
|
|
433
|
+
"PiB",
|
|
434
|
+
"pebibytes",
|
|
435
|
+
"pebibyte"
|
|
436
|
+
],
|
|
437
|
+
"description": "Compact number format"
|
|
438
|
+
},
|
|
439
|
+
"metrics": {
|
|
440
|
+
"type": "object",
|
|
441
|
+
"additionalProperties": {
|
|
442
|
+
"$ref": "#/definitions/Metric"
|
|
443
|
+
},
|
|
444
|
+
"description": "Metrics derived from this dimension"
|
|
445
|
+
},
|
|
446
|
+
"additional_dimensions": {
|
|
447
|
+
"type": "object",
|
|
448
|
+
"additionalProperties": {
|
|
449
|
+
"$ref": "#/definitions/AdditionalDimension"
|
|
450
|
+
},
|
|
451
|
+
"description": "Additional dimensions derived from this dimension"
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
"Metric": {
|
|
456
|
+
"type": "object",
|
|
457
|
+
"required": ["type"],
|
|
458
|
+
"properties": {
|
|
459
|
+
"type": {
|
|
460
|
+
"enum": [
|
|
461
|
+
"count",
|
|
462
|
+
"count_distinct",
|
|
463
|
+
"sum",
|
|
464
|
+
"average",
|
|
465
|
+
"min",
|
|
466
|
+
"max",
|
|
467
|
+
"number",
|
|
468
|
+
"string",
|
|
469
|
+
"date",
|
|
470
|
+
"timestamp",
|
|
471
|
+
"boolean",
|
|
472
|
+
"percentile",
|
|
473
|
+
"median",
|
|
474
|
+
"percent_of_previous",
|
|
475
|
+
"percent_of_total",
|
|
476
|
+
"running_total"
|
|
477
|
+
],
|
|
478
|
+
"description": "Metric aggregation type"
|
|
479
|
+
},
|
|
480
|
+
"label": {
|
|
481
|
+
"type": "string",
|
|
482
|
+
"description": "Human-readable label"
|
|
483
|
+
},
|
|
484
|
+
"description": {
|
|
485
|
+
"type": "string",
|
|
486
|
+
"description": "Detailed description"
|
|
487
|
+
},
|
|
488
|
+
"sql": {
|
|
489
|
+
"type": "string",
|
|
490
|
+
"description": "Custom SQL expression for this metric"
|
|
491
|
+
},
|
|
492
|
+
"round": {
|
|
493
|
+
"type": "number",
|
|
494
|
+
"description": "Number of decimal places to round to"
|
|
495
|
+
},
|
|
496
|
+
"format": {
|
|
497
|
+
"type": "string",
|
|
498
|
+
"description": "Format string for displaying values"
|
|
499
|
+
},
|
|
500
|
+
"hidden": {
|
|
501
|
+
"type": "boolean",
|
|
502
|
+
"description": "Hide this metric from the UI"
|
|
503
|
+
},
|
|
504
|
+
"filters": {
|
|
505
|
+
"type": "array",
|
|
506
|
+
"items": {
|
|
507
|
+
"$ref": "#/definitions/Filter"
|
|
508
|
+
},
|
|
509
|
+
"description": "Filters to apply when calculating this metric"
|
|
510
|
+
},
|
|
511
|
+
"percentile": {
|
|
512
|
+
"type": "number",
|
|
513
|
+
"description": "Percentile value (for percentile metrics)"
|
|
514
|
+
},
|
|
515
|
+
"show_underlying_values": {
|
|
516
|
+
"type": "array",
|
|
517
|
+
"items": {
|
|
518
|
+
"type": "string"
|
|
519
|
+
},
|
|
520
|
+
"description": "Fields to show when drilling into metric values"
|
|
521
|
+
},
|
|
522
|
+
"compact": {
|
|
523
|
+
"enum": [
|
|
524
|
+
"thousands",
|
|
525
|
+
"thousand",
|
|
526
|
+
"K",
|
|
527
|
+
"millions",
|
|
528
|
+
"million",
|
|
529
|
+
"M",
|
|
530
|
+
"billions",
|
|
531
|
+
"billion",
|
|
532
|
+
"B",
|
|
533
|
+
"trillions",
|
|
534
|
+
"trillion",
|
|
535
|
+
"T",
|
|
536
|
+
"kilobytes",
|
|
537
|
+
"kilobyte",
|
|
538
|
+
"KB",
|
|
539
|
+
"KiB",
|
|
540
|
+
"kibibytes",
|
|
541
|
+
"kibibyte",
|
|
542
|
+
"megabytes",
|
|
543
|
+
"megabyte",
|
|
544
|
+
"MB",
|
|
545
|
+
"MiB",
|
|
546
|
+
"mebibytes",
|
|
547
|
+
"mebibyte",
|
|
548
|
+
"gigabytes",
|
|
549
|
+
"gigabyte",
|
|
550
|
+
"GB",
|
|
551
|
+
"GiB",
|
|
552
|
+
"gibibytes",
|
|
553
|
+
"gibibyte",
|
|
554
|
+
"terabytes",
|
|
555
|
+
"terabyte",
|
|
556
|
+
"TB",
|
|
557
|
+
"TiB",
|
|
558
|
+
"tebibytes",
|
|
559
|
+
"tebibyte",
|
|
560
|
+
"petabytes",
|
|
561
|
+
"petabyte",
|
|
562
|
+
"PB",
|
|
563
|
+
"PiB",
|
|
564
|
+
"pebibytes",
|
|
565
|
+
"pebibyte"
|
|
566
|
+
],
|
|
567
|
+
"description": "Compact number format"
|
|
568
|
+
},
|
|
569
|
+
"group_label": {
|
|
570
|
+
"type": "string",
|
|
571
|
+
"description": "Group this metric belongs to"
|
|
572
|
+
},
|
|
573
|
+
"urls": {
|
|
574
|
+
"type": "array",
|
|
575
|
+
"items": {
|
|
576
|
+
"type": "object",
|
|
577
|
+
"required": ["url", "label"],
|
|
578
|
+
"properties": {
|
|
579
|
+
"url": {
|
|
580
|
+
"type": "string"
|
|
581
|
+
},
|
|
582
|
+
"label": {
|
|
583
|
+
"type": "string"
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
"description": "URL templates for metric values"
|
|
588
|
+
},
|
|
589
|
+
"required_attributes": {
|
|
590
|
+
"type": "object",
|
|
591
|
+
"additionalProperties": {
|
|
592
|
+
"oneOf": [
|
|
593
|
+
{
|
|
594
|
+
"type": "string"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"type": "array",
|
|
598
|
+
"items": {
|
|
599
|
+
"type": "string"
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
]
|
|
603
|
+
},
|
|
604
|
+
"description": "Required user attributes for accessing this metric"
|
|
605
|
+
},
|
|
606
|
+
"ai_hint": {
|
|
607
|
+
"oneOf": [
|
|
608
|
+
{
|
|
609
|
+
"type": "string"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
"type": "array",
|
|
613
|
+
"items": {
|
|
614
|
+
"type": "string"
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
],
|
|
618
|
+
"description": "Hints for AI-powered query generation"
|
|
619
|
+
},
|
|
620
|
+
"tags": {
|
|
621
|
+
"oneOf": [
|
|
622
|
+
{
|
|
623
|
+
"type": "string"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
"type": "array",
|
|
627
|
+
"items": {
|
|
628
|
+
"type": "string"
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
],
|
|
632
|
+
"description": "Tags for organizing and filtering metrics"
|
|
633
|
+
},
|
|
634
|
+
"default_time_dimension": {
|
|
635
|
+
"type": "object",
|
|
636
|
+
"required": ["field", "interval"],
|
|
637
|
+
"properties": {
|
|
638
|
+
"field": {
|
|
639
|
+
"type": "string"
|
|
640
|
+
},
|
|
641
|
+
"interval": {
|
|
642
|
+
"$ref": "#/definitions/TimeInterval"
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
"description": "Default time dimension for this metric"
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
"AdditionalDimension": {
|
|
650
|
+
"type": "object",
|
|
651
|
+
"required": ["type", "sql"],
|
|
652
|
+
"properties": {
|
|
653
|
+
"type": {
|
|
654
|
+
"enum": [
|
|
655
|
+
"string",
|
|
656
|
+
"number",
|
|
657
|
+
"timestamp",
|
|
658
|
+
"date",
|
|
659
|
+
"boolean"
|
|
660
|
+
],
|
|
661
|
+
"description": "Data type of the additional dimension"
|
|
662
|
+
},
|
|
663
|
+
"sql": {
|
|
664
|
+
"type": "string",
|
|
665
|
+
"description": "SQL expression for this dimension"
|
|
666
|
+
},
|
|
667
|
+
"label": {
|
|
668
|
+
"type": "string",
|
|
669
|
+
"description": "Human-readable label"
|
|
670
|
+
},
|
|
671
|
+
"description": {
|
|
672
|
+
"type": "string",
|
|
673
|
+
"description": "Detailed description"
|
|
674
|
+
},
|
|
675
|
+
"hidden": {
|
|
676
|
+
"type": "boolean",
|
|
677
|
+
"description": "Hide this dimension from the UI"
|
|
678
|
+
},
|
|
679
|
+
"round": {
|
|
680
|
+
"type": "number",
|
|
681
|
+
"description": "Number of decimal places to round to"
|
|
682
|
+
},
|
|
683
|
+
"format": {
|
|
684
|
+
"type": "string",
|
|
685
|
+
"description": "Format string for displaying values"
|
|
686
|
+
},
|
|
687
|
+
"group_label": {
|
|
688
|
+
"type": "string",
|
|
689
|
+
"description": "Group this dimension belongs to"
|
|
690
|
+
},
|
|
691
|
+
"colors": {
|
|
692
|
+
"type": "object",
|
|
693
|
+
"additionalProperties": {
|
|
694
|
+
"type": "string"
|
|
695
|
+
},
|
|
696
|
+
"description": "Color mapping for dimension values"
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
"Join": {
|
|
701
|
+
"type": "object",
|
|
702
|
+
"required": ["join", "sql_on"],
|
|
703
|
+
"properties": {
|
|
704
|
+
"join": {
|
|
705
|
+
"type": "string",
|
|
706
|
+
"description": "Name of the model to join"
|
|
707
|
+
},
|
|
708
|
+
"sql_on": {
|
|
709
|
+
"type": "string",
|
|
710
|
+
"description": "SQL join condition"
|
|
711
|
+
},
|
|
712
|
+
"alias": {
|
|
713
|
+
"type": "string",
|
|
714
|
+
"description": "Alias for the joined model"
|
|
715
|
+
},
|
|
716
|
+
"label": {
|
|
717
|
+
"type": "string",
|
|
718
|
+
"description": "Human-readable label for the join"
|
|
719
|
+
},
|
|
720
|
+
"type": {
|
|
721
|
+
"enum": ["inner", "left", "right", "full"],
|
|
722
|
+
"description": "Type of SQL join"
|
|
723
|
+
},
|
|
724
|
+
"hidden": {
|
|
725
|
+
"type": "boolean",
|
|
726
|
+
"description": "Hide this join from the UI"
|
|
727
|
+
},
|
|
728
|
+
"fields": {
|
|
729
|
+
"type": "array",
|
|
730
|
+
"items": {
|
|
731
|
+
"type": "string"
|
|
732
|
+
},
|
|
733
|
+
"description": "Specific fields to include from the joined model"
|
|
734
|
+
},
|
|
735
|
+
"always": {
|
|
736
|
+
"type": "boolean",
|
|
737
|
+
"description": "Always include this join in queries"
|
|
738
|
+
},
|
|
739
|
+
"relationship": {
|
|
740
|
+
"enum": [
|
|
741
|
+
"one-to-one",
|
|
742
|
+
"one-to-many",
|
|
743
|
+
"many-to-one",
|
|
744
|
+
"many-to-many"
|
|
745
|
+
],
|
|
746
|
+
"description": "Relationship cardinality"
|
|
747
|
+
},
|
|
748
|
+
"primary_key": {
|
|
749
|
+
"oneOf": [
|
|
750
|
+
{
|
|
751
|
+
"type": "string"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
"type": "array",
|
|
755
|
+
"items": {
|
|
756
|
+
"type": "string"
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
],
|
|
760
|
+
"description": "Primary key of the joined model"
|
|
761
|
+
},
|
|
762
|
+
"description": {
|
|
763
|
+
"type": "string",
|
|
764
|
+
"description": "Detailed description of the join"
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
"Filter": {
|
|
769
|
+
"type": "object",
|
|
770
|
+
"additionalProperties": true,
|
|
771
|
+
"description": "Filter condition (field: value or field: [values])"
|
|
772
|
+
},
|
|
773
|
+
"Explore": {
|
|
774
|
+
"type": "object",
|
|
775
|
+
"properties": {
|
|
776
|
+
"label": {
|
|
777
|
+
"type": "string",
|
|
778
|
+
"description": "Human-readable label for the explore"
|
|
779
|
+
},
|
|
780
|
+
"description": {
|
|
781
|
+
"type": "string",
|
|
782
|
+
"description": "Detailed description of the explore"
|
|
783
|
+
},
|
|
784
|
+
"group_label": {
|
|
785
|
+
"type": "string",
|
|
786
|
+
"description": "Group this explore belongs to"
|
|
787
|
+
},
|
|
788
|
+
"joins": {
|
|
789
|
+
"type": "array",
|
|
790
|
+
"items": {
|
|
791
|
+
"$ref": "#/definitions/Join"
|
|
792
|
+
},
|
|
793
|
+
"description": "Additional joins for this explore"
|
|
794
|
+
},
|
|
795
|
+
"required_filters": {
|
|
796
|
+
"type": "array",
|
|
797
|
+
"items": {
|
|
798
|
+
"$ref": "#/definitions/Filter"
|
|
799
|
+
},
|
|
800
|
+
"description": "Filters required for this explore"
|
|
801
|
+
},
|
|
802
|
+
"default_filters": {
|
|
803
|
+
"type": "array",
|
|
804
|
+
"items": {
|
|
805
|
+
"$ref": "#/definitions/Filter"
|
|
806
|
+
},
|
|
807
|
+
"description": "Default filters for this explore"
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
},
|
|
811
|
+
"TimeInterval": {
|
|
812
|
+
"enum": [
|
|
813
|
+
"RAW",
|
|
814
|
+
"YEAR",
|
|
815
|
+
"QUARTER",
|
|
816
|
+
"MONTH",
|
|
817
|
+
"WEEK",
|
|
818
|
+
"DAY",
|
|
819
|
+
"HOUR",
|
|
820
|
+
"MINUTE",
|
|
821
|
+
"SECOND",
|
|
822
|
+
"MILLISECOND",
|
|
823
|
+
"YEAR_NUM",
|
|
824
|
+
"QUARTER_NUM",
|
|
825
|
+
"MONTH_NUM",
|
|
826
|
+
"WEEK_NUM",
|
|
827
|
+
"DAY_OF_YEAR_NUM",
|
|
828
|
+
"DAY_OF_MONTH_NUM",
|
|
829
|
+
"DAY_OF_WEEK_INDEX",
|
|
830
|
+
"HOUR_OF_DAY_NUM",
|
|
831
|
+
"MINUTE_OF_HOUR_NUM",
|
|
832
|
+
"QUARTER_NAME",
|
|
833
|
+
"MONTH_NAME",
|
|
834
|
+
"DAY_OF_WEEK_NAME"
|
|
835
|
+
],
|
|
836
|
+
"description": "Time interval for grouping time dimensions"
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|