in src/schema/validator.js [289:323]
get validateStaticTheme() {
this._lazyInit();
if (!this._staticThemeValidator) {
// Create a new schema object that merges theme.json and the regular
// manifest.json schema.
// Then modify the result of that to set `additionalProperties = false`
// so that additional properties are not allowed for themes.
// We have to use deepmerge here to make sure we can overwrite the nested
// structure and can use object-destructuring at the root level
// because we only overwrite `id` and `$ref` in root of the resulting object.
// Uses ``deepPatch`` (instead of deepmerge) because we're patching a
// complicated schema instead of simply merging them together.
this._staticThemeValidator = this._validator.compile({
...deepPatch(
this.schemaObject,
deepPatch(this.themeSchemaObject, {
types: {
ThemeManifest: {
$merge: {
with: {
additionalProperties: false,
},
},
},
},
})
),
$id: 'static-theme-manifest',
$ref: '#/types/ThemeManifest',
});
}
return this._staticThemeValidator;
}