Skip to content

Commit 318dceb

Browse files
committed
4565: Updated API spec
1 parent 4a73327 commit 318dceb

File tree

4 files changed

+19
-99
lines changed

4 files changed

+19
-99
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
1010
* Cleaned up Github Actions workflows.
1111
* Updated PHP dependencies.
1212
* Added Playwright github action.
13+
* Changed how templates are imported.
1314

1415
### NB! Prior to 3.x the project was split into separate repositories
1516

assets/shared/slide-utils/templates.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
// Load templates.
22
// @see https://vite.dev/guide/features.html#glob-import
33
// @see docs/custom-templates.md
4-
const templateModules = import.meta.glob('../templates/*.jsx', { eager: true })
5-
const customTemplatesModules = import.meta.glob('../custom-templates/*.jsx', { eager: true })
4+
const templateModules = import.meta.glob("../templates/*.jsx", { eager: true });
5+
const customTemplatesModules = import.meta.glob("../custom-templates/*.jsx", {
6+
eager: true,
7+
});
68

79
function duckTypingTemplateModule(module) {
8-
return typeof(module.id) === "function" &&
9-
typeof(module.config) === "function" &&
10-
typeof(module.renderSlide) === "function";
10+
return (
11+
typeof module.id === "function" &&
12+
typeof module.config === "function" &&
13+
typeof module.renderSlide === "function"
14+
);
1115
}
1216

1317
function findModule(modules, templateUlid) {
@@ -19,7 +23,9 @@ function findModule(modules, templateUlid) {
1923
return module;
2024
}
2125
} else {
22-
throw new Error("Template should implement functions: id(), config(), renderSlide(slide, run, slideDone)");
26+
throw new Error(
27+
"Template should implement functions: id(), config(), renderSlide(slide, run, slideDone)",
28+
);
2329
}
2430
}
2531

@@ -31,8 +37,10 @@ function getTemplateModule(templateUlid) {
3137
return null;
3238
}
3339

34-
const module = findModule(templateModules, templateUlid) ??
35-
findModule(customTemplatesModules, templateUlid) ?? null;
40+
const module =
41+
findModule(templateModules, templateUlid) ??
42+
findModule(customTemplatesModules, templateUlid) ??
43+
null;
3644

3745
if (module === null) {
3846
throw new Error(`Cannot find module '${templateUlid}'`);
@@ -64,13 +72,10 @@ function renderSlide(slide, run, slideDone) {
6472
const module = getTemplateModule(templateUlid);
6573

6674
if (!module) {
67-
return '';
75+
return "";
6876
}
6977

7078
return module.renderSlide(slide, run, slideDone);
7179
}
7280

73-
export {
74-
getConfig,
75-
renderSlide
76-
}
81+
export { getConfig, renderSlide };

public/api-spec-v2.json

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5878,20 +5878,6 @@
58785878
"explode": false,
58795879
"allowReserved": false
58805880
},
5881-
{
5882-
"name": "description",
5883-
"in": "query",
5884-
"description": "",
5885-
"required": false,
5886-
"deprecated": false,
5887-
"allowEmptyValue": false,
5888-
"schema": {
5889-
"type": "string"
5890-
},
5891-
"style": "form",
5892-
"explode": false,
5893-
"allowReserved": false
5894-
},
58955881
{
58965882
"name": "createdBy",
58975883
"in": "query",
@@ -14649,15 +14635,6 @@
1464914635
"title": {
1465014636
"type": "string"
1465114637
},
14652-
"description": {
14653-
"type": "string"
14654-
},
14655-
"resources": {
14656-
"type": "array",
14657-
"items": {
14658-
"type": "string"
14659-
}
14660-
},
1466114638
"modifiedBy": {
1466214639
"type": "string"
1466314640
},
@@ -14686,15 +14663,6 @@
1468614663
"title": {
1468714664
"type": "string"
1468814665
},
14689-
"description": {
14690-
"type": "string"
14691-
},
14692-
"resources": {
14693-
"type": "array",
14694-
"items": {
14695-
"type": "string"
14696-
}
14697-
},
1469814666
"modifiedBy": {
1469914667
"type": "string"
1470014668
},
@@ -14758,15 +14726,6 @@
1475814726
"title": {
1475914727
"type": "string"
1476014728
},
14761-
"description": {
14762-
"type": "string"
14763-
},
14764-
"resources": {
14765-
"type": "array",
14766-
"items": {
14767-
"type": "string"
14768-
}
14769-
},
1477014729
"modifiedBy": {
1477114730
"type": "string"
1477214731
},
@@ -14830,15 +14789,6 @@
1483014789
"title": {
1483114790
"type": "string"
1483214791
},
14833-
"description": {
14834-
"type": "string"
14835-
},
14836-
"resources": {
14837-
"type": "array",
14838-
"items": {
14839-
"type": "string"
14840-
}
14841-
},
1484214792
"modifiedBy": {
1484314793
"type": "string"
1484414794
},

public/api-spec-v2.yaml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4164,18 +4164,6 @@ paths:
41644164
style: form
41654165
explode: false
41664166
allowReserved: false
4167-
-
4168-
name: description
4169-
in: query
4170-
description: ''
4171-
required: false
4172-
deprecated: false
4173-
allowEmptyValue: false
4174-
schema:
4175-
type: string
4176-
style: form
4177-
explode: false
4178-
allowReserved: false
41794167
-
41804168
name: createdBy
41814169
in: query
@@ -10214,12 +10202,6 @@ components:
1021410202
properties:
1021510203
title:
1021610204
type: string
10217-
description:
10218-
type: string
10219-
resources:
10220-
type: array
10221-
items:
10222-
type: string
1022310205
modifiedBy:
1022410206
type: string
1022510207
createdBy:
@@ -10240,12 +10222,6 @@ components:
1024010222
properties:
1024110223
title:
1024210224
type: string
10243-
description:
10244-
type: string
10245-
resources:
10246-
type: array
10247-
items:
10248-
type: string
1024910225
modifiedBy:
1025010226
type: string
1025110227
createdBy:
@@ -10289,12 +10265,6 @@ components:
1028910265
additionalProperties: true
1029010266
title:
1029110267
type: string
10292-
description:
10293-
type: string
10294-
resources:
10295-
type: array
10296-
items:
10297-
type: string
1029810268
modifiedBy:
1029910269
type: string
1030010270
createdBy:
@@ -10338,12 +10308,6 @@ components:
1033810308
type: string
1033910309
title:
1034010310
type: string
10341-
description:
10342-
type: string
10343-
resources:
10344-
type: array
10345-
items:
10346-
type: string
1034710311
modifiedBy:
1034810312
type: string
1034910313
createdBy:

0 commit comments

Comments
 (0)