in eng/tools/typespec-migration-validation/src/fix/helper.ts [1:31]
export function checkPropertyAttributeDeleted(checkKey: string, jsonObj: any, currentPath: string = ''): Array<{path: string, value: string}> {
const results: Array<{path: string, value: string}> = [];
if (!jsonObj || typeof jsonObj !== 'object') {
return results;
}
for (const key in jsonObj) {
if (!Object.prototype.hasOwnProperty.call(jsonObj, key)) {
continue;
}
const newPath = currentPath ? `${currentPath}.${key}` : key;
if (key === `${checkKey}__deleted`) {
// Store both the path and the value
results.push({
path: currentPath, // Use parent path since we're interested in the property that has this extension
value: jsonObj[key]
});
}
// If value is an object or array, recursively search it
if (jsonObj[key] && typeof jsonObj[key] === 'object') {
const nestedResults = checkPropertyAttributeDeleted(checkKey, jsonObj[key], newPath);
results.push(...nestedResults);
}
}
return results;
}