@lightdash/common 0.2072.0 → 0.2073.0
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/schemas/json/chart-as-code-1.0.json +436 -0
- package/dist/cjs/schemas/json/dashboard-as-code-1.0.json +349 -0
- package/dist/esm/schemas/json/chart-as-code-1.0.json +436 -0
- package/dist/esm/schemas/json/dashboard-as-code-1.0.json +349 -0
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -0,0 +1,436 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
3
|
+
"$id": "https://schemas.lightdash.com/lightdash/chart-as-code.json",
|
4
|
+
"title": "Lightdash Chart as Code",
|
5
|
+
"description": "Schema for defining Lightdash charts in YAML format for version control",
|
6
|
+
"type": "object",
|
7
|
+
"required": [
|
8
|
+
"name",
|
9
|
+
"tableName",
|
10
|
+
"metricQuery",
|
11
|
+
"slug",
|
12
|
+
"spaceSlug",
|
13
|
+
"version"
|
14
|
+
],
|
15
|
+
"properties": {
|
16
|
+
"version": {
|
17
|
+
"type": "number",
|
18
|
+
"description": "Schema version for this chart configuration",
|
19
|
+
"const": 1
|
20
|
+
},
|
21
|
+
"name": {
|
22
|
+
"type": "string",
|
23
|
+
"description": "Display name of the chart",
|
24
|
+
"minLength": 1
|
25
|
+
},
|
26
|
+
"description": {
|
27
|
+
"type": "string",
|
28
|
+
"description": "Optional description of what this chart displays"
|
29
|
+
},
|
30
|
+
"slug": {
|
31
|
+
"type": "string",
|
32
|
+
"description": "Unique identifier slug for this chart",
|
33
|
+
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
|
34
|
+
},
|
35
|
+
"spaceSlug": {
|
36
|
+
"type": "string",
|
37
|
+
"description": "Path to the space containing this chart (e.g., 'sales/reports' or 'marketing')"
|
38
|
+
},
|
39
|
+
"tableName": {
|
40
|
+
"type": "string",
|
41
|
+
"description": "The explore/table name this chart queries from"
|
42
|
+
},
|
43
|
+
"dashboardSlug": {
|
44
|
+
"type": ["string", "null"],
|
45
|
+
"description": "Optional dashboard slug if this chart is saved within a dashboard",
|
46
|
+
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
|
47
|
+
},
|
48
|
+
"updatedAt": {
|
49
|
+
"type": "string",
|
50
|
+
"format": "date-time",
|
51
|
+
"description": "Timestamp when the chart was last updated (readonly)"
|
52
|
+
},
|
53
|
+
"downloadedAt": {
|
54
|
+
"type": "string",
|
55
|
+
"format": "date-time",
|
56
|
+
"description": "Timestamp when this chart was downloaded from Lightdash (readonly)"
|
57
|
+
},
|
58
|
+
"metricQuery": {
|
59
|
+
"type": "object",
|
60
|
+
"description": "The query configuration defining what data to fetch",
|
61
|
+
"required": ["exploreName"],
|
62
|
+
"properties": {
|
63
|
+
"exploreName": {
|
64
|
+
"type": "string",
|
65
|
+
"description": "The name of the explore to query"
|
66
|
+
},
|
67
|
+
"dimensions": {
|
68
|
+
"type": "array",
|
69
|
+
"description": "List of dimension field IDs to include",
|
70
|
+
"items": {
|
71
|
+
"type": "string"
|
72
|
+
}
|
73
|
+
},
|
74
|
+
"metrics": {
|
75
|
+
"type": "array",
|
76
|
+
"description": "List of metric field IDs to include",
|
77
|
+
"items": {
|
78
|
+
"type": "string"
|
79
|
+
}
|
80
|
+
},
|
81
|
+
"filters": {
|
82
|
+
"type": "object",
|
83
|
+
"description": "Filter rules to apply to the query using 'and'/'or' filter groups",
|
84
|
+
"properties": {
|
85
|
+
"dimensions": {
|
86
|
+
"type": "object",
|
87
|
+
"description": "Dimension filter group",
|
88
|
+
"properties": {
|
89
|
+
"and": {
|
90
|
+
"type": "array",
|
91
|
+
"description": "Array of filters combined with AND logic",
|
92
|
+
"items": {
|
93
|
+
"type": "object",
|
94
|
+
"required": ["target", "operator"],
|
95
|
+
"properties": {
|
96
|
+
"target": {
|
97
|
+
"type": "object",
|
98
|
+
"required": ["fieldId"],
|
99
|
+
"properties": {
|
100
|
+
"fieldId": {
|
101
|
+
"type": "string",
|
102
|
+
"description": "Field ID to filter on"
|
103
|
+
}
|
104
|
+
}
|
105
|
+
},
|
106
|
+
"operator": {
|
107
|
+
"type": "string",
|
108
|
+
"description": "Filter operator",
|
109
|
+
"enum": [
|
110
|
+
"equals",
|
111
|
+
"notEquals",
|
112
|
+
"isNull",
|
113
|
+
"notNull",
|
114
|
+
"startsWith",
|
115
|
+
"endsWith",
|
116
|
+
"include",
|
117
|
+
"doesNotInclude",
|
118
|
+
"lessThan",
|
119
|
+
"lessThanOrEqual",
|
120
|
+
"greaterThan",
|
121
|
+
"greaterThanOrEqual",
|
122
|
+
"inThePast",
|
123
|
+
"notInThePast",
|
124
|
+
"inTheNext",
|
125
|
+
"inTheCurrent",
|
126
|
+
"notInTheCurrent",
|
127
|
+
"inBetween",
|
128
|
+
"notInBetween"
|
129
|
+
]
|
130
|
+
},
|
131
|
+
"values": {
|
132
|
+
"type": "array",
|
133
|
+
"description": "Values to filter by"
|
134
|
+
},
|
135
|
+
"required": {
|
136
|
+
"type": "boolean",
|
137
|
+
"description": "Whether this filter is required"
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
},
|
142
|
+
"or": {
|
143
|
+
"type": "array",
|
144
|
+
"description": "Array of filters combined with OR logic",
|
145
|
+
"items": {
|
146
|
+
"$ref": "#/properties/metricQuery/properties/filters/properties/dimensions/properties/and/items"
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
},
|
151
|
+
"metrics": {
|
152
|
+
"type": "object",
|
153
|
+
"description": "Metric filter group",
|
154
|
+
"properties": {
|
155
|
+
"and": {
|
156
|
+
"$ref": "#/properties/metricQuery/properties/filters/properties/dimensions/properties/and"
|
157
|
+
},
|
158
|
+
"or": {
|
159
|
+
"$ref": "#/properties/metricQuery/properties/filters/properties/dimensions/properties/or"
|
160
|
+
}
|
161
|
+
}
|
162
|
+
},
|
163
|
+
"tableCalculations": {
|
164
|
+
"type": "object",
|
165
|
+
"description": "Table calculation filter group",
|
166
|
+
"properties": {
|
167
|
+
"and": {
|
168
|
+
"$ref": "#/properties/metricQuery/properties/filters/properties/dimensions/properties/and"
|
169
|
+
},
|
170
|
+
"or": {
|
171
|
+
"$ref": "#/properties/metricQuery/properties/filters/properties/dimensions/properties/or"
|
172
|
+
}
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
},
|
177
|
+
"sorts": {
|
178
|
+
"type": "array",
|
179
|
+
"description": "Sort configuration for query results",
|
180
|
+
"items": {
|
181
|
+
"type": "object",
|
182
|
+
"required": ["fieldId", "descending"],
|
183
|
+
"properties": {
|
184
|
+
"fieldId": {
|
185
|
+
"type": "string",
|
186
|
+
"description": "Field ID to sort by"
|
187
|
+
},
|
188
|
+
"descending": {
|
189
|
+
"type": "boolean",
|
190
|
+
"description": "Sort in descending order"
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
},
|
195
|
+
"limit": {
|
196
|
+
"type": "number",
|
197
|
+
"description": "Maximum number of rows to return",
|
198
|
+
"minimum": 1
|
199
|
+
},
|
200
|
+
"metricOverrides": {
|
201
|
+
"type": "object",
|
202
|
+
"description": "Override formatting and display options for existing metrics",
|
203
|
+
"additionalProperties": {
|
204
|
+
"type": "object",
|
205
|
+
"properties": {
|
206
|
+
"formatOptions": {
|
207
|
+
"type": "object",
|
208
|
+
"description": "Formatting configuration for the metric",
|
209
|
+
"properties": {
|
210
|
+
"type": {
|
211
|
+
"type": "string",
|
212
|
+
"enum": [
|
213
|
+
"default",
|
214
|
+
"currency",
|
215
|
+
"number",
|
216
|
+
"percent"
|
217
|
+
],
|
218
|
+
"description": "Format type"
|
219
|
+
},
|
220
|
+
"round": {
|
221
|
+
"type": "number",
|
222
|
+
"description": "Number of decimal places"
|
223
|
+
},
|
224
|
+
"currency": {
|
225
|
+
"type": "string",
|
226
|
+
"description": "Currency code (e.g., USD, GBP, EUR)"
|
227
|
+
},
|
228
|
+
"separator": {
|
229
|
+
"type": "string",
|
230
|
+
"enum": [
|
231
|
+
"default",
|
232
|
+
"commaPeriod",
|
233
|
+
"spacePeriod",
|
234
|
+
"periodComma",
|
235
|
+
"spaceComma"
|
236
|
+
],
|
237
|
+
"description": "Thousands separator style"
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
}
|
242
|
+
}
|
243
|
+
},
|
244
|
+
"tableCalculations": {
|
245
|
+
"type": "array",
|
246
|
+
"description": "Custom calculations to perform on query results (like window functions)",
|
247
|
+
"items": {
|
248
|
+
"type": "object",
|
249
|
+
"required": ["name", "displayName", "sql"],
|
250
|
+
"properties": {
|
251
|
+
"name": {
|
252
|
+
"type": "string",
|
253
|
+
"description": "Internal name of the table calculation"
|
254
|
+
},
|
255
|
+
"displayName": {
|
256
|
+
"type": "string",
|
257
|
+
"description": "Display name shown in the UI"
|
258
|
+
},
|
259
|
+
"sql": {
|
260
|
+
"type": "string",
|
261
|
+
"description": "SQL expression for the calculation (can reference fields with ${table.field})"
|
262
|
+
},
|
263
|
+
"type": {
|
264
|
+
"type": "string",
|
265
|
+
"enum": ["string", "number", "date", "boolean"],
|
266
|
+
"description": "Data type of the calculation result"
|
267
|
+
},
|
268
|
+
"format": {
|
269
|
+
"type": "object",
|
270
|
+
"description": "Formatting options for the calculation",
|
271
|
+
"properties": {
|
272
|
+
"type": {
|
273
|
+
"type": "string",
|
274
|
+
"enum": [
|
275
|
+
"default",
|
276
|
+
"currency",
|
277
|
+
"number",
|
278
|
+
"percent"
|
279
|
+
],
|
280
|
+
"description": "Format type"
|
281
|
+
},
|
282
|
+
"round": {
|
283
|
+
"type": "number",
|
284
|
+
"description": "Number of decimal places"
|
285
|
+
},
|
286
|
+
"currency": {
|
287
|
+
"type": "string",
|
288
|
+
"description": "Currency code (e.g., USD, GBP, EUR)"
|
289
|
+
},
|
290
|
+
"separator": {
|
291
|
+
"type": "string",
|
292
|
+
"enum": [
|
293
|
+
"default",
|
294
|
+
"commaPeriod",
|
295
|
+
"spacePeriod",
|
296
|
+
"periodComma",
|
297
|
+
"spaceComma"
|
298
|
+
]
|
299
|
+
}
|
300
|
+
}
|
301
|
+
}
|
302
|
+
}
|
303
|
+
}
|
304
|
+
},
|
305
|
+
"additionalMetrics": {
|
306
|
+
"type": "array",
|
307
|
+
"description": "Custom metrics defined inline (ad-hoc metrics not in the dbt model)",
|
308
|
+
"items": {
|
309
|
+
"type": "object",
|
310
|
+
"required": ["name", "label", "sql", "table", "type"],
|
311
|
+
"properties": {
|
312
|
+
"name": {
|
313
|
+
"type": "string",
|
314
|
+
"description": "Internal name of the metric"
|
315
|
+
},
|
316
|
+
"label": {
|
317
|
+
"type": "string",
|
318
|
+
"description": "Display label for the metric"
|
319
|
+
},
|
320
|
+
"description": {
|
321
|
+
"type": "string",
|
322
|
+
"description": "Description of what the metric measures"
|
323
|
+
},
|
324
|
+
"sql": {
|
325
|
+
"type": "string",
|
326
|
+
"description": "SQL expression (e.g., ${TABLE}.column_name)"
|
327
|
+
},
|
328
|
+
"table": {
|
329
|
+
"type": "string",
|
330
|
+
"description": "Table name the metric belongs to"
|
331
|
+
},
|
332
|
+
"type": {
|
333
|
+
"type": "string",
|
334
|
+
"enum": [
|
335
|
+
"count",
|
336
|
+
"count_distinct",
|
337
|
+
"sum",
|
338
|
+
"average",
|
339
|
+
"min",
|
340
|
+
"max"
|
341
|
+
],
|
342
|
+
"description": "Aggregation type"
|
343
|
+
},
|
344
|
+
"baseDimensionName": {
|
345
|
+
"type": "string",
|
346
|
+
"description": "Name of the base dimension/column this metric aggregates"
|
347
|
+
},
|
348
|
+
"formatOptions": {
|
349
|
+
"type": "object",
|
350
|
+
"description": "Formatting configuration",
|
351
|
+
"properties": {
|
352
|
+
"type": {
|
353
|
+
"type": "string",
|
354
|
+
"enum": [
|
355
|
+
"default",
|
356
|
+
"currency",
|
357
|
+
"number",
|
358
|
+
"percent"
|
359
|
+
]
|
360
|
+
},
|
361
|
+
"separator": {
|
362
|
+
"type": "string",
|
363
|
+
"enum": [
|
364
|
+
"default",
|
365
|
+
"commaPeriod",
|
366
|
+
"spacePeriod",
|
367
|
+
"periodComma",
|
368
|
+
"spaceComma"
|
369
|
+
]
|
370
|
+
}
|
371
|
+
}
|
372
|
+
}
|
373
|
+
}
|
374
|
+
}
|
375
|
+
},
|
376
|
+
"customDimensions": {
|
377
|
+
"type": "array",
|
378
|
+
"description": "Custom dimensions defined inline",
|
379
|
+
"items": {
|
380
|
+
"type": "object"
|
381
|
+
}
|
382
|
+
}
|
383
|
+
}
|
384
|
+
},
|
385
|
+
"chartConfig": {
|
386
|
+
"type": "object",
|
387
|
+
"description": "Visualization configuration for the chart",
|
388
|
+
"required": ["type"],
|
389
|
+
"properties": {
|
390
|
+
"type": {
|
391
|
+
"type": "string",
|
392
|
+
"description": "Type of chart visualization",
|
393
|
+
"enum": [
|
394
|
+
"cartesian",
|
395
|
+
"pie",
|
396
|
+
"table",
|
397
|
+
"big_number",
|
398
|
+
"funnel",
|
399
|
+
"treemap",
|
400
|
+
"custom"
|
401
|
+
]
|
402
|
+
},
|
403
|
+
"config": {
|
404
|
+
"type": "object",
|
405
|
+
"description": "Chart-specific configuration (varies by chart type)"
|
406
|
+
}
|
407
|
+
}
|
408
|
+
},
|
409
|
+
"tableConfig": {
|
410
|
+
"type": "object",
|
411
|
+
"description": "Table view configuration",
|
412
|
+
"properties": {
|
413
|
+
"columnOrder": {
|
414
|
+
"type": "array",
|
415
|
+
"description": "Order of columns in table view",
|
416
|
+
"items": {
|
417
|
+
"type": "string"
|
418
|
+
}
|
419
|
+
}
|
420
|
+
}
|
421
|
+
},
|
422
|
+
"pivotConfig": {
|
423
|
+
"type": "object",
|
424
|
+
"description": "Pivot table configuration",
|
425
|
+
"properties": {
|
426
|
+
"columns": {
|
427
|
+
"type": "array",
|
428
|
+
"description": "Fields to use as pivot columns",
|
429
|
+
"items": {
|
430
|
+
"type": "string"
|
431
|
+
}
|
432
|
+
}
|
433
|
+
}
|
434
|
+
}
|
435
|
+
}
|
436
|
+
}
|