Many cloud services provide REST API accessible to client applications. However, developers often identify specification violations only during testing, as error messages typically lack the detail necessary for effective diagnosis. Consequently, debugging requires trial and error. This study proposes dcFix, a method for detecting and automatically repairing REST API misuses in client programs. In particular, dcFix identifies non-conforming code fragments, integrates them with the relevant API specifications into prompts, and leverages a Large Language Model (LLM) to produce the corrected code. Our evaluation demonstrates that dcFix accurately detects misuse and outperforms the baseline approach, in which prompts to the LLM omit any indication of code fragments non conforming to REST API specifications.
翻译:许多云服务提供可供客户端应用程序访问的REST API。然而,开发者通常仅在测试阶段才能发现规范违反情况,因为错误消息通常缺乏有效诊断所需的细节。因此,调试过程需要反复试错。本研究提出dcFix方法,用于检测并自动修复客户端程序中REST API的误用。具体而言,dcFix识别不符合规范的代码片段,将其与相关API规范整合至提示中,并利用大型语言模型(LLM)生成修正后的代码。我们的评估表明,dcFix能准确检测误用情况,并优于基线方法——后者在向LLM提供的提示中省略了代码片段不符合REST API规范的任何指示。