diff --git a/scripts/validation/embedded-examples-validation.js b/scripts/validation/embedded-examples-validation.js index d6672a9d..467f093f 100644 --- a/scripts/validation/embedded-examples-validation.js +++ b/scripts/validation/embedded-examples-validation.js @@ -51,17 +51,16 @@ const combinedData = extractCommentsAndExamples(markdownContent); function applyUpdates(updates, baseDoc) { updates.forEach(update => { try { - // Handle root document case - if (jsonPointerPath === '') { + if (update.json_pointer === '') { baseDoc = mergePatch.apply(baseDoc, update.example); return; } // For non-root cases, use jsonpointer to get and set the correct location - const targetObject = jsonpointer.get(baseDoc, jsonPointerPath); + const targetObject = jsonpointer.get(baseDoc, update.json_pointer); const updatedObject = mergePatch.apply(targetObject || {}, update.example); - jsonpointer.set(baseDoc, jsonPointerPath, updatedObject); + jsonpointer.set(baseDoc, update.json_pointer, updatedObject); } catch (e) { console.error(`\nError processing update for '${update.name}' at path '${update.json_pointer}'`, e);