diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index a1492af390..c1949be31d 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -203,6 +203,9 @@ class LayerBuilder extends Conversion> { context = context.inOperation("building Layer " + id).enters("layer", id) const config = this._layerConfigJsons.get(id) + if (config.id !== id) { + context.err("Invalid ID: expected", id, "but got", id) + } const prepped = this.prepareLayer.convert(config, context) this._loadedIds.add(id) this._desugaringState.sharedLayers.set(id, prepped) @@ -760,11 +763,15 @@ class LayerOverviewUtils extends Script { ScriptUtils.erasableLog( `Parsing layerConfig ${i + 1}/${allPaths.length}: ${path} ` ) + const expectedId = path.match(/.*\/([a-z_0-9]+).json/)[1] try { const data = JSON.parse(readFileSync(path, "utf8")) results.push(data) + if (data.id !== expectedId) { + throw "Wrong ID or location for file " + path + "; expected " + expectedId + " but got " + data.id + } } catch (e) { - throw "Could not parse layer file " + path + throw "Could not parse layer file " + path + " due to " + e } }