Skip to content

Commit

Permalink
fix: add function to handle URI Representation
Browse files Browse the repository at this point in the history
  • Loading branch information
AnimeshKumar923 committed Jun 21, 2024
1 parent f9d057f commit 3928ef3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/validation/embedded-examples-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ function extractCommentsAndExamples(content) {
// Extract comments and examples from the markdown file
const combinedData = extractCommentsAndExamples(markdownContent);

// Function to convert URI Fragment to JSON Pointer
function uriFragmentToJsonPointer(uriFragment) {
if (uriFragment === '#') return '';
return uriFragment.slice(1).split('/').map(decodeURIComponent).join('/');
}

// Function to apply JSON Merge Patch updates to the document
function applyUpdates(updates, baseDoc) {
updates.forEach(update => {
try {
const jsonPointerPath = update.json_pointer;
const jsonPointerPath = uriFragmentToJsonPointer(update.json_pointer);

// Handle root document case
if (jsonPointerPath === '') {
Expand Down

0 comments on commit 3928ef3

Please sign in to comment.