From 03142771e556f9e115709832a98d81942528f10a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 20 Nov 2025 11:55:28 -0400 Subject: data, infra: auto-inherit yaml document specs --- src/data/things/index.js | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'src/data/things/index.js') diff --git a/src/data/things/index.js b/src/data/things/index.js index 33fc933d..893684de 100644 --- a/src/data/things/index.js +++ b/src/data/things/index.js @@ -216,6 +216,27 @@ function evaluateSerializeDescriptors() { }); } +function finalizeYamlDocumentSpecs() { + return descriptorAggregateHelper({ + message: `Errors finalizing Thing YAML document specs`, + + op(constructor) { + const superclass = Object.getPrototypeOf(constructor); + if ( + constructor[Thing.yamlDocumentSpec] && + superclass[Thing.yamlDocumentSpec] + ) { + constructor[Thing.yamlDocumentSpec] = + Thing.extendDocumentSpec(superclass, constructor[Thing.yamlDocumentSpec]); + } + }, + + showFailedClasses(failedClasses) { + logError`Failed to finalize YAML document specs for classes: ${failedClasses.join(', ')}`; + }, + }); +} + function finalizeCacheableObjectPrototypes() { return descriptorAggregateHelper({ message: `Errors finalizing Thing class prototypes`, @@ -230,19 +251,14 @@ function finalizeCacheableObjectPrototypes() { }); } -if (!errorDuplicateClassNames()) - process.exit(1); +if (!errorDuplicateClassNames()) process.exit(1); flattenClassLists(); -if (!evaluatePropertyDescriptors()) - process.exit(1); - -if (!evaluateSerializeDescriptors()) - process.exit(1); - -if (!finalizeCacheableObjectPrototypes()) - process.exit(1); +if (!evaluatePropertyDescriptors()) process.exit(1); +if (!evaluateSerializeDescriptors()) process.exit(1); +if (!finalizeYamlDocumentSpecs()) process.exit(1); +if (!finalizeCacheableObjectPrototypes()) process.exit(1); Object.assign(allClasses, {Thing}); -- cgit 1.3.0-6-gf8a5