From a9bbce35eaaa08007535de1d993ccc5096186016 Mon Sep 17 00:00:00 2001 From: Stamen Stoychev Date: Mon, 16 Nov 2026 15:14:50 +0200 Subject: [PATCH] fix(snippets): don't compile the root Description union on Windows schemaValidator registered the whole emitted schema with ajv. The first $ref into it makes ajv compile the schema's root, which reaches #/definitions/Description: an anyOf over every description type. ajv nests one block per branch, and at the 897 branches the igniteui-webcomponents-core 7.1.1-beta.19 emitter produces, compiling that code overflows V8's parser stack on Windows ("Maximum call stack size exceeded"). Every local xplat generate and dev run on Windows fails; Linux CI has the headroom and passes. Nothing validates against the root: validators are compiled per type. Registering only the definitions keeps the union from being compiled. Co-Authored-By: Claude Opus 5.5 --- docs/xplat/scripts/lib/snippet-schema.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/xplat/scripts/lib/snippet-schema.mjs b/docs/xplat/scripts/lib/snippet-schema.mjs index a723f6d78f..254a260570 100644 --- a/docs/xplat/scripts/lib/snippet-schema.mjs +++ b/docs/xplat/scripts/lib/snippet-schema.mjs @@ -117,7 +117,12 @@ export function schemaValidator(api, examplesRoot, { onProgress = () => {} } = { // each site rather than compile it once and call it. const ajv = new Ajv({ allErrors: true, strict: false, validateFormats: false, inlineRefs: false }); ajv.addMetaSchema(draft06); - ajv.addSchema(schema, 'snippets'); + // Registered as its definitions alone, without the root's own keywords. The first $ref into a + // registered schema makes ajv compile that schema's root, and this root reaches the Description + // union over every type: an anyOf whose branches each nest one level deeper in the generated + // code. At the 897 branches of 7.1.1-beta.19 that overflows V8's parser stack on Windows, and + // nothing here validates against the root anyway: validatorFor compiles one definition at a time. + ajv.addSchema({ $schema: schema.$schema, definitions: schema.definitions }, 'snippets'); const compiled = new Map(); const validatorFor = (type) => {