diff --git a/schema/index.yaml b/schema/index.yaml index 2dcb917..32b4921 100644 --- a/schema/index.yaml +++ b/schema/index.yaml @@ -75,6 +75,8 @@ $defs: "^[\\w]+": type: string format: uri + speakers: + type: array person: type: object additionalProperties: false diff --git a/src/events/index.yaml b/src/events/index.yaml index ec7abbc..da66219 100644 --- a/src/events/index.yaml +++ b/src/events/index.yaml @@ -13,6 +13,26 @@ links: web: https://prague.web3privacy.info/ git: https://github.com/web3privacy/w3ps1 + speakers: + - ameen-soleimani + - guy-zyskind + - max-hampshire + - antoni-zolciak + - rachel-rose-oleary + - alex-kampa + - oliver-gale + - mario-havel + - costanza-gallo + - manu-alzuru + - nick-almond + - juraj-bednar + - dcbuilder + - alona-shevchenko + - tibor-csoka + - merula + - serinko + - steffen-kux + - althea - id: w3ps2 type: summit diff --git a/src/index.yaml b/src/index.yaml index 100bec2..3be9a8b 100644 --- a/src/index.yaml +++ b/src/index.yaml @@ -18,9 +18,11 @@ core-team: - name: Coinmandeer projects: $load: projects -events: - $load: events people: $load: people $opts: - loader: person \ No newline at end of file + loader: person +events: + $load: events + $opts: + loader: events \ No newline at end of file diff --git a/utils/engine.js b/utils/engine.js index 1d5432a..e4dcbab 100644 --- a/utils/engine.js +++ b/utils/engine.js @@ -26,13 +26,25 @@ export class Engine { this.rendered = await this.render(this.index); } - async loadDir(src, opts = {}) { + async loadDir(src, opts = {}, full = {}) { const out = {}; const dir = join(SRC_DIR, src); console.log(`reading dir=${dir}`); if (await exists(join(dir, "index.yaml"))) { - const out = readYamlFile(join(dir, "index.yaml")); + const out = await readYamlFile(join(dir, "index.yaml")); + if (opts.loader === "events") { + // check speaker connection + for (const ev of out) { + if (ev.speakers) { + for (const spId of ev.speakers) { + if (!full.people.find((p) => p.id === spId)) { + throw new Error(`Speaker not exists: ${spId} (event ${ev.id})`); + } + } + } + } + } return out; } @@ -50,7 +62,7 @@ export class Engine { if (!ext && !fn.startsWith("_")) { const obj = Object.assign( { id: fn }, - await this.loadDir(join(src, fn)), + await this.loadDir(join(src, fn), opts, full), ); arr.push(obj); } @@ -78,7 +90,7 @@ export class Engine { for (const key of Object.keys(src)) { const val = src[key]; if (typeof val === "object" && val.$load) { - out[key] = await this.loadDir(val.$load, val.$opts); + out[key] = await this.loadDir(val.$load, val.$opts, out); continue; }