export function suggestPrompt()

in eng/tools/typespec-migration-validation/src/fix/troubleshooting.ts [25:48]


export function suggestPrompt(jsonObj: any): string[] {
  const suggestedFixes: string[] = [];

  const clientNameChanges = checkPropertyAttributeChanged('x-ms-client-name', jsonObj);
  if (clientNameChanges.length > 0) {
    for (const change of clientNameChanges) {
      const { path, oldValue, newValue } = change;
      const realPath = path.split('.').filter(part => !['definitions', 'properties', 'x-ms-client-name'].includes(part)).join('.');
      suggestedFixes.push(`Find this TypeSpec statement @@clientName(${realPath}, "${newValue}") in file back-compatible.tsp or client.tsp. Change it to @@clientName(${realPath}, "${oldValue})"`);
    }
  }

  suggestedFixes.push(...checkMinMax(jsonObj));
  suggestedFixes.push(...checkReadOnly(jsonObj));
  suggestedFixes.push(...checkDefault(jsonObj));

  if (suggestedFixes.length > 0) {
    suggestedFixes.unshift(`You are an expert in TypeSpec. Do the following changes to the TypeSpec file:`);
    for (let i = 1; i < suggestedFixes.length; i++) {
      suggestedFixes[i] = `${i}. ${suggestedFixes[i]}`;
    }
  }
  return suggestedFixes;
}